mesa/st: implement ARB_stencil_texturing
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 3 May 2014 09:08:53 +0000 (05:08 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Mon, 5 May 2014 00:10:14 +0000 (20:10 -0400)
If StencilSampling is enabled on the texture object, pass in an
equivalent stencil-only format.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_extensions.c

index afc6d9dab7e1c2f35526401c09b1ce52b7f9501a..928a4ffd2a33d84fae06c60c9b353469fb03c5e4 100644 (file)
@@ -271,6 +271,10 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st,
 
    sv = st_texture_get_sampler_view(st, stObj);
 
+   if (stObj->base.StencilSampling &&
+       util_format_is_depth_and_stencil(format))
+      format = util_format_stencil_only(format);
+
    /* if sampler view has changed dereference it */
    if (*sv) {
       if (check_sampler_swizzle(stObj, *sv) ||
index 33cd1295bfd433a640093208bc133d4f0dd00bdf..12ba82df342bd59e6dfdb406ec11bc703901ae1d 100644 (file)
@@ -507,6 +507,11 @@ void st_init_extensions(struct st_context *st)
 
       { { o(OES_compressed_ETC1_RGB8_texture) },
         { PIPE_FORMAT_ETC1_RGB8 } },
+
+      { { o(ARB_stencil_texturing) },
+        { PIPE_FORMAT_X24S8_UINT,
+          PIPE_FORMAT_S8X24_UINT },
+        GL_TRUE }, /* at least one format must be supported */
    };
 
    /* Required: vertex fetch support. */