coherency_weighting.glsl (1302B)
1 /* See LICENSE for license details. */ 2 layout(std430, buffer_reference, buffer_reference_align = 8) restrict buffer Int16 { 3 int16_t values[]; 4 }; 5 6 layout(std430, buffer_reference, buffer_reference_align = 8) restrict buffer Int16Complex { 7 i16vec2 values[]; 8 }; 9 10 layout(std430, buffer_reference, buffer_reference_align = 8) restrict buffer Float32 { 11 float values[]; 12 }; 13 14 layout(std430, buffer_reference, buffer_reference_align = 8) restrict buffer Float32Complex { 15 vec2 values[]; 16 }; 17 18 #if InputDataKind == DataKind_Float32 19 #define COHERENT_SAMPLE(index) Float32(coherent_sum).values[index] 20 #define INCOHERENT_SAMPLE(index) Float32(IncoherentSum).values[index] 21 #elif InputDataKind == DataKind_Float32Complex 22 #define COHERENT_SAMPLE(index) Float32Complex(coherent_sum).values[index] 23 #define INCOHERENT_SAMPLE(index) Float32(IncoherentSum).values[index] 24 #else 25 #error DataKind unsupported for CoherencyWeighting 26 #endif 27 28 void main() 29 { 30 const uvec3 total_threads = gl_WorkGroupSize * gl_NumWorkGroups; 31 u32 index = gl_GlobalInvocationID.z * total_threads.x * total_threads.y + 32 gl_GlobalInvocationID.y * total_threads.x + 33 gl_GlobalInvocationID.x; 34 35 if (index < OutputVoxels) 36 COHERENT_SAMPLE(index) *= Scale * COHERENT_SAMPLE(index) / INCOHERENT_SAMPLE(index); 37 }