summaryrefslogtreecommitdiff
path: root/src/video_core/shader/shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/shader/shader.cpp')
-rw-r--r--src/video_core/shader/shader.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp
index 5e8930476..dbb8fd804 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -109,15 +109,23 @@ OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attr
109 OutputVertex ret; 109 OutputVertex ret;
110 // TODO(neobrain): Under some circumstances, up to 16 attributes may be output. We need to 110 // TODO(neobrain): Under some circumstances, up to 16 attributes may be output. We need to
111 // figure out what those circumstances are and enable the remaining outputs then. 111 // figure out what those circumstances are and enable the remaining outputs then.
112 for (int i = 0; i < 7; ++i) { 112 unsigned index = 0;
113 const auto& output_register_map = g_state.regs.vs_output_attributes[i]; // TODO: Don't hardcode VS here 113 for (unsigned i = 0; i < 7; ++i) {
114
115 if (index >= g_state.regs.vs_output_total)
116 break;
117
118 if ((g_state.regs.vs.output_mask & (1 << i)) == 0)
119 continue;
120
121 const auto& output_register_map = g_state.regs.vs_output_attributes[index]; // TODO: Don't hardcode VS here
114 122
115 u32 semantics[4] = { 123 u32 semantics[4] = {
116 output_register_map.map_x, output_register_map.map_y, 124 output_register_map.map_x, output_register_map.map_y,
117 output_register_map.map_z, output_register_map.map_w 125 output_register_map.map_z, output_register_map.map_w
118 }; 126 };
119 127
120 for (int comp = 0; comp < 4; ++comp) { 128 for (unsigned comp = 0; comp < 4; ++comp) {
121 float24* out = ((float24*)&ret) + semantics[comp]; 129 float24* out = ((float24*)&ret) + semantics[comp];
122 if (semantics[comp] != Regs::VSOutputAttributes::INVALID) { 130 if (semantics[comp] != Regs::VSOutputAttributes::INVALID) {
123 *out = state.registers.output[i][comp]; 131 *out = state.registers.output[i][comp];
@@ -127,10 +135,12 @@ OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attr
127 memset(out, 0, sizeof(*out)); 135 memset(out, 0, sizeof(*out));
128 } 136 }
129 } 137 }
138
139 index++;
130 } 140 }
131 141
132 // The hardware takes the absolute and saturates vertex colors like this, *before* doing interpolation 142 // The hardware takes the absolute and saturates vertex colors like this, *before* doing interpolation
133 for (int i = 0; i < 4; ++i) { 143 for (unsigned i = 0; i < 4; ++i) {
134 ret.color[i] = float24::FromFloat32( 144 ret.color[i] = float24::FromFloat32(
135 std::fmin(std::fabs(ret.color[i].ToFloat32()), 1.0f)); 145 std::fmin(std::fabs(ret.color[i].ToFloat32()), 1.0f));
136 } 146 }