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 509558fc0..eb1db0778 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -121,15 +121,23 @@ OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attr
121 OutputVertex ret; 121 OutputVertex ret;
122 // TODO(neobrain): Under some circumstances, up to 16 attributes may be output. We need to 122 // TODO(neobrain): Under some circumstances, up to 16 attributes may be output. We need to
123 // figure out what those circumstances are and enable the remaining outputs then. 123 // figure out what those circumstances are and enable the remaining outputs then.
124 for (int i = 0; i < 7; ++i) { 124 unsigned index = 0;
125 const auto& output_register_map = g_state.regs.vs_output_attributes[i]; // TODO: Don't hardcode VS here 125 for (unsigned i = 0; i < 7; ++i) {
126
127 if (index >= g_state.regs.vs_output_total)
128 break;
129
130 if ((g_state.regs.vs.output_mask & (1 << i)) == 0)
131 continue;
132
133 const auto& output_register_map = g_state.regs.vs_output_attributes[index]; // TODO: Don't hardcode VS here
126 134
127 u32 semantics[4] = { 135 u32 semantics[4] = {
128 output_register_map.map_x, output_register_map.map_y, 136 output_register_map.map_x, output_register_map.map_y,
129 output_register_map.map_z, output_register_map.map_w 137 output_register_map.map_z, output_register_map.map_w
130 }; 138 };
131 139
132 for (int comp = 0; comp < 4; ++comp) { 140 for (unsigned comp = 0; comp < 4; ++comp) {
133 float24* out = ((float24*)&ret) + semantics[comp]; 141 float24* out = ((float24*)&ret) + semantics[comp];
134 if (semantics[comp] != Regs::VSOutputAttributes::INVALID) { 142 if (semantics[comp] != Regs::VSOutputAttributes::INVALID) {
135 *out = state.registers.output[i][comp]; 143 *out = state.registers.output[i][comp];
@@ -139,10 +147,12 @@ OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attr
139 memset(out, 0, sizeof(*out)); 147 memset(out, 0, sizeof(*out));
140 } 148 }
141 } 149 }
150
151 index++;
142 } 152 }
143 153
144 // The hardware takes the absolute and saturates vertex colors like this, *before* doing interpolation 154 // The hardware takes the absolute and saturates vertex colors like this, *before* doing interpolation
145 for (int i = 0; i < 4; ++i) { 155 for (unsigned i = 0; i < 4; ++i) {
146 ret.color[i] = float24::FromFloat32( 156 ret.color[i] = float24::FromFloat32(
147 std::fmin(std::fabs(ret.color[i].ToFloat32()), 1.0f)); 157 std::fmin(std::fabs(ret.color[i].ToFloat32()), 1.0f));
148 } 158 }