diff options
| author | Stenzek <stenzek@gmail.com> | 2015-12-19 15:45:21 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2015-12-20 00:31:58 +1000 |
| commit | 7b628c99ec4731ab606b8dd50ce3c3223d81b4eb (patch) | |
| tree | 3a6e1c558bdcaa398b9f04810e9f76d81f6e34f4 /Source/Core/VideoBackends/D3D/Render.cpp | |
| parent | e638775bc79b1e5da24dce7892bc1c22db400174 (diff) | |
D3D: Implement vectored efb pokes, increase util vertex buffer size to 64KiB
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/D3D/Render.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index 970a7e5bea..434742c5c1 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -474,56 +474,56 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) else if (alpha_read_mode.ReadMode == 1) return (ret | 0xFF000000); // GX_READ_FF else /*if(alpha_read_mode.ReadMode == 0)*/ return (ret & 0x00FFFFFF); // GX_READ_00 } - else if (type == POKE_COLOR) + else // if (type == POKE_COLOR || type == POKE_Z) { - u32 rgbaColor = (poke_data & 0xFF00FF00) | ((poke_data >> 16) & 0xFF) | ((poke_data << 16) & 0xFF0000); + std::vector<EfbPokeData> vector; + EfbPokeData d; + d.x = x; + d.y = y; + d.data = poke_data; + vector.push_back(d); + PokeEFB(type, vector); + } - // TODO: The first five PE registers may change behavior of EFB pokes, this isn't implemented, yet. - ResetAPIState(); + return 0; +} +void Renderer::PokeEFB(EFBAccessType type, const std::vector<EfbPokeData>& data) +{ + ResetAPIState(); + + if (type == POKE_COLOR) + { D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.0f, 0.0f, (float)GetTargetWidth(), (float)GetTargetHeight()); D3D::context->RSSetViewports(1, &vp); - D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), nullptr); - D3D::drawColorQuad(rgbaColor, 0.f, - (float)RectToLock.left * 2.f / GetTargetWidth() - 1.f, - - (float)RectToLock.top * 2.f / GetTargetHeight() + 1.f, - (float)RectToLock.right * 2.f / GetTargetWidth() - 1.f, - - (float)RectToLock.bottom * 2.f / GetTargetHeight() + 1.f); - - RestoreAPIState(); } else // if (type == POKE_Z) { - // TODO: The first five PE registers may change behavior of EFB pokes, this isn't implemented, yet. - ResetAPIState(); - D3D::stateman->PushBlendState(clearblendstates[3]); D3D::stateman->PushDepthState(cleardepthstates[1]); D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.0f, 0.0f, (float)GetTargetWidth(), (float)GetTargetHeight(), 1.0f - MathUtil::Clamp<float>(xfmem.viewport.farZ, 0.0f, 16777215.0f) / 16777216.0f, 1.0f - MathUtil::Clamp<float>((xfmem.viewport.farZ - MathUtil::Clamp<float>(xfmem.viewport.zRange, 0.0f, 16777215.0f)), 0.0f, 16777215.0f) / 16777216.0f); + D3D::context->RSSetViewports(1, &vp); D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV()); - D3D::drawColorQuad(0, 1.0f - float(poke_data & 0xFFFFFF) / 16777216.0f, - (float)RectToLock.left * 2.f / GetTargetWidth() - 1.f, - - (float)RectToLock.top * 2.f / GetTargetHeight() + 1.f, - (float)RectToLock.right * 2.f / GetTargetWidth() - 1.f, - - (float)RectToLock.bottom * 2.f / GetTargetHeight() + 1.f); + } + D3D::DrawEFBPokeQuads(type, data.data(), data.size()); + + if (type == POKE_Z) + { D3D::stateman->PopDepthState(); D3D::stateman->PopBlendState(); - - RestoreAPIState(); } - return 0; + RestoreAPIState(); } - void Renderer::SetViewport() { // reversed gxsetviewport(xorig, yorig, width, height, nearz, farz) |
