libobs-d3d11: Support typeless textures

In the future, we may share or wrap typeless textures to support SRGB
and non-SRGB views.
This commit is contained in:
jpark37 2020-12-17 04:01:08 -08:00 committed by Jim
parent 12b6e28f03
commit c72b5de23e
2 changed files with 5 additions and 2 deletions

View File

@ -114,11 +114,14 @@ static inline gs_color_format ConvertDXGITextureFormat(DXGI_FORMAT format)
return GS_R8;
case DXGI_FORMAT_R8G8_UNORM:
return GS_R8G8;
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
case DXGI_FORMAT_R8G8B8A8_UNORM:
return GS_RGBA;
case DXGI_FORMAT_B8G8R8X8_UNORM:
case DXGI_FORMAT_B8G8R8X8_TYPELESS:
return GS_BGRX;
case DXGI_FORMAT_B8G8R8A8_UNORM:
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
return GS_BGRA;
case DXGI_FORMAT_R10G10B10A2_UNORM:
return GS_R10G10B10A2;

View File

@ -302,7 +302,7 @@ gs_texture_2d::gs_texture_2d(gs_device_t *device, uint32_t handle)
this->dxgiFormat = td.Format;
memset(&resourceDesc, 0, sizeof(resourceDesc));
resourceDesc.Format = td.Format;
resourceDesc.Format = ConvertGSTextureFormat(this->format);
resourceDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
resourceDesc.Texture2D.MipLevels = 1;
@ -329,7 +329,7 @@ gs_texture_2d::gs_texture_2d(gs_device_t *device, ID3D11Texture2D *obj)
this->dxgiFormat = td.Format;
memset(&resourceDesc, 0, sizeof(resourceDesc));
resourceDesc.Format = td.Format;
resourceDesc.Format = ConvertGSTextureFormat(this->format);
resourceDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
resourceDesc.Texture2D.MipLevels = 1;