smaa_edge.glsl 764 B

123456789101112131415161718192021222324
  1. layout(rgba8, binding = 0) uniform image2D imgOutput;
  2. uniform sampler2D inputTexture;
  3. layout( location=0 ) uniform vec2 invResolution;
  4. void main()
  5. {
  6. vec2 loc = ivec2(gl_GlobalInvocationID.x * 4, gl_GlobalInvocationID.y * 4);
  7. for(int i = 0; i < 4; i++)
  8. {
  9. for(int j = 0; j < 4; j++)
  10. {
  11. ivec2 texelCoord = ivec2(loc.x + i, loc.y + j);
  12. vec2 coord = (texelCoord + vec2(0.5)) / invResolution;
  13. vec4 offset[3];
  14. SMAAEdgeDetectionVS(coord, offset);
  15. vec2 oColor = SMAAColorEdgeDetectionPS(coord, offset, inputTexture);
  16. if (oColor != float2(-2.0, -2.0))
  17. {
  18. imageStore(imgOutput, texelCoord, vec4(oColor, 0.0, 1.0));
  19. }
  20. }
  21. }
  22. }