diff options
-rw-r--r-- | src/video_core/engines/shader_bytecode.h | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index e285d097d..98af381df 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -247,6 +247,7 @@ static_assert(sizeof(OpCode) == 0x8, "Incorrect structure size"); namespace std { +// TODO(bunne): The below is forbidden by the C++ standard, but works fine. See #330. template <> struct make_unsigned<Tegra::Shader::Attribute> { using type = Tegra::Shader::Attribute; @@ -281,7 +282,6 @@ enum class SubOp : u64 { Rsq = 0x5, }; -#pragma pack(1) union Instruction { Instruction& operator=(const Instruction& instr) { hex = instr.hex; diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 6251a4be2..1290fa4cd 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -448,17 +448,19 @@ private: for (const auto& index : declr_input_attribute) { // TODO(bunnei): Use proper number of elements for these - declarations.AddLine( - "layout(location = " + std::to_string(static_cast<u32>(index) - 8) + ") in vec4 " + - GetInputAttribute(index) + ";"); + declarations.AddLine("layout(location = " + + std::to_string(static_cast<u32>(index) - + static_cast<u32>(Attribute::Index::Attribute_0)) + + ") in vec4 " + GetInputAttribute(index) + ";"); } declarations.AddLine(""); for (const auto& index : declr_output_attribute) { // TODO(bunnei): Use proper number of elements for these - declarations.AddLine( - "layout(location = " + std::to_string(static_cast<u32>(index) - 8) + ") out vec4 " + - GetOutputAttribute(index) + ";"); + declarations.AddLine("layout(location = " + + std::to_string(static_cast<u32>(index) - + static_cast<u32>(Attribute::Index::Attribute_0)) + + ") out vec4 " + GetOutputAttribute(index) + ";"); } declarations.AddLine(""); } |