ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

reshape.glsl (875B)


      1 /* See LICENSE for license details. */
      2 
      3 layout(std430, buffer_reference) readonly buffer Input  { InputDataType  x[]; };
      4 layout(std430, buffer_reference)          buffer Output { OutputDataType x[]; };
      5 
      6 void main(void)
      7 {
      8 	if (all(lessThan(gl_GlobalInvocationID, uvec3(SizeX, SizeY, SizeZ)))) {
      9 		u32 x = gl_GlobalInvocationID.x;
     10 		u32 y = gl_GlobalInvocationID.y;
     11 		u32 z = gl_GlobalInvocationID.z;
     12 
     13 		u32 input_index  = InputStrideX  * x + InputStrideY  * y + InputStrideZ  * z;
     14 		u32 output_index = OutputStrideX * x + OutputStrideY * y + OutputStrideZ * z;
     15 
     16 		OutputDataType out_value = OutputDataType(0);
     17 
     18 		#if Interleave
     19 		out_value[0] = Input(left_input_buffer).x[input_index];
     20 		out_value[1] = Input(right_input_buffer).x[input_index];
     21 		#else
     22 		out_value = Input(left_input_buffer).x[input_index];
     23 		#endif
     24 
     25 		Output(output_buffer).x[output_index] = out_value;
     26 	}
     27 }