diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-05-20 18:48:14 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-05-20 18:48:24 +0300 |
commit | 93b5682444d51c3232efa59b0e4e6c3e0562a503 (patch) | |
tree | 8c5397bf9f273bd3cf9cbfe336ca1bcce29e6c17 /source/blender/draw/engines/gpencil | |
parent | e15ffc0c54c25e503c5e59f73d0e9f5092ee5773 (diff) |
Fix T76909 GPencil: Layers with mask(s) invisible when using "in front"
The gpSceneDepthTexture is using a dummy 1px texture which was generating
wrong values for uvs when sampling gpMaskTexture.
Use the max size of both since any of the 2 can use dummy texture.
Diffstat (limited to 'source/blender/draw/engines/gpencil')
-rw-r--r-- | source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl index 8c2032f834a..d81c6f4fe0b 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl @@ -99,8 +99,10 @@ void main() discard; } + vec2 fb_size = max(vec2(textureSize(gpSceneDepthTexture, 0).xy), + vec2(textureSize(gpMaskTexture, 0).xy)); + vec2 uvs = gl_FragCoord.xy / fb_size; /* Manual depth test */ - vec2 uvs = gl_FragCoord.xy / vec2(textureSize(gpSceneDepthTexture, 0).xy); float scene_depth = texture(gpSceneDepthTexture, uvs).r; if (gl_FragCoord.z > scene_depth) { discard; |