OSDN Git Service

radeonsi: fix texture gather on stencil textures
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 18 Jan 2017 08:28:47 +0000 (09:28 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 20 Jan 2017 23:24:17 +0000 (23:24 +0000)
commit1cc5774e5e7b268017af9527c1e1af1185c9745a
tree9697e822d36f4fffedcc5927808bcaca57dcbf9a
parent50a607cf70073d5980b07f73f38bd991b68f7029
radeonsi: fix texture gather on stencil textures

At least on VI, texture gather doesn't work with a 24_8 data format, so
use 8_8_8_8 and a modified swizzle instead.

A bit of background: When creating a GL_STENCIL_INDEX8 texture, we select
the X24S8 pipe format because we don't support stencil-only render targets
properly. With mip-mapping this can lead to a setup where the tiling is
incompatible with stencil texturing, and a flushed stencil texture is
used. For the flushed stencil, a literal X24S8 is used because there were
issues with an 8bpp DB->CB copy.

Longer term, it would be good if we could get away from these workarounds,
i.e. properly support an S8 format for stencil-only rendering and flushed
stencil. Since stencil texturing is somewhat rare, it's not a high
priority.

Fixes GL45-CTS.texture_cube_map_array.sampling.

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
(cherry picked from commit 3cd092c41508dde2e6259f09df1736911a828548)
src/gallium/drivers/radeonsi/si_state.c