mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 09:18:40 +12:00
gl: Use uniform buffer for transform constants.
This commit is contained in:
parent
247af0ebbf
commit
5447521ce5
3 changed files with 11 additions and 11 deletions
|
@ -1064,8 +1064,10 @@ void GLGSRender::oninit_thread()
|
||||||
m_vbo.create();
|
m_vbo.create();
|
||||||
m_ebo.create();
|
m_ebo.create();
|
||||||
m_scale_offset_buffer.create(16 * sizeof(float));
|
m_scale_offset_buffer.create(16 * sizeof(float));
|
||||||
|
m_vertex_constants_buffer.create(512 * 4 * sizeof(float));
|
||||||
|
|
||||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, m_scale_offset_buffer.id());
|
glBindBufferBase(GL_UNIFORM_BUFFER, 0, m_scale_offset_buffer.id());
|
||||||
|
glBindBufferBase(GL_UNIFORM_BUFFER, 1, m_vertex_constants_buffer.id());
|
||||||
|
|
||||||
m_vao.array_buffer = m_vbo;
|
m_vao.array_buffer = m_vbo;
|
||||||
m_vao.element_array_buffer = m_ebo;
|
m_vao.element_array_buffer = m_ebo;
|
||||||
|
@ -1268,12 +1270,10 @@ bool GLGSRender::load_program()
|
||||||
fill_scale_offset_data(buffer, false);
|
fill_scale_offset_data(buffer, false);
|
||||||
glUnmapBuffer(GL_UNIFORM_BUFFER);
|
glUnmapBuffer(GL_UNIFORM_BUFFER);
|
||||||
|
|
||||||
|
glBindBuffer(GL_UNIFORM_BUFFER, m_vertex_constants_buffer.id());
|
||||||
for (auto &constant : transform_constants)
|
buffer = glMapBuffer(GL_UNIFORM_BUFFER, GL_WRITE_ONLY);
|
||||||
{
|
fill_vertex_program_constants_data(buffer);
|
||||||
//LOG_WARNING(RSX, "vc[%u] = (%f, %f, %f, %f)", constant.first, constant.second.r, constant.second.g, constant.second.b, constant.second.a);
|
glUnmapBuffer(GL_UNIFORM_BUFFER);
|
||||||
__glcheck m_program->uniforms["vc[" + std::to_string(constant.first) + "]"] = constant.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u32 constant_offset : m_prog_buffer.getFragmentConstantOffsetsCache(&fragment_program))
|
for (u32 constant_offset : m_prog_buffer.getFragmentConstantOffsetsCache(&fragment_program))
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,6 +76,7 @@ private:
|
||||||
gl::texture m_flip_tex_color;
|
gl::texture m_flip_tex_color;
|
||||||
|
|
||||||
gl::buffer m_scale_offset_buffer;
|
gl::buffer m_scale_offset_buffer;
|
||||||
|
gl::buffer m_vertex_constants_buffer;
|
||||||
|
|
||||||
gl::buffer m_vbo;
|
gl::buffer m_vbo;
|
||||||
gl::buffer m_ebo;
|
gl::buffer m_ebo;
|
||||||
|
|
|
@ -46,11 +46,10 @@ void GLVertexDecompilerThread::insertInputs(std::stringstream & OS, const std::v
|
||||||
|
|
||||||
void GLVertexDecompilerThread::insertConstants(std::stringstream & OS, const std::vector<ParamType> & constants)
|
void GLVertexDecompilerThread::insertConstants(std::stringstream & OS, const std::vector<ParamType> & constants)
|
||||||
{
|
{
|
||||||
for (const ParamType PT : constants)
|
OS << "layout(std140, binding = 1) uniform VertexConstantsBuffer" << std::endl;
|
||||||
{
|
OS << "{" << std::endl;
|
||||||
for (const ParamItem &PI : PT.items)
|
OS << " vec4 vc[468];" << std::endl;
|
||||||
OS << "uniform " << PT.type << " " << PI.name << ";" << std::endl;
|
OS << "};" << std::endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct reg_info
|
struct reg_info
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue