rsx: Pass on shader flags to the cache

This commit is contained in:
kd-11 2022-12-05 01:33:02 +03:00 committed by kd-11
parent ab3c8268f0
commit e3b23822fd
7 changed files with 42 additions and 21 deletions

View file

@ -15,7 +15,7 @@ u64 GLGSRender::get_cycles()
GLGSRender::GLGSRender(utils::serial* ar) noexcept : GSRender(ar) GLGSRender::GLGSRender(utils::serial* ar) noexcept : GSRender(ar)
{ {
m_shaders_cache = std::make_unique<gl::shader_cache>(m_prog_buffer, "opengl", "v1.93"); m_shaders_cache = std::make_unique<gl::shader_cache>(m_prog_buffer, "opengl", "v1.94");
if (g_cfg.video.disable_vertex_cache || g_cfg.video.multithreaded_rsx) if (g_cfg.video.disable_vertex_cache || g_cfg.video.multithreaded_rsx)
m_vertex_cache = std::make_unique<gl::null_vertex_cache>(); m_vertex_cache = std::make_unique<gl::null_vertex_cache>();
@ -25,6 +25,7 @@ GLGSRender::GLGSRender(utils::serial* ar) noexcept : GSRender(ar)
backend_config.supports_hw_a2c = false; backend_config.supports_hw_a2c = false;
backend_config.supports_hw_a2one = false; backend_config.supports_hw_a2one = false;
backend_config.supports_multidraw = true; backend_config.supports_multidraw = true;
backend_config.supports_normalized_barycentrics = true;
} }
extern CellGcmContextData current_context; extern CellGcmContextData current_context;

View file

@ -223,6 +223,7 @@ struct RSXVertexProgram
{ {
std::vector<u32> data; std::vector<u32> data;
rsx::vertex_program_texture_state texture_state; rsx::vertex_program_texture_state texture_state;
u32 ctrl;
u32 output_mask; u32 output_mask;
u32 base_address; u32 base_address;
u32 entry; u32 entry;

View file

@ -607,6 +607,13 @@ namespace rsx
} }
} }
if (!backend_config.supports_normalized_barycentrics)
{
// TODO
// Store a global flag to track raster mode between polygon and non-polygon
// Check if flag changed. If state is the same, ignore.
}
in_begin_end = true; in_begin_end = true;
} }

View file

@ -461,6 +461,7 @@ namespace rsx
bool supports_passthrough_dma; // DMA passthrough bool supports_passthrough_dma; // DMA passthrough
bool supports_asynchronous_compute; // Async compute bool supports_asynchronous_compute; // Async compute
bool supports_host_gpu_labels; // Advanced host synchronization bool supports_host_gpu_labels; // Advanced host synchronization
bool supports_normalized_barycentrics; // Basically all GPUs except NVIDIA have properly normalized barycentrics
}; };
struct sampled_image_descriptor_base; struct sampled_image_descriptor_base;

View file

@ -510,7 +510,7 @@ VKGSRender::VKGSRender(utils::serial* ar) noexcept : GSRender(ar)
else else
m_vertex_cache = std::make_unique<vk::weak_vertex_cache>(); m_vertex_cache = std::make_unique<vk::weak_vertex_cache>();
m_shaders_cache = std::make_unique<vk::shader_cache>(*m_prog_buffer, "vulkan", "v1.93"); m_shaders_cache = std::make_unique<vk::shader_cache>(*m_prog_buffer, "vulkan", "v1.94");
for (u32 i = 0; i < m_swapchain->get_swap_image_count(); ++i) for (u32 i = 0; i < m_swapchain->get_swap_image_count(); ++i)
{ {
@ -539,6 +539,9 @@ VKGSRender::VKGSRender(utils::serial* ar) noexcept : GSRender(ar)
backend_config.supports_multidraw = true; backend_config.supports_multidraw = true;
// NVIDIA has broken barycentric interpolation
backend_config.supports_normalized_barycentrics = (vk::get_driver_vendor() != vk::driver_vendor::NVIDIA);
// NOTE: We do not actually need multiple sample support for A2C to work // NOTE: We do not actually need multiple sample support for A2C to work
// This is here for visual consistency - will be removed when AA problems due to mipmaps are fixed // This is here for visual consistency - will be removed when AA problems due to mipmaps are fixed
if (g_cfg.video.antialiasing_level != msaa_level::none) if (g_cfg.video.antialiasing_level != msaa_level::none)

View file

@ -778,7 +778,10 @@ enum
RSX_SHADER_CONTROL_USED_TEMP_REGS_MASK = 0xff << 24, RSX_SHADER_CONTROL_USED_TEMP_REGS_MASK = 0xff << 24,
RSX_SHADER_CONTROL_USES_KIL = 0x80, // program uses KIL op RSX_SHADER_CONTROL_USES_KIL = 0x80, // program uses KIL op
RSX_SHADER_CONTROL_UNKNOWN0 = 0x400, // seemingly always set RSX_SHADER_CONTROL_UNKNOWN0 = 0x400, // seemingly always set
RSX_SHADER_CONTROL_UNKNOWN1 = 0x8000 //seemingly set when srgb packer is used?? RSX_SHADER_CONTROL_UNKNOWN1 = 0x8000, // seemingly set when srgb packer is used??
// Custom
RSX_SHADER_CONTROL_POLYGON_RASTER = 0x10000 // Rasterizing triangles and not lines or points
}; };
// GCM Reports // GCM Reports

View file

@ -28,8 +28,10 @@ namespace rsx
u64 fragment_program_hash; u64 fragment_program_hash;
u64 pipeline_storage_hash; u64 pipeline_storage_hash;
u32 vp_ctrl; u32 vp_ctrl0;
u32 vp_ctrl1;
u32 vp_texture_dimensions; u32 vp_texture_dimensions;
u32 vp_reserved_0;
u64 vp_instruction_mask[9]; u64 vp_instruction_mask[9];
u32 vp_base_address; u32 vp_base_address;
@ -37,8 +39,8 @@ namespace rsx
u16 vp_jump_table[32]; u16 vp_jump_table[32];
u16 vp_multisampled_textures; u16 vp_multisampled_textures;
u16 vp_reserved_0; u16 vp_reserved_1;
u32 vp_reserved_1; u32 vp_reserved_2;
u32 fp_ctrl; u32 fp_ctrl;
u32 fp_texture_dimensions; u32 fp_texture_dimensions;
@ -305,7 +307,8 @@ namespace rsx
} }
u64 state_hash = 0; u64 state_hash = 0;
state_hash ^= rpcs3::hash_base<u32>(data.vp_ctrl); state_hash ^= rpcs3::hash_base<u32>(data.vp_ctrl0);
state_hash ^= rpcs3::hash_base<u32>(data.vp_ctrl1);
state_hash ^= rpcs3::hash_base<u32>(data.fp_ctrl); state_hash ^= rpcs3::hash_base<u32>(data.fp_ctrl);
state_hash ^= rpcs3::hash_base<u32>(data.vp_texture_dimensions); state_hash ^= rpcs3::hash_base<u32>(data.vp_texture_dimensions);
state_hash ^= rpcs3::hash_base<u32>(data.fp_texture_dimensions); state_hash ^= rpcs3::hash_base<u32>(data.fp_texture_dimensions);
@ -362,7 +365,8 @@ namespace rsx
fp = load_fp_raw(data.fragment_program_hash); fp = load_fp_raw(data.fragment_program_hash);
pipeline = data.pipeline_properties; pipeline = data.pipeline_properties;
vp.output_mask = data.vp_ctrl; vp.ctrl = data.vp_ctrl0;
vp.output_mask = data.vp_ctrl1;
vp.texture_state.texture_dimensions = data.vp_texture_dimensions; vp.texture_state.texture_dimensions = data.vp_texture_dimensions;
vp.texture_state.multisampled_textures = data.vp_multisampled_textures; vp.texture_state.multisampled_textures = data.vp_multisampled_textures;
vp.base_address = data.vp_base_address; vp.base_address = data.vp_base_address;
@ -401,7 +405,8 @@ namespace rsx
data_block.fragment_program_hash = m_storage.get_hash(fp); data_block.fragment_program_hash = m_storage.get_hash(fp);
data_block.pipeline_storage_hash = m_storage.get_hash(pipeline); data_block.pipeline_storage_hash = m_storage.get_hash(pipeline);
data_block.vp_ctrl = vp.output_mask; data_block.vp_ctrl0 = vp.ctrl;
data_block.vp_ctrl1 = vp.output_mask;
data_block.vp_texture_dimensions = vp.texture_state.texture_dimensions; data_block.vp_texture_dimensions = vp.texture_state.texture_dimensions;
data_block.vp_multisampled_textures = vp.texture_state.multisampled_textures; data_block.vp_multisampled_textures = vp.texture_state.multisampled_textures;
data_block.vp_base_address = vp.base_address; data_block.vp_base_address = vp.base_address;