diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-09-23 21:40:58 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-10-25 15:01:29 +0200 |
commit | acd64411342e70bd7e9f7156f62c3b1a609ac3c4 (patch) | |
tree | c05f05bb52fdee4fb0c693c98dec5915b69b302d /src/video_core/renderer_opengl/gl_shader_gen.cpp | |
parent | VideoCore: Unify const buffer accessing along engines and provide ConstBufferLocker class to shaders. (diff) | |
download | yuzu-acd64411342e70bd7e9f7156f62c3b1a609ac3c4.tar yuzu-acd64411342e70bd7e9f7156f62c3b1a609ac3c4.tar.gz yuzu-acd64411342e70bd7e9f7156f62c3b1a609ac3c4.tar.bz2 yuzu-acd64411342e70bd7e9f7156f62c3b1a609ac3c4.tar.lz yuzu-acd64411342e70bd7e9f7156f62c3b1a609ac3c4.tar.xz yuzu-acd64411342e70bd7e9f7156f62c3b1a609ac3c4.tar.zst yuzu-acd64411342e70bd7e9f7156f62c3b1a609ac3c4.zip |
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_gen.cpp')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index b5a43e79e..817c6e12c 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -21,7 +21,8 @@ static constexpr u32 COMPUTE_OFFSET = 0; static constexpr CompilerSettings settings{CompileDepth::NoFlowStack, true}; -ProgramResult GenerateVertexShader(const Device& device, const ShaderSetup& setup) { +ProgramResult GenerateVertexShader(ConstBufferLocker& locker, const Device& device, + const ShaderSetup& setup) { const std::string id = fmt::format("{:016x}", setup.program.unique_identifier); std::string out = "// Shader Unique Id: VS" + id + "\n\n"; @@ -35,14 +36,15 @@ layout (std140, binding = EMULATION_UBO_BINDING) uniform vs_config { )"; - const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET, setup.program.size_a, settings); + const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET, setup.program.size_a, settings, + locker); const auto stage = setup.IsDualProgram() ? ProgramType::VertexA : ProgramType::VertexB; ProgramResult program = Decompile(device, program_ir, stage, "vertex"); out += program.first; if (setup.IsDualProgram()) { const ShaderIR program_ir_b(setup.program.code_b, PROGRAM_OFFSET, setup.program.size_b, - settings); + settings, locker); ProgramResult program_b = Decompile(device, program_ir_b, ProgramType::VertexB, "vertex_b"); out += program_b.first; } @@ -71,7 +73,8 @@ void main() { return {std::move(out), std::move(program.second)}; } -ProgramResult GenerateGeometryShader(const Device& device, const ShaderSetup& setup) { +ProgramResult GenerateGeometryShader(ConstBufferLocker& locker, const Device& device, + const ShaderSetup& setup) { const std::string id = fmt::format("{:016x}", setup.program.unique_identifier); std::string out = "// Shader Unique Id: GS" + id + "\n\n"; @@ -85,7 +88,8 @@ layout (std140, binding = EMULATION_UBO_BINDING) uniform gs_config { )"; - const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET, setup.program.size_a, settings); + const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET, setup.program.size_a, settings, + locker); ProgramResult program = Decompile(device, program_ir, ProgramType::Geometry, "geometry"); out += program.first; @@ -97,7 +101,8 @@ void main() { return {std::move(out), std::move(program.second)}; } -ProgramResult GenerateFragmentShader(const Device& device, const ShaderSetup& setup) { +ProgramResult GenerateFragmentShader(ConstBufferLocker& locker, const Device& device, + const ShaderSetup& setup) { const std::string id = fmt::format("{:016x}", setup.program.unique_identifier); std::string out = "// Shader Unique Id: FS" + id + "\n\n"; @@ -120,7 +125,8 @@ layout (std140, binding = EMULATION_UBO_BINDING) uniform fs_config { )"; - const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET, setup.program.size_a, settings); + const ShaderIR program_ir(setup.program.code, PROGRAM_OFFSET, setup.program.size_a, settings, + locker); ProgramResult program = Decompile(device, program_ir, ProgramType::Fragment, "fragment"); out += program.first; @@ -133,13 +139,15 @@ void main() { return {std::move(out), std::move(program.second)}; } -ProgramResult GenerateComputeShader(const Device& device, const ShaderSetup& setup) { +ProgramResult GenerateComputeShader(ConstBufferLocker& locker, const Device& device, + const ShaderSetup& setup) { const std::string id = fmt::format("{:016x}", setup.program.unique_identifier); std::string out = "// Shader Unique Id: CS" + id + "\n\n"; out += GetCommonDeclarations(); - const ShaderIR program_ir(setup.program.code, COMPUTE_OFFSET, setup.program.size_a, settings); + const ShaderIR program_ir(setup.program.code, COMPUTE_OFFSET, setup.program.size_a, settings, + locker); ProgramResult program = Decompile(device, program_ir, ProgramType::Compute, "compute"); out += program.first; |