d3d1x: use ZS formats for TYPELESS resources with DS binding
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Thu, 13 Oct 2011 19:27:09 +0000 (21:27 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 21 Oct 2011 21:00:38 +0000 (23:00 +0200)
src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h

index 8f740ba5af9ad83180f96edea3442dbbf62db496..dfa0d9e180441aa0592b6529679323cb2d8be530 100644 (file)
@@ -744,6 +744,16 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                else
                        templat.last_level = MAX2(MAX2(util_logbase2(templat.width0), util_logbase2(templat.height0)), util_logbase2(templat.depth0));
                templat.format = dxgi_to_pipe_format[format];
+               if(bind_flags & D3D11_BIND_DEPTH_STENCIL) {
+                       // colour formats are not depth-renderable, but depth/stencil-formats may be colour-renderable
+                       switch(format)
+                       {
+                       case DXGI_FORMAT_R32_TYPELESS: templat.format = PIPE_FORMAT_Z32_FLOAT; break;
+                       case DXGI_FORMAT_R16_TYPELESS: templat.format = PIPE_FORMAT_Z16_UNORM; break;
+                       default:
+                               break;
+                       }
+               }
                templat.bind = d3d11_to_pipe_bind_flags(bind_flags);
                if(c_p_u_access_flags & D3D11_CPU_ACCESS_READ)
                        templat.bind |= PIPE_BIND_TRANSFER_READ;