Commit 62a90cf6 by Geoff Lang Committed by Commit Bot

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: Iedce65f6c877786e28b96c159abd7a5b2a32cfd5 Reviewed-on: https://chromium-review.googlesource.com/408339Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent f097e238
...@@ -2000,6 +2000,14 @@ gl::Error Blit11::getSwizzleShader(GLenum type, ...@@ -2000,6 +2000,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();
...@@ -2128,6 +2136,14 @@ gl::Error Blit11::initResolveDepthStencil(const gl::Extents &extents) ...@@ -2128,6 +2136,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));
......
...@@ -3288,6 +3288,16 @@ gl::Error Renderer11::createRenderTarget(int width, ...@@ -3288,6 +3288,16 @@ 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;
if (isMultisampledDepthStencil && !supportsMultisampledDepthStencilSRVs)
{
bindSRV = false;
}
desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET : 0) | desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET : 0) |
(bindDSV ? D3D11_BIND_DEPTH_STENCIL : 0) | (bindDSV ? D3D11_BIND_DEPTH_STENCIL : 0) |
(bindSRV ? D3D11_BIND_SHADER_RESOURCE : 0); (bindSRV ? D3D11_BIND_SHADER_RESOURCE : 0);
......
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