diff options
author | Subv <subv2112@gmail.com> | 2018-04-15 21:42:23 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-04-15 22:02:50 +0200 |
commit | 477aab59603825e3cfc5144b784d0fe3df286ae4 (patch) | |
tree | 4ea684514f99ad3e1718282e01e2d04c6b938f5f /src/video_core/renderer_opengl/gl_rasterizer.cpp | |
parent | GPU: Don't use explicit binding points when uploading the constbuffers to opengl. (diff) | |
download | yuzu-477aab59603825e3cfc5144b784d0fe3df286ae4.tar yuzu-477aab59603825e3cfc5144b784d0fe3df286ae4.tar.gz yuzu-477aab59603825e3cfc5144b784d0fe3df286ae4.tar.bz2 yuzu-477aab59603825e3cfc5144b784d0fe3df286ae4.tar.lz yuzu-477aab59603825e3cfc5144b784d0fe3df286ae4.tar.xz yuzu-477aab59603825e3cfc5144b784d0fe3df286ae4.tar.zst yuzu-477aab59603825e3cfc5144b784d0fe3df286ae4.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index a80923285..28abc563a 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -226,10 +226,6 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset, size Memory::ReadBlock(cpu_address, program_code.data(), program_code.size() * sizeof(u64)); GLShader::ShaderSetup setup{std::move(program_code)}; - static constexpr std::array<const char*, Maxwell::MaxShaderStage> base_names = { - "buffer_vs_c", "buffer_tessc_c", "buffer_tesse_c", "buffer_gs_c", "buffer_fs_c", - }; - GLShader::ShaderEntries shader_resources; switch (program) { @@ -255,9 +251,9 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset, size static_cast<Maxwell::ShaderStage>(stage)); // Configure the const buffers for this shader stage. - current_constbuffer_bindpoint = SetupConstBuffers( - static_cast<Maxwell::ShaderStage>(stage), gl_stage_program, base_names[stage], - current_constbuffer_bindpoint, shader_resources.const_buffer_entries); + current_constbuffer_bindpoint = + SetupConstBuffers(static_cast<Maxwell::ShaderStage>(stage), gl_stage_program, + current_constbuffer_bindpoint, shader_resources.const_buffer_entries); } shader_program_manager->UseTrivialGeometryShader(); @@ -555,7 +551,7 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr } u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint program, - const std::string& base_name, u32 current_bindpoint, + u32 current_bindpoint, const std::vector<GLShader::ConstBufferEntry>& entries) { auto& gpu = Core::System::GetInstance().GPU(); auto& maxwell3d = gpu.Get3DEngine(); @@ -591,10 +587,11 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); // Now configure the bindpoint of the buffer inside the shader - std::string buffer_name = base_name + std::to_string(used_buffer.GetIndex()); + std::string buffer_name = used_buffer.GetName(); GLuint index = glGetProgramResourceIndex(program, GL_SHADER_STORAGE_BLOCK, buffer_name.c_str()); - glShaderStorageBlockBinding(program, index, buffer_draw_state.bindpoint); + if (index != -1) + glShaderStorageBlockBinding(program, index, buffer_draw_state.bindpoint); } state.Apply(); |