summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/r600/r600_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mesa/src/gallium/drivers/r600/r600_texture.c')
-rw-r--r--lib/mesa/src/gallium/drivers/r600/r600_texture.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/mesa/src/gallium/drivers/r600/r600_texture.c b/lib/mesa/src/gallium/drivers/r600/r600_texture.c
index 3ffa7be72..518e92d9f 100644
--- a/lib/mesa/src/gallium/drivers/r600/r600_texture.c
+++ b/lib/mesa/src/gallium/drivers/r600/r600_texture.c
@@ -243,6 +243,8 @@ static int r600_init_surface(struct r600_common_screen *rscreen,
flags |= RADEON_SURF_SHAREABLE;
if (is_imported)
flags |= RADEON_SURF_IMPORTED | RADEON_SURF_SHAREABLE;
+ if (!(ptex->flags & R600_RESOURCE_FLAG_FORCE_TILING))
+ flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE;
r = rscreen->ws->surface_init(rscreen->ws, ptex,
flags, bpe, array_mode, surface);
@@ -916,6 +918,7 @@ r600_texture_create_object(struct pipe_screen *screen,
resource = &rtex->resource;
resource->b.b = *base;
+ resource->b.b.next = NULL;
resource->b.vtbl = &r600_texture_vtbl;
pipe_reference_init(&resource->b.b.reference, 1);
resource->b.b.screen = screen;
@@ -1632,11 +1635,11 @@ static void r600_clear_texture(struct pipe_context *pipe,
/* Depth is always present. */
clear = PIPE_CLEAR_DEPTH;
- util_format_unpack_z_float(tex->format, &depth, data, 1);
+ desc->unpack_z_float(&depth, 0, data, 0, 1, 1);
if (rtex->surface.has_stencil) {
clear |= PIPE_CLEAR_STENCIL;
- util_format_unpack_s_8uint(tex->format, &stencil, data, 1);
+ desc->unpack_s_8uint(&stencil, 0, data, 0, 1, 1);
}
pipe->clear_depth_stencil(pipe, sf, clear, depth, stencil,
@@ -1645,7 +1648,13 @@ static void r600_clear_texture(struct pipe_context *pipe,
} else {
union pipe_color_union color;
- util_format_unpack_rgba(tex->format, color.ui, data, 1);
+ /* pipe_color_union requires the full vec4 representation. */
+ if (util_format_is_pure_uint(tex->format))
+ desc->unpack_rgba_uint(color.ui, 0, data, 0, 1, 1);
+ else if (util_format_is_pure_sint(tex->format))
+ desc->unpack_rgba_sint(color.i, 0, data, 0, 1, 1);
+ else
+ desc->unpack_rgba_float(color.f, 0, data, 0, 1, 1);
if (screen->is_format_supported(screen, tex->format,
tex->target, 0, 0,
@@ -1742,8 +1751,12 @@ static void evergreen_set_clear_color(struct r600_texture *rtex,
color->ui[0] == color->ui[2]);
uc.ui[0] = color->ui[0];
uc.ui[1] = color->ui[3];
+ } else if (util_format_is_pure_uint(surface_format)) {
+ util_format_write_4ui(surface_format, color->ui, 0, &uc, 0, 0, 0, 1, 1);
+ } else if (util_format_is_pure_sint(surface_format)) {
+ util_format_write_4i(surface_format, color->i, 0, &uc, 0, 0, 0, 1, 1);
} else {
- util_pack_color_union(surface_format, &uc, color);
+ util_pack_color(color->f, surface_format, &uc);
}
memcpy(rtex->color_clear_value, &uc, 2 * sizeof(uint32_t));