mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 12:32:43 +00:00
Use sampler buffers in vertex shaders
This commit is contained in:
parent
8637754d6a
commit
1778113b71
@ -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;
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user