diff options
author | Dave Airlie <[email protected]> | 2015-04-05 14:45:25 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2015-04-23 10:11:27 +1000 |
commit | 6cc49c4ce1dcb06528bfa2d6e650c26721355ae1 (patch) | |
tree | d1c2afe40a0b4d334d769735f614b07d84a2b52a /src/mesa/state_tracker/st_atom_texture.c | |
parent | 782e71cc078308dddd5d6f9505bff0cb8e67f455 (diff) |
st/mesa: add ARB_texture_stencil8 support (v4)
if we support stencil texturing, enable texture_stencil8
there is no requirement to support native S8 for this,
the texture can be converted to x24s8 fine.
v2: fold fixes from Marek in:
a) put S8 last in the list
b) fix renderable to always test for d/s renderable
fixup the texture case to use a stencil only format
for picking the format for the texture view.
v3: hit fallback for getteximage
v4: put s8 back in front, it shouldn't get picked now (Ilia)
Reviewed-by: Ilia Mirkin <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r-- | src/mesa/state_tracker/st_atom_texture.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index eff28fc6f37..04ba86448fc 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -287,16 +287,22 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st, enum pipe_format format) { struct pipe_sampler_view **sv; - + const struct st_texture_image *firstImage; if (!stObj || !stObj->pt) { return NULL; } 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 (util_format_is_depth_and_stencil(format)) { + if (stObj->base.StencilSampling) + format = util_format_stencil_only(format); + else { + firstImage = st_texture_image_const(_mesa_base_tex_image(&stObj->base)); + if (firstImage->base._BaseFormat == GL_STENCIL_INDEX) + format = util_format_stencil_only(format); + } + } /* if sampler view has changed dereference it */ if (*sv) { |