Commit 4d208abb by Geoff Lang

Don't use the bind SRV flag for MS textures in D3D11 FL 10.0.

With the latest Windows SDKs, it is an error to create a multisampled texture with both bind SRV and DSV flags in feature level 10.0. The error: D3D11 ERROR: ID3D11Device::CreateTexture2D: If the feature level is less than D3D_FEATURE_LEVEL_10_1, a Texture2D with sample count > 1 cannot have both D3D11_BIND_DEPTH_STENCIL and D3D11_BIND_SHADER_RESOURCE. This call may appear to incorrectly return success on older/current D3D runtimes due to missing validation, despite this debug layer message. [STATE_CREATION ERROR #99: CREATETEXTURE2D_INVALIDBINDFLAGS] BUG=656989 Change-Id: Ife7d206f0b815b81558b084f05eca63bd85d8c75 Reviewed-on: https://chromium-review.googlesource.com/409695Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 4e5f1451
...@@ -2002,6 +2002,14 @@ gl::Error Blit11::getSwizzleShader(GLenum type, ...@@ -2002,6 +2002,14 @@ gl::Error Blit11::getSwizzleShader(GLenum type,
gl::ErrorOrResult<TextureHelper11> Blit11::resolveDepth(RenderTarget11 *depth) gl::ErrorOrResult<TextureHelper11> Blit11::resolveDepth(RenderTarget11 *depth)
{ {
// Multisampled depth stencil SRVs are not available in feature level 10.0
if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_10_0)
{
return gl::Error(GL_INVALID_OPERATION,
"Resolving multisampled depth stencil textures is not supported in "
"feature level 10.0.");
}
const auto &extents = depth->getExtents(); const auto &extents = depth->getExtents();
ID3D11Device *device = mRenderer->getDevice(); ID3D11Device *device = mRenderer->getDevice();
ID3D11DeviceContext *context = mRenderer->getDeviceContext(); ID3D11DeviceContext *context = mRenderer->getDeviceContext();
...@@ -2130,6 +2138,14 @@ gl::Error Blit11::initResolveDepthStencil(const gl::Extents &extents) ...@@ -2130,6 +2138,14 @@ gl::Error Blit11::initResolveDepthStencil(const gl::Extents &extents)
gl::ErrorOrResult<TextureHelper11> Blit11::resolveStencil(RenderTarget11 *depthStencil, gl::ErrorOrResult<TextureHelper11> Blit11::resolveStencil(RenderTarget11 *depthStencil,
bool alsoDepth) bool alsoDepth)
{ {
// Multisampled depth stencil SRVs are not available in feature level 10.0
if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_10_0)
{
return gl::Error(GL_INVALID_OPERATION,
"Resolving multisampled depth stencil textures is not supported in "
"feature level 10.0.");
}
const auto &extents = depthStencil->getExtents(); const auto &extents = depthStencil->getExtents();
ANGLE_TRY(initResolveDepthStencil(extents)); ANGLE_TRY(initResolveDepthStencil(extents));
......
...@@ -3136,8 +3136,18 @@ gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, G ...@@ -3136,8 +3136,18 @@ gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, G
bindDSV = (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN); bindDSV = (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
bindSRV = (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN); bindSRV = (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN);
desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET : 0) | // D3D feature level 10.0 no longer allows creation of textures with both the bind SRV and
(bindDSV ? D3D11_BIND_DEPTH_STENCIL : 0) | // DSV flags when multisampled. crbug.com/656989
bool supportsMultisampledDepthStencilSRVs =
mRenderer11DeviceCaps.featureLevel > D3D_FEATURE_LEVEL_10_0;
bool isMultisampledDepthStencil = bindDSV && desc.SampleDesc.Count > 1;
if (isMultisampledDepthStencil && !supportsMultisampledDepthStencilSRVs)
{
bindSRV = false;
}
desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET : 0) |
(bindDSV ? D3D11_BIND_DEPTH_STENCIL : 0) |
(bindSRV ? D3D11_BIND_SHADER_RESOURCE : 0); (bindSRV ? D3D11_BIND_SHADER_RESOURCE : 0);
// The format must be either an RTV or a DSV // The format must be either an RTV or a DSV
......
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