diff options
author | José Fonseca <[email protected]> | 2011-04-14 13:28:10 +0100 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-09-23 07:58:46 -0600 |
commit | ffeed5da6e568836867f09f1acb7ce660d091d4a (patch) | |
tree | 2b77b81f53317f4e91bcf15dc5125cdd98daed7d /src/gallium/drivers/svga/svga_resource_texture.c | |
parent | 8bf3fb4eca5594f8348de2f8fb67bc94127f8d5a (diff) |
svga: Don't use the new depth formats for surfaces that will never be sampled from.
Mitigates issues with hosts where support for these new depth formats is
flaky.
Diffstat (limited to 'src/gallium/drivers/svga/svga_resource_texture.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_resource_texture.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 5fb31d2940b..8297f830a61 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -54,7 +54,8 @@ SVGA3dSurfaceFormat svga_translate_format(struct svga_screen *ss, - enum pipe_format format) + enum pipe_format format, + unsigned bind) { switch(format) { @@ -81,11 +82,11 @@ svga_translate_format(struct svga_screen *ss, return SVGA3D_Z_D32; */ case PIPE_FORMAT_Z16_UNORM: - return ss->depth.z16; + return bind & PIPE_BIND_SAMPLER_VIEW ? ss->depth.z16 : SVGA3D_Z_D16; case PIPE_FORMAT_S8_USCALED_Z24_UNORM: - return ss->depth.s8z24; + return bind & PIPE_BIND_SAMPLER_VIEW ? ss->depth.s8z24 : SVGA3D_Z_D24S8; case PIPE_FORMAT_X8Z24_UNORM: - return ss->depth.x8z24; + return bind & PIPE_BIND_SAMPLER_VIEW ? ss->depth.x8z24 : SVGA3D_Z_D24X8; case PIPE_FORMAT_A8_UNORM: return SVGA3D_ALPHA8; @@ -108,7 +109,8 @@ svga_translate_format(struct svga_screen *ss, SVGA3dSurfaceFormat svga_translate_format_render(struct svga_screen *ss, - enum pipe_format format) + enum pipe_format format, + unsigned bind) { switch(format) { case PIPE_FORMAT_B8G8R8A8_UNORM: @@ -121,7 +123,7 @@ svga_translate_format_render(struct svga_screen *ss, case PIPE_FORMAT_Z32_UNORM: case PIPE_FORMAT_Z16_UNORM: case PIPE_FORMAT_L8_UNORM: - return svga_translate_format(ss, format); + return svga_translate_format(ss, format, bind); default: return SVGA3D_FORMAT_INVALID; @@ -562,7 +564,7 @@ svga_texture_create(struct pipe_screen *screen, tex->key.numMipLevels = template->last_level + 1; - tex->key.format = svga_translate_format(svgascreen, template->format); + tex->key.format = svga_translate_format(svgascreen, template->format, template->bind); if(tex->key.format == SVGA3D_FORMAT_INVALID) goto error2; @@ -609,8 +611,8 @@ svga_texture_from_handle(struct pipe_screen *screen, if (!srf) return NULL; - if (svga_translate_format(svga_screen(screen), template->format) != format) { - unsigned f1 = svga_translate_format(svga_screen(screen), template->format); + if (svga_translate_format(svga_screen(screen), template->format, template->bind) != format) { + unsigned f1 = svga_translate_format(svga_screen(screen), template->format, template->bind); unsigned f2 = format; /* It's okay for XRGB and ARGB or depth with/out stencil to get mixed up */ |