github.com/cybriq/giocore@v0.0.7-0.20210703034601-cfb9cb5f3900/gpu/shaders/cover.frag (about)

     1  #version 310 es
     2  
     3  // SPDX-License-Identifier: Unlicense OR MIT
     4  
     5  precision mediump float;
     6  
     7  {{.Header}}
     8  
     9  // Use high precision to be pixel accurate for
    10  // large cover atlases.
    11  layout(location = 0) in highp vec2 vCoverUV;
    12  layout(location = 1) in vec2 vUV;
    13  
    14  layout(binding = 1) uniform sampler2D cover;
    15  
    16  layout(location = 0) out vec4 fragColor;
    17  
    18  void main() {
    19      fragColor = {{.FetchColorExpr}};
    20  	float cover = min(abs(texture(cover, vCoverUV).r), 1.0);
    21  	fragColor *= cover;
    22  }