mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 03:32:55 +00:00
remove m_surface*
This commit is contained in:
parent
16311b36b0
commit
73535e0c04
@ -242,18 +242,21 @@ void D3D12GSRender::setScaleOffset()
|
||||
0.0f, 0.0f, 0.0f, 1.0f
|
||||
};
|
||||
|
||||
int clip_w = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] >> 16;
|
||||
int clip_h = rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL] >> 16;
|
||||
|
||||
// Scale
|
||||
scaleOffsetMat[0] *= (float&)rsx::method_registers[NV4097_SET_VIEWPORT_SCALE + (0x4 * 0)] / (m_surface_clip_w / 2.f);
|
||||
scaleOffsetMat[5] *= (float&)rsx::method_registers[NV4097_SET_VIEWPORT_SCALE + (0x4 * 1)] / (m_surface_clip_h / 2.f);
|
||||
scaleOffsetMat[0] *= (float&)rsx::method_registers[NV4097_SET_VIEWPORT_SCALE + (0x4 * 0)] / (clip_w / 2.f);
|
||||
scaleOffsetMat[5] *= (float&)rsx::method_registers[NV4097_SET_VIEWPORT_SCALE + (0x4 * 1)] / (clip_h / 2.f);
|
||||
scaleOffsetMat[10] = (float&)rsx::method_registers[NV4097_SET_VIEWPORT_SCALE + (0x4 * 2)];
|
||||
|
||||
// Offset
|
||||
scaleOffsetMat[3] = (float&)rsx::method_registers[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 0)] - (m_surface_clip_w / 2.f);
|
||||
scaleOffsetMat[7] = -((float&)rsx::method_registers[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 1)] - (m_surface_clip_h / 2.f));
|
||||
scaleOffsetMat[3] = (float&)rsx::method_registers[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 0)] - (clip_w / 2.f);
|
||||
scaleOffsetMat[7] = -((float&)rsx::method_registers[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 1)] - (clip_h / 2.f));
|
||||
scaleOffsetMat[11] = (float&)rsx::method_registers[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 2)];
|
||||
|
||||
scaleOffsetMat[3] /= m_surface_clip_w / 2.f;
|
||||
scaleOffsetMat[7] /= m_surface_clip_h / 2.f;
|
||||
scaleOffsetMat[3] /= clip_w / 2.f;
|
||||
scaleOffsetMat[7] /= clip_h / 2.f;
|
||||
|
||||
assert(m_constantsData.canAlloc(256));
|
||||
size_t heapOffset = m_constantsData.alloc(256);
|
||||
|
@ -321,7 +321,7 @@ void D3D12GSRender::clear_surface(u32 arg)
|
||||
if (arg & 0x1)
|
||||
{
|
||||
u32 clear_depth = rsx::method_registers[NV4097_SET_ZSTENCIL_CLEAR_VALUE] >> 8;
|
||||
u32 max_depth_value = m_surface_depth_format == CELL_GCM_SURFACE_Z16 ? 0x0000ffff : 0x00ffffff;
|
||||
u32 max_depth_value = m_surface.depth_format == CELL_GCM_SURFACE_Z16 ? 0x0000ffff : 0x00ffffff;
|
||||
getCurrentResourceStorage().m_commandList->ClearDepthStencilView(m_rtts.m_depthStencilDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), D3D12_CLEAR_FLAG_DEPTH, clear_depth / (float)max_depth_value, 0, 0, nullptr);
|
||||
}
|
||||
|
||||
@ -552,12 +552,15 @@ void D3D12GSRender::end()
|
||||
getCurrentResourceStorage().m_commandList->OMSetRenderTargets((UINT)numRTT, &m_rtts.m_renderTargetsDescriptorsHeap->GetCPUDescriptorHandleForHeapStart(), true,
|
||||
&CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtts.m_depthStencilDescriptorHeap->GetCPUDescriptorHandleForHeapStart()));
|
||||
|
||||
int clip_w = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] >> 16;
|
||||
int clip_h = rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL] >> 16;
|
||||
|
||||
D3D12_VIEWPORT viewport =
|
||||
{
|
||||
0.f,
|
||||
0.f,
|
||||
(float)m_surface_clip_w,
|
||||
(float)m_surface_clip_h,
|
||||
(float)clip_w,
|
||||
(float)clip_h,
|
||||
-1.f,
|
||||
1.f
|
||||
};
|
||||
@ -567,8 +570,8 @@ void D3D12GSRender::end()
|
||||
{
|
||||
0,
|
||||
0,
|
||||
(LONG)m_surface_clip_w,
|
||||
(LONG)m_surface_clip_h,
|
||||
(LONG)clip_w,
|
||||
(LONG)clip_h,
|
||||
};
|
||||
getCurrentResourceStorage().m_commandList->RSSetScissorRects(1, &box);
|
||||
|
||||
@ -849,11 +852,13 @@ D3D12GSRender::ResourceStorage& D3D12GSRender::getNonCurrentResourceStorage()
|
||||
|
||||
ID3D12Resource * D3D12GSRender::writeColorBuffer(ID3D12Resource * RTT, ID3D12GraphicsCommandList * cmdlist)
|
||||
{
|
||||
int clip_w = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] >> 16;
|
||||
int clip_h = rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL] >> 16;
|
||||
ID3D12Resource *Result;
|
||||
size_t w = m_surface_clip_w, h = m_surface_clip_h;
|
||||
size_t w = clip_w, h = clip_h;
|
||||
DXGI_FORMAT dxgiFormat;
|
||||
size_t rowPitch;
|
||||
switch (m_surface_color_format)
|
||||
switch (m_surface.color_format)
|
||||
{
|
||||
case CELL_GCM_SURFACE_A8R8G8B8:
|
||||
dxgiFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
@ -910,7 +915,8 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
// Add all buffer write
|
||||
// Cell can't make any assumption about readyness of color/depth buffer
|
||||
// Except when a semaphore is written by RSX
|
||||
|
||||
int clip_w = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] >> 16;
|
||||
int clip_h = rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL] >> 16;
|
||||
|
||||
ComPtr<ID3D12Fence> fence;
|
||||
ThrowIfFailed(
|
||||
@ -921,7 +927,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
|
||||
ComPtr<ID3D12Resource> writeDest, depthConverted;
|
||||
ComPtr<ID3D12DescriptorHeap> descriptorHeap;
|
||||
size_t depthRowPitch = m_surface_clip_w;
|
||||
size_t depthRowPitch = clip_w;
|
||||
depthRowPitch = (depthRowPitch + 255) & ~255;
|
||||
|
||||
bool needTransfer = (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue()) ||
|
||||
@ -929,7 +935,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
|
||||
if (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue())
|
||||
{
|
||||
size_t sizeInByte = m_surface_clip_w * m_surface_clip_h * 2;
|
||||
size_t sizeInByte = clip_w * clip_h * 2;
|
||||
assert(m_UAVHeap.canAlloc(sizeInByte));
|
||||
size_t heapOffset = m_UAVHeap.alloc(sizeInByte);
|
||||
|
||||
@ -937,14 +943,14 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
m_device->CreatePlacedResource(
|
||||
m_UAVHeap.m_heap,
|
||||
heapOffset,
|
||||
&CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8_UNORM, m_surface_clip_w, m_surface_clip_h, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS),
|
||||
&CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_R8_UNORM, clip_w, clip_h, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS),
|
||||
D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
|
||||
nullptr,
|
||||
IID_PPV_ARGS(depthConverted.GetAddressOf())
|
||||
)
|
||||
);
|
||||
|
||||
sizeInByte = depthRowPitch * m_surface_clip_h;
|
||||
sizeInByte = depthRowPitch * clip_h;
|
||||
assert(m_readbackResources.canAlloc(sizeInByte));
|
||||
heapOffset = m_readbackResources.alloc(sizeInByte);
|
||||
|
||||
@ -964,7 +970,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
m_device->CreateDescriptorHeap(&descriptorHeapDesc, IID_PPV_ARGS(descriptorHeap.GetAddressOf()))
|
||||
);
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
switch (m_surface_depth_format)
|
||||
switch (m_surface.depth_format)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
@ -975,7 +981,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
srvDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format);
|
||||
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface.depth_format);
|
||||
assert(0);
|
||||
}
|
||||
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
@ -996,7 +1002,7 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
getCurrentResourceStorage().m_commandList->SetComputeRootSignature(m_convertRootSignature);
|
||||
getCurrentResourceStorage().m_commandList->SetDescriptorHeaps(1, descriptorHeap.GetAddressOf());
|
||||
getCurrentResourceStorage().m_commandList->SetComputeRootDescriptorTable(0, descriptorHeap->GetGPUDescriptorHandleForHeapStart());
|
||||
getCurrentResourceStorage().m_commandList->Dispatch(m_surface_clip_w / 8, m_surface_clip_h / 8, 1);
|
||||
getCurrentResourceStorage().m_commandList->Dispatch(clip_w / 8, clip_h / 8, 1);
|
||||
|
||||
D3D12_RESOURCE_BARRIER barriers[] =
|
||||
{
|
||||
@ -1005,10 +1011,10 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
};
|
||||
getCurrentResourceStorage().m_commandList->ResourceBarrier(2, barriers);
|
||||
getCurrentResourceStorage().m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(depthConverted.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE));
|
||||
getCurrentResourceStorage().m_commandList->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(writeDest.Get(), { 0, { DXGI_FORMAT_R8_UNORM, m_surface_clip_w, m_surface_clip_h, 1, (UINT)depthRowPitch } }), 0, 0, 0,
|
||||
getCurrentResourceStorage().m_commandList->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(writeDest.Get(), { 0, { DXGI_FORMAT_R8_UNORM, (UINT)clip_w, (UINT)clip_h, 1, (UINT)depthRowPitch } }), 0, 0, 0,
|
||||
&CD3DX12_TEXTURE_COPY_LOCATION(depthConverted.Get(), 0), nullptr);
|
||||
|
||||
invalidateAddress(rsx::get_address(m_surface_offset_z, m_context_dma_z - 0xfeed0000));
|
||||
invalidateAddress(rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET], m_context_dma_z - 0xfeed0000));
|
||||
}
|
||||
|
||||
ID3D12Resource *rtt0, *rtt1, *rtt2, *rtt3;
|
||||
@ -1046,10 +1052,10 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_context_dma_color_a) invalidateAddress(rsx::get_address(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000));
|
||||
if (m_context_dma_color_b) invalidateAddress(rsx::get_address(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000));
|
||||
if (m_context_dma_color_c) invalidateAddress(rsx::get_address(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000));
|
||||
if (m_context_dma_color_d) invalidateAddress(rsx::get_address(m_surface_offset_d, m_context_dma_color_d - 0xfeed0000));
|
||||
if (m_context_dma_color_a) invalidateAddress(rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET], m_context_dma_color_a - 0xfeed0000));
|
||||
if (m_context_dma_color_b) invalidateAddress(rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET], m_context_dma_color_b - 0xfeed0000));
|
||||
if (m_context_dma_color_c) invalidateAddress(rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_COFFSET], m_context_dma_color_c - 0xfeed0000));
|
||||
if (m_context_dma_color_d) invalidateAddress(rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_DOFFSET], m_context_dma_color_d - 0xfeed0000));
|
||||
}
|
||||
if (needTransfer)
|
||||
{
|
||||
@ -1065,35 +1071,35 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
|
||||
if (m_set_context_dma_z && Ini.GSDumpDepthBuffer.GetValue())
|
||||
{
|
||||
u32 address = rsx::get_address(m_surface_offset_z, m_context_dma_z - 0xfeed0000);
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET], m_context_dma_z - 0xfeed0000);
|
||||
auto ptr = vm::get_ptr<void>(address);
|
||||
char *ptrAsChar = (char*)ptr;
|
||||
unsigned char *writeDestPtr;
|
||||
ThrowIfFailed(writeDest->Map(0, nullptr, (void**)&writeDestPtr));
|
||||
|
||||
for (unsigned row = 0; row < m_surface_clip_h; row++)
|
||||
for (unsigned row = 0; row < (unsigned)clip_h; row++)
|
||||
{
|
||||
for (unsigned i = 0; i < m_surface_clip_w; i++)
|
||||
for (unsigned i = 0; i < (unsigned)clip_w; i++)
|
||||
{
|
||||
unsigned char c = writeDestPtr[row * depthRowPitch + i];
|
||||
ptrAsChar[4 * (row * m_surface_clip_w + i)] = c;
|
||||
ptrAsChar[4 * (row * m_surface_clip_w + i) + 1] = c;
|
||||
ptrAsChar[4 * (row * m_surface_clip_w + i) + 2] = c;
|
||||
ptrAsChar[4 * (row * m_surface_clip_w + i) + 3] = c;
|
||||
ptrAsChar[4 * (row * clip_w + i)] = c;
|
||||
ptrAsChar[4 * (row * clip_w + i) + 1] = c;
|
||||
ptrAsChar[4 * (row * clip_w + i) + 2] = c;
|
||||
ptrAsChar[4 * (row * clip_w + i) + 3] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t srcPitch, dstPitch;
|
||||
switch (m_surface_color_format)
|
||||
switch (m_surface.color_format)
|
||||
{
|
||||
case CELL_GCM_SURFACE_A8R8G8B8:
|
||||
srcPitch = align(m_surface_clip_w * 4, 256);
|
||||
dstPitch = m_surface_clip_w * 4;
|
||||
srcPitch = align(clip_w * 4, 256);
|
||||
dstPitch = clip_w * 4;
|
||||
break;
|
||||
case CELL_GCM_SURFACE_F_W16Z16Y16X16:
|
||||
srcPitch = align(m_surface_clip_w * 8, 256);
|
||||
dstPitch = m_surface_clip_w * 8;
|
||||
srcPitch = align(clip_w * 8, 256);
|
||||
dstPitch = clip_w * 8;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1105,55 +1111,55 @@ void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
|
||||
break;
|
||||
case CELL_GCM_SURFACE_TARGET_0:
|
||||
{
|
||||
u32 address = rsx::get_address(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000);
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET], m_context_dma_color_a - 0xfeed0000);
|
||||
void *dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt0, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
copyToCellRamAndRelease(dstAddress, rtt0, srcPitch, dstPitch, clip_w, clip_h);
|
||||
}
|
||||
break;
|
||||
case CELL_GCM_SURFACE_TARGET_1:
|
||||
{
|
||||
u32 address = rsx::get_address(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000);
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET], m_context_dma_color_b - 0xfeed0000);
|
||||
void *dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt1, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
copyToCellRamAndRelease(dstAddress, rtt1, srcPitch, dstPitch, clip_w, clip_h);
|
||||
}
|
||||
break;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT1:
|
||||
{
|
||||
u32 address = rsx::get_address(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000);
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET], m_context_dma_color_a - 0xfeed0000);
|
||||
void *dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt0, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
address = rsx::get_address(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000);
|
||||
copyToCellRamAndRelease(dstAddress, rtt0, srcPitch, dstPitch, clip_w, clip_h);
|
||||
address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET], m_context_dma_color_b - 0xfeed0000);
|
||||
dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt1, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
copyToCellRamAndRelease(dstAddress, rtt1, srcPitch, dstPitch, clip_w, clip_h);
|
||||
}
|
||||
break;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT2:
|
||||
{
|
||||
u32 address = rsx::get_address(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000);
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET], m_context_dma_color_a - 0xfeed0000);
|
||||
void *dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt0, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
address = rsx::get_address(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000);
|
||||
copyToCellRamAndRelease(dstAddress, rtt0, srcPitch, dstPitch, clip_w, clip_h);
|
||||
address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET], m_context_dma_color_b - 0xfeed0000);
|
||||
dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt1, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
address = rsx::get_address(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000);
|
||||
copyToCellRamAndRelease(dstAddress, rtt1, srcPitch, dstPitch, clip_w, clip_h);
|
||||
address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_COFFSET], m_context_dma_color_c - 0xfeed0000);
|
||||
dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt2, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
copyToCellRamAndRelease(dstAddress, rtt2, srcPitch, dstPitch, clip_w, clip_h);
|
||||
}
|
||||
break;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT3:
|
||||
{
|
||||
u32 address = rsx::get_address(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000);
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET], m_context_dma_color_a - 0xfeed0000);
|
||||
void *dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt0, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
address = rsx::get_address(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000);
|
||||
copyToCellRamAndRelease(dstAddress, rtt0, srcPitch, dstPitch, clip_w, clip_h);
|
||||
address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET], m_context_dma_color_b - 0xfeed0000);
|
||||
dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt1, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
address = rsx::get_address(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000);
|
||||
copyToCellRamAndRelease(dstAddress, rtt1, srcPitch, dstPitch, clip_w, clip_h);
|
||||
address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_COFFSET], m_context_dma_color_c - 0xfeed0000);
|
||||
dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt2, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
address = rsx::get_address(m_surface_offset_d, m_context_dma_color_d - 0xfeed0000);
|
||||
copyToCellRamAndRelease(dstAddress, rtt2, srcPitch, dstPitch, clip_w, clip_h);
|
||||
address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_COLOR_DOFFSET], m_context_dma_color_d - 0xfeed0000);
|
||||
dstAddress = vm::get_ptr<void>(address);
|
||||
copyToCellRamAndRelease(dstAddress, rtt3, srcPitch, dstPitch, m_surface_clip_w, m_surface_clip_h);
|
||||
copyToCellRamAndRelease(dstAddress, rtt3, srcPitch, dstPitch, clip_w, clip_h);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ bool D3D12GSRender::LoadProgram()
|
||||
// checkForGlError("glBlendColor");
|
||||
}
|
||||
|
||||
switch (m_surface_depth_format)
|
||||
switch (m_surface.depth_format)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
@ -193,11 +193,11 @@ bool D3D12GSRender::LoadProgram()
|
||||
prop.DepthStencilFormat = DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format);
|
||||
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface.depth_format);
|
||||
assert(0);
|
||||
}
|
||||
|
||||
switch (m_surface_color_format)
|
||||
switch (m_surface.color_format)
|
||||
{
|
||||
case CELL_GCM_SURFACE_A8R8G8B8:
|
||||
prop.RenderTargetsFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
|
@ -14,26 +14,43 @@
|
||||
|
||||
void D3D12GSRender::PrepareRenderTargets(ID3D12GraphicsCommandList *copycmdlist)
|
||||
{
|
||||
u32 surface_format = rsx::method_registers[NV4097_SET_SURFACE_FORMAT];
|
||||
|
||||
u32 clip_horizontal = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL];
|
||||
u32 clip_vertical = rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL];
|
||||
|
||||
u32 clip_width = clip_horizontal >> 16;
|
||||
u32 clip_height = clip_vertical >> 16;
|
||||
u32 clip_x = clip_horizontal;
|
||||
u32 clip_y = clip_vertical;
|
||||
|
||||
if (m_surface.format != surface_format)
|
||||
{
|
||||
m_surface.unpack(surface_format);
|
||||
m_surface.width = clip_width;
|
||||
m_surface.height = clip_height;
|
||||
}
|
||||
|
||||
// Exit early if there is no rtt changes
|
||||
if ((m_previous_address_a == m_surface_offset_a) &&
|
||||
(m_previous_address_b == m_surface_offset_b) &&
|
||||
(m_previous_address_c == m_surface_offset_c) &&
|
||||
(m_previous_address_d == m_surface_offset_d) &&
|
||||
(m_previous_address_z == m_surface_offset_z))
|
||||
if ((m_previous_address_a == rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET]) &&
|
||||
(m_previous_address_b == rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET]) &&
|
||||
(m_previous_address_c == rsx::method_registers[NV4097_SET_SURFACE_COLOR_COFFSET]) &&
|
||||
(m_previous_address_d == rsx::method_registers[NV4097_SET_SURFACE_COLOR_DOFFSET]) &&
|
||||
(m_previous_address_z == rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET]))
|
||||
return;
|
||||
|
||||
m_previous_address_a = m_surface_offset_a;
|
||||
m_previous_address_b = m_surface_offset_b;
|
||||
m_previous_address_c = m_surface_offset_c;
|
||||
m_previous_address_d = m_surface_offset_d;
|
||||
m_previous_address_z = m_surface_offset_z;
|
||||
m_previous_address_a = rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET];
|
||||
m_previous_address_b = rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET];
|
||||
m_previous_address_c = rsx::method_registers[NV4097_SET_SURFACE_COLOR_COFFSET];
|
||||
m_previous_address_d = rsx::method_registers[NV4097_SET_SURFACE_COLOR_DOFFSET];
|
||||
m_previous_address_z = rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET];
|
||||
|
||||
// FBO location has changed, previous data might be copied
|
||||
u32 address_a = m_set_context_dma_color_a ? rsx::get_address(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000) : 0;
|
||||
u32 address_b = m_set_context_dma_color_b ? rsx::get_address(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000) : 0;
|
||||
u32 address_c = m_set_context_dma_color_c ? rsx::get_address(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000) : 0;
|
||||
u32 address_d = m_set_context_dma_color_d ? rsx::get_address(m_surface_offset_d, m_context_dma_color_d - 0xfeed0000) : 0;
|
||||
u32 address_z = m_set_context_dma_z ? rsx::get_address(m_surface_offset_z, m_context_dma_z - 0xfeed0000) : 0;
|
||||
u32 address_a = m_set_context_dma_color_a ? rsx::get_address(m_previous_address_a, m_context_dma_color_a - 0xfeed0000) : 0;
|
||||
u32 address_b = m_set_context_dma_color_b ? rsx::get_address(m_previous_address_b, m_context_dma_color_b - 0xfeed0000) : 0;
|
||||
u32 address_c = m_set_context_dma_color_c ? rsx::get_address(m_previous_address_c, m_context_dma_color_c - 0xfeed0000) : 0;
|
||||
u32 address_d = m_set_context_dma_color_d ? rsx::get_address(m_previous_address_d, m_context_dma_color_d - 0xfeed0000) : 0;
|
||||
u32 address_z = m_set_context_dma_z ? rsx::get_address(m_previous_address_z, m_context_dma_z - 0xfeed0000) : 0;
|
||||
|
||||
// Make previous RTTs sampleable
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
@ -56,7 +73,7 @@ void D3D12GSRender::PrepareRenderTargets(ID3D12GraphicsCommandList *copycmdlist)
|
||||
size_t g_RTTIncrement = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
||||
|
||||
DXGI_FORMAT dxgiFormat;
|
||||
switch (m_surface_color_format)
|
||||
switch (m_surface.color_format)
|
||||
{
|
||||
case CELL_GCM_SURFACE_A8R8G8B8:
|
||||
dxgiFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
@ -86,69 +103,69 @@ void D3D12GSRender::PrepareRenderTargets(ID3D12GraphicsCommandList *copycmdlist)
|
||||
{
|
||||
case CELL_GCM_SURFACE_TARGET_0:
|
||||
{
|
||||
ID3D12Resource *rttA = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_a, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttA = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_a, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttA, &rttViewDesc, Handle);
|
||||
break;
|
||||
}
|
||||
case CELL_GCM_SURFACE_TARGET_1:
|
||||
{
|
||||
ID3D12Resource *rttB = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_b, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttB = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_b, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttB, &rttViewDesc, Handle);
|
||||
break;
|
||||
}
|
||||
case CELL_GCM_SURFACE_TARGET_MRT1:
|
||||
{
|
||||
ID3D12Resource *rttA = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_a, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttA = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_a, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttA, &rttViewDesc, Handle);
|
||||
Handle.ptr += g_RTTIncrement;
|
||||
ID3D12Resource *rttB = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 1, address_b, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttB = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 1, address_b, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttB, &rttViewDesc, Handle);
|
||||
}
|
||||
break;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT2:
|
||||
{
|
||||
ID3D12Resource *rttA = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_a, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttA = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_a, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttA, &rttViewDesc, Handle);
|
||||
Handle.ptr += g_RTTIncrement;
|
||||
ID3D12Resource *rttB = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 1, address_b, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttB = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 1, address_b, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttB, &rttViewDesc, Handle);
|
||||
Handle.ptr += g_RTTIncrement;
|
||||
ID3D12Resource *rttC = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 2, address_c, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttC = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 2, address_c, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttC, &rttViewDesc, Handle);
|
||||
break;
|
||||
}
|
||||
case CELL_GCM_SURFACE_TARGET_MRT3:
|
||||
{
|
||||
ID3D12Resource *rttA = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_a, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttA = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 0, address_a, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttA, &rttViewDesc, Handle);
|
||||
Handle.ptr += g_RTTIncrement;
|
||||
ID3D12Resource *rttB = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 1, address_b, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttB = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 1, address_b, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttB, &rttViewDesc, Handle);
|
||||
Handle.ptr += g_RTTIncrement;
|
||||
ID3D12Resource *rttC = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 2, address_c, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttC = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 2, address_c, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttC, &rttViewDesc, Handle);
|
||||
Handle.ptr += g_RTTIncrement;
|
||||
ID3D12Resource *rttD = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 3, address_d, m_surface_clip_w, m_surface_clip_h, m_surface_color_format,
|
||||
ID3D12Resource *rttD = m_rtts.bindAddressAsRenderTargets(m_device.Get(), copycmdlist, 3, address_d, clip_width, clip_height, m_surface.color_format,
|
||||
clearColor);
|
||||
m_device->CreateRenderTargetView(rttD, &rttViewDesc, Handle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ID3D12Resource *ds = m_rtts.bindAddressAsDepthStencil(m_device.Get(), copycmdlist, address_z, m_surface_clip_w, m_surface_clip_h, m_surface_depth_format, 1., 0);
|
||||
ID3D12Resource *ds = m_rtts.bindAddressAsDepthStencil(m_device.Get(), copycmdlist, address_z, clip_width, clip_height, m_surface.depth_format, 1., 0);
|
||||
|
||||
D3D12_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc = {};
|
||||
switch (m_surface_depth_format)
|
||||
switch (m_surface.depth_format)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
@ -159,7 +176,7 @@ void D3D12GSRender::PrepareRenderTargets(ID3D12GraphicsCommandList *copycmdlist)
|
||||
depthStencilViewDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format);
|
||||
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface.depth_format);
|
||||
assert(0);
|
||||
}
|
||||
depthStencilViewDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
|
||||
|
@ -1155,7 +1155,7 @@ void GLGSRender::WriteDepthBuffer()
|
||||
return;
|
||||
}
|
||||
|
||||
u32 address = rsx::get_address(m_surface_offset_z, m_context_dma_z - 0xfeed0000);
|
||||
u32 address;// = rsx::get_address(m_surface_offset_z, m_context_dma_z - 0xfeed0000);
|
||||
|
||||
auto ptr = vm::get_ptr<void>(address);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, g_pbo[4]);
|
||||
@ -1187,7 +1187,7 @@ void GLGSRender::WriteColorBufferA()
|
||||
return;
|
||||
}
|
||||
|
||||
u32 address = rsx::get_address(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000);
|
||||
u32 address;// = rsx::get_address(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000);
|
||||
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
checkForGlError("WriteColorBufferA(): glReadBuffer");
|
||||
@ -1213,7 +1213,7 @@ void GLGSRender::WriteColorBufferB()
|
||||
return;
|
||||
}
|
||||
|
||||
u32 address = rsx::get_address(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000);
|
||||
u32 address;// = rsx::get_address(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000);
|
||||
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT1);
|
||||
checkForGlError("WriteColorBufferB(): glReadBuffer");
|
||||
@ -1239,7 +1239,7 @@ void GLGSRender::WriteColorBufferC()
|
||||
return;
|
||||
}
|
||||
|
||||
u32 address = rsx::get_address(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000);
|
||||
u32 address;// = rsx::get_address(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000);
|
||||
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT2);
|
||||
checkForGlError("WriteColorBufferC(): glReadBuffer");
|
||||
@ -1265,7 +1265,7 @@ void GLGSRender::WriteColorBufferD()
|
||||
return;
|
||||
}
|
||||
|
||||
u32 address = rsx::get_address(m_surface_offset_d, m_context_dma_color_d - 0xfeed0000);
|
||||
u32 address;// = rsx::get_address(m_surface_offset_d, m_context_dma_color_d - 0xfeed0000);
|
||||
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT3);
|
||||
checkForGlError("WriteColorBufferD(): glReadBuffer");
|
||||
@ -1413,12 +1413,12 @@ void GLGSRender::OnReset()
|
||||
|
||||
void GLGSRender::InitDrawBuffers()
|
||||
{
|
||||
if (!m_fbo.IsCreated() || RSXThread::m_width != last_width || RSXThread::m_height != last_height || last_depth_format != m_surface_depth_format)
|
||||
// if (!m_fbo.IsCreated() || RSXThread::m_width != last_width || RSXThread::m_height != last_height || last_depth_format != m_surface_depth_format)
|
||||
{
|
||||
LOG_WARNING(RSX, "New FBO (%dx%d)", RSXThread::m_width, RSXThread::m_height);
|
||||
last_width = RSXThread::m_width;
|
||||
last_height = RSXThread::m_height;
|
||||
last_depth_format = m_surface_depth_format;
|
||||
// last_depth_format = m_surface_depth_format;
|
||||
|
||||
m_fbo.Create();
|
||||
checkForGlError("m_fbo.Create");
|
||||
@ -1436,7 +1436,7 @@ void GLGSRender::InitDrawBuffers()
|
||||
|
||||
m_rbo.Bind(4);
|
||||
|
||||
switch (m_surface_depth_format)
|
||||
switch (m_surface.depth_format)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
@ -1478,7 +1478,7 @@ void GLGSRender::InitDrawBuffers()
|
||||
|
||||
default:
|
||||
{
|
||||
LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format);
|
||||
// LOG_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format);
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
@ -1502,14 +1502,14 @@ void GLGSRender::InitDrawBuffers()
|
||||
|
||||
if (!m_set_surface_clip_horizontal)
|
||||
{
|
||||
m_surface_clip_x = 0;
|
||||
m_surface_clip_w = RSXThread::m_width;
|
||||
// m_surface_clip_x = 0;
|
||||
// m_surface_clip_w = RSXThread::m_width;
|
||||
}
|
||||
|
||||
if (!m_set_surface_clip_vertical)
|
||||
{
|
||||
m_surface_clip_y = 0;
|
||||
m_surface_clip_h = RSXThread::m_height;
|
||||
// m_surface_clip_y = 0;
|
||||
// m_surface_clip_h = RSXThread::m_height;
|
||||
}
|
||||
|
||||
m_fbo.Bind();
|
||||
|
@ -1296,24 +1296,6 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
|
||||
// Depth/Color buffer usage
|
||||
case NV4097_SET_SURFACE_FORMAT:
|
||||
{
|
||||
const u32 a0 = ARGS(0);
|
||||
m_set_surface_format = true;
|
||||
m_surface_color_format = a0 & 0x1f;
|
||||
m_surface_depth_format = (a0 >> 5) & 0x7;
|
||||
m_surface_type = (a0 >> 8) & 0xf;
|
||||
m_surface_antialias = (a0 >> 12) & 0xf;
|
||||
m_surface_width = (a0 >> 16) & 0xff;
|
||||
m_surface_height = (a0 >> 24) & 0xff;
|
||||
|
||||
switch (std::min((u32)6, count))
|
||||
{
|
||||
case 6: m_surface_pitch_b = ARGS(5);
|
||||
case 5: m_surface_offset_b = ARGS(4);
|
||||
case 4: m_surface_offset_z = ARGS(3);
|
||||
case 3: m_surface_offset_a = ARGS(2);
|
||||
case 2: m_surface_pitch_a = ARGS(1);
|
||||
}
|
||||
|
||||
auto buffers = vm::get_ptr<CellGcmDisplayInfo>(m_gcm_buffers_addr);
|
||||
m_width = buffers[gcm_current_buffer].width;
|
||||
m_height = buffers[gcm_current_buffer].height;
|
||||
@ -1330,85 +1312,34 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
|
||||
break;
|
||||
|
||||
case NV4097_SET_SURFACE_COLOR_AOFFSET:
|
||||
{
|
||||
m_surface_offset_a = ARGS(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_COLOR_BOFFSET:
|
||||
{
|
||||
m_surface_offset_b = ARGS(0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case NV4097_SET_SURFACE_COLOR_COFFSET:
|
||||
{
|
||||
m_surface_offset_c = ARGS(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_COLOR_DOFFSET:
|
||||
{
|
||||
m_surface_offset_d = ARGS(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_ZETA_OFFSET:
|
||||
{
|
||||
m_surface_offset_z = ARGS(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_PITCH_A:
|
||||
{
|
||||
m_surface_pitch_a = ARGS(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_PITCH_B:
|
||||
{
|
||||
m_surface_pitch_b = ARGS(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_PITCH_C:
|
||||
{
|
||||
if (count != 4)
|
||||
{
|
||||
LOG_ERROR(RSX, "NV4097_SET_SURFACE_PITCH_C: Bad count (%d)", count);
|
||||
break;
|
||||
}
|
||||
|
||||
m_surface_pitch_c = ARGS(0);
|
||||
m_surface_pitch_d = ARGS(1);
|
||||
m_surface_offset_c = ARGS(2);
|
||||
m_surface_offset_d = ARGS(3);
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_PITCH_D:
|
||||
{
|
||||
m_surface_pitch_d = ARGS(0);
|
||||
|
||||
if (count != 1)
|
||||
{
|
||||
LOG_ERROR(RSX, "NV4097_SET_SURFACE_PITCH_D: Bad count (%d)", count);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_PITCH_Z:
|
||||
{
|
||||
m_surface_pitch_z = ARGS(0);
|
||||
|
||||
if (count != 1)
|
||||
{
|
||||
LOG_ERROR(RSX, "NV4097_SET_SURFACE_PITCH_Z: Bad count (%d)", count);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_CONTEXT_DMA_COLOR_A:
|
||||
{
|
||||
@ -1478,31 +1409,10 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_CLIP_HORIZONTAL:
|
||||
{
|
||||
const u32 a0 = ARGS(0);
|
||||
|
||||
m_set_surface_clip_horizontal = true;
|
||||
m_surface_clip_x = a0;
|
||||
m_surface_clip_w = a0 >> 16;
|
||||
|
||||
if (count == 2)
|
||||
{
|
||||
const u32 a1 = ARGS(1);
|
||||
m_set_surface_clip_vertical = true;
|
||||
m_surface_clip_y = a1;
|
||||
m_surface_clip_h = a1 >> 16;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NV4097_SET_SURFACE_CLIP_VERTICAL:
|
||||
{
|
||||
const u32 a0 = ARGS(0);
|
||||
m_set_surface_clip_vertical = true;
|
||||
m_surface_clip_y = a0;
|
||||
m_surface_clip_h = a0 >> 16;
|
||||
break;
|
||||
}
|
||||
|
||||
// Anti-aliasing
|
||||
case NV4097_SET_ANTI_ALIASING_CONTROL:
|
||||
|
@ -32,6 +32,33 @@ namespace rsx
|
||||
u32 linear_to_swizzle(u32 x, u32 y, u32 z, u32 log2_width, u32 log2_height, u32 log2_depth);
|
||||
|
||||
u32 get_vertex_type_size(u32 type);
|
||||
|
||||
struct surface_info
|
||||
{
|
||||
u8 log2height;
|
||||
u8 log2width;
|
||||
u8 antialias;
|
||||
u8 depth_format;
|
||||
u8 color_format;
|
||||
|
||||
u32 width;
|
||||
u32 height;
|
||||
u32 format;
|
||||
|
||||
void unpack(u32 surface_format)
|
||||
{
|
||||
format = surface_format;
|
||||
|
||||
log2height = surface_format >> 24;
|
||||
log2width = (surface_format >> 16) & 0xff;
|
||||
antialias = (surface_format >> 12) & 0xf;
|
||||
depth_format = (surface_format >> 5) & 0x7;
|
||||
color_format = surface_format & 0x1f;
|
||||
|
||||
width = 1 << (u32(log2width) + 1);
|
||||
height = 1 << (u32(log2width) + 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
enum Method
|
||||
@ -292,29 +319,9 @@ public:
|
||||
bool m_clip_plane_5;
|
||||
|
||||
// Surface
|
||||
bool m_set_surface_format;
|
||||
u8 m_surface_color_format;
|
||||
u8 m_surface_depth_format;
|
||||
u8 m_surface_type;
|
||||
u8 m_surface_antialias;
|
||||
u8 m_surface_width;
|
||||
u8 m_surface_height;
|
||||
rsx::surface_info m_surface;
|
||||
bool m_set_surface_clip_horizontal;
|
||||
u16 m_surface_clip_x;
|
||||
u16 m_surface_clip_w;
|
||||
bool m_set_surface_clip_vertical;
|
||||
u16 m_surface_clip_y;
|
||||
u16 m_surface_clip_h;
|
||||
u32 m_surface_pitch_a;
|
||||
u32 m_surface_pitch_b;
|
||||
u32 m_surface_pitch_c;
|
||||
u32 m_surface_pitch_d;
|
||||
u32 m_surface_pitch_z;
|
||||
u32 m_surface_offset_a;
|
||||
u32 m_surface_offset_b;
|
||||
u32 m_surface_offset_c;
|
||||
u32 m_surface_offset_d;
|
||||
u32 m_surface_offset_z;
|
||||
|
||||
// DMA context
|
||||
bool m_set_context_dma_color_a;
|
||||
@ -509,7 +516,6 @@ protected:
|
||||
m_set_specular = false;
|
||||
m_set_line_stipple = false;
|
||||
m_set_polygon_stipple = false;
|
||||
m_set_surface_format = false;
|
||||
m_set_surface_clip_horizontal = false;
|
||||
m_set_surface_clip_vertical = false;
|
||||
|
||||
|
@ -498,7 +498,7 @@ void SetupRsxRenderingStates(vm::ptr<CellGcmContextData>& cntxt)
|
||||
r.m_width = s_rescInternalInstance->m_dstWidth;
|
||||
r.m_height = s_rescInternalInstance->m_dstHeight;
|
||||
|
||||
r.m_surface_depth_format = 2;
|
||||
// r.m_surface_depth_format = 2;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET] = 1;
|
||||
|
||||
if (IsPalInterpolate())
|
||||
@ -535,30 +535,30 @@ void SetupSurfaces(vm::ptr<CellGcmContextData>& cntxt)
|
||||
|
||||
GSRender& r = Emu.GetGSManager().GetRender();
|
||||
|
||||
r.m_surface_type = CELL_GCM_SURFACE_PITCH;
|
||||
r.m_surface_antialias = CELL_GCM_SURFACE_CENTER_1;
|
||||
r.m_surface_color_format = (u8)s_rescInternalInstance->m_pRescDsts->format;
|
||||
// r.m_surface_type = CELL_GCM_SURFACE_PITCH;
|
||||
// r.m_surface_antialias = CELL_GCM_SURFACE_CENTER_1;
|
||||
// r.m_surface_color_format = (u8)s_rescInternalInstance->m_pRescDsts->format;
|
||||
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;
|
||||
r.m_surface_offset_a = dstOffset0;
|
||||
r.m_surface_pitch_a = s_rescInternalInstance->m_dstPitch;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET] = dstOffset0;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_PITCH_A] = s_rescInternalInstance->m_dstPitch;
|
||||
//surface.colorLocation[1] = CELL_GCM_LOCATION_LOCAL;
|
||||
r.m_surface_offset_b = (!isMrt) ? 0 : dstOffset1;
|
||||
r.m_surface_pitch_b = (!isMrt) ? 64 : s_rescInternalInstance->m_dstPitch;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET] = (!isMrt) ? 0 : dstOffset1;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_PITCH_B] = (!isMrt) ? 64 : s_rescInternalInstance->m_dstPitch;
|
||||
//surface.colorLocation[2] = CELL_GCM_LOCATION_LOCAL;
|
||||
r.m_surface_offset_c = 0;
|
||||
r.m_surface_pitch_c = 64;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_COLOR_COFFSET] = 0;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_PITCH_C] = 64;
|
||||
//surface.colorLocation[3] = CELL_GCM_LOCATION_LOCAL;
|
||||
r.m_surface_offset_d = 0;
|
||||
r.m_surface_pitch_d = 64;
|
||||
r.m_surface_depth_format = CELL_GCM_SURFACE_Z24S8;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_COLOR_DOFFSET] = 0;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_PITCH_D] = 64;
|
||||
// r.m_surface_depth_format = CELL_GCM_SURFACE_Z24S8;
|
||||
//surface.depthLocation = CELL_GCM_LOCATION_LOCAL;
|
||||
r.m_surface_offset_z = 0;
|
||||
r.m_surface_pitch_z = 64;
|
||||
r.m_surface_width = s_rescInternalInstance->m_dstWidth;
|
||||
r.m_surface_height = s_rescInternalInstance->m_dstHeight;
|
||||
r.m_surface_clip_x = 0;
|
||||
r.m_surface_clip_y = 0;
|
||||
rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET];
|
||||
rsx::method_registers[NV4097_SET_SURFACE_PITCH_Z] = 64;
|
||||
// r.m_surface_width = s_rescInternalInstance->m_dstWidth;
|
||||
// r.m_surface_height = s_rescInternalInstance->m_dstHeight;
|
||||
// r.m_surface_clip_x = 0;
|
||||
// r.m_surface_clip_y = 0;
|
||||
}
|
||||
|
||||
// Module<> Functions
|
||||
|
@ -626,16 +626,16 @@ void RSXDebugger::GetSettings()
|
||||
// LIST_SETTINGS_ADD("Stencil func", !(render.m_set_stencil_func) ? "(none)" : wxString::Format("0x%x (%s)",
|
||||
// render.m_stencil_func,
|
||||
// ParseGCMEnum(render.m_stencil_func, CELL_GCM_ENUM)));
|
||||
LIST_SETTINGS_ADD("Surface Pitch A", wxString::Format("0x%x", render.m_surface_pitch_a));
|
||||
LIST_SETTINGS_ADD("Surface Pitch B", wxString::Format("0x%x", render.m_surface_pitch_b));
|
||||
LIST_SETTINGS_ADD("Surface Pitch C", wxString::Format("0x%x", render.m_surface_pitch_c));
|
||||
LIST_SETTINGS_ADD("Surface Pitch D", wxString::Format("0x%x", render.m_surface_pitch_d));
|
||||
LIST_SETTINGS_ADD("Surface Pitch Z", wxString::Format("0x%x", render.m_surface_pitch_z));
|
||||
LIST_SETTINGS_ADD("Surface Offset A", wxString::Format("0x%x", render.m_surface_offset_a));
|
||||
LIST_SETTINGS_ADD("Surface Offset B", wxString::Format("0x%x", render.m_surface_offset_b));
|
||||
LIST_SETTINGS_ADD("Surface Offset C", wxString::Format("0x%x", render.m_surface_offset_c));
|
||||
LIST_SETTINGS_ADD("Surface Offset D", wxString::Format("0x%x", render.m_surface_offset_d));
|
||||
LIST_SETTINGS_ADD("Surface Offset Z", wxString::Format("0x%x", render.m_surface_offset_z));
|
||||
LIST_SETTINGS_ADD("Surface Pitch A", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_PITCH_A]));
|
||||
LIST_SETTINGS_ADD("Surface Pitch B", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_PITCH_B]));
|
||||
LIST_SETTINGS_ADD("Surface Pitch C", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_PITCH_C]));
|
||||
LIST_SETTINGS_ADD("Surface Pitch D", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_PITCH_D]));
|
||||
LIST_SETTINGS_ADD("Surface Pitch Z", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_PITCH_Z]));
|
||||
LIST_SETTINGS_ADD("Surface Offset A", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_COLOR_AOFFSET]));
|
||||
LIST_SETTINGS_ADD("Surface Offset B", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_COLOR_BOFFSET]));
|
||||
LIST_SETTINGS_ADD("Surface Offset C", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_COLOR_COFFSET]));
|
||||
LIST_SETTINGS_ADD("Surface Offset D", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_COLOR_DOFFSET]));
|
||||
LIST_SETTINGS_ADD("Surface Offset Z", wxString::Format("0x%x", rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET]));
|
||||
LIST_SETTINGS_ADD("Viewport", wxString::Format("X:%d, Y:%d, W:%d, H:%d",
|
||||
rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] & 0xFFFF,
|
||||
rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL] & 0xFFFF,
|
||||
|
Loading…
x
Reference in New Issue
Block a user