On Sun, May 4, 2014 at 11:59 AM, Roland Scheidegger <[email protected]> wrote: > Am 03.05.2014 11:25, schrieb Ilia Mirkin: >> If StencilSampling is enabled on the texture object, pass in an >> equivalent stencil-only format. >> >> Signed-off-by: Ilia Mirkin <[email protected]> >> --- >> >> This replaces my earlier series, based on a suggestion from Michel Dänzer on >> IRC. Much simpler, and enables it for pretty much all gallium drivers. >> >> src/mesa/state_tracker/st_atom_texture.c | 4 ++++ >> src/mesa/state_tracker/st_extensions.c | 5 +++++ >> 2 files changed, 9 insertions(+) >> >> diff --git a/src/mesa/state_tracker/st_atom_texture.c >> b/src/mesa/state_tracker/st_atom_texture.c >> index afc6d9d..928a4ff 100644 >> --- a/src/mesa/state_tracker/st_atom_texture.c >> +++ b/src/mesa/state_tracker/st_atom_texture.c >> @@ -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) || >> diff --git a/src/mesa/state_tracker/st_extensions.c >> b/src/mesa/state_tracker/st_extensions.c >> index 33cd129..12ba82d 100644 >> --- a/src/mesa/state_tracker/st_extensions.c >> +++ b/src/mesa/state_tracker/st_extensions.c >> @@ -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. */ >> > > This version looks good to me. I guess you had to support stencil > texturing for all depthstencil formats the driver claims to support, but > presumably this isn't a problem for any hardware which can do it in the > first place.
At a quick glance at a few drivers I didn't notice any problems. Should any issues come up, we can do something cleverer, like checking directly that for each supported DEPTH_STENCIL format, that its related STENCIL format is also supported. It didn't seem that the complexity was worth it for now. > (Gallium actually is a bit lenient wrt to sampling depthstencil > textures, if you pass in a depthstencil format it will assume you want > the depth part - it would be cleaner if you'd have to specify the > corresponding depth-only format in the view). Hmm... that seems akin to poking a dragon with a stick. In theory that seems like it should work, but I'd like to leave it to someone else to find out :) -ilia _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
