From 367ca09f1dbb264717c2459a52bb50d89a9ff12a Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Mon, 7 Dec 2015 13:03:35 -0800 Subject: [PATCH] Don't duplicate vf bindings. --- src/xenia/gpu/glsl_shader_translator.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/xenia/gpu/glsl_shader_translator.cc b/src/xenia/gpu/glsl_shader_translator.cc index dfd46b786..85289576f 100644 --- a/src/xenia/gpu/glsl_shader_translator.cc +++ b/src/xenia/gpu/glsl_shader_translator.cc @@ -9,6 +9,8 @@ #include "xenia/gpu/glsl_shader_translator.h" +#include + namespace xe { namespace gpu { @@ -246,8 +248,16 @@ void main() { // Add vertex shader input declarations. if (is_vertex_shader()) { + std::unordered_set defined_locations; for (auto& binding : vertex_bindings()) { for (auto& attrib : binding.attributes) { + uint64_t key = (static_cast(binding.fetch_constant) << 32) | + attrib.fetch_instr.attributes.offset; + if (defined_locations.count(key)) { + // Already defined. + continue; + } + defined_locations.insert(key); const char* type_name = GetVertexFormatTypeName(attrib.fetch_instr.attributes.data_format); EmitSource("layout(location = %d) in %s vf%u_%d;\n",