summaryrefslogtreecommitdiff
path: root/src/video_core/vertex_shader.cpp
diff options
context:
space:
mode:
authorGravatar Subv2015-04-11 13:53:35 -0500
committerGravatar Subv2015-05-06 18:11:46 -0500
commit0e5ca080a86a6e393eab1a11075561a62a2e01f9 (patch)
treecf37d6291c720f06311a5403acb37d5b6a82d18e /src/video_core/vertex_shader.cpp
parentMerge pull request #683 from bunnei/thread-priority (diff)
downloadyuzu-0e5ca080a86a6e393eab1a11075561a62a2e01f9.tar.gz
yuzu-0e5ca080a86a6e393eab1a11075561a62a2e01f9.tar.xz
yuzu-0e5ca080a86a6e393eab1a11075561a62a2e01f9.zip
GPU: Implemented default vertex shader attributes.
Fixes some games crashing.
Diffstat (limited to 'src/video_core/vertex_shader.cpp')
-rw-r--r--src/video_core/vertex_shader.cpp39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index e8d865172..51f4e58bf 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -35,6 +35,8 @@ static struct {
35 std::array<Math::Vec4<u8>,4> i; 35 std::array<Math::Vec4<u8>,4> i;
36} shader_uniforms; 36} shader_uniforms;
37 37
38static Math::Vec4<float24> vs_default_attributes[16];
39
38// TODO: Not sure where the shader binary and swizzle patterns are supposed to be loaded to! 40// TODO: Not sure where the shader binary and swizzle patterns are supposed to be loaded to!
39// For now, we just keep these local arrays around. 41// For now, we just keep these local arrays around.
40static std::array<u32, 1024> shader_memory; 42static std::array<u32, 1024> shader_memory;
@@ -60,6 +62,10 @@ Math::Vec4<u8>& GetIntUniform(u32 index) {
60 return shader_uniforms.i[index]; 62 return shader_uniforms.i[index];
61} 63}
62 64
65Math::Vec4<float24>& GetDefaultAttribute(u32 index) {
66 return vs_default_attributes[index];
67}
68
63const std::array<u32, 1024>& GetShaderBinary() { 69const std::array<u32, 1024>& GetShaderBinary() {
64 return shader_memory; 70 return shader_memory;
65} 71}
@@ -568,22 +574,23 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) {
568 const auto& attribute_register_map = registers.vs_input_register_map; 574 const auto& attribute_register_map = registers.vs_input_register_map;
569 float24 dummy_register; 575 float24 dummy_register;
570 boost::fill(state.input_register_table, &dummy_register); 576 boost::fill(state.input_register_table, &dummy_register);
571 if(num_attributes > 0) state.input_register_table[attribute_register_map.attribute0_register] = &input.attr[0].x; 577
572 if(num_attributes > 1) state.input_register_table[attribute_register_map.attribute1_register] = &input.attr[1].x; 578 if (num_attributes > 0) state.input_register_table[attribute_register_map.attribute0_register] = &input.attr[0].x;
573 if(num_attributes > 2) state.input_register_table[attribute_register_map.attribute2_register] = &input.attr[2].x; 579 if (num_attributes > 1) state.input_register_table[attribute_register_map.attribute1_register] = &input.attr[1].x;
574 if(num_attributes > 3) state.input_register_table[attribute_register_map.attribute3_register] = &input.attr[3].x; 580 if (num_attributes > 2) state.input_register_table[attribute_register_map.attribute2_register] = &input.attr[2].x;
575 if(num_attributes > 4) state.input_register_table[attribute_register_map.attribute4_register] = &input.attr[4].x; 581 if (num_attributes > 3) state.input_register_table[attribute_register_map.attribute3_register] = &input.attr[3].x;
576 if(num_attributes > 5) state.input_register_table[attribute_register_map.attribute5_register] = &input.attr[5].x; 582 if (num_attributes > 4) state.input_register_table[attribute_register_map.attribute4_register] = &input.attr[4].x;
577 if(num_attributes > 6) state.input_register_table[attribute_register_map.attribute6_register] = &input.attr[6].x; 583 if (num_attributes > 5) state.input_register_table[attribute_register_map.attribute5_register] = &input.attr[5].x;
578 if(num_attributes > 7) state.input_register_table[attribute_register_map.attribute7_register] = &input.attr[7].x; 584 if (num_attributes > 6) state.input_register_table[attribute_register_map.attribute6_register] = &input.attr[6].x;
579 if(num_attributes > 8) state.input_register_table[attribute_register_map.attribute8_register] = &input.attr[8].x; 585 if (num_attributes > 7) state.input_register_table[attribute_register_map.attribute7_register] = &input.attr[7].x;
580 if(num_attributes > 9) state.input_register_table[attribute_register_map.attribute9_register] = &input.attr[9].x; 586 if (num_attributes > 8) state.input_register_table[attribute_register_map.attribute8_register] = &input.attr[8].x;
581 if(num_attributes > 10) state.input_register_table[attribute_register_map.attribute10_register] = &input.attr[10].x; 587 if (num_attributes > 9) state.input_register_table[attribute_register_map.attribute9_register] = &input.attr[9].x;
582 if(num_attributes > 11) state.input_register_table[attribute_register_map.attribute11_register] = &input.attr[11].x; 588 if (num_attributes > 10) state.input_register_table[attribute_register_map.attribute10_register] = &input.attr[10].x;
583 if(num_attributes > 12) state.input_register_table[attribute_register_map.attribute12_register] = &input.attr[12].x; 589 if (num_attributes > 11) state.input_register_table[attribute_register_map.attribute11_register] = &input.attr[11].x;
584 if(num_attributes > 13) state.input_register_table[attribute_register_map.attribute13_register] = &input.attr[13].x; 590 if (num_attributes > 12) state.input_register_table[attribute_register_map.attribute12_register] = &input.attr[12].x;
585 if(num_attributes > 14) state.input_register_table[attribute_register_map.attribute14_register] = &input.attr[14].x; 591 if (num_attributes > 13) state.input_register_table[attribute_register_map.attribute13_register] = &input.attr[13].x;
586 if(num_attributes > 15) state.input_register_table[attribute_register_map.attribute15_register] = &input.attr[15].x; 592 if (num_attributes > 14) state.input_register_table[attribute_register_map.attribute14_register] = &input.attr[14].x;
593 if (num_attributes > 15) state.input_register_table[attribute_register_map.attribute15_register] = &input.attr[15].x;
587 594
588 state.conditional_code[0] = false; 595 state.conditional_code[0] = false;
589 state.conditional_code[1] = false; 596 state.conditional_code[1] = false;