Commit 920ef28a by Rafael Cintron Committed by Commit Bot

Fix FL10_0 multisampling

The last render-to-texture commit broke FL10_0 multisampling by unconditionally asking for D3D11_STANDARD_MULTISAMPLE_PATTERN quality setting. Per the documentation on https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_standard_multisample_quality_levels applications can only request the standard multisample pattern on feature levels 10_1 and above. For feature levels 10_0 and below, we'll stick with asking for a quality level of 0 like the code previous did. Bug: chromium:1036367 Change-Id: I0dd7704cf144ebce952e1f7d5e148d3382891aed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2003238 Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent d9689725
...@@ -2703,7 +2703,7 @@ angle::Result Renderer11::createRenderTarget(const gl::Context *context, ...@@ -2703,7 +2703,7 @@ angle::Result Renderer11::createRenderTarget(const gl::Context *context,
desc.ArraySize = 1; desc.ArraySize = 1;
desc.Format = formatInfo.texFormat; desc.Format = formatInfo.texFormat;
desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples; desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
desc.SampleDesc.Quality = (supportedSamples == 0) ? 0 : D3D11_STANDARD_MULTISAMPLE_PATTERN; desc.SampleDesc.Quality = getSampleDescQuality(supportedSamples);
desc.Usage = D3D11_USAGE_DEFAULT; desc.Usage = D3D11_USAGE_DEFAULT;
desc.CPUAccessFlags = 0; desc.CPUAccessFlags = 0;
desc.MiscFlags = 0; desc.MiscFlags = 0;
...@@ -4037,6 +4037,19 @@ angle::Result Renderer11::getSamplerState(const gl::Context *context, ...@@ -4037,6 +4037,19 @@ angle::Result Renderer11::getSamplerState(const gl::Context *context,
return mStateCache.getSamplerState(context, this, samplerState, outSamplerState); return mStateCache.getSamplerState(context, this, samplerState, outSamplerState);
} }
UINT Renderer11::getSampleDescQuality(GLuint supportedSamples) const
{
// Per the documentation on
// https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_standard_multisample_quality_levels
// applications can only request the standard multisample pattern on
// feature levels 10_1 and above.
if (supportedSamples > 0 && mDevice->GetFeatureLevel() >= D3D_FEATURE_LEVEL_10_1)
{
return D3D11_STANDARD_MULTISAMPLE_PATTERN;
}
return 0;
}
angle::Result Renderer11::clearRenderTarget(const gl::Context *context, angle::Result Renderer11::clearRenderTarget(const gl::Context *context,
RenderTargetD3D *renderTarget, RenderTargetD3D *renderTarget,
const gl::ColorF &clearColorValue, const gl::ColorF &clearColorValue,
......
...@@ -341,6 +341,7 @@ class Renderer11 : public RendererD3D ...@@ -341,6 +341,7 @@ class Renderer11 : public RendererD3D
angle::Result getSamplerState(const gl::Context *context, angle::Result getSamplerState(const gl::Context *context,
const gl::SamplerState &samplerState, const gl::SamplerState &samplerState,
ID3D11SamplerState **outSamplerState); ID3D11SamplerState **outSamplerState);
UINT getSampleDescQuality(GLuint supportedSamples) const;
Blit11 *getBlitter() { return mBlit; } Blit11 *getBlitter() { return mBlit; }
Clear11 *getClearer() { return mClear; } Clear11 *getClearer() { return mClear; }
......
...@@ -3484,7 +3484,7 @@ angle::Result TextureStorage11_2DMultisample::ensureTextureExists(const gl::Cont ...@@ -3484,7 +3484,7 @@ angle::Result TextureStorage11_2DMultisample::ensureTextureExists(const gl::Cont
mRenderer->getNativeTextureCaps().get(mFormatInfo.internalFormat); mRenderer->getNativeTextureCaps().get(mFormatInfo.internalFormat);
GLuint supportedSamples = textureCaps.getNearestSamples(mSamples); GLuint supportedSamples = textureCaps.getNearestSamples(mSamples);
desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples; desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
desc.SampleDesc.Quality = static_cast<UINT>(D3D11_STANDARD_MULTISAMPLE_PATTERN); desc.SampleDesc.Quality = mRenderer->getSampleDescQuality(supportedSamples);
ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo, ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo,
&mTexture)); &mTexture));
...@@ -3676,7 +3676,7 @@ angle::Result TextureStorage11_2DMultisampleArray::ensureTextureExists(const gl: ...@@ -3676,7 +3676,7 @@ angle::Result TextureStorage11_2DMultisampleArray::ensureTextureExists(const gl:
mRenderer->getNativeTextureCaps().get(mFormatInfo.internalFormat); mRenderer->getNativeTextureCaps().get(mFormatInfo.internalFormat);
GLuint supportedSamples = textureCaps.getNearestSamples(mSamples); GLuint supportedSamples = textureCaps.getNearestSamples(mSamples);
desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples; desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
desc.SampleDesc.Quality = static_cast<UINT>(D3D11_STANDARD_MULTISAMPLE_PATTERN); desc.SampleDesc.Quality = mRenderer->getSampleDescQuality(supportedSamples);
ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo, ANGLE_TRY(mRenderer->allocateTexture(GetImplAs<Context11>(context), desc, mFormatInfo,
&mTexture)); &mTexture));
......
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