Commit a0d38875 by Geoff Lang Committed by Commit Bot

Don't create SRVs for multisampled depth stencil textures in FL10.0.

Renderer11::createRenderTarget already fixed this issue but it also is exposed in SwapChain11::resetOffscreenDepthBuffer now that multisampled surfaces are supported in ANGLE. BUG=angleproject:2136 Change-Id: I978666ebc1bb3db14ddf69954d7eb750391bf7a8 Reviewed-on: https://chromium-review.googlesource.com/653779 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 7cadfcc7
...@@ -934,6 +934,9 @@ void Renderer11::populateRenderer11DeviceCaps() ...@@ -934,6 +934,9 @@ void Renderer11::populateRenderer11DeviceCaps()
} }
} }
mRenderer11DeviceCaps.supportsMultisampledDepthStencilSRVs =
mRenderer11DeviceCaps.featureLevel > D3D_FEATURE_LEVEL_10_0;
if (getWorkarounds().disableB5G6R5Support) if (getWorkarounds().disableB5G6R5Support)
{ {
mRenderer11DeviceCaps.B5G6R5support = 0; mRenderer11DeviceCaps.B5G6R5support = 0;
...@@ -3037,12 +3040,9 @@ gl::Error Renderer11::createRenderTarget(int width, ...@@ -3037,12 +3040,9 @@ gl::Error Renderer11::createRenderTarget(int width,
bindDSV = (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN); bindDSV = (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
bindSRV = (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN); bindSRV = (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN);
// D3D feature level 10.0 no longer allows creation of textures with both the bind SRV and
// DSV flags when multisampled. crbug.com/656989
bool supportsMultisampledDepthStencilSRVs =
mRenderer11DeviceCaps.featureLevel > D3D_FEATURE_LEVEL_10_0;
bool isMultisampledDepthStencil = bindDSV && desc.SampleDesc.Count > 1; bool isMultisampledDepthStencil = bindDSV && desc.SampleDesc.Count > 1;
if (isMultisampledDepthStencil && !supportsMultisampledDepthStencilSRVs) if (isMultisampledDepthStencil &&
!mRenderer11DeviceCaps.supportsMultisampledDepthStencilSRVs)
{ {
bindSRV = false; bindSRV = false;
} }
......
...@@ -51,6 +51,10 @@ struct Renderer11DeviceCaps ...@@ -51,6 +51,10 @@ struct Renderer11DeviceCaps
bool supportsConstantBufferOffsets; // Support for Constant buffer offset bool supportsConstantBufferOffsets; // Support for Constant buffer offset
bool supportsVpRtIndexWriteFromVertexShader; // VP/RT can be selected in the Vertex Shader bool supportsVpRtIndexWriteFromVertexShader; // VP/RT can be selected in the Vertex Shader
// stage. // stage.
bool supportsMultisampledDepthStencilSRVs; // D3D feature level 10.0 no longer allows creation
// of textures with both the bind SRV and DSV flags
// when multisampled. Textures will need to be
// resolved before reading. crbug.com/656989
UINT B5G6R5support; // Bitfield of D3D11_FORMAT_SUPPORT values for DXGI_FORMAT_B5G6R5_UNORM UINT B5G6R5support; // Bitfield of D3D11_FORMAT_SUPPORT values for DXGI_FORMAT_B5G6R5_UNORM
UINT B5G6R5maxSamples; // Maximum number of samples supported by DXGI_FORMAT_B5G6R5_UNORM UINT B5G6R5maxSamples; // Maximum number of samples supported by DXGI_FORMAT_B5G6R5_UNORM
UINT B4G4R4A4support; // Bitfield of D3D11_FORMAT_SUPPORT values for DXGI_FORMAT_B4G4R4A4_UNORM UINT B4G4R4A4support; // Bitfield of D3D11_FORMAT_SUPPORT values for DXGI_FORMAT_B4G4R4A4_UNORM
......
...@@ -389,7 +389,12 @@ EGLint SwapChain11::resetOffscreenDepthBuffer(int backbufferWidth, int backbuffe ...@@ -389,7 +389,12 @@ EGLint SwapChain11::resetOffscreenDepthBuffer(int backbufferWidth, int backbuffe
depthStencilTextureDesc.SampleDesc.Quality = 0; depthStencilTextureDesc.SampleDesc.Quality = 0;
} }
if (depthBufferFormatInfo.srvFormat != DXGI_FORMAT_UNKNOWN) // Only create an SRV if it is supported
bool depthStencilSRV =
depthBufferFormatInfo.srvFormat != DXGI_FORMAT_UNKNOWN &&
(mRenderer->getRenderer11DeviceCaps().supportsMultisampledDepthStencilSRVs ||
depthStencilTextureDesc.SampleDesc.Count <= 1);
if (depthStencilSRV)
{ {
depthStencilTextureDesc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; depthStencilTextureDesc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
} }
...@@ -419,7 +424,7 @@ EGLint SwapChain11::resetOffscreenDepthBuffer(int backbufferWidth, int backbuffe ...@@ -419,7 +424,7 @@ EGLint SwapChain11::resetOffscreenDepthBuffer(int backbufferWidth, int backbuffe
ASSERT(!err.isError()); ASSERT(!err.isError());
mDepthStencilDSView.setDebugName("Offscreen depth stencil view"); mDepthStencilDSView.setDebugName("Offscreen depth stencil view");
if (depthBufferFormatInfo.srvFormat != DXGI_FORMAT_UNKNOWN) if (depthStencilSRV)
{ {
D3D11_SHADER_RESOURCE_VIEW_DESC depthStencilSRVDesc; D3D11_SHADER_RESOURCE_VIEW_DESC depthStencilSRVDesc;
depthStencilSRVDesc.Format = depthBufferFormatInfo.srvFormat; depthStencilSRVDesc.Format = depthBufferFormatInfo.srvFormat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment