From a51874a92b214522c125ae278f6b543d4d4b1971 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sun, 25 Jan 2026 00:59:04 +0000 Subject: [PATCH] FUCK YOUUUUUUUUUUUUUUUUUU --- .../renderer_vulkan/fixed_pipeline_state.cpp | 6 ++++-- .../renderer_vulkan/fixed_pipeline_state.h | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp index e8f2d7ed5d..dc3f471437 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.cpp @@ -116,11 +116,13 @@ void FixedPipelineState::Refresh(Tegra::Engines::Maxwell3D& maxwell3d, DynamicFe // We sparsely store the bits for each of them, so if they clash we don't deal // with the fixed pipeline taking in invalid vertices! :) const auto& attrs = regs.vertex_attrib_format; - attribute_types[0] = attribute_types[1] = attribute_types[2] = attribute_types[3] = 0; + attribute_types[0] = 0; + attribute_types[1] = 0; + attribute_types[2] = 0; static_assert(Maxwell::NumVertexAttributes == 32); for (size_t i = 0; i < Maxwell::NumVertexAttributes; ++i) { u32 const mask = attrs[i].constant != 0 ? 0 : 0x07; // non-constant equates invalid - u32 const type = size_t(attrs[i].type.Value()); + u32 const type = u32(attrs[i].type.Value()); attribute_types[0] |= u64((type >> 0) & 1) << i; attribute_types[1] |= u64((type >> 1) & 1) << i; attribute_types[2] |= u64((type >> 2) & 1) << i; diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h index b181a71dae..f302408580 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h @@ -225,10 +225,10 @@ struct FixedPipelineState { u32 point_size; std::array viewport_swizzles; - union { - std::array attribute_types; // Used with VK_EXT_vertex_input_dynamic_state - u64 enabled_divisors; - }; + + // TODO: this has to be trivially constructuible and both are mutually exclusive + std::array attribute_types; // Used with VK_EXT_vertex_input_dynamic_state + u64 enabled_divisors; DynamicState dynamic_state; std::array attachments; @@ -277,9 +277,9 @@ struct FixedPipelineState { } u32 DynamicAttributeType(size_t i) const noexcept { - return (((attribute_types[0] >> i) & 1) << 0) + return u32((((attribute_types[0] >> i) & 1) << 0) | (((attribute_types[1] >> i) & 1) << 1) - | (((attribute_types[2] >> i) & 1) << 2); + | (((attribute_types[2] >> i) & 1) << 2)); } }; static_assert(std::has_unique_object_representations_v);