diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2016-12-19 08:42:29 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2017-01-30 06:31:38 +0100 |
commit | 8ed9f9d49f716487f14736c48a7850129a5910ba (patch) | |
tree | 6726dd4b1a8618a7bd76b3d8fac7069ac65ca410 /src/video_core | |
parent | Common: Optimize BitSet iterator (diff) | |
download | yuzu-8ed9f9d49f716487f14736c48a7850129a5910ba.tar yuzu-8ed9f9d49f716487f14736c48a7850129a5910ba.tar.gz yuzu-8ed9f9d49f716487f14736c48a7850129a5910ba.tar.bz2 yuzu-8ed9f9d49f716487f14736c48a7850129a5910ba.tar.lz yuzu-8ed9f9d49f716487f14736c48a7850129a5910ba.tar.xz yuzu-8ed9f9d49f716487f14736c48a7850129a5910ba.tar.zst yuzu-8ed9f9d49f716487f14736c48a7850129a5910ba.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/pica.h | 3 | ||||
-rw-r--r-- | src/video_core/shader/shader.cpp | 23 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h index ac81a3d0f..e326f7727 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h @@ -99,7 +99,8 @@ struct Regs { TEXCOORD1_U = 14, TEXCOORD1_V = 15, - // TODO: Not verified + TEXCOORD0_W = 16, + VIEW_X = 18, VIEW_Y = 19, VIEW_Z = 20, diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 99a22c2dd..2c6e45ac4 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp @@ -22,23 +22,28 @@ namespace Shader { OutputVertex OutputVertex::FromAttributeBuffer(const Regs& regs, AttributeBuffer& input) { // Setup output data - OutputVertex ret; + union { + OutputVertex ret{}; + std::array<float24, 24> vertex_slots; + }; + static_assert(sizeof(vertex_slots) <= sizeof(ret), "Struct and array have different sizes."); unsigned int num_attributes = regs.vs_output_total; + ASSERT(num_attributes <= 7); for (unsigned int i = 0; i < num_attributes; ++i) { const auto& output_register_map = regs.vs_output_attributes[i]; - u32 semantics[4] = {output_register_map.map_x, output_register_map.map_y, - output_register_map.map_z, output_register_map.map_w}; + Regs::VSOutputAttributes::Semantic semantics[4] = { + output_register_map.map_x, output_register_map.map_y, output_register_map.map_z, + output_register_map.map_w}; for (unsigned comp = 0; comp < 4; ++comp) { - float24* out = ((float24*)&ret) + semantics[comp]; - if (semantics[comp] != Regs::VSOutputAttributes::INVALID) { + Regs::VSOutputAttributes::Semantic semantic = semantics[comp]; + float24* out = &vertex_slots[semantic]; + if (semantic < vertex_slots.size()) { *out = input.attr[i][comp]; - } else { - // Zero output so that attributes which aren't output won't have denormals in them, - // which would slow us down later. - memset(out, 0, sizeof(*out)); + } else if (semantic != Regs::VSOutputAttributes::INVALID) { + LOG_ERROR(HW_GPU, "Invalid/unknown semantic id: %u", (unsigned int)semantic); } } } |