1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 20:10:05 +00:00

Set the render target view to sRGB format (#68)

This allows to correctly sample from sRGB textures and write back
correct colors to backbuffer. Also work with linear RGB textures
This commit is contained in:
Francesco Pretto 2017-12-18 22:27:20 +01:00 committed by Chuck Walbourn
parent 9191df06ce
commit d536725320

View File

@ -385,7 +385,11 @@ HRESULT InitDevice( const TexMetadata& mdata )
if( FAILED( hr ) ) if( FAILED( hr ) )
return hr; return hr;
hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, nullptr, &g_pRenderTargetView ); D3D11_RENDER_TARGET_VIEW_DESC vd;
ZeroMemory(&vd, sizeof(vd));
vd.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
vd.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, &vd, &g_pRenderTargetView );
pBackBuffer->Release(); pBackBuffer->Release();
if( FAILED( hr ) ) if( FAILED( hr ) )
return hr; return hr;