Remove color target

This commit is contained in:
Vincent Lejeune 2015-10-10 01:19:20 +02:00
parent 71552f7ffe
commit 8dd19d1446
7 changed files with 18 additions and 22 deletions

View file

@ -347,7 +347,7 @@ void D3D12GSRender::clear_surface(u32 arg)
}; };
size_t g_RTTIncrement = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); size_t g_RTTIncrement = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
switch (m_surface_color_target) switch (u32 color_target = rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_NONE: break; case CELL_GCM_SURFACE_TARGET_NONE: break;
@ -371,7 +371,7 @@ void D3D12GSRender::clear_surface(u32 arg)
getCurrentResourceStorage().m_commandList->ClearRenderTargetView(CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtts.m_renderTargetsDescriptorsHeap->GetCPUDescriptorHandleForHeapStart()).Offset(3, g_descriptorStrideRTV), clearColor, 0, nullptr); getCurrentResourceStorage().m_commandList->ClearRenderTargetView(CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtts.m_renderTargetsDescriptorsHeap->GetCPUDescriptorHandleForHeapStart()).Offset(3, g_descriptorStrideRTV), clearColor, 0, nullptr);
break; break;
default: default:
LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target); LOG_ERROR(RSX, "Bad surface color target: %d", color_target);
} }
} }
@ -529,7 +529,7 @@ void D3D12GSRender::end()
m_timers.m_textureDuration += std::chrono::duration_cast<std::chrono::microseconds>(textureDurationEnd - textureDurationStart).count(); m_timers.m_textureDuration += std::chrono::duration_cast<std::chrono::microseconds>(textureDurationEnd - textureDurationStart).count();
size_t numRTT; size_t numRTT;
switch (m_surface_color_target) switch (u32 color_target = rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_NONE: break; case CELL_GCM_SURFACE_TARGET_NONE: break;
case CELL_GCM_SURFACE_TARGET_0: case CELL_GCM_SURFACE_TARGET_0:
@ -546,7 +546,7 @@ void D3D12GSRender::end()
numRTT = 4; numRTT = 4;
break; break;
default: default:
LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target); LOG_ERROR(RSX, "Bad surface color target: %d", color_target);
} }
getCurrentResourceStorage().m_commandList->OMSetRenderTargets((UINT)numRTT, &m_rtts.m_renderTargetsDescriptorsHeap->GetCPUDescriptorHandleForHeapStart(), true, getCurrentResourceStorage().m_commandList->OMSetRenderTargets((UINT)numRTT, &m_rtts.m_renderTargetsDescriptorsHeap->GetCPUDescriptorHandleForHeapStart(), true,
@ -644,7 +644,7 @@ void D3D12GSRender::flip(int buffer)
ID3D12Resource *resourceToFlip; ID3D12Resource *resourceToFlip;
float viewport_w, viewport_h; float viewport_w, viewport_h;
if (!isFlipSurfaceInLocalMemory(m_surface_color_target)) if (!isFlipSurfaceInLocalMemory(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
{ {
ResourceStorage &storage = getCurrentResourceStorage(); ResourceStorage &storage = getCurrentResourceStorage();
assert(storage.m_RAMFramebuffer == nullptr); assert(storage.m_RAMFramebuffer == nullptr);
@ -727,7 +727,7 @@ void D3D12GSRender::flip(int buffer)
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MipLevels = 1; srvDesc.Texture2D.MipLevels = 1;
if (isFlipSurfaceInLocalMemory(m_surface_color_target)) if (isFlipSurfaceInLocalMemory(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
else else
srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING( srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
@ -768,7 +768,7 @@ void D3D12GSRender::flip(int buffer)
if (!Ini.GSOverlay.GetValue()) if (!Ini.GSOverlay.GetValue())
getCurrentResourceStorage().m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_backBuffer[m_swapChain->GetCurrentBackBufferIndex()].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT)); getCurrentResourceStorage().m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_backBuffer[m_swapChain->GetCurrentBackBufferIndex()].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT));
if (isFlipSurfaceInLocalMemory(m_surface_color_target) && m_rtts.m_currentlyBoundRenderTargets[0] != nullptr) if (isFlipSurfaceInLocalMemory(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]) && m_rtts.m_currentlyBoundRenderTargets[0] != nullptr)
getCurrentResourceStorage().m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_rtts.m_currentlyBoundRenderTargets[0], D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET)); getCurrentResourceStorage().m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_rtts.m_currentlyBoundRenderTargets[0], D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET));
ThrowIfFailed(getCurrentResourceStorage().m_commandList->Close()); ThrowIfFailed(getCurrentResourceStorage().m_commandList->Close());
m_commandQueueGraphic->ExecuteCommandLists(1, (ID3D12CommandList**)getCurrentResourceStorage().m_commandList.GetAddressOf()); m_commandQueueGraphic->ExecuteCommandLists(1, (ID3D12CommandList**)getCurrentResourceStorage().m_commandList.GetAddressOf());
@ -1014,7 +1014,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
ID3D12Resource *rtt0, *rtt1, *rtt2, *rtt3; ID3D12Resource *rtt0, *rtt1, *rtt2, *rtt3;
if (Ini.GSDumpColorBuffers.GetValue()) if (Ini.GSDumpColorBuffers.GetValue())
{ {
switch (m_surface_color_target) switch (rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_NONE: case CELL_GCM_SURFACE_TARGET_NONE:
break; break;
@ -1099,7 +1099,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
if (Ini.GSDumpColorBuffers.GetValue()) if (Ini.GSDumpColorBuffers.GetValue())
{ {
switch (m_surface_color_target) switch (rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_NONE: case CELL_GCM_SURFACE_TARGET_NONE:
break; break;

View file

@ -213,7 +213,7 @@ bool D3D12GSRender::LoadProgram()
break; break;
} }
switch (m_surface_color_target) switch (u32 color_target = rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_0: case CELL_GCM_SURFACE_TARGET_0:
case CELL_GCM_SURFACE_TARGET_1: case CELL_GCM_SURFACE_TARGET_1:
@ -229,7 +229,7 @@ bool D3D12GSRender::LoadProgram()
prop.numMRT = 4; prop.numMRT = 4;
break; break;
default: default:
LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target); LOG_ERROR(RSX, "Bad surface color target: %d", color_target);
} }
prop.DepthStencil.DepthEnable = !!(rsx::method_registers[NV4097_SET_DEPTH_TEST_ENABLE]); prop.DepthStencil.DepthEnable = !!(rsx::method_registers[NV4097_SET_DEPTH_TEST_ENABLE]);

View file

@ -82,7 +82,7 @@ void D3D12GSRender::PrepareRenderTargets(ID3D12GraphicsCommandList *copycmdlist)
clear_a / 255.0f clear_a / 255.0f
}; };
switch (m_surface_color_target) switch (rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_0: case CELL_GCM_SURFACE_TARGET_0:
{ {

View file

@ -1290,7 +1290,7 @@ void GLGSRender::WriteColorBuffers()
glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_ROW_LENGTH, 0);
glPixelStorei(GL_PACK_ALIGNMENT, 4); glPixelStorei(GL_PACK_ALIGNMENT, 4);
switch(m_surface_color_target) switch(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_NONE: case CELL_GCM_SURFACE_TARGET_NONE:
return; return;
@ -1516,7 +1516,7 @@ void GLGSRender::InitDrawBuffers()
static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 }; static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 };
switch (m_surface_color_target) switch (u32 color_target = rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_NONE: break; case CELL_GCM_SURFACE_TARGET_NONE: break;
@ -1557,7 +1557,7 @@ void GLGSRender::InitDrawBuffers()
default: default:
{ {
LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target); LOG_ERROR(RSX, "Bad surface color target: %d", color_target);
break; break;
} }
@ -1994,7 +1994,7 @@ void GLGSRender::flip(int buffer)
checkForGlError("glScissor"); checkForGlError("glScissor");
} }
switch (m_surface_color_target) switch (rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])
{ {
case CELL_GCM_SURFACE_TARGET_0: case CELL_GCM_SURFACE_TARGET_0:
case CELL_GCM_SURFACE_TARGET_1: case CELL_GCM_SURFACE_TARGET_1:

View file

@ -1407,10 +1407,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
} }
case NV4097_SET_SURFACE_COLOR_TARGET: case NV4097_SET_SURFACE_COLOR_TARGET:
{
m_surface_color_target = ARGS(0);
break; break;
}
case NV4097_SET_SURFACE_COLOR_AOFFSET: case NV4097_SET_SURFACE_COLOR_AOFFSET:
{ {

View file

@ -348,7 +348,6 @@ public:
u32 m_surface_offset_c; u32 m_surface_offset_c;
u32 m_surface_offset_d; u32 m_surface_offset_d;
u32 m_surface_offset_z; u32 m_surface_offset_z;
u32 m_surface_color_target;
// DMA context // DMA context
bool m_set_context_dma_color_a; bool m_set_context_dma_color_a;

View file

@ -502,7 +502,7 @@ void SetupRsxRenderingStates(vm::ptr<CellGcmContextData>& cntxt)
r.m_height = s_rescInternalInstance->m_dstHeight; r.m_height = s_rescInternalInstance->m_dstHeight;
r.m_surface_depth_format = 2; r.m_surface_depth_format = 2;
r.m_surface_color_target = 1; rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET] = 1;
if (IsPalInterpolate()) if (IsPalInterpolate())
{ {
@ -541,7 +541,7 @@ void SetupSurfaces(vm::ptr<CellGcmContextData>& cntxt)
r.m_surface_type = CELL_GCM_SURFACE_PITCH; r.m_surface_type = CELL_GCM_SURFACE_PITCH;
r.m_surface_antialias = CELL_GCM_SURFACE_CENTER_1; r.m_surface_antialias = CELL_GCM_SURFACE_CENTER_1;
r.m_surface_color_format = (u8)s_rescInternalInstance->m_pRescDsts->format; r.m_surface_color_format = (u8)s_rescInternalInstance->m_pRescDsts->format;
r.m_surface_color_target = (!isMrt) ? CELL_GCM_SURFACE_TARGET_0 : CELL_GCM_SURFACE_TARGET_MRT1; rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET] = (!isMrt) ? CELL_GCM_SURFACE_TARGET_0 : CELL_GCM_SURFACE_TARGET_MRT1;
//surface.colorLocation[0] = CELL_GCM_LOCATION_LOCAL; //surface.colorLocation[0] = CELL_GCM_LOCATION_LOCAL;
r.m_surface_offset_a = dstOffset0; r.m_surface_offset_a = dstOffset0;
r.m_surface_pitch_a = s_rescInternalInstance->m_dstPitch; r.m_surface_pitch_a = s_rescInternalInstance->m_dstPitch;