Commit c38fa8a5 by Jamie Madill

Revert "Track bound render targets in D3D9 with uintptr_t and dirty them with -1."

Failures on the Chromium GPU FYI bots: http://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20%28Intel%29/builds/8695 This reverts commit 358c8a95. Change-Id: I01d674929280364e097e4f65b06d7c3b1f928e92 Reviewed-on: https://chromium-review.googlesource.com/247091Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 4e47b92f
...@@ -1281,22 +1281,21 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf ...@@ -1281,22 +1281,21 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf
D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN; D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN;
bool renderTargetChanged = false; bool renderTargetChanged = false;
unsigned int renderTargetSerial = GetAttachmentSerial(colorBuffer);
// Apply the render target on the device if (renderTargetSerial != mAppliedRenderTargetSerial)
RenderTarget9 *renderTarget = NULL;
gl::Error error = d3d9::GetAttachmentRenderTarget(colorBuffer, &renderTarget);
if (error.isError())
{ {
return error; // Apply the render target on the device
} RenderTarget9 *renderTarget = NULL;
ASSERT(renderTarget); gl::Error error = d3d9::GetAttachmentRenderTarget(colorBuffer, &renderTarget);
if (error.isError())
{
return error;
}
ASSERT(renderTarget);
IDirect3DSurface9 *renderTargetSurface = renderTarget->getSurface(); IDirect3DSurface9 *renderTargetSurface = renderTarget->getSurface();
uintptr_t renderTargetUintPtr = reinterpret_cast<uintptr_t>(renderTargetSurface); ASSERT(renderTargetSurface);
ASSERT(renderTargetSurface);
if (renderTargetUintPtr != mAppliedRenderTarget)
{
mDevice->SetRenderTarget(0, renderTargetSurface); mDevice->SetRenderTarget(0, renderTargetSurface);
SafeRelease(renderTargetSurface); SafeRelease(renderTargetSurface);
...@@ -1304,59 +1303,57 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf ...@@ -1304,59 +1303,57 @@ gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorBuf
renderTargetHeight = renderTarget->getHeight(); renderTargetHeight = renderTarget->getHeight();
renderTargetFormat = renderTarget->getD3DFormat(); renderTargetFormat = renderTarget->getD3DFormat();
mAppliedRenderTarget = renderTargetUintPtr; mAppliedRenderTargetSerial = renderTargetSerial;
renderTargetChanged = true; renderTargetChanged = true;
} }
unsigned int depthSize = 0; unsigned int depthStencilSerial = (depthStencilBuffer != nullptr) ? GetAttachmentSerial(depthStencilBuffer) : 0;
unsigned int stencilSize = 0; if (depthStencilSerial != mAppliedDepthStencilSerial || !mDepthStencilInitialized)
// Apply the depth stencil on the device
if (depthStencilBuffer)
{ {
RenderTarget9 *depthStencilRenderTarget = NULL; unsigned int depthSize = 0;
gl::Error error = d3d9::GetAttachmentRenderTarget(depthStencilBuffer, &depthStencilRenderTarget); unsigned int stencilSize = 0;
if (error.isError())
// Apply the depth stencil on the device
if (depthStencilBuffer)
{ {
return error; RenderTarget9 *depthStencilRenderTarget = NULL;
} gl::Error error = d3d9::GetAttachmentRenderTarget(depthStencilBuffer, &depthStencilRenderTarget);
ASSERT(depthStencilRenderTarget); if (error.isError())
{
return error;
}
ASSERT(depthStencilRenderTarget);
IDirect3DSurface9 *depthStencilSurface = depthStencilRenderTarget->getSurface(); IDirect3DSurface9 *depthStencilSurface = depthStencilRenderTarget->getSurface();
uintptr_t depthStencilUintPtr = reinterpret_cast<uintptr_t>(depthStencilSurface); ASSERT(depthStencilSurface);
ASSERT(depthStencilSurface);
if (depthStencilUintPtr != mAppliedDepthStencil || !mDepthStencilInitialized)
{
mDevice->SetDepthStencilSurface(depthStencilSurface); mDevice->SetDepthStencilSurface(depthStencilSurface);
SafeRelease(depthStencilSurface); SafeRelease(depthStencilSurface);
depthSize = depthStencilBuffer->getDepthSize(); depthSize = depthStencilBuffer->getDepthSize();
stencilSize = depthStencilBuffer->getStencilSize(); stencilSize = depthStencilBuffer->getStencilSize();
}
else
{
mDevice->SetDepthStencilSurface(NULL);
}
mAppliedDepthStencil = depthStencilUintPtr; if (!mDepthStencilInitialized || depthSize != mCurDepthSize)
{
mCurDepthSize = depthSize;
mForceSetRasterState = true;
} }
}
else if (mAppliedDepthStencil != 0)
{
mDevice->SetDepthStencilSurface(NULL);
mAppliedDepthStencil = 0;
}
if (!mDepthStencilInitialized || depthSize != mCurDepthSize) if (!mDepthStencilInitialized || stencilSize != mCurStencilSize)
{ {
mCurDepthSize = depthSize; mCurStencilSize = stencilSize;
mForceSetRasterState = true; mForceSetDepthStencilState = true;
} }
if (!mDepthStencilInitialized || stencilSize != mCurStencilSize) mAppliedDepthStencilSerial = depthStencilSerial;
{ mDepthStencilInitialized = true;
mCurStencilSize = stencilSize;
mForceSetDepthStencilState = true;
} }
mDepthStencilInitialized = true;
if (renderTargetChanged || !mRenderTargetDescInitialized) if (renderTargetChanged || !mRenderTargetDescInitialized)
{ {
mForceSetScissor = true; mForceSetScissor = true;
...@@ -2176,11 +2173,8 @@ gl::Error Renderer9::clear(const gl::ClearParameters &clearParams, const gl::Fra ...@@ -2176,11 +2173,8 @@ gl::Error Renderer9::clear(const gl::ClearParameters &clearParams, const gl::Fra
void Renderer9::markAllStateDirty() void Renderer9::markAllStateDirty()
{ {
// dirtyPointer is a special value that will make the comparison with any valid pointer fail and force the renderer to re-apply the state. mAppliedRenderTargetSerial = 0;
const uintptr_t dirtyPointer = -1; mAppliedDepthStencilSerial = 0;
mAppliedRenderTarget = dirtyPointer;
mAppliedDepthStencil = dirtyPointer;
mDepthStencilInitialized = false; mDepthStencilInitialized = false;
mRenderTargetDescInitialized = false; mRenderTargetDescInitialized = false;
......
...@@ -260,8 +260,8 @@ class Renderer9 : public RendererD3D ...@@ -260,8 +260,8 @@ class Renderer9 : public RendererD3D
bool mVertexTextureSupport; bool mVertexTextureSupport;
// current render target states // current render target states
uintptr_t mAppliedRenderTarget; unsigned int mAppliedRenderTargetSerial;
uintptr_t mAppliedDepthStencil; unsigned int mAppliedDepthStencilSerial;
bool mDepthStencilInitialized; bool mDepthStencilInitialized;
bool mRenderTargetDescInitialized; bool mRenderTargetDescInitialized;
unsigned int mCurStencilSize; unsigned int mCurStencilSize;
......
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