video_core: Fix some struct comparisons. (#3450)

This commit is contained in:
squidbus
2025-08-23 17:16:52 -07:00
committed by GitHub
parent 6dd2b3090c
commit 6590f07772
3 changed files with 22 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ struct VsAttribSpecialization {
AmdGpu::NumberClass num_class{}; AmdGpu::NumberClass num_class{};
AmdGpu::CompMapping dst_select{}; AmdGpu::CompMapping dst_select{};
auto operator<=>(const VsAttribSpecialization&) const = default; bool operator==(const VsAttribSpecialization&) const = default;
}; };
struct BufferSpecialization { struct BufferSpecialization {
@@ -52,21 +52,21 @@ struct ImageSpecialization {
AmdGpu::CompMapping dst_select{}; AmdGpu::CompMapping dst_select{};
AmdGpu::NumberConversion num_conversion{}; AmdGpu::NumberConversion num_conversion{};
auto operator<=>(const ImageSpecialization&) const = default; bool operator==(const ImageSpecialization&) const = default;
}; };
struct FMaskSpecialization { struct FMaskSpecialization {
u32 width; u32 width;
u32 height; u32 height;
auto operator<=>(const FMaskSpecialization&) const = default; bool operator==(const FMaskSpecialization&) const = default;
}; };
struct SamplerSpecialization { struct SamplerSpecialization {
u8 force_unnormalized : 1; u8 force_unnormalized : 1;
u8 force_degamma : 1; u8 force_degamma : 1;
auto operator<=>(const SamplerSpecialization&) const = default; bool operator==(const SamplerSpecialization&) const = default;
}; };
/** /**

View File

@@ -56,6 +56,10 @@ struct GraphicsPipelineKey {
u32 depth_clip_enable : 1; u32 depth_clip_enable : 1;
}; };
GraphicsPipelineKey() {
std::memset(this, 0, sizeof(*this));
}
bool operator==(const GraphicsPipelineKey& key) const noexcept { bool operator==(const GraphicsPipelineKey& key) const noexcept {
return std::memcmp(this, &key, sizeof(key)) == 0; return std::memcmp(this, &key, sizeof(key)) == 0;
} }

View File

@@ -20,15 +20,20 @@ namespace Vulkan {
class Instance; class Instance;
struct RenderState { struct RenderState {
std::array<vk::RenderingAttachmentInfo, 8> color_attachments{}; std::array<vk::RenderingAttachmentInfo, 8> color_attachments;
vk::RenderingAttachmentInfo depth_attachment{}; vk::RenderingAttachmentInfo depth_attachment;
vk::RenderingAttachmentInfo stencil_attachment{}; vk::RenderingAttachmentInfo stencil_attachment;
u32 num_color_attachments{}; u32 num_color_attachments;
u32 num_layers{1}; u32 num_layers;
bool has_depth{}; bool has_depth;
bool has_stencil{}; bool has_stencil;
u32 width{}; u32 width;
u32 height{}; u32 height;
RenderState() {
std::memset(this, 0, sizeof(*this));
num_layers = 1;
}
bool operator==(const RenderState& other) const noexcept { bool operator==(const RenderState& other) const noexcept {
return std::memcmp(this, &other, sizeof(RenderState)) == 0; return std::memcmp(this, &other, sizeof(RenderState)) == 0;