Perform the following steps:
- In the compute shader, as usual, we start by defining the number of shader invocations per work group:
layout (local_size_x = 25, local_size_y = 25) in;
- Next, we declare uniform variables for our input and output images and for the edge detection threshold. The input image is the rendered image from the FBO, and the output image will be the result of the edge detection filter:
uniform float EdgeThreshold = 0.1; layout(binding=0, rgba8) uniform image2D InputImg; layout(binding=1, rgba8) uniform image2D OutputImg;
- Then, we declare our work group's shared memory, which is an array of size 27 x 27:
shared float localData[gl_WorkGroupSize.x+2][gl_WorkGroupSize.y+2];
- We also define a function ...