diff options
author | Christoph Bumiller <[email protected]> | 2011-10-17 20:50:23 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2011-10-21 23:00:37 +0200 |
commit | 845808f105f216861e725ce1bce67338357bba8d (patch) | |
tree | e7b48dbfbe355243df5f2a3ea99cb32b3d8b1152 /src/gallium/state_trackers/d3d1x/gd3d11 | |
parent | 5081ebf23803c1f3042c3ca94f97865726d0c9f6 (diff) |
d3d1x: use resource format if view format is UNKNOWN
Diffstat (limited to 'src/gallium/state_trackers/d3d1x/gd3d11')
-rw-r--r-- | src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 15 |
1 files changed, 9 insertions, 6 deletions
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; |