[Mesa-dev] [PATCH] mesa: Restore depth texture state on glPopAttrib(GL_TEXTURE_BIT).

Brian Paul brianp at vmware.com
Mon Jan 30 06:58:36 PST 2012


On 01/27/2012 05:09 PM, Kenneth Graunke wrote:
> According to Table 6.17 in the GL 2.1 specification, DEPTH_TEXTURE_MODE,
> TEXTURE_COMPARE_MODE, and TEXTURE_COMPARE_FUNC need to be restored on
> glPopAttrib(GL_TEXTURE_BIT).
>
> Makes oglconform's shad-compiler advanced.TestShadow2D_VertShader test
> a bit less grumbly.
>
> NOTE: This is a candidate for release branches.
> Signed-off-by: Kenneth Graunke<kenneth at whitecape.org>
> ---
>   src/mesa/main/attrib.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
> index 01e7945..07884c1 100644
> --- a/src/mesa/main/attrib.c
> +++ b/src/mesa/main/attrib.c
> @@ -796,6 +796,9 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
>               _mesa_TexParameterf(target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB,
>                                   samp->CompareFailValue);
>            }
> +         _mesa_TexParameteri(target, GL_DEPTH_TEXTURE_MODE, samp->DepthMode);
> +         _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_MODE, samp->CompareMode);
> +         _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_FUNC, samp->CompareFunc);
>         }
>
>         /* remove saved references to the texture objects */

I think you need to enclose those calls inside conditionals that 
checks if GL_ARB_depth_texture or GL_ARB_shadow is supported. 
Otherwise, if the extension is not supported, these calls will 
generate unexpected GL errors.

-Brian



More information about the mesa-dev mailing list