1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

rsx: Fix depth clears on z16 surfaces without stencil

remove some debug code
This commit is contained in:
kd-11 2017-03-26 14:51:25 +03:00
parent 70d3a6d840
commit 3ec1fe9ee7
5 changed files with 16 additions and 11 deletions

View File

@ -125,8 +125,9 @@ void D3D12GSRender::clear_surface(u32 arg)
if (arg & 0x1)
{
u32 clear_depth = rsx::method_registers.z_clear_value();
u32 max_depth_value = get_max_depth_value(rsx::method_registers.surface_depth_fmt());
auto depth_format = rsx::method_registers.surface_depth_fmt();
u32 clear_depth = rsx::method_registers.z_clear_value(depth_format == rsx::surface_depth_format::z24s8);
u32 max_depth_value = get_max_depth_value(depth_format);
get_current_resource_storage().command_list->ClearDepthStencilView(m_rtts.current_ds_handle, D3D12_CLEAR_FLAG_DEPTH, clear_depth / (float)max_depth_value, 0,
1, &get_scissor(rsx::method_registers.scissor_origin_x(), rsx::method_registers.scissor_origin_y(), rsx::method_registers.scissor_width(), rsx::method_registers.scissor_height()));
}

View File

@ -635,8 +635,7 @@ void GLGSRender::clear_surface(u32 arg)
if (arg & 0x1)
{
u32 max_depth_value = get_max_depth_value(surface_depth_format);
u32 clear_depth = rsx::method_registers.z_clear_value();
u32 clear_depth = rsx::method_registers.z_clear_value(surface_depth_format == rsx::surface_depth_format::z24s8);
glDepthMask(GL_TRUE);
glClearDepth(double(clear_depth) / max_depth_value);

View File

@ -889,7 +889,7 @@ void VKGSRender::clear_surface(u32 mask)
{
u32 max_depth_value = get_max_depth_value(surface_depth_format);
u32 clear_depth = rsx::method_registers.z_clear_value();
u32 clear_depth = rsx::method_registers.z_clear_value(surface_depth_format == rsx::surface_depth_format::z24s8);
float depth_clear = (float)clear_depth / max_depth_value;
depth_stencil_clear_values.depthStencil.depth = depth_clear;

View File

@ -3410,7 +3410,8 @@ struct registers_decoder<NV4097_SET_ZSTENCIL_CLEAR_VALUE>
union
{
u32 raw_value;
bitfield_decoder_t<8, 24> clear_z;
bitfield_decoder_t<0, 16> clear_z16;
bitfield_decoder_t<8, 24> clear_z24;
bitfield_decoder_t<0, 8> clear_stencil;
} m_data;
public:
@ -3421,15 +3422,19 @@ struct registers_decoder<NV4097_SET_ZSTENCIL_CLEAR_VALUE>
return m_data.clear_stencil;
}
u32 clear_z() const
u32 clear_z(bool is_depth_stencil) const
{
return m_data.clear_z;
if (is_depth_stencil)
return m_data.clear_z24;
return m_data.clear_z16;
}
};
static std::string dump(decoded_type &&decoded_values)
{
return "Clear: Z = " + std::to_string(decoded_values.clear_z()) +
return "Clear: Z24 = " + std::to_string(decoded_values.clear_z(true)) +
" z16 = " + std::to_string(decoded_values.clear_z(false)) +
" Stencil = " + std::to_string(decoded_values.clear_stencil());
}
};

View File

@ -287,9 +287,9 @@ namespace rsx
return decode<NV4097_SET_RESTART_INDEX>().restart_index();
}
u32 z_clear_value() const
u32 z_clear_value(bool is_depth_stencil) const
{
return decode<NV4097_SET_ZSTENCIL_CLEAR_VALUE>().clear_z();
return decode<NV4097_SET_ZSTENCIL_CLEAR_VALUE>().clear_z(is_depth_stencil);
}
u8 stencil_clear_value() const