summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-04-16 05:34:03 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2019-04-16 05:34:03 +0200
commit6fc562a9aa1c89c793e71390790796e46b7c0cb0 (patch)
treef533beba60efb7255da4965315da3cd177fda9c1
parentUse ReadBlockUnsafe on TIC and TSC reading (diff)
downloadyuzu-6fc562a9aa1c89c793e71390790796e46b7c0cb0.tar
yuzu-6fc562a9aa1c89c793e71390790796e46b7c0cb0.tar.gz
yuzu-6fc562a9aa1c89c793e71390790796e46b7c0cb0.tar.bz2
yuzu-6fc562a9aa1c89c793e71390790796e46b7c0cb0.tar.lz
yuzu-6fc562a9aa1c89c793e71390790796e46b7c0cb0.tar.xz
yuzu-6fc562a9aa1c89c793e71390790796e46b7c0cb0.tar.zst
yuzu-6fc562a9aa1c89c793e71390790796e46b7c0cb0.zip
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp12
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) {
}
/// Gets the shader program code from memory for the specified address
-ProgramCode GetShaderCode(const u8* host_ptr) {
+ProgramCode GetShaderCode(const GPUVAddr gpu_addr, const u8* host_ptr) {
+ auto& memory_manager{Core::System::GetInstance().GPU().MemoryManager()};
ProgramCode program_code(VideoCommon::Shader::MAX_PROGRAM_LENGTH);
ASSERT_OR_EXECUTE(host_ptr != nullptr, {
std::fill(program_code.begin(), program_code.end(), 0);
return program_code;
});
- std::memcpy(program_code.data(), host_ptr, program_code.size() * sizeof(u64));
+ memory_manager.ReadBlockUnsafe(gpu_addr, program_code.data(), program_code.size() * sizeof(u64));
return program_code;
}
@@ -497,11 +498,12 @@ Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) {
if (!shader) {
// No shader found - create a new one
- ProgramCode program_code{GetShaderCode(host_ptr)};
+ ProgramCode program_code{GetShaderCode(program_addr, host_ptr)};
ProgramCode program_code_b;
if (program == Maxwell::ShaderProgram::VertexA) {
- program_code_b = GetShaderCode(
- memory_manager.GetPointer(GetShaderAddress(Maxwell::ShaderProgram::VertexB)));
+ const GPUVAddr program_addr_b{GetShaderAddress(Maxwell::ShaderProgram::VertexB)};
+ program_code_b =
+ GetShaderCode(program_addr_b, memory_manager.GetPointer(program_addr_b));
}
const u64 unique_identifier = GetUniqueIdentifier(program, program_code, program_code_b);
const VAddr cpu_addr{*memory_manager.GpuToCpuAddress(program_addr)};