feat(shader): impl ir metadata eq operators

This commit is contained in:
boykopovar
2026-09-18 12:33:02 +03:00
parent bb2ce84019
commit 3326614308
7 changed files with 16 additions and 54 deletions
@@ -6,7 +6,6 @@
#include <array>
#include <cstdint>
#include <optional>
#include <stdexcept>
#include <vector>
namespace ShaderRecompiler {
@@ -28,27 +27,21 @@ struct DescriptorSource {
std::uint32_t selectorOffset = 0;
std::uint32_t keyArg = 0;
bool operator==(const IndirectImage& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const IndirectImage& other) const = default;
};
std::array<IrValue*, 8> dwords {};
std::uint32_t dwordCount = 0;
std::optional<IndirectImage> indirectImage;
bool operator==(const DescriptorSource& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const DescriptorSource& other) const = default;
};
struct SrtRead {
IrValue* value = nullptr;
std::uint32_t flatOffset = 0;
bool operator==(const SrtRead& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const SrtRead& other) const = default;
};
struct ResourceBlock {
@@ -43,9 +43,7 @@ struct IrDescriptorBinding {
DescriptorBindingKind kind = DescriptorBindingKind::Buffers;
std::vector<std::uint32_t> resources;
bool operator==(const IrDescriptorBinding& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const IrDescriptorBinding& other) const = default;
};
struct IrBindingLayout {
@@ -65,9 +63,7 @@ struct IrBindingLayout {
throw std::runtime_error("AdvancePushData not implemented");
}
bool operator==(const IrBindingLayout& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const IrBindingLayout& other) const = default;
};
}
@@ -3,7 +3,6 @@
#include "RdnaDecoder/RdnaInstruction.hpp"
#include <cstdint>
#include <stdexcept>
namespace ShaderRecompiler {
@@ -47,9 +46,7 @@ struct MemoryInfo {
bool offen = false;
bool planningOnly = false;
bool operator==(const MemoryInfo& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const MemoryInfo& other) const = default;
};
enum class ExportTargetKind { Unknown, Null, Position, Primitive, Parameter, Mrt, MrtZ };
@@ -63,9 +60,7 @@ struct ExportInfo {
bool compr = false;
bool vm = false;
bool operator==(const ExportInfo& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const ExportInfo& other) const = default;
};
}
@@ -10,7 +10,6 @@
#include <array>
#include <cstdint>
#include <memory>
#include <stdexcept>
#include <vector>
namespace ShaderRecompiler {
@@ -19,9 +18,7 @@ struct DescriptorValue {
std::array<std::uint32_t, 8> dwords = {};
std::uint32_t dwordCount = 0;
bool operator==(const DescriptorValue& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const DescriptorValue& other) const = default;
};
enum class UniformFillKind { None, Buffer, Image };
@@ -33,9 +30,7 @@ struct UniformFill {
std::uint32_t words = 0;
std::uint32_t value = 0;
bool operator==(const UniformFill& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const UniformFill& other) const = default;
};
struct ResourceSnapshot {
@@ -6,7 +6,6 @@
#include "RdnaDecoder/RdnaInstruction.hpp"
#include <cstdint>
#include <limits>
#include <stdexcept>
#include <vector>
namespace ShaderRecompiler {
@@ -27,9 +26,7 @@ struct BufferResource {
bool formatted = false;
bool scalar = false;
bool operator==(const BufferResource& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const BufferResource& other) const = default;
};
enum class ImageMipMode { None, DynamicStorage };
@@ -57,9 +54,7 @@ struct ImageResource {
std::uint32_t indirectSearchIterations = 0;
std::vector<std::uint32_t> indirectResources;
bool operator==(const ImageResource& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const ImageResource& other) const = default;
};
struct SamplerResource {
@@ -68,9 +63,7 @@ struct SamplerResource {
bool forcePointFiltering = false;
bool depthCompare = false;
bool operator==(const SamplerResource& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const SamplerResource& other) const = default;
};
struct SampledResourcePair {
@@ -78,9 +71,7 @@ struct SampledResourcePair {
std::uint32_t sampler = 0;
std::uint32_t firstUsePc = 0;
bool operator==(const SampledResourcePair& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const SampledResourcePair& other) const = default;
};
}
@@ -5,7 +5,6 @@
#include "IntermediateRepresentation/IrMetadata/StageIO.hpp"
#include <array>
#include <cstdint>
#include <stdexcept>
#include <vector>
namespace ShaderRecompiler {
@@ -30,9 +29,7 @@ struct ShaderInfo {
bool hasBitwiseXor = false;
bool usesDma = false;
bool operator==(const ShaderInfo& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const ShaderInfo& other) const = default;
};
}
@@ -3,7 +3,6 @@
#include <cstdint>
#include <limits>
#include <stdexcept>
#include <string>
namespace ShaderRecompiler {
@@ -65,9 +64,7 @@ struct StageInput {
std::string debugName;
bool perVertex = false;
bool operator==(const StageInput& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const StageInput& other) const = default;
};
struct StageOutput {
@@ -76,9 +73,7 @@ struct StageOutput {
std::uint32_t location = 0;
std::string debugName;
bool operator==(const StageOutput& other) const {
throw std::runtime_error("operator== not implemented");
}
bool operator==(const StageOutput& other) const = default;
};
}