mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-31 20:41:45 +01:00
commit
8edef32c76
@ -106,6 +106,7 @@ D3D12_STENCIL_OP get_stencil_op(u32 op) noexcept
|
||||
case CELL_GCM_KEEP: return D3D12_STENCIL_OP_KEEP;
|
||||
case CELL_GCM_ZERO: return D3D12_STENCIL_OP_ZERO;
|
||||
case CELL_GCM_REPLACE: return D3D12_STENCIL_OP_REPLACE;
|
||||
default: // Jet Set Radio set some garbage, turns out OP_INCR is the intended behavior.
|
||||
case CELL_GCM_INCR: return D3D12_STENCIL_OP_INCR;
|
||||
case CELL_GCM_DECR: return D3D12_STENCIL_OP_DECR;
|
||||
case CELL_GCM_INCR_WRAP:
|
||||
|
@ -52,7 +52,7 @@ void D3D12FragmentDecompiler::insertIntputs(std::stringstream & OS)
|
||||
OS << " float4 dst_reg3 : COLOR2;" << std::endl;
|
||||
OS << " float4 dst_reg4 : COLOR3;" << std::endl;
|
||||
OS << " float fogc : FOG;" << std::endl;
|
||||
OS << " float4 dummy : COLOR4;" << std::endl;
|
||||
OS << " float4 tc9 : TEXCOORD9;" << std::endl;
|
||||
OS << " float4 tc0 : TEXCOORD0;" << std::endl;
|
||||
OS << " float4 tc1 : TEXCOORD1;" << std::endl;
|
||||
OS << " float4 tc2 : TEXCOORD2;" << std::endl;
|
||||
@ -62,7 +62,6 @@ void D3D12FragmentDecompiler::insertIntputs(std::stringstream & OS)
|
||||
OS << " float4 tc6 : TEXCOORD6;" << std::endl;
|
||||
OS << " float4 tc7 : TEXCOORD7;" << std::endl;
|
||||
OS << " float4 tc8 : TEXCOORD8;" << std::endl;
|
||||
OS << " float4 tc9 : TEXCOORD9;" << std::endl;
|
||||
OS << "};" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlis
|
||||
rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_C],
|
||||
rsx::method_registers[NV4097_SET_CONTEXT_DMA_COLOR_D]
|
||||
};
|
||||
u32 offset_zeta = rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET];
|
||||
u32 m_context_dma_z = rsx::method_registers[NV4097_SET_CONTEXT_DMA_ZETA];
|
||||
|
||||
u32 offset_color[] =
|
||||
{
|
||||
@ -146,17 +146,17 @@ void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlis
|
||||
rsx::method_registers[NV4097_SET_SURFACE_COLOR_COFFSET],
|
||||
rsx::method_registers[NV4097_SET_SURFACE_COLOR_DOFFSET]
|
||||
};
|
||||
u32 m_context_dma_z = rsx::method_registers[NV4097_SET_CONTEXT_DMA_ZETA];
|
||||
u32 offset_zeta = rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET];
|
||||
|
||||
// FBO location has changed, previous data might be copied
|
||||
u32 address_color[] =
|
||||
{
|
||||
context_dma_color[0] ? rsx::get_address(offset_color[0], context_dma_color[0]) : 0,
|
||||
context_dma_color[1] ? rsx::get_address(offset_color[1], context_dma_color[1]) : 0,
|
||||
context_dma_color[2] ? rsx::get_address(offset_color[2], context_dma_color[2]) : 0,
|
||||
context_dma_color[3] ? rsx::get_address(offset_color[3], context_dma_color[3]) : 0,
|
||||
rsx::get_address(offset_color[0], context_dma_color[0]),
|
||||
rsx::get_address(offset_color[1], context_dma_color[1]),
|
||||
rsx::get_address(offset_color[2], context_dma_color[2]),
|
||||
rsx::get_address(offset_color[3], context_dma_color[3]),
|
||||
};
|
||||
u32 address_z = offset_zeta ? rsx::get_address(offset_zeta, m_context_dma_z) : 0;
|
||||
u32 address_z = rsx::get_address(offset_zeta, m_context_dma_z);
|
||||
|
||||
// Exit early if there is no rtt changes
|
||||
if (m_previous_address_a == address_color[0] &&
|
||||
@ -164,7 +164,7 @@ void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlis
|
||||
m_previous_address_c == address_color[2] &&
|
||||
m_previous_address_d == address_color[3] &&
|
||||
m_previous_address_z == address_z &&
|
||||
m_surface.format != surface_format)
|
||||
m_surface.format == surface_format)
|
||||
return;
|
||||
|
||||
m_previous_address_a = address_color[0];
|
||||
|
@ -141,12 +141,18 @@ void D3D12GSRender::upload_and_bind_textures(ID3D12GraphicsCommandList *command_
|
||||
|
||||
ID3D12Resource *vram_texture;
|
||||
std::unordered_map<u32, ComPtr<ID3D12Resource> >::const_iterator ItRTT = m_rtts.render_targets_storage.find(texaddr);
|
||||
std::unordered_map<u32, ComPtr<ID3D12Resource> >::const_iterator ItDS = m_rtts.depth_stencil_storage.find(texaddr);
|
||||
std::pair<texture_entry, ComPtr<ID3D12Resource> > *cached_texture = m_texture_cache.find_data_if_available(texaddr);
|
||||
bool isRenderTarget = false;
|
||||
bool is_render_target = false, is_depth_stencil_texture = false;
|
||||
if (ItRTT != m_rtts.render_targets_storage.end())
|
||||
{
|
||||
vram_texture = ItRTT->second.Get();
|
||||
isRenderTarget = true;
|
||||
is_render_target = true;
|
||||
}
|
||||
else if (ItDS != m_rtts.depth_stencil_storage.end())
|
||||
{
|
||||
vram_texture = ItDS->second.Get();
|
||||
is_depth_stencil_texture = true;
|
||||
}
|
||||
else if (cached_texture != nullptr && (cached_texture->first == texture_entry(format, w, h, textures[i].mipmap())))
|
||||
{
|
||||
@ -200,7 +206,7 @@ void D3D12GSRender::upload_and_bind_textures(ID3D12GraphicsCommandList *command_
|
||||
u8 remap_r = (textures[i].remap() >> 2) & 0x3;
|
||||
u8 remap_g = (textures[i].remap() >> 4) & 0x3;
|
||||
u8 remap_b = (textures[i].remap() >> 6) & 0x3;
|
||||
if (isRenderTarget)
|
||||
if (is_render_target)
|
||||
{
|
||||
// ARGB format
|
||||
// Data comes from RTT, stored as RGBA already
|
||||
@ -218,6 +224,15 @@ void D3D12GSRender::upload_and_bind_textures(ID3D12GraphicsCommandList *command_
|
||||
RemapValue[remap_b],
|
||||
RemapValue[remap_a]);
|
||||
}
|
||||
else if (is_depth_stencil_texture)
|
||||
{
|
||||
shared_resource_view_desc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
||||
shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
|
||||
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ARGB format
|
||||
|
@ -74,7 +74,7 @@ void D3D12VertexProgramDecompiler::insertOutputs(std::stringstream & OS, const s
|
||||
OS << " float4 dst_reg3 : COLOR2;" << std::endl;
|
||||
OS << " float4 dst_reg4 : COLOR3;" << std::endl;
|
||||
OS << " float dst_reg5 : FOG;" << std::endl;
|
||||
OS << " float4 dst_reg6 : COLOR4;" << std::endl;
|
||||
OS << " float4 dst_reg6 : TEXCOORD9;" << std::endl;
|
||||
OS << " float4 dst_reg7 : TEXCOORD0;" << std::endl;
|
||||
OS << " float4 dst_reg8 : TEXCOORD1;" << std::endl;
|
||||
OS << " float4 dst_reg9 : TEXCOORD2;" << std::endl;
|
||||
@ -84,7 +84,6 @@ void D3D12VertexProgramDecompiler::insertOutputs(std::stringstream & OS, const s
|
||||
OS << " float4 dst_reg13 : TEXCOORD6;" << std::endl;
|
||||
OS << " float4 dst_reg14 : TEXCOORD7;" << std::endl;
|
||||
OS << " float4 dst_reg15 : TEXCOORD8;" << std::endl;
|
||||
OS << " float4 dst_reg16 : TEXCOORD9;" << std::endl;
|
||||
OS << "};" << std::endl;
|
||||
}
|
||||
|
||||
@ -108,10 +107,12 @@ static const reg_info reg_table[] =
|
||||
{ "gl_ClipDistance[0]", false, "dst_reg5", ".y", false },
|
||||
{ "gl_ClipDistance[1]", false, "dst_reg5", ".z", false },
|
||||
{ "gl_ClipDistance[2]", false, "dst_reg5", ".w", false },
|
||||
{ "gl_PointSize", false, "dst_reg6", ".x", false },
|
||||
// TODO: Handle user clip distance properly
|
||||
/* { "gl_PointSize", false, "dst_reg6", ".x", false },
|
||||
{ "gl_ClipDistance[3]", false, "dst_reg6", ".y", false },
|
||||
{ "gl_ClipDistance[4]", false, "dst_reg6", ".z", false },
|
||||
{ "gl_ClipDistance[5]", false, "dst_reg6", ".w", false },
|
||||
{ "gl_ClipDistance[5]", false, "dst_reg6", ".w", false },*/
|
||||
{ "tc9", false, "dst_reg6", "", false },
|
||||
{ "tc0", true, "dst_reg7", "", false },
|
||||
{ "tc1", true, "dst_reg8", "", false },
|
||||
{ "tc2", true, "dst_reg9", "", false },
|
||||
@ -121,7 +122,6 @@ static const reg_info reg_table[] =
|
||||
{ "tc6", true, "dst_reg13", "", false },
|
||||
{ "tc7", true, "dst_reg14", "", false },
|
||||
{ "tc8", true, "dst_reg15", "", false },
|
||||
{ "tc9", true, "dst_reg6", "", false } // In this line, dst_reg6 is correct since dst_reg goes from 0 to 15.
|
||||
};
|
||||
|
||||
void D3D12VertexProgramDecompiler::insertMainStart(std::stringstream & OS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user