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.
This commit is contained in:
Clément Foucault 2020-05-20 17:48:14 +02:00
parent e15ffc0c54
commit 93b5682444
Notes: blender-bot 2024-03-22 15:57:27 +01:00
Referenced by issue #76909, GPencil: Layers with mask(s) are not visible when "in front" option is checked
1 changed files with 3 additions and 1 deletions

View File

@ -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;