-
Notifications
You must be signed in to change notification settings - Fork 21.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ghstack-source-id: 19a3669e01f721c1ae14b7ea02cd0a901c65ece3 Pull Request resolved: #47312
- Loading branch information
Showing
4 changed files
with
256 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#version 450 core | ||
#define PRECISION $precision | ||
layout(std430) buffer; | ||
layout(std430) uniform; | ||
layout(set = 0, binding = 0, rgba16f) uniform PRECISION restrict writeonly image3D uOutput; | ||
layout(set = 0, binding = 1) uniform PRECISION sampler3D uInput; | ||
layout(set = 0, binding = 2) uniform PRECISION restrict Block { | ||
int W; | ||
int H; | ||
} uBlock; | ||
|
||
layout(local_size_x_id = 1, local_size_y_id = 2, local_size_z_id = 3) in; | ||
|
||
void main() { | ||
ivec3 pos = ivec3(gl_GlobalInvocationID); | ||
vec4 r = vec4(1.0) / (float(uBlock.W) * float(uBlock.H)); | ||
vec4 acc = vec4(0); | ||
int xi, yi; | ||
int zi = (imageSize(uOutput).x*pos.y + pos.x)/4; | ||
int zo = (imageSize(uOutput).x*pos.y + pos.x)%4; | ||
for (yi = 0; yi < uBlock.H; ++yi) { | ||
for (xi = 0; xi < uBlock.W; ++xi) { | ||
acc += texelFetch(uInput, ivec3(xi, yi, zi), 0); | ||
} | ||
} | ||
vec4 outValue = r * acc; | ||
|
||
imageStore(uOutput, pos, vec4(outValue[zo], 0,0,0)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.