mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 05:16:24 -05:00
Merge pull request #4151 from ReinUsesLisp/gl-invalidations
gl_shader_cache: Avoid use after move for program size
This commit is contained in:
commit
5872fc21fe
2 changed files with 7 additions and 6 deletions
|
@ -460,8 +460,9 @@ Shader* ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) {
|
||||||
const u8* host_ptr_b = memory_manager.GetPointer(address_b);
|
const u8* host_ptr_b = memory_manager.GetPointer(address_b);
|
||||||
code_b = GetShaderCode(memory_manager, address_b, host_ptr_b, false);
|
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);
|
GetShaderType(program), program == Maxwell::ShaderProgram::VertexA, code, code_b);
|
||||||
|
|
||||||
const ShaderParameters params{system, disk_cache, device,
|
const ShaderParameters params{system, disk_cache, device,
|
||||||
|
@ -477,7 +478,7 @@ Shader* ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) {
|
||||||
|
|
||||||
Shader* const result = shader.get();
|
Shader* const result = shader.get();
|
||||||
if (cpu_addr) {
|
if (cpu_addr) {
|
||||||
Register(std::move(shader), *cpu_addr, code.size() * sizeof(u64));
|
Register(std::move(shader), *cpu_addr, code_size);
|
||||||
} else {
|
} else {
|
||||||
null_shader = std::move(shader);
|
null_shader = std::move(shader);
|
||||||
}
|
}
|
||||||
|
@ -495,8 +496,9 @@ Shader* ShaderCacheOpenGL::GetComputeKernel(GPUVAddr code_addr) {
|
||||||
|
|
||||||
const auto host_ptr{memory_manager.GetPointer(code_addr)};
|
const auto host_ptr{memory_manager.GetPointer(code_addr)};
|
||||||
// No kernel found, create a new one
|
// No kernel found, create a new one
|
||||||
auto code{GetShaderCode(memory_manager, code_addr, host_ptr, true)};
|
ProgramCode code{GetShaderCode(memory_manager, code_addr, host_ptr, true)};
|
||||||
const auto unique_identifier{GetUniqueIdentifier(ShaderType::Compute, false, code)};
|
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,
|
const ShaderParameters params{system, disk_cache, device,
|
||||||
*cpu_addr, host_ptr, unique_identifier};
|
*cpu_addr, host_ptr, unique_identifier};
|
||||||
|
@ -511,7 +513,7 @@ Shader* ShaderCacheOpenGL::GetComputeKernel(GPUVAddr code_addr) {
|
||||||
|
|
||||||
Shader* const result = kernel.get();
|
Shader* const result = kernel.get();
|
||||||
if (cpu_addr) {
|
if (cpu_addr) {
|
||||||
Register(std::move(kernel), *cpu_addr, code.size() * sizeof(u64));
|
Register(std::move(kernel), *cpu_addr, code_size);
|
||||||
} else {
|
} else {
|
||||||
null_kernel = std::move(kernel);
|
null_kernel = std::move(kernel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ namespace OpenGL {
|
||||||
|
|
||||||
class Device;
|
class Device;
|
||||||
class RasterizerOpenGL;
|
class RasterizerOpenGL;
|
||||||
struct UnspecializedShader;
|
|
||||||
|
|
||||||
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue