diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-05 05:01:38 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-30 04:00:15 +0100 |
commit | 9f803299de3a9c512939ede48654fab838343a8a (patch) | |
tree | 4ba30f0ad404bd4120dd5b2e4f21193bf03952fd /src/video_core/renderer_opengl/gl_rasterizer.cpp | |
parent | shader_decode: Implement LDG and basic cbuf tracking (diff) | |
download | yuzu-9f803299de3a9c512939ede48654fab838343a8a.tar yuzu-9f803299de3a9c512939ede48654fab838343a8a.tar.gz yuzu-9f803299de3a9c512939ede48654fab838343a8a.tar.bz2 yuzu-9f803299de3a9c512939ede48654fab838343a8a.tar.lz yuzu-9f803299de3a9c512939ede48654fab838343a8a.tar.xz yuzu-9f803299de3a9c512939ede48654fab838343a8a.tar.zst yuzu-9f803299de3a9c512939ede48654fab838343a8a.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 71829fee0..ca421ef28 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -300,6 +300,7 @@ void RasterizerOpenGL::SetupShaders(GLenum primitive_mode) { // Next available bindpoints to use when uploading the const buffers and textures to the GLSL // shaders. The constbuffer bindpoint starts after the shader stage configuration bind points. u32 current_constbuffer_bindpoint = Tegra::Engines::Maxwell3D::Regs::MaxShaderStage; + u32 current_gmem_bindpoint = 0; u32 current_texture_bindpoint = 0; std::array<bool, Maxwell::NumClipDistances> clip_distances{}; @@ -358,6 +359,10 @@ void RasterizerOpenGL::SetupShaders(GLenum primitive_mode) { SetupConstBuffers(static_cast<Maxwell::ShaderStage>(stage), shader, primitive_mode, current_constbuffer_bindpoint); + // Configure global memory regions for this shader stage. + current_gmem_bindpoint = SetupGlobalRegions(static_cast<Maxwell::ShaderStage>(stage), + shader, primitive_mode, current_gmem_bindpoint); + // Configure the textures for this shader stage. current_texture_bindpoint = SetupTextures(static_cast<Maxwell::ShaderStage>(stage), shader, primitive_mode, current_texture_bindpoint); @@ -993,6 +998,23 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, Shader& shad return current_bindpoint + static_cast<u32>(entries.size()); } +u32 RasterizerOpenGL::SetupGlobalRegions(Maxwell::ShaderStage stage, Shader& shader, + GLenum primitive_mode, u32 current_bindpoint) { + for (const auto& global_region : shader->GetShaderEntries().global_memory_entries) { + const auto& region = + global_cache.GetGlobalRegion(global_region, static_cast<Maxwell::ShaderStage>(stage)); + const GLuint block_index{shader->GetProgramResourceIndex(global_region)}; + ASSERT(block_index != GL_INVALID_INDEX); + + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, current_bindpoint, region->GetBufferHandle()); + glShaderStorageBlockBinding(shader->GetProgramHandle(primitive_mode), block_index, + current_bindpoint); + ++current_bindpoint; + } + + return current_bindpoint; +} + u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, Shader& shader, GLenum primitive_mode, u32 current_unit) { MICROPROFILE_SCOPE(OpenGL_Texture); |