d3d1x: use resource format if view format is UNKNOWN

This commit is contained in:
Christoph Bumiller 2011-10-17 20:50:23 +02:00
parent 5081ebf238
commit 845808f105

View file

@ -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;