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)
{
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)
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_a2one = false;
backend_config.supports_multidraw = true;
backend_config.supports_normalized_barycentrics = true;
}
extern CellGcmContextData current_context;

View File

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

View File

@ -452,15 +452,16 @@ namespace rsx
struct backend_configuration
{
bool supports_multidraw; // Draw call batching
bool supports_hw_a2c; // Alpha to coverage
bool supports_hw_renormalization; // Should be true on NV hardware which matches PS3 texture renormalization behaviour
bool supports_hw_msaa; // MSAA support
bool supports_hw_a2one; // Alpha to one
bool supports_hw_conditional_render; // Conditional render
bool supports_passthrough_dma; // DMA passthrough
bool supports_asynchronous_compute; // Async compute
bool supports_host_gpu_labels; // Advanced host synchronization
bool supports_multidraw; // Draw call batching
bool supports_hw_a2c; // Alpha to coverage
bool supports_hw_renormalization; // Should be true on NV hardware which matches PS3 texture renormalization behaviour
bool supports_hw_msaa; // MSAA support
bool supports_hw_a2one; // Alpha to one
bool supports_hw_conditional_render; // Conditional render
bool supports_passthrough_dma; // DMA passthrough
bool supports_asynchronous_compute; // Async compute
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;

View File

@ -510,7 +510,7 @@ VKGSRender::VKGSRender(utils::serial* ar) noexcept : GSRender(ar)
else
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)
{
@ -539,6 +539,9 @@ VKGSRender::VKGSRender(utils::serial* ar) noexcept : GSRender(ar)
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
// 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)

View File

@ -773,12 +773,15 @@ enum
CELL_GCM_SHADER_CONTROL_DEPTH_EXPORT = 0xe, ///< shader program exports the depth of the shaded fragment
CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS = 0x40, ///< shader program exports 32 bits registers values (instead of 16 bits ones)
//Other known flags
// Other known flags
RSX_SHADER_CONTROL_USED_REGS_MASK = 0xf,
RSX_SHADER_CONTROL_USED_TEMP_REGS_MASK = 0xff << 24,
RSX_SHADER_CONTROL_USES_KIL = 0x80, //program uses KIL op
RSX_SHADER_CONTROL_UNKNOWN0 = 0x400, //seemingly always set
RSX_SHADER_CONTROL_UNKNOWN1 = 0x8000 //seemingly set when srgb packer is used??
RSX_SHADER_CONTROL_USES_KIL = 0x80, // program uses KIL op
RSX_SHADER_CONTROL_UNKNOWN0 = 0x400, // seemingly always set
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

View File

@ -28,8 +28,10 @@ namespace rsx
u64 fragment_program_hash;
u64 pipeline_storage_hash;
u32 vp_ctrl;
u32 vp_ctrl0;
u32 vp_ctrl1;
u32 vp_texture_dimensions;
u32 vp_reserved_0;
u64 vp_instruction_mask[9];
u32 vp_base_address;
@ -37,8 +39,8 @@ namespace rsx
u16 vp_jump_table[32];
u16 vp_multisampled_textures;
u16 vp_reserved_0;
u32 vp_reserved_1;
u16 vp_reserved_1;
u32 vp_reserved_2;
u32 fp_ctrl;
u32 fp_texture_dimensions;
@ -305,7 +307,8 @@ namespace rsx
}
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.vp_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);
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.multisampled_textures = data.vp_multisampled_textures;
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.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_multisampled_textures = vp.texture_state.multisampled_textures;
data_block.vp_base_address = vp.base_address;