r600g: use format from the sampler view not from the texture.
authorDave Airlie <airlied@redhat.com>
Thu, 7 Oct 2010 05:13:09 +0000 (15:13 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 7 Oct 2010 05:17:28 +0000 (15:17 +1000)
we want to use the format from the sampler view which isn't always the
same as the texture format when creating sampler views.

src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_state.c

index 603a8a7b915766c5f5d5b4942f626b0bcbeeefc1..0fd1d3995182695025dd83a5a174487614ace316 100644 (file)
@@ -424,15 +424,15 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
        swizzle[1] = state->swizzle_g;
        swizzle[2] = state->swizzle_b;
        swizzle[3] = state->swizzle_a;
-       format = r600_translate_texformat(texture->format,
+       format = r600_translate_texformat(state->format,
                                          swizzle,
                                          &word4, &yuv_format);
        if (format == ~0) {
                format = 0;
        }
-       desc = util_format_description(texture->format);
+       desc = util_format_description(state->format);
        if (desc == NULL) {
-               R600_ERR("unknow format %d\n", texture->format);
+               R600_ERR("unknow format %d\n", state->format);
        }
        tmp = (struct r600_resource_texture*)texture;
        rbuffer = &tmp->resource;
index b55c34500595b875009fa751636cab46983aa472..7ceedf6363b01ef8eee3c9545f76d0d2b4c7e320 100644 (file)
@@ -626,15 +626,15 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
        swizzle[1] = state->swizzle_g;
        swizzle[2] = state->swizzle_b;
        swizzle[3] = state->swizzle_a;
-       format = r600_translate_texformat(texture->format,
+       format = r600_translate_texformat(state->format,
                                          swizzle,
                                          &word4, &yuv_format);
        if (format == ~0) {
                format = 0;
        }
-       desc = util_format_description(texture->format);
+       desc = util_format_description(state->format);
        if (desc == NULL) {
-               R600_ERR("unknow format %d\n", texture->format);
+               R600_ERR("unknow format %d\n", state->format);
        }
        tmp = (struct r600_resource_texture*)texture;
        rbuffer = &tmp->resource;