mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-12-06 07:12:28 +01:00
gl: Reimplement user clip planes using the new ABI
This commit is contained in:
parent
f3e34e1d44
commit
efa4c6c34e
|
|
@ -903,16 +903,16 @@ void GLGSRender::load_program_env()
|
||||||
if (update_vertex_env)
|
if (update_vertex_env)
|
||||||
{
|
{
|
||||||
// Vertex state
|
// Vertex state
|
||||||
auto mapping = m_vertex_env_buffer->alloc_from_heap(144, m_uniform_buffer_offset_align);
|
auto mapping = m_vertex_env_buffer->alloc_from_heap(96, m_uniform_buffer_offset_align);
|
||||||
auto buf = static_cast<u8*>(mapping.first);
|
auto buf = static_cast<u8*>(mapping.first);
|
||||||
m_draw_processor.fill_scale_offset_data(buf, false);
|
m_draw_processor.fill_scale_offset_data(buf, false);
|
||||||
m_draw_processor.fill_user_clip_data(buf + 64);
|
m_draw_processor.fill_user_clip_data(buf + 64);
|
||||||
*(reinterpret_cast<u32*>(buf + 128)) = rsx::method_registers.transform_branch_bits();
|
*(reinterpret_cast<u32*>(buf + 68)) = rsx::method_registers.transform_branch_bits();
|
||||||
*(reinterpret_cast<f32*>(buf + 132)) = rsx::method_registers.point_size() * rsx::get_resolution_scale();
|
*(reinterpret_cast<f32*>(buf + 72)) = rsx::method_registers.point_size() * rsx::get_resolution_scale();
|
||||||
*(reinterpret_cast<f32*>(buf + 136)) = rsx::method_registers.clip_min();
|
*(reinterpret_cast<f32*>(buf + 76)) = rsx::method_registers.clip_min();
|
||||||
*(reinterpret_cast<f32*>(buf + 140)) = rsx::method_registers.clip_max();
|
*(reinterpret_cast<f32*>(buf + 80)) = rsx::method_registers.clip_max();
|
||||||
|
|
||||||
m_vertex_env_buffer->bind_range(GL_VERTEX_PARAMS_BIND_SLOT, mapping.second, 144);
|
m_vertex_env_buffer->bind_range(GL_VERTEX_PARAMS_BIND_SLOT, mapping.second, 96);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_instancing_data)
|
if (update_instancing_data)
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ namespace gl
|
||||||
::glsl::shader_properties properties{};
|
::glsl::shader_properties properties{};
|
||||||
properties.domain = ::glsl::program_domain::glsl_vertex_program;
|
properties.domain = ::glsl::program_domain::glsl_vertex_program;
|
||||||
properties.require_lit_emulation = true;
|
properties.require_lit_emulation = true;
|
||||||
|
properties.require_clip_plane_functions = true;
|
||||||
|
|
||||||
// TODO: Extend decompiler thread
|
// TODO: Extend decompiler thread
|
||||||
// TODO: Rename decompiler thread, it no longer spawns a thread
|
// TODO: Rename decompiler thread, it no longer spawns a thread
|
||||||
|
|
|
||||||
|
|
@ -33,23 +33,21 @@ void GLVertexDecompilerThread::insertHeader(std::stringstream &OS)
|
||||||
"layout(std140, binding = " << GL_VERTEX_PARAMS_BIND_SLOT << ") uniform VertexContextBuffer\n"
|
"layout(std140, binding = " << GL_VERTEX_PARAMS_BIND_SLOT << ") uniform VertexContextBuffer\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" mat4 scale_offset_mat;\n"
|
" mat4 scale_offset_mat;\n"
|
||||||
" ivec4 user_clip_enabled[2];\n"
|
" uint user_clip_configuration_bits;\n"
|
||||||
" vec4 user_clip_factors[2];\n"
|
|
||||||
" uint transform_branch_bits;\n"
|
" uint transform_branch_bits;\n"
|
||||||
" float point_size;\n"
|
" float point_size;\n"
|
||||||
" float z_near;\n"
|
" float z_near;\n"
|
||||||
" float z_far;\n"
|
" float z_far;\n"
|
||||||
"};\n\n"
|
"};\n"
|
||||||
|
"#define get_user_clip_config() user_clip_configuration_bits\n"
|
||||||
|
"\n\n"
|
||||||
|
|
||||||
"layout(std140, binding = " << GL_VERTEX_LAYOUT_BIND_SLOT << ") uniform VertexLayoutBuffer\n"
|
"layout(std140, binding = " << GL_VERTEX_LAYOUT_BIND_SLOT << ") uniform VertexLayoutBuffer\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" uint vertex_base_index;\n"
|
" uint vertex_base_index;\n"
|
||||||
" uint vertex_index_offset;\n"
|
" uint vertex_index_offset;\n"
|
||||||
" uvec4 input_attributes_blob[16 / 2];\n"
|
" uvec4 input_attributes_blob[16 / 2];\n"
|
||||||
"};\n\n"
|
"};\n\n";
|
||||||
|
|
||||||
"#define user_clip_factor(idx) user_clip_factors[idx >> 2][idx & 3]\n"
|
|
||||||
"#define is_user_clip_enabled(idx) (user_clip_enabled[idx >> 2][idx & 3] > 0)\n\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVertexDecompilerThread::insertInputs(std::stringstream& OS, const std::vector<ParamType>& /*inputs*/)
|
void GLVertexDecompilerThread::insertInputs(std::stringstream& OS, const std::vector<ParamType>& /*inputs*/)
|
||||||
|
|
@ -176,6 +174,7 @@ void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS)
|
||||||
properties2.low_precision_tests = dev_caps.vendor_NVIDIA;
|
properties2.low_precision_tests = dev_caps.vendor_NVIDIA;
|
||||||
properties2.require_explicit_invariance = dev_caps.vendor_MESA || (dev_caps.vendor_NVIDIA && g_cfg.video.shader_precision != gpu_preset_level::low);
|
properties2.require_explicit_invariance = dev_caps.vendor_MESA || (dev_caps.vendor_NVIDIA && g_cfg.video.shader_precision != gpu_preset_level::low);
|
||||||
properties2.require_instanced_render = !!(m_prog.ctrl & RSX_SHADER_CONTROL_INSTANCED_CONSTANTS);
|
properties2.require_instanced_render = !!(m_prog.ctrl & RSX_SHADER_CONTROL_INSTANCED_CONSTANTS);
|
||||||
|
properties2.require_clip_plane_functions = true;
|
||||||
|
|
||||||
insert_glsl_legacy_function(OS, properties2);
|
insert_glsl_legacy_function(OS, properties2);
|
||||||
glsl::insert_vertex_input_fetch(OS, glsl::glsl_rules_opengl4, dev_caps.vendor_INTEL == false);
|
glsl::insert_vertex_input_fetch(OS, glsl::glsl_rules_opengl4, dev_caps.vendor_INTEL == false);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue