Merge pull request #4165 from lioncash/global

Backends: Remove unnecessary references to the renderer global
This commit is contained in:
Jules Blok 2016-09-01 03:20:31 +02:00 committed by GitHub
commit 2ab9e5e610
3 changed files with 17 additions and 20 deletions

View File

@ -628,8 +628,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
void Renderer::ReinterpretPixelData(unsigned int convtype) void Renderer::ReinterpretPixelData(unsigned int convtype)
{ {
// TODO: MSAA support.. // TODO: MSAA support..
D3D11_RECT source = D3D11_RECT source = CD3D11_RECT(0, 0, GetTargetWidth(), GetTargetHeight());
CD3D11_RECT(0, 0, g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight());
ID3D11PixelShader* pixel_shader; ID3D11PixelShader* pixel_shader;
if (convtype == 0) if (convtype == 0)
@ -644,21 +643,21 @@ void Renderer::ReinterpretPixelData(unsigned int convtype)
} }
// convert data and set the target texture as our new EFB // convert data and set the target texture as our new EFB
g_renderer->ResetAPIState(); ResetAPIState();
D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, (float)g_renderer->GetTargetWidth(), D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, static_cast<float>(GetTargetWidth()),
(float)g_renderer->GetTargetHeight()); static_cast<float>(GetTargetHeight()));
D3D::context->RSSetViewports(1, &vp); D3D::context->RSSetViewports(1, &vp);
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTempTexture()->GetRTV(), D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTempTexture()->GetRTV(),
nullptr); nullptr);
D3D::SetPointCopySampler(); D3D::SetPointCopySampler();
D3D::drawShadedTexQuad( D3D::drawShadedTexQuad(
FramebufferManager::GetEFBColorTexture()->GetSRV(), &source, g_renderer->GetTargetWidth(), FramebufferManager::GetEFBColorTexture()->GetSRV(), &source, GetTargetWidth(),
g_renderer->GetTargetHeight(), pixel_shader, VertexShaderCache::GetSimpleVertexShader(), GetTargetHeight(), pixel_shader, VertexShaderCache::GetSimpleVertexShader(),
VertexShaderCache::GetSimpleInputLayout(), GeometryShaderCache::GetCopyGeometryShader()); VertexShaderCache::GetSimpleInputLayout(), GeometryShaderCache::GetCopyGeometryShader());
g_renderer->RestoreAPIState(); RestoreAPIState();
FramebufferManager::SwapReinterpretTexture(); FramebufferManager::SwapReinterpretTexture();
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(),

View File

@ -527,7 +527,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha
FramebufferManager::GetEFBColorTexture()->GetMultisampled()); FramebufferManager::GetEFBColorTexture()->GetMultisampled());
// Restores proper viewport/scissor settings. // Restores proper viewport/scissor settings.
g_renderer->SetViewport(); SetViewport();
BPFunctions::SetScissor(); BPFunctions::SetScissor();
FramebufferManager::InvalidateEFBAccessCopies(); FramebufferManager::InvalidateEFBAccessCopies();
@ -536,9 +536,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha
void Renderer::ReinterpretPixelData(unsigned int convtype) void Renderer::ReinterpretPixelData(unsigned int convtype)
{ {
// EXISTINGD3D11TODO: MSAA support.. // EXISTINGD3D11TODO: MSAA support..
D3D12_RECT source = D3D12_RECT source = CD3DX12_RECT(0, 0, GetTargetWidth(), GetTargetHeight());
CD3DX12_RECT(0, 0, g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight());
D3D12_SHADER_BYTECODE pixel_shader = {}; D3D12_SHADER_BYTECODE pixel_shader = {};
if (convtype == 0) if (convtype == 0)
@ -556,7 +554,7 @@ void Renderer::ReinterpretPixelData(unsigned int convtype)
return; return;
} }
D3D::SetViewportAndScissor(0, 0, g_renderer->GetTargetWidth(), g_renderer->GetTargetHeight()); D3D::SetViewportAndScissor(0, 0, GetTargetWidth(), GetTargetHeight());
FramebufferManager::GetEFBColorTempTexture()->TransitionToResourceState( FramebufferManager::GetEFBColorTempTexture()->TransitionToResourceState(
D3D::current_command_list, D3D12_RESOURCE_STATE_RENDER_TARGET); D3D::current_command_list, D3D12_RESOURCE_STATE_RENDER_TARGET);
@ -565,8 +563,8 @@ void Renderer::ReinterpretPixelData(unsigned int convtype)
D3D::SetPointCopySampler(); D3D::SetPointCopySampler();
D3D::DrawShadedTexQuad( D3D::DrawShadedTexQuad(
FramebufferManager::GetEFBColorTexture(), &source, g_renderer->GetTargetWidth(), FramebufferManager::GetEFBColorTexture(), &source, GetTargetWidth(), GetTargetHeight(),
g_renderer->GetTargetHeight(), pixel_shader, StaticShaderCache::GetSimpleVertexShader(), pixel_shader, StaticShaderCache::GetSimpleVertexShader(),
StaticShaderCache::GetSimpleVertexShaderInputLayout(), StaticShaderCache::GetSimpleVertexShaderInputLayout(),
StaticShaderCache::GetCopyGeometryShader(), 1.0f, 0, DXGI_FORMAT_R8G8B8A8_UNORM, false, StaticShaderCache::GetCopyGeometryShader(), 1.0f, 0, DXGI_FORMAT_R8G8B8A8_UNORM, false,
FramebufferManager::GetEFBColorTempTexture()->GetMultisampled()); FramebufferManager::GetEFBColorTempTexture()->GetMultisampled());

View File

@ -833,7 +833,7 @@ TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc)
// therefore the width and height are (scissorBR + 1) - scissorTL // therefore the width and height are (scissorBR + 1) - scissorTL
void Renderer::SetScissorRect(const EFBRectangle& rc) void Renderer::SetScissorRect(const EFBRectangle& rc)
{ {
TargetRectangle trc = g_renderer->ConvertEFBRectangle(rc); TargetRectangle trc = ConvertEFBRectangle(rc);
glScissor(trc.left, trc.bottom, trc.GetWidth(), trc.GetHeight()); glScissor(trc.left, trc.bottom, trc.GetWidth(), trc.GetHeight());
} }
@ -952,13 +952,13 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
{ {
if (s_MSAASamples > 1) if (s_MSAASamples > 1)
{ {
g_renderer->ResetAPIState(); ResetAPIState();
// Resolve our rectangle. // Resolve our rectangle.
FramebufferManager::GetEFBDepthTexture(efbPixelRc); FramebufferManager::GetEFBDepthTexture(efbPixelRc);
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetResolvedFramebuffer()); glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetResolvedFramebuffer());
g_renderer->RestoreAPIState(); RestoreAPIState();
} }
std::unique_ptr<float[]> depthMap(new float[targetPixelRcWidth * targetPixelRcHeight]); std::unique_ptr<float[]> depthMap(new float[targetPixelRcWidth * targetPixelRcHeight]);
@ -991,13 +991,13 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
{ {
if (s_MSAASamples > 1) if (s_MSAASamples > 1)
{ {
g_renderer->ResetAPIState(); ResetAPIState();
// Resolve our rectangle. // Resolve our rectangle.
FramebufferManager::GetEFBColorTexture(efbPixelRc); FramebufferManager::GetEFBColorTexture(efbPixelRc);
glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetResolvedFramebuffer()); glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetResolvedFramebuffer());
g_renderer->RestoreAPIState(); RestoreAPIState();
} }
std::unique_ptr<u32[]> colorMap(new u32[targetPixelRcWidth * targetPixelRcHeight]); std::unique_ptr<u32[]> colorMap(new u32[targetPixelRcWidth * targetPixelRcHeight]);