From 37b8504faaeca9aaffd67649f5a026a900743431 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Tue, 7 Jan 2020 18:56:03 -0400 Subject: [PATCH] Shader_IR: Correct Custom Variable assignment. --- src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 2 ++ src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index df681bdcb0..2f2bb07a4f 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1336,6 +1336,8 @@ private: const std::string final_offset = fmt::format("({} - {}) >> 2", real, base); target = {fmt::format("{}[{}]", GetGlobalMemory(gmem->GetDescriptor()), final_offset), Type::Uint}; + } else if (const auto cv = std::get_if(&*dest)) { + target = {GetCustomVariable(cv->GetIndex()), Type::Float}; } else { UNREACHABLE_MSG("Assign called without a proper target"); } diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index bf797dad31..130060369b 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp @@ -1361,6 +1361,8 @@ private: target = {OpAccessChain(t_gmem_float, gmem_buffer, Constant(t_uint, 0), offset), Type::Float}; + } else if (const auto cv = std::get_if(&*dest)) { + target = {custom_variables.at(cv->GetIndex()), Type::Float}; } else { UNIMPLEMENTED(); }