A platform to try compute shader filters for image post-processing methods
Now supporting multiple compute shader image filters as a pipeline
For example:
[0] edge detection filter (compute)
[1] sharpen filter (compute)
[Final] output (vertex-fragment)
Orders can be modified
git submodule update --init --recursive
mkdir build && cd build
cmake ..
make -j4
Or (if there's no make
)
cmake --build . --config Release
- C++ compiler supporting cpp11
- GPU supporting OpenGL 4.5
R
to reload shader fileF12
to toggle UI display
The following is an example of a input -> output filter with no processing
#version 450 core
layout (local_size_x=32, local_size_y=32, local_size_z=1) in;
layout (rgba32f, binding=0) readonly uniform image2D imageIn;
layout (rgba32f, binding=1) writeonly uniform image2D imageOut;
// support uniform (int, float) controls
// support initial values
// control via ImGui
uniform int control1;
uniform float control2;
uniform int control3 = 12;
uniform float control4 = 5.2;
void main()
{
ivec2 baseUV = ivec2(gl_GlobalInvocationID.xy);
baseUV = clamp(baseUV, ivec2(0,0), imageSize(imageIn));
vec3 imgColor = imageLoad(imageIn, baseUV).rgb;
imageStore(imageOut, baseUV, vec4(imgColor, 1.0));
}