Commit f03c4da0 by Shannon Woods

Revert "In Clear11, use ID3D11DeviceContext1::ClearView when appropriate"

Causing failures on GPU Windows bots This reverts commit 3b231629. Change-Id: Ie1806db36b13f8b03dc1a1ae10f237260c99de7b Reviewed-on: https://chromium-review.googlesource.com/231701Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarShannon Woods <shannonwoods@chromium.org>
parent f60fab6d
...@@ -150,19 +150,15 @@ Clear11::~Clear11() ...@@ -150,19 +150,15 @@ Clear11::~Clear11()
gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, const gl::Framebuffer *frameBuffer) gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, const gl::Framebuffer *frameBuffer)
{ {
// Iterate over the color buffers which require clearing and determine if they can be // First determine if a scissored clear is needed, this will always require drawing a quad.
// cleared with ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView. //
// This requires: // Otherwise, iterate over the color buffers which require clearing and determine if they can be
// cleared with ID3D11DeviceContext::ClearRenderTargetView... This requires:
// 1) The render target is being cleared to a float value (will be cast to integer when clearing integer // 1) The render target is being cleared to a float value (will be cast to integer when clearing integer
// render targets as expected but does not work the other way around) // render targets as expected but does not work the other way around)
// 2) The format of the render target has no color channels that are currently masked out. // 2) The format of the render target has no color channels that are currently masked out.
// Clear the easy-to-clear buffers on the spot and accumulate the ones that require special work. // Clear the easy-to-clear buffers on the spot and accumulate the ones that require special work.
// //
// If these conditions are met, and:
// - No scissored clear is needed, then clear using ID3D11DeviceContext::ClearRenderTargetView.
// - A scissored clear is needed then clear using ID3D11DeviceContext1::ClearView if available.
// Otherwise draw a quad.
//
// Also determine if the depth stencil can be cleared with ID3D11DeviceContext::ClearDepthStencilView // Also determine if the depth stencil can be cleared with ID3D11DeviceContext::ClearDepthStencilView
// by checking if the stencil write mask covers the entire stencil. // by checking if the stencil write mask covers the entire stencil.
// //
...@@ -207,7 +203,6 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons ...@@ -207,7 +203,6 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons
RenderTarget11* maskedClearDepthStencil = NULL; RenderTarget11* maskedClearDepthStencil = NULL;
ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext(); ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++) for (unsigned int colorAttachment = 0; colorAttachment < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{ {
...@@ -241,13 +236,13 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons ...@@ -241,13 +236,13 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons
// Every channel either does not exist in the render target or is masked out // Every channel either does not exist in the render target or is masked out
continue; continue;
} }
else if ((!deviceContext1 && needScissoredClear) || clearParams.colorClearType != GL_FLOAT || else if (needScissoredClear || clearParams.colorClearType != GL_FLOAT ||
(formatInfo.redBits > 0 && !clearParams.colorMaskRed) || (formatInfo.redBits > 0 && !clearParams.colorMaskRed) ||
(formatInfo.greenBits > 0 && !clearParams.colorMaskGreen) || (formatInfo.greenBits > 0 && !clearParams.colorMaskGreen) ||
(formatInfo.blueBits > 0 && !clearParams.colorMaskBlue) || (formatInfo.blueBits > 0 && !clearParams.colorMaskBlue) ||
(formatInfo.alphaBits > 0 && !clearParams.colorMaskAlpha)) (formatInfo.alphaBits > 0 && !clearParams.colorMaskAlpha))
{ {
// A masked clear is required, or a scissored clear is required and ID3D11DeviceContext1::ClearView is unavailable // A scissored or masked clear is required
MaskedRenderTarget maskAndRt; MaskedRenderTarget maskAndRt;
bool clearColor = clearParams.clearColor[colorAttachment]; bool clearColor = clearParams.clearColor[colorAttachment];
maskAndRt.colorMask[0] = (clearColor && clearParams.colorMaskRed); maskAndRt.colorMask[0] = (clearColor && clearParams.colorMaskRed);
...@@ -259,7 +254,7 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons ...@@ -259,7 +254,7 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons
} }
else else
{ {
// ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView is possible // ID3D11DeviceContext::ClearRenderTargetView is possible
ID3D11RenderTargetView *framebufferRTV = renderTarget->getRenderTargetView(); ID3D11RenderTargetView *framebufferRTV = renderTarget->getRenderTargetView();
if (!framebufferRTV) if (!framebufferRTV)
...@@ -279,23 +274,7 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons ...@@ -279,23 +274,7 @@ gl::Error Clear11::clearFramebuffer(const gl::ClearParameters &clearParams, cons
((formatInfo.alphaBits == 0 && actualFormatInfo.alphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha), ((formatInfo.alphaBits == 0 && actualFormatInfo.alphaBits > 0) ? 1.0f : clearParams.colorFClearValue.alpha),
}; };
if (needScissoredClear) deviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
{
// We shouldn't reach here if deviceContext1 is unavailable.
ASSERT(deviceContext1);
D3D11_RECT rect;
rect.left = clearParams.scissor.x;
rect.right = clearParams.scissor.x + clearParams.scissor.width;
rect.top = clearParams.scissor.y;
rect.bottom = clearParams.scissor.y + clearParams.scissor.height;
deviceContext1->ClearView(framebufferRTV, clearValues, &rect, 1);
}
else
{
deviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
}
} }
} }
} }
......
...@@ -178,7 +178,6 @@ Renderer11::Renderer11(egl::Display *display, EGLNativeDisplayType hDc, const eg ...@@ -178,7 +178,6 @@ Renderer11::Renderer11(egl::Display *display, EGLNativeDisplayType hDc, const eg
mDevice = NULL; mDevice = NULL;
mDeviceContext = NULL; mDeviceContext = NULL;
mDeviceContext1 = NULL;
mDxgiAdapter = NULL; mDxgiAdapter = NULL;
mDxgiFactory = NULL; mDxgiFactory = NULL;
...@@ -331,11 +330,6 @@ EGLint Renderer11::initialize() ...@@ -331,11 +330,6 @@ EGLint Renderer11::initialize()
#endif #endif
#endif #endif
// Cast the DeviceContext to a DeviceContext1.
// This could fail on Windows 7 without the Platform Update.
// Don't error in this case- just don't use mDeviceContext1.
mDeviceContext1 = d3d11::DynamicCastComObject<ID3D11DeviceContext1>(mDeviceContext);
IDXGIDevice *dxgiDevice = NULL; IDXGIDevice *dxgiDevice = NULL;
result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice); result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice);
...@@ -1900,8 +1894,6 @@ void Renderer11::release() ...@@ -1900,8 +1894,6 @@ void Renderer11::release()
SafeRelease(mDxgiFactory); SafeRelease(mDxgiFactory);
SafeRelease(mDxgiAdapter); SafeRelease(mDxgiAdapter);
SafeRelease(mDeviceContext1);
if (mDeviceContext) if (mDeviceContext)
{ {
mDeviceContext->ClearState(); mDeviceContext->ClearState();
......
...@@ -188,7 +188,6 @@ class Renderer11 : public RendererD3D ...@@ -188,7 +188,6 @@ class Renderer11 : public RendererD3D
// D3D11-renderer specific methods // D3D11-renderer specific methods
ID3D11Device *getDevice() { return mDevice; } ID3D11Device *getDevice() { return mDevice; }
ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; }; ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
ID3D11DeviceContext1 *getDeviceContext1IfSupported() { return mDeviceContext1; };
DXGIFactory *getDxgiFactory() { return mDxgiFactory; }; DXGIFactory *getDxgiFactory() { return mDxgiFactory; };
Blit11 *getBlitter() { return mBlit; } Blit11 *getBlitter() { return mBlit; }
...@@ -362,7 +361,6 @@ class Renderer11 : public RendererD3D ...@@ -362,7 +361,6 @@ class Renderer11 : public RendererD3D
ID3D11Device *mDevice; ID3D11Device *mDevice;
D3D_FEATURE_LEVEL mFeatureLevel; D3D_FEATURE_LEVEL mFeatureLevel;
ID3D11DeviceContext *mDeviceContext; ID3D11DeviceContext *mDeviceContext;
ID3D11DeviceContext1 *mDeviceContext1;
IDXGIAdapter *mDxgiAdapter; IDXGIAdapter *mDxgiAdapter;
DXGI_ADAPTER_DESC mAdapterDescription; DXGI_ADAPTER_DESC mAdapterDescription;
char mDescription[128]; char mDescription[128];
......
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