mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
D3D: Implement vectored efb pokes, increase util vertex buffer size to 64KiB
This commit is contained in:
@ -474,55 +474,55 @@ 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::stateman->PopDepthState();
|
||||
D3D::stateman->PopBlendState();
|
||||
|
||||
RestoreAPIState();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
D3D::DrawEFBPokeQuads(type, data.data(), data.size());
|
||||
|
||||
if (type == POKE_Z)
|
||||
{
|
||||
D3D::stateman->PopDepthState();
|
||||
D3D::stateman->PopBlendState();
|
||||
}
|
||||
|
||||
RestoreAPIState();
|
||||
}
|
||||
|
||||
void Renderer::SetViewport()
|
||||
{
|
||||
|
Reference in New Issue
Block a user