diff options
| author | 2021-06-04 00:11:16 +0200 | |
|---|---|---|
| committer | 2021-07-22 21:51:34 -0400 | |
| commit | 562af301819227d65a251a2c29c997bf798da7ba (patch) | |
| tree | 00199eb2c9c34d78430d88e40bd5b27f585daeec /src/video_core | |
| parent | shader: Add 2D and 3D variants to SUATOM and SURED (diff) | |
| download | yuzu-562af301819227d65a251a2c29c997bf798da7ba.tar.gz yuzu-562af301819227d65a251a2c29c997bf798da7ba.tar.xz yuzu-562af301819227d65a251a2c29c997bf798da7ba.zip | |
shader: Fix VertexA Shaders.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 26 |
1 files changed, 21 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 bdffac4b2..0e4904733 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -40,6 +40,7 @@ namespace OpenGL { | |||
| 40 | namespace { | 40 | namespace { |
| 41 | using Shader::Backend::GLASM::EmitGLASM; | 41 | using Shader::Backend::GLASM::EmitGLASM; |
| 42 | using Shader::Backend::SPIRV::EmitSPIRV; | 42 | using Shader::Backend::SPIRV::EmitSPIRV; |
| 43 | using Shader::Maxwell::MergeDualVertexPrograms; | ||
| 43 | using Shader::Maxwell::TranslateProgram; | 44 | using Shader::Maxwell::TranslateProgram; |
| 44 | using VideoCommon::ComputeEnvironment; | 45 | using VideoCommon::ComputeEnvironment; |
| 45 | using VideoCommon::FileEnvironment; | 46 | using VideoCommon::FileEnvironment; |
| @@ -446,6 +447,8 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 446 | size_t env_index{}; | 447 | size_t env_index{}; |
| 447 | u32 total_storage_buffers{}; | 448 | u32 total_storage_buffers{}; |
| 448 | std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs; | 449 | std::array<Shader::IR::Program, Maxwell::MaxShaderProgram> programs; |
| 450 | const bool uses_vertex_a{key.unique_hashes[0] != 0}; | ||
| 451 | const bool uses_vertex_b{key.unique_hashes[1] != 0}; | ||
| 449 | for (size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) { | 452 | for (size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) { |
| 450 | if (key.unique_hashes[index] == 0) { | 453 | if (key.unique_hashes[index] == 0) { |
| 451 | continue; | 454 | continue; |
| @@ -454,11 +457,22 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 454 | ++env_index; | 457 | ++env_index; |
| 455 | 458 | ||
| 456 | const u32 cfg_offset{static_cast<u32>(env.StartAddress() + sizeof(Shader::ProgramHeader))}; | 459 | const u32 cfg_offset{static_cast<u32>(env.StartAddress() + sizeof(Shader::ProgramHeader))}; |
| 457 | Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset); | 460 | Shader::Maxwell::Flow::CFG cfg(env, pools.flow_block, cfg_offset, index == 0); |
| 458 | programs[index] = TranslateProgram(pools.inst, pools.block, env, cfg); | 461 | if (!uses_vertex_a || index != 1) { |
| 462 | // Normal path | ||
| 463 | programs[index] = TranslateProgram(pools.inst, pools.block, env, cfg); | ||
| 459 | 464 | ||
| 460 | for (const auto& desc : programs[index].info.storage_buffers_descriptors) { | 465 | for (const auto& desc : programs[index].info.storage_buffers_descriptors) { |
| 461 | total_storage_buffers += desc.count; | 466 | total_storage_buffers += desc.count; |
| 467 | } | ||
| 468 | } else { | ||
| 469 | // VertexB path when VertexA is present. | ||
| 470 | Shader::IR::Program& program_va{programs[0]}; | ||
| 471 | Shader::IR::Program program_vb{TranslateProgram(pools.inst, pools.block, env, cfg)}; | ||
| 472 | for (const auto& desc : program_vb.info.storage_buffers_descriptors) { | ||
| 473 | total_storage_buffers += desc.count; | ||
| 474 | } | ||
| 475 | programs[index] = MergeDualVertexPrograms(program_va, program_vb, env); | ||
| 462 | } | 476 | } |
| 463 | } | 477 | } |
| 464 | const u32 glasm_storage_buffer_limit{device.GetMaxGLASMStorageBufferBlocks()}; | 478 | const u32 glasm_storage_buffer_limit{device.GetMaxGLASMStorageBufferBlocks()}; |
| @@ -472,7 +486,9 @@ std::unique_ptr<GraphicsPipeline> ShaderCache::CreateGraphicsPipeline( | |||
| 472 | if (!device.UseAssemblyShaders()) { | 486 | if (!device.UseAssemblyShaders()) { |
| 473 | source_program.handle = glCreateProgram(); | 487 | source_program.handle = glCreateProgram(); |
| 474 | } | 488 | } |
| 475 | for (size_t index = 0; index < Maxwell::MaxShaderProgram; ++index) { | 489 | |
| 490 | for (size_t index = uses_vertex_a && uses_vertex_b ? 1 : 0; index < Maxwell::MaxShaderProgram; | ||
| 491 | ++index) { | ||
| 476 | if (key.unique_hashes[index] == 0) { | 492 | if (key.unique_hashes[index] == 0) { |
| 477 | continue; | 493 | continue; |
| 478 | } | 494 | } |