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
4 files
+ 57
19
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -17,6 +17,7 @@ layout( push_constant ) uniform constants{
// camera planes are needed to linearize depth
float cameraNearPlane;
float cameraFarPlane;
float motionTileOffsetLength;
};
float linearizeDepth(float depth, float near, float far){
@@ -111,6 +112,22 @@ float dither(ivec2 coord){
return x ^^ y ? 1 : 0;
}
// from https://www.shadertoy.com/view/ttc3zr
uvec2 murmurHash22(uvec2 src) {
const uint M = 0x5bd1e995u;
uvec2 h = uvec2(1190494759u, 2147483647u);
src *= M; src ^= src>>24u; src *= M;
h *= M; h ^= src.x; h *= M; h ^= src.y;
h ^= h>>13u; h *= M; h ^= h>>15u;
return h;
}
vec2 hash22(vec2 src) {
uvec2 h = murmurHash22(floatBitsToUint(src));
return uintBitsToFloat(h & 0x007fffffu | 0x3f800000u) - 1.0;
}
void main(){
if(any(greaterThanEqual(gl_GlobalInvocationID.xy, imageSize(outImage))))
@@ -120,7 +137,9 @@ void main(){
ivec2 coord = ivec2(gl_GlobalInvocationID.xy);
vec2 uv = vec2(coord + 0.5) / textureRes; // + 0.5 to shift uv into pixel center
vec2 motionNeighbourhoodMax = processMotionVector(texture(sampler2D(inMotionNeighbourhoodMax, nearestSampler), uv).rg);
// the motion tile lookup is jittered, so the hard edges in the blur are replaced by noise
vec2 motionOffset = motionTileOffsetLength * (hash22(coord) * 2 - 1) / textureRes;
vec2 motionNeighbourhoodMax = processMotionVector(texture(sampler2D(inMotionNeighbourhoodMax, nearestSampler), uv + motionOffset).rg);
SampleData mainPixel = loadSampleData(uv);
Loading