[Mesa-dev] [PATCH] u_tile: fix stencil texturing tests under softpipe
Roland Scheidegger
sroland at vmware.com
Mon Apr 6 17:43:57 PDT 2015
Am 07.04.2015 um 02:15 schrieb Dave Airlie:
> From: Dave Airlie <airlied at redhat.com>
>
> arb_stencil_texturing-draw failed under softpipe because we got a float
> back from the texturing function, and then tried to U2F it, stencil
> texturing returns ints, so we should fix the tiling to retrieve
> the stencil values as integers not floats.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/gallium/auxiliary/util/u_tile.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
> index 6252e5d..f5edb8b 100644
> --- a/src/gallium/auxiliary/util/u_tile.c
> +++ b/src/gallium/auxiliary/util/u_tile.c
> @@ -214,13 +214,13 @@ s8x24_get_tile_rgba(const unsigned *src,
> unsigned i, j;
>
> for (i = 0; i < h; i++) {
> - float *pRow = p;
> + uint32_t *pRow = p;
>
> for (j = 0; j < w; j++, pRow += 4) {
> pRow[0] =
> pRow[1] =
> pRow[2] =
> - pRow[3] = (float)((*src++ >> 24) & 0xff);
> + pRow[3] = ((*src++ >> 24) & 0xff);
> }
>
> p += dst_stride;
> @@ -241,12 +241,12 @@ x24s8_get_tile_rgba(const unsigned *src,
> unsigned i, j;
>
> for (i = 0; i < h; i++) {
> - float *pRow = p;
> + uint32_t *pRow = p;
> for (j = 0; j < w; j++, pRow += 4) {
> pRow[0] =
> pRow[1] =
> pRow[2] =
> - pRow[3] = (float)(*src++ & 0xff);
> + pRow[3] = (*src++ & 0xff);
> }
> p += dst_stride;
> }
> @@ -265,12 +265,12 @@ s8_get_tile_rgba(const unsigned char *src,
> unsigned i, j;
>
> for (i = 0; i < h; i++) {
> - float *pRow = p;
> + uint32_t *pRow = p;
> for (j = 0; j < w; j++, pRow += 4) {
> pRow[0] =
> pRow[1] =
> pRow[2] =
> - pRow[3] = (float)(*src++ & 0xff);
> + pRow[3] = (*src++ & 0xff);
> }
> p += dst_stride;
> }
>
I am kinda surprised the code is all there to actually make it work...
int32_t *pRow = p is an implicit cast from a float ptr to a int ptr
though and probably violates strict aliasing rules. I guess though to
fix it properly you'd need to use a void ptr in the interface or something.
Though it's an improvement in any case.
Roland
More information about the mesa-dev
mailing list