diff options
| author | 2021-06-02 00:33:03 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:37 -0400 | |
| commit | f4799e8fa15b92d8d5607dc5dfca4974901ee06c (patch) | |
| tree | fe05a0bb667c92f018d08aaf7e410fd55746e0c1 /src/video_core | |
| parent | glsl: Yet another gl_ViewportIndex fix attempt (diff) | |
| download | yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.tar.gz yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.tar.xz yuzu-f4799e8fa15b92d8d5607dc5dfca4974901ee06c.zip | |
glsl: Implement transform feedback
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index cd11ff653..0a1ba363b 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -92,9 +92,15 @@ GLenum AssemblyStage(size_t stage_index) { | |||
| 92 | 92 | ||
| 93 | Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsPipelineKey& key, | 93 | Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsPipelineKey& key, |
| 94 | const Shader::IR::Program& program, | 94 | const Shader::IR::Program& program, |
| 95 | bool glasm_use_storage_buffers) { | 95 | bool glasm_use_storage_buffers, bool use_assembly_shaders) { |
| 96 | Shader::RuntimeInfo info; | 96 | Shader::RuntimeInfo info; |
| 97 | switch (program.stage) { | 97 | switch (program.stage) { |
| 98 | case Shader::Stage::VertexB: | ||
| 99 | case Shader::Stage::Geometry: | ||
| 100 | if (!use_assembly_shaders && key.xfb_enabled != 0) { | ||
| 101 | info.xfb_varyings = VideoCommon::MakeTransformFeedbackVaryings(key.xfb_state); | ||
| 102 | } | ||
| 103 | break; | ||
| 98 | case Shader::Stage::TessellationEval: | 104 | case Shader::Stage::TessellationEval: |
| 99 | info.tess_clockwise = key.tessellation_clockwise != 0; | 105 | info.tess_clockwise = key.tessellation_clockwise != 0; |
| 100 | info.tess_primitive = [&key] { | 106 | info.tess_primitive = [&key] { |
| @@ -420,7 +426,8 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 420 | OGLProgram source_program; | 426 | OGLProgram source_program; |
| 421 | std::array<OGLAssemblyProgram, 5> assembly_programs; | 427 | std::array<OGLAssemblyProgram, 5> assembly_programs; |
| 422 | Shader::Backend::Bindings binding; | 428 | Shader::Backend::Bindings binding; |
| 423 | if (!device.UseAssemblyShaders()) { | 429 | const bool use_glasm{device.UseAssemblyShaders()}; |
| 430 | if (!use_glasm) { | ||
| 424 | source_program.handle = glCreateProgram(); | 431 | source_program.handle = glCreateProgram(); |
| 425 | } | 432 | } |
| 426 | const size_t first_index = uses_vertex_a && uses_vertex_b ? 1 : 0; | 433 | const size_t first_index = uses_vertex_a && uses_vertex_b ? 1 : 0; |
| @@ -434,8 +441,9 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 434 | const size_t stage_index{index - 1}; | 441 | const size_t stage_index{index - 1}; |
| 435 | infos[stage_index] = &program.info; | 442 | infos[stage_index] = &program.info; |
| 436 | 443 | ||
| 437 | const auto runtime_info{MakeRuntimeInfo(key, program, glasm_use_storage_buffers)}; | 444 | const auto runtime_info{ |
| 438 | if (device.UseAssemblyShaders()) { | 445 | MakeRuntimeInfo(key, program, glasm_use_storage_buffers, use_glasm)}; |
| 446 | if (use_glasm) { | ||
| 439 | const std::string code{EmitGLASM(profile, runtime_info, program, binding)}; | 447 | const std::string code{EmitGLASM(profile, runtime_info, program, binding)}; |
| 440 | assembly_programs[stage_index] = CompileProgram(code, AssemblyStage(stage_index)); | 448 | assembly_programs[stage_index] = CompileProgram(code, AssemblyStage(stage_index)); |
| 441 | } else { | 449 | } else { |
| @@ -443,7 +451,7 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 443 | AttachShader(Stage(stage_index), source_program.handle, code); | 451 | AttachShader(Stage(stage_index), source_program.handle, code); |
| 444 | } | 452 | } |
| 445 | } | 453 | } |
| 446 | if (!device.UseAssemblyShaders()) { | 454 | if (!use_glasm) { |
| 447 | LinkProgram(source_program.handle); | 455 | LinkProgram(source_program.handle); |
| 448 | } | 456 | } |
| 449 | return std::make_unique<GraphicsPipeline>( | 457 | return std::make_unique<GraphicsPipeline>( |