Skip to content

Commit

Permalink
reflect: derive eq for types and handles
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran committed Sep 4, 2024
1 parent e368538 commit bbcaf59
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spirv-cross2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spirv-cross2"
version = "0.3.2"
version = "0.3.3"
edition = "2021"

license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion spirv-cross2/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<T> Debug for PointerOnlyForComparison<T> {
///
/// The usage of `Handle<T>` ensures that item IDs can not be forged from
/// a different compiler instance or from a `u32`.
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Handle<T> {
id: T,
tag: PointerOnlyForComparison<spvc_compiler_s>,
Expand Down
18 changes: 9 additions & 9 deletions spirv-cross2/src/reflect/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::string::ContextStr;
use spirv_cross_sys as sys;

/// The kind of scalar
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[repr(u8)]
pub enum ScalarKind {
/// Signed integer.
Expand All @@ -24,7 +24,7 @@ pub enum ScalarKind {
}

/// The bit width of a scalar.
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[repr(u8)]
pub enum BitWidth {
/// 1 bit
Expand All @@ -40,7 +40,7 @@ pub enum BitWidth {
}

/// A scalar type.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Scalar {
/// How the value’s bits are to be interpreted.
pub kind: ScalarKind,
Expand Down Expand Up @@ -123,7 +123,7 @@ pub struct Type<'a> {
}

/// Type definition for a struct member.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct StructMember<'a> {
/// The type ID of the struct member.
pub id: Handle<TypeId>,
Expand All @@ -148,7 +148,7 @@ pub struct StructMember<'a> {
}

/// Type definition for a struct.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct StructType<'a> {
/// The type ID of the struct.
pub id: Handle<TypeId>,
Expand All @@ -163,7 +163,7 @@ pub struct StructType<'a> {
/// Most of the time, these will be [`ArrayDimension::Literal`].
/// If an array dimension is specified as a specialization constant,
/// then the dimension will be [`ArrayDimension::Constant`].
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ArrayDimension {
/// A literal array dimension, i.e. `array[4]`.
Literal(u32),
Expand All @@ -179,7 +179,7 @@ pub enum ArrayDimension {
}

/// Class of image or texture handle.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ImageClass {
/// Combined image samplers.
Sampled {
Expand All @@ -205,7 +205,7 @@ pub enum ImageClass {
}

/// Type definition for an image or texture handle.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct ImageType {
/// The id of the type.
pub id: Handle<TypeId>,
Expand All @@ -221,7 +221,7 @@ pub struct ImageType {
///
/// The design of this API is inspired heavily by [`naga::TypeInner`](https://docs.rs/naga/latest/naga/enum.TypeInner.html),
/// with some changes to fit SPIR-V.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum TypeInner<'a> {
/// Unknown type.
Unknown,
Expand Down

0 comments on commit bbcaf59

Please sign in to comment.