summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorRodrigo Locatti <reinuseslisp@airmail.cc>2020-06-26 02:05:27 +0200
committerGitHub <noreply@github.com>2020-06-26 02:05:27 +0200
commit5872fc21fecf3e4993c5bd1110146974a45c16e4 (patch)
tree2deb2e364b0666077311b495e44e669f923a19cd /src/video_core
parentMerge pull request #4136 from VolcaEM/mods (diff)
parentgl_shader_cache: Avoid use after move for program size (diff)
downloadyuzu-5872fc21fecf3e4993c5bd1110146974a45c16e4.tar
yuzu-5872fc21fecf3e4993c5bd1110146974a45c16e4.tar.gz
yuzu-5872fc21fecf3e4993c5bd1110146974a45c16e4.tar.bz2
yuzu-5872fc21fecf3e4993c5bd1110146974a45c16e4.tar.lz
yuzu-5872fc21fecf3e4993c5bd1110146974a45c16e4.tar.xz
yuzu-5872fc21fecf3e4993c5bd1110146974a45c16e4.tar.zst
yuzu-5872fc21fecf3e4993c5bd1110146974a45c16e4.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.h1
2 files changed, 7 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 46e780a06..c6a3bf3a1 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -460,8 +460,9 @@ Shader* ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) {
const u8* host_ptr_b = memory_manager.GetPointer(address_b);
code_b = GetShaderCode(memory_manager, address_b, host_ptr_b, false);
}
+ const std::size_t code_size = code.size() * sizeof(u64);
- const auto unique_identifier = GetUniqueIdentifier(
+ const u64 unique_identifier = GetUniqueIdentifier(
GetShaderType(program), program == Maxwell::ShaderProgram::VertexA, code, code_b);
const ShaderParameters params{system, disk_cache, device,
@@ -477,7 +478,7 @@ Shader* ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) {
Shader* const result = shader.get();
if (cpu_addr) {
- Register(std::move(shader), *cpu_addr, code.size() * sizeof(u64));
+ Register(std::move(shader), *cpu_addr, code_size);
} else {
null_shader = std::move(shader);
}
@@ -495,8 +496,9 @@ Shader* ShaderCacheOpenGL::GetComputeKernel(GPUVAddr code_addr) {
const auto host_ptr{memory_manager.GetPointer(code_addr)};
// No kernel found, create a new one
- auto code{GetShaderCode(memory_manager, code_addr, host_ptr, true)};
- const auto unique_identifier{GetUniqueIdentifier(ShaderType::Compute, false, code)};
+ ProgramCode code{GetShaderCode(memory_manager, code_addr, host_ptr, true)};
+ const std::size_t code_size{code.size() * sizeof(u64)};
+ const u64 unique_identifier{GetUniqueIdentifier(ShaderType::Compute, false, code)};
const ShaderParameters params{system, disk_cache, device,
*cpu_addr, host_ptr, unique_identifier};
@@ -511,7 +513,7 @@ Shader* ShaderCacheOpenGL::GetComputeKernel(GPUVAddr code_addr) {
Shader* const result = kernel.get();
if (cpu_addr) {
- Register(std::move(kernel), *cpu_addr, code.size() * sizeof(u64));
+ Register(std::move(kernel), *cpu_addr, code_size);
} else {
null_kernel = std::move(kernel);
}
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.h b/src/video_core/renderer_opengl/gl_shader_cache.h
index 6848f1388..994aaeaf2 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.h
+++ b/src/video_core/renderer_opengl/gl_shader_cache.h
@@ -37,7 +37,6 @@ namespace OpenGL {
class Device;
class RasterizerOpenGL;
-struct UnspecializedShader;
using Maxwell = Tegra::Engines::Maxwell3D::Regs;