private string GetShaderHeader() { return("#version 430\n" + $"layout(local_size_x = {LocalSize}, local_size_y = {LocalSize}) in;\n" + "layout(binding = 0) uniform sampler2D src_image;\n" + "layout(rgba32f, binding = 1) uniform writeonly image2D dst_image;\n" + "layout(location = 1) uniform ivec2 pixelOffset;\n" + (filterModel.IsSepa ? "layout(location = 0) uniform ivec2 filterDirection;\n" : "") + SrgbShader.FromSrgbFunction() + GetVariableLocations() + GetTextureFunctions()); }
private static string GetComputeSource() { return(OpenGlContext.ShaderVersion + "\n" + $"layout(local_size_x = {LocalSize}, local_size_y = {LocalSize}) in;\n" + SrgbShader.ToSrgbFunction() + @"layout(binding = 0) uniform sampler2D src; layout(rgba32f, binding = 1) uniform writeonly image2D dst; layout(location = 0) uniform ivec2 offset; layout(location = 1) uniform bool srgb; void main(){ ivec2 coord = ivec2(gl_GlobalInvocationID.xy); if(coord.x < imageSize(dst).x && coord.y < imageSize(dst).y) { vec4 pixel = texelFetch(src, coord + offset, 0); if(srgb) pixel = toSrgb(pixel); imageStore(dst, coord, pixel); } }"); }