18 lines
632 B
Plaintext
18 lines
632 B
Plaintext
|
|
#version 450
|
||
|
|
/* Scaled residual add: out = scale * a + b. In-place safe (out may alias a or
|
||
|
|
* b). Used for the 0.2 residual scaling in RRDBNet blocks. */
|
||
|
|
layout(local_size_x = 256) in;
|
||
|
|
|
||
|
|
layout(std430, binding = 0) readonly buffer A { float a[]; };
|
||
|
|
layout(std430, binding = 1) readonly buffer B { float bb[]; };
|
||
|
|
layout(std430, binding = 2) writeonly buffer Out { float outp[]; };
|
||
|
|
|
||
|
|
layout(push_constant) uniform PC { uint n; float scale; } pc;
|
||
|
|
|
||
|
|
void main() {
|
||
|
|
uint stride_g = gl_NumWorkGroups.x * 256u;
|
||
|
|
for (uint i = gl_GlobalInvocationID.x; i < pc.n; i += stride_g) {
|
||
|
|
outp[i] = pc.scale * a[i] + bb[i];
|
||
|
|
}
|
||
|
|
}
|