Skip to content
Snippets Groups Projects
Commit d151d797 authored by Yuri Kunde Schlesner's avatar Yuri Kunde Schlesner
Browse files

Vertex Shader: Zero OutputVertex to avoid denormals

Unused OutputVertex attributes were being left un-initialized. The
leftover garbage sometimes decoded as floating-point denormalized
values, causing fallbacks to microcode and massive slowdowns in the rest
of the rasterization pipeline even though the results were unused. By
zeroing the structure we ensure these attributes only contain harmless
zeros.
parent 487a80f9
No related branches found
No related tags found
No related merge requests found
...@@ -469,6 +469,10 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) ...@@ -469,6 +469,10 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes)
// Setup output register table // Setup output register table
OutputVertex ret; OutputVertex ret;
// Zero output so that attributes which aren't output won't have denormals in them, which will
// slow us down later.
memset(&ret, 0, sizeof(ret));
for (int i = 0; i < 7; ++i) { for (int i = 0; i < 7; ++i) {
const auto& output_register_map = registers.vs_output_attributes[i]; const auto& output_register_map = registers.vs_output_attributes[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment