From 661483f313a7dbbbebd4f233acecb06b6505a636 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Fri, 25 Dec 2020 23:34:38 -0300 Subject: renderer_vulkan/fixed_pipeline_state: Move enabled bindings to static state Without using VK_EXT_robustness2, we can't consider the 'enabled' (not null) vertex buffers as dynamic state, as this leads to invalid Vulkan state. Move this to static state that is always hashed and compared in the pipeline key. The bits for enabled vertex buffers are moved into the attribute state bitfield. This is not 'correct' as it's not an attribute state, but that struct has bits to spare, and it's used in an array of 32 elements (the exact same number of vertex buffer bindings). --- src/video_core/renderer_vulkan/fixed_pipeline_state.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/video_core/renderer_vulkan/fixed_pipeline_state.h') diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h index c26b77790..9b18301c1 100644 --- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h +++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h @@ -96,6 +96,8 @@ struct FixedPipelineState { BitField<6, 14, u32> offset; BitField<20, 3, u32> type; BitField<23, 6, u32> size; + // Not really an element of a vertex attribute, but it can be packed here + BitField<29, 1, u32> binding_index_enabled; constexpr Maxwell::VertexAttribute::Type Type() const noexcept { return static_cast(type.Value()); @@ -130,12 +132,6 @@ struct FixedPipelineState { } }; - union VertexBinding { - u16 raw; - BitField<0, 12, u16> stride; - BitField<12, 1, u16> enabled; - }; - struct DynamicState { union { u32 raw1; @@ -153,7 +149,8 @@ struct FixedPipelineState { BitField<0, 2, u32> cull_face; BitField<2, 1, u32> cull_enable; }; - std::array vertex_bindings; + // Vertex stride is a 12 bits value, we have 4 bits to spare per element + std::array vertex_strides; void Fill(const Maxwell& regs); -- cgit v1.2.3