diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 12 |
1 files changed, 7 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 99f67494c..90598e291 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -38,13 +38,14 @@ GPUVAddr GetShaderAddress(Maxwell::ShaderProgram program) { | |||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | /// Gets the shader program code from memory for the specified address | 40 | /// Gets the shader program code from memory for the specified address |
| 41 | ProgramCode GetShaderCode(const u8* host_ptr) { | 41 | ProgramCode GetShaderCode(const GPUVAddr gpu_addr, const u8* host_ptr) { |
| 42 | auto& memory_manager{Core::System::GetInstance().GPU().MemoryManager()}; | ||
| 42 | ProgramCode program_code(VideoCommon::Shader::MAX_PROGRAM_LENGTH); | 43 | ProgramCode program_code(VideoCommon::Shader::MAX_PROGRAM_LENGTH); |
| 43 | ASSERT_OR_EXECUTE(host_ptr != nullptr, { | 44 | ASSERT_OR_EXECUTE(host_ptr != nullptr, { |
| 44 | std::fill(program_code.begin(), program_code.end(), 0); | 45 | std::fill(program_code.begin(), program_code.end(), 0); |
| 45 | return program_code; | 46 | return program_code; |
| 46 | }); | 47 | }); |
| 47 | std::memcpy(program_code.data(), host_ptr, program_code.size() * sizeof(u64)); | 48 | memory_manager.ReadBlockUnsafe(gpu_addr, program_code.data(), program_code.size() * sizeof(u64)); |
| 48 | return program_code; | 49 | return program_code; |
| 49 | } | 50 | } |
| 50 | 51 | ||
| @@ -497,11 +498,12 @@ Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) { | |||
| 497 | 498 | ||
| 498 | if (!shader) { | 499 | if (!shader) { |
| 499 | // No shader found - create a new one | 500 | // No shader found - create a new one |
| 500 | ProgramCode program_code{GetShaderCode(host_ptr)}; | 501 | ProgramCode program_code{GetShaderCode(program_addr, host_ptr)}; |
| 501 | ProgramCode program_code_b; | 502 | ProgramCode program_code_b; |
| 502 | if (program == Maxwell::ShaderProgram::VertexA) { | 503 | if (program == Maxwell::ShaderProgram::VertexA) { |
| 503 | program_code_b = GetShaderCode( | 504 | const GPUVAddr program_addr_b{GetShaderAddress(Maxwell::ShaderProgram::VertexB)}; |
| 504 | memory_manager.GetPointer(GetShaderAddress(Maxwell::ShaderProgram::VertexB))); | 505 | program_code_b = |
| 506 | GetShaderCode(program_addr_b, memory_manager.GetPointer(program_addr_b)); | ||
| 505 | } | 507 | } |
| 506 | const u64 unique_identifier = GetUniqueIdentifier(program, program_code, program_code_b); | 508 | const u64 unique_identifier = GetUniqueIdentifier(program, program_code, program_code_b); |
| 507 | const VAddr cpu_addr{*memory_manager.GpuToCpuAddress(program_addr)}; | 509 | const VAddr cpu_addr{*memory_manager.GpuToCpuAddress(program_addr)}; |