From: Christoph Bumiller Date: Mon, 17 Oct 2011 18:50:23 +0000 (+0200) Subject: d3d1x: use resource format if view format is UNKNOWN X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=845808f105f216861e725ce1bce67338357bba8d;p=mesa.git d3d1x: use resource format if view format is UNKNOWN --- diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 401e3121c43..8f740ba5af9 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -973,9 +973,10 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen #endif SYNCHRONIZED; + const struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; + if(!desc) { - struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; init_pipe_to_dxgi_format(); memset(&def_desc, 0, sizeof(def_desc)); def_desc.Format = pipe_to_dxgi_format[resource->format]; @@ -1030,7 +1031,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen memset(&templat, 0, sizeof(templat)); if(invalid(format >= DXGI_FORMAT_COUNT)) return E_INVALIDARG; - templat.format = dxgi_to_pipe_format[desc->Format]; + templat.format = (desc->Format == DXGI_FORMAT_UNKNOWN) ? resource->format : dxgi_to_pipe_format[desc->Format]; if(!templat.format) return E_NOTIMPL; templat.swizzle_r = PIPE_SWIZZLE_RED; @@ -1102,10 +1103,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen { SYNCHRONIZED; + const struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; + D3D11_RENDER_TARGET_VIEW_DESC def_desc; if(!desc) { - struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; init_pipe_to_dxgi_format(); memset(&def_desc, 0, sizeof(def_desc)); def_desc.Format = pipe_to_dxgi_format[resource->format]; @@ -1148,7 +1150,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen memset(&templat, 0, sizeof(templat)); if(invalid(desc->format >= DXGI_FORMAT_COUNT)) return E_INVALIDARG; - templat.format = dxgi_to_pipe_format[desc->Format]; + templat.format = (desc->Format == DXGI_FORMAT_UNKNOWN) ? resource->format : dxgi_to_pipe_format[desc->Format]; if(!templat.format) return E_NOTIMPL; templat.usage = PIPE_BIND_RENDER_TARGET; @@ -1196,10 +1198,11 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen { SYNCHRONIZED; + const struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; + D3D11_DEPTH_STENCIL_VIEW_DESC def_desc; if(!desc) { - struct pipe_resource* resource = ((GalliumD3D11Resource<>*)iresource)->resource; init_pipe_to_dxgi_format(); memset(&def_desc, 0, sizeof(def_desc)); def_desc.Format = pipe_to_dxgi_format[resource->format]; @@ -1234,7 +1237,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen memset(&templat, 0, sizeof(templat)); if(invalid(desc->format >= DXGI_FORMAT_COUNT)) return E_INVALIDARG; - templat.format = dxgi_to_pipe_format[desc->Format]; + templat.format = (desc->Format == DXGI_FORMAT_UNKNOWN) ? resource->format : dxgi_to_pipe_format[desc->Format]; if(!templat.format) return E_NOTIMPL; templat.usage = PIPE_BIND_DEPTH_STENCIL;