diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 83dde91c8a..e794f43a21 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -582,7 +582,7 @@ bool GLGSRender::load_program() glBindBufferRange(GL_UNIFORM_BUFFER, 0, m_uniform_ring_buffer->get_buffer().id(), scale_offset_offset, 512); glBindBufferRange(GL_UNIFORM_BUFFER, 1, m_uniform_ring_buffer->get_buffer().id(), vertex_constants_offset, 512 * 16); - glBindBufferRange(GL_UNIFORM_BUFFER, 2, m_uniform_ring_buffer->get_buffer().id(), fragment_constants_offset, fragment_constants_sz); + //glBindBufferRange(GL_UNIFORM_BUFFER, 2, m_uniform_ring_buffer->get_buffer().id(), fragment_constants_offset, fragment_constants_sz); return true; } diff --git a/rpcs3/Emu/RSX/GL/rsx_gl_cache.cpp b/rpcs3/Emu/RSX/GL/rsx_gl_cache.cpp index a93ccb8196..db290e3580 100644 --- a/rpcs3/Emu/RSX/GL/rsx_gl_cache.cpp +++ b/rpcs3/Emu/RSX/GL/rsx_gl_cache.cpp @@ -7,7 +7,7 @@ rsx::complete_shader glsl_complete_shader(const rsx::decompiled_shader &shader, { rsx::complete_shader result; result.decompiled = &shader; - result.code = "#version 420\n\n"; + result.code = "#version 430\n\n"; if (shader.raw->type == rsx::program_type::vertex) { @@ -80,6 +80,7 @@ rsx::complete_shader glsl_complete_shader(const rsx::decompiled_shader &shader, std::string prepare; std::string finalize; + int location = 1; switch (shader.raw->type) { @@ -244,10 +245,12 @@ rsx::complete_shader glsl_complete_shader(const rsx::decompiled_shader &shader, case rsx::program_type::vertex: result.code += "out vec4 wpos;\n"; - + + // TODO if (1) { finalize += "\tgl_Position = o0;\n"; + finalize += "\tgl_Position = gl_Position * viewport_matrix;\n"; } else { @@ -261,7 +264,12 @@ rsx::complete_shader glsl_complete_shader(const rsx::decompiled_shader &shader, { if (shader.input_attributes & (1 << index)) { - result.code += "in vec4 " + rsx::vertex_program::input_attrib_names[index] + ";\n"; + // result.code += "in vec4 " + rsx::vertex_program::input_attrib_names[index] + ";\n"; + + // TODO: use actual information about vertex inputs + result.code += "layout(location=" + std::to_string(location++) + ") uniform samplerBuffer " + rsx::vertex_program::input_attrib_names[index] + "_buffer" + ";\n"; + result.code += "vec4 " + rsx::vertex_program::input_attrib_names[index] + + " = texelFetch(" + rsx::vertex_program::input_attrib_names[index] + "_buffer, gl_VertexID).rgba;\n"; } } diff --git a/rpcs3/Emu/RSX/GL/vertex_buffer.cpp b/rpcs3/Emu/RSX/GL/vertex_buffer.cpp index 3203ed6ffb..602b158c86 100644 --- a/rpcs3/Emu/RSX/GL/vertex_buffer.cpp +++ b/rpcs3/Emu/RSX/GL/vertex_buffer.cpp @@ -235,7 +235,7 @@ u32 GLGSRender::set_vertex_buffer() auto &vertex_info = vertex_arrays_info[index]; int location; - if (!m_program->attribs.has_location(rsx::vertex_program::input_attrib_names[index], &location)) + if (!m_program->uniforms.has_location(rsx::vertex_program::input_attrib_names[index] + "_buffer", &location)) continue; if (!vertex_info.size) // disabled, bind a null sampler @@ -303,7 +303,7 @@ u32 GLGSRender::set_vertex_buffer() for (int index = 0; index < rsx::limits::vertex_count; ++index) { int location; - if (!m_program->attribs.has_location(rsx::vertex_program::input_attrib_names[index], &location)) + if (!m_program->uniforms.has_location(rsx::vertex_program::input_attrib_names[index] + "_buffer", &location)) continue; bool enabled = !!(input_mask & (1 << index));