Am 07.01.2017 um 19:11 schrieb Marek Olšák: > On Sat, Jan 7, 2017 at 5:23 PM, Roland Scheidegger <srol...@vmware.com> wrote: >> Am 07.01.2017 um 15:51 schrieb Marek Olšák: >>> From: Marek Olšák <marek.ol...@amd.com> >>> >>> This fixes broken depth texturing after: >>> >>> commit 22639a6e19f95902aef23474ad672bf489231ea7 >>> Author: Timothy Arceri <timothy.arc...@collabora.com> >>> Date: Mon Nov 21 00:29:29 2016 +1100 >>> >>> st/mesa: get Version from gl_program rather than gl_shader_program >>> --- >>> src/mesa/main/ff_fragment_shader.cpp | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/src/mesa/main/ff_fragment_shader.cpp >>> b/src/mesa/main/ff_fragment_shader.cpp >>> index 48b84e8..a13a5de 100644 >>> --- a/src/mesa/main/ff_fragment_shader.cpp >>> +++ b/src/mesa/main/ff_fragment_shader.cpp >>> @@ -1215,21 +1215,22 @@ create_new_program(struct gl_context *ctx, struct >>> state_key *key) >>> p.shader_program = _mesa_new_shader_program(0); >>> >>> /* Tell the linker to ignore the fact that we're building a >>> * separate shader, in case we're in a GLES2 context that would >>> * normally reject that. The real problem is that we're building a >>> * fixed function program in a GLES2 context at all, but that's a >>> * big mess to clean up. >>> */ >>> p.shader_program->SeparateShader = GL_TRUE; >>> >>> - state->language_version = 130; >>> + /* Don't use 1.30, because depth texturing behaves differently there. */ >> Could you elaborate on this? > > Yeah it wasn't a completely accurate statement. IIRC (off the top of > my head), the legacy GLSL shadow functions follow the depth texture > mode and return vec4. The GLSL 1.30 shadow functions return float and > ignore the depth texture mode. That's a shader and state dependency > that's difficult to deal with. st/mesa uses a simple but not > completely correct solution: if the shader declares GLSL >= 1.30 and > the depth texture mode is GL_ALPHA (000X), it sets the XXXX swizzle > instead. Thus, the GLSL 1.30 shadow function will get the result in .x > and legacy shadow functions will get it in .w as expected. It's an > acceptable deviation from the spec considering how rare the GL_ALPHA > setting is, but one piglit test checking GL_ALPHA showed an obvious > failure there. >
Ah yes, that makes sense. With an updated comment, Reviewed-by: Roland Scheidegger <srol...@vmware.com> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev