Skip to content
Snippets Groups Projects

Resolve "Indirect Dispatch"

Merged Ghost User requested to merge 106-indirect-dispatch into develop
Compare and Show latest version
5 files
+ 47
9
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -8,6 +8,13 @@ layout(set=0, binding=3, r11f_g11f_b10f) uniform image2D outImage;
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
layout( push_constant ) uniform constants{
// computed from delta time and shutter speed
float motionFactor;
float minVelocity;
};
void main(){
if(any(greaterThanEqual(gl_GlobalInvocationID.xy, imageSize(outImage))))
@@ -18,6 +25,16 @@ void main(){
vec2 uv = vec2(coord) / textureRes;
vec2 motion = texture(sampler2D(inMotion, textureSampler), uv).rg;
float velocity = length(motion);
// early out on little movement
if(velocity < minVelocity){
vec3 color = texture(sampler2D(inColor, textureSampler), uv).rgb;
imageStore(outImage, coord, vec4(color, 0.f));
return;
}
motion *= motionFactor;
vec3 color = vec3(0);
const int sampleCount = 16;
Loading