diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 1470f8fead..3441fd438e 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -903,16 +903,16 @@ void GLGSRender::load_program_env() if (update_vertex_env) { // 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(mapping.first); m_draw_processor.fill_scale_offset_data(buf, false); m_draw_processor.fill_user_clip_data(buf + 64); - *(reinterpret_cast(buf + 128)) = rsx::method_registers.transform_branch_bits(); - *(reinterpret_cast(buf + 132)) = rsx::method_registers.point_size() * rsx::get_resolution_scale(); - *(reinterpret_cast(buf + 136)) = rsx::method_registers.clip_min(); - *(reinterpret_cast(buf + 140)) = rsx::method_registers.clip_max(); + *(reinterpret_cast(buf + 68)) = rsx::method_registers.transform_branch_bits(); + *(reinterpret_cast(buf + 72)) = rsx::method_registers.point_size() * rsx::get_resolution_scale(); + *(reinterpret_cast(buf + 76)) = rsx::method_registers.clip_min(); + *(reinterpret_cast(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) diff --git a/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp b/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp index 406ece755c..7383c0d7fa 100644 --- a/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp +++ b/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp @@ -119,6 +119,7 @@ namespace gl ::glsl::shader_properties properties{}; properties.domain = ::glsl::program_domain::glsl_vertex_program; properties.require_lit_emulation = true; + properties.require_clip_plane_functions = true; // TODO: Extend decompiler thread // TODO: Rename decompiler thread, it no longer spawns a thread diff --git a/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp b/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp index e7583ae9ce..6f5cb85df0 100644 --- a/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp +++ b/rpcs3/Emu/RSX/GL/GLVertexProgram.cpp @@ -33,23 +33,21 @@ void GLVertexDecompilerThread::insertHeader(std::stringstream &OS) "layout(std140, binding = " << GL_VERTEX_PARAMS_BIND_SLOT << ") uniform VertexContextBuffer\n" "{\n" " mat4 scale_offset_mat;\n" - " ivec4 user_clip_enabled[2];\n" - " vec4 user_clip_factors[2];\n" + " uint user_clip_configuration_bits;\n" " uint transform_branch_bits;\n" " float point_size;\n" " float z_near;\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" "{\n" " uint vertex_base_index;\n" " uint vertex_index_offset;\n" " uvec4 input_attributes_blob[16 / 2];\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"; + "};\n\n"; } void GLVertexDecompilerThread::insertInputs(std::stringstream& OS, const std::vector& /*inputs*/) @@ -176,6 +174,7 @@ void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS) 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_instanced_render = !!(m_prog.ctrl & RSX_SHADER_CONTROL_INSTANCED_CONSTANTS); + properties2.require_clip_plane_functions = true; insert_glsl_legacy_function(OS, properties2); glsl::insert_vertex_input_fetch(OS, glsl::glsl_rules_opengl4, dev_caps.vendor_INTEL == false);