mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
GPU/HW: Fix ROV depth being written with semitransparency
This commit is contained in:
parent
7d2898b94c
commit
d9c9b3038d
@ -1276,13 +1276,16 @@ bool GPU_HW::CompilePipelines(Error* error)
|
||||
texture_mode - (sprite ? static_cast<u8>(BatchTextureMode::SpriteStart) : 0));
|
||||
const bool use_rov =
|
||||
(render_mode == static_cast<u8>(BatchRenderMode::ShaderBlend) && m_use_rov_for_shader_blend);
|
||||
const bool rov_depth_test = (use_rov && depth_test != 0);
|
||||
const bool rov_depth_write = (rov_depth_test && static_cast<GPUTransparencyMode>(transparency_mode) ==
|
||||
GPUTransparencyMode::Disabled);
|
||||
const std::string fs = shadergen.GenerateBatchFragmentShader(
|
||||
static_cast<BatchRenderMode>(render_mode), static_cast<GPUTransparencyMode>(transparency_mode),
|
||||
shader_texmode, sprite ? m_sprite_texture_filtering : m_texture_filtering, upscaled, msaa,
|
||||
per_sample_shading, uv_limits, !sprite && force_round_texcoords, true_color,
|
||||
ConvertToBoolUnchecked(dithering), scaled_dithering, disable_color_perspective,
|
||||
ConvertToBoolUnchecked(interlacing), ConvertToBoolUnchecked(check_mask), m_write_mask_as_depth,
|
||||
use_rov, needs_rov_depth, (depth_test != 0));
|
||||
use_rov, needs_rov_depth, rov_depth_test, rov_depth_write);
|
||||
|
||||
if (!(batch_fragment_shaders[depth_test][render_mode][transparency_mode][texture_mode][check_mask]
|
||||
[dithering][interlacing] = g_gpu_device->CreateShader(
|
||||
|
@ -733,13 +733,12 @@ std::string GPU_HW_ShaderGen::GenerateBatchFragmentShader(
|
||||
GPUTextureFilter texture_filtering, bool upscaled, bool msaa, bool per_sample_shading, bool uv_limits,
|
||||
bool force_round_texcoords, bool true_color, bool dithering, bool scaled_dithering, bool disable_color_perspective,
|
||||
bool interlacing, bool check_mask, bool write_mask_as_depth, bool use_rov, bool use_rov_depth,
|
||||
bool rov_depth_test) const
|
||||
bool rov_depth_test, bool rov_depth_write) const
|
||||
{
|
||||
DebugAssert(!true_color || !dithering); // Should not be doing dithering+true color.
|
||||
|
||||
// TODO: don't write depth for shader blend
|
||||
DebugAssert(transparency == GPUTransparencyMode::Disabled || render_mode == GPU_HW::BatchRenderMode::ShaderBlend);
|
||||
DebugAssert(!rov_depth_test || (use_rov && use_rov_depth));
|
||||
DebugAssert((!rov_depth_test && !rov_depth_write) || (use_rov && use_rov_depth));
|
||||
|
||||
const bool textured = (texture_mode != GPU_HW::BatchTextureMode::Disabled);
|
||||
const bool palette =
|
||||
@ -773,6 +772,7 @@ std::string GPU_HW_ShaderGen::GenerateBatchFragmentShader(
|
||||
DefineMacro(ss, "USE_ROV", use_rov);
|
||||
DefineMacro(ss, "USE_ROV_DEPTH", use_rov_depth);
|
||||
DefineMacro(ss, "ROV_DEPTH_TEST", rov_depth_test);
|
||||
DefineMacro(ss, "ROV_DEPTH_WRITE", rov_depth_write);
|
||||
DefineMacro(ss, "USE_DUAL_SOURCE", use_dual_source);
|
||||
DefineMacro(ss, "WRITE_MASK_AS_DEPTH", write_mask_as_depth);
|
||||
DefineMacro(ss, "FORCE_ROUND_TEXCOORDS", force_round_texcoords);
|
||||
@ -1124,7 +1124,7 @@ float4 SampleFromVRAM(TEXPAGE_VALUE texpage, float2 coords)
|
||||
if (!discarded)
|
||||
{
|
||||
ROV_STORE(rov_color, fragpos, o_col0);
|
||||
#if USE_ROV_DEPTH
|
||||
#if USE_ROV_DEPTH && ROV_DEPTH_WRITE
|
||||
ROV_STORE(rov_depth, fragpos, float4(v_pos.z, 0.0, 0.0, 0.0));
|
||||
#endif
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
bool force_round_texcoords, bool true_color, bool dithering,
|
||||
bool scaled_dithering, bool disable_color_perspective, bool interlacing,
|
||||
bool check_mask, bool write_mask_as_depth, bool use_rov, bool use_rov_depth,
|
||||
bool rov_depth_test) const;
|
||||
bool rov_depth_test, bool rov_depth_write) const;
|
||||
std::string GenerateWireframeGeometryShader() const;
|
||||
std::string GenerateWireframeFragmentShader() const;
|
||||
std::string GenerateVRAMReadFragmentShader(u32 resolution_scale, u32 multisamples) const;
|
||||
|
@ -5,4 +5,4 @@
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 26;
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 27;
|
||||
|
Loading…
x
Reference in New Issue
Block a user