Derive PartialEq
for ImageSampler
(#19105)
# Objective Ran into a situation where I need to compare two image samplers. My current workaround is to compare the `Debug` outputs ## Solution Derive `PartialEq` on `ImageSampler` and structs in its fields. ## Testing Full CI passed.
This commit is contained in:
parent
ee3d9b2a88
commit
c84a808f80
@ -358,7 +358,7 @@ pub struct Image {
|
|||||||
/// Used in [`Image`], this determines what image sampler to use when rendering. The default setting,
|
/// Used in [`Image`], this determines what image sampler to use when rendering. The default setting,
|
||||||
/// [`ImageSampler::Default`], will read the sampler from the `ImagePlugin` at setup.
|
/// [`ImageSampler::Default`], will read the sampler from the `ImagePlugin` at setup.
|
||||||
/// Setting this to [`ImageSampler::Descriptor`] will override the global default descriptor for this [`Image`].
|
/// Setting this to [`ImageSampler::Descriptor`] will override the global default descriptor for this [`Image`].
|
||||||
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum ImageSampler {
|
pub enum ImageSampler {
|
||||||
/// Default image sampler, derived from the `ImagePlugin` setup.
|
/// Default image sampler, derived from the `ImagePlugin` setup.
|
||||||
#[default]
|
#[default]
|
||||||
@ -403,7 +403,7 @@ impl ImageSampler {
|
|||||||
/// See [`ImageSamplerDescriptor`] for information how to configure this.
|
/// See [`ImageSamplerDescriptor`] for information how to configure this.
|
||||||
///
|
///
|
||||||
/// This type mirrors [`AddressMode`].
|
/// This type mirrors [`AddressMode`].
|
||||||
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum ImageAddressMode {
|
pub enum ImageAddressMode {
|
||||||
/// Clamp the value to the edge of the texture.
|
/// Clamp the value to the edge of the texture.
|
||||||
///
|
///
|
||||||
@ -432,7 +432,7 @@ pub enum ImageAddressMode {
|
|||||||
/// Texel mixing mode when sampling between texels.
|
/// Texel mixing mode when sampling between texels.
|
||||||
///
|
///
|
||||||
/// This type mirrors [`FilterMode`].
|
/// This type mirrors [`FilterMode`].
|
||||||
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum ImageFilterMode {
|
pub enum ImageFilterMode {
|
||||||
/// Nearest neighbor sampling.
|
/// Nearest neighbor sampling.
|
||||||
///
|
///
|
||||||
@ -448,7 +448,7 @@ pub enum ImageFilterMode {
|
|||||||
/// Comparison function used for depth and stencil operations.
|
/// Comparison function used for depth and stencil operations.
|
||||||
///
|
///
|
||||||
/// This type mirrors [`CompareFunction`].
|
/// This type mirrors [`CompareFunction`].
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum ImageCompareFunction {
|
pub enum ImageCompareFunction {
|
||||||
/// Function never passes
|
/// Function never passes
|
||||||
Never,
|
Never,
|
||||||
@ -475,7 +475,7 @@ pub enum ImageCompareFunction {
|
|||||||
/// Color variation to use when the sampler addressing mode is [`ImageAddressMode::ClampToBorder`].
|
/// Color variation to use when the sampler addressing mode is [`ImageAddressMode::ClampToBorder`].
|
||||||
///
|
///
|
||||||
/// This type mirrors [`SamplerBorderColor`].
|
/// This type mirrors [`SamplerBorderColor`].
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub enum ImageSamplerBorderColor {
|
pub enum ImageSamplerBorderColor {
|
||||||
/// RGBA color `[0, 0, 0, 0]`.
|
/// RGBA color `[0, 0, 0, 0]`.
|
||||||
TransparentBlack,
|
TransparentBlack,
|
||||||
@ -498,7 +498,7 @@ pub enum ImageSamplerBorderColor {
|
|||||||
/// a breaking change.
|
/// a breaking change.
|
||||||
///
|
///
|
||||||
/// This types mirrors [`SamplerDescriptor`], but that might change in future versions.
|
/// This types mirrors [`SamplerDescriptor`], but that might change in future versions.
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct ImageSamplerDescriptor {
|
pub struct ImageSamplerDescriptor {
|
||||||
pub label: Option<String>,
|
pub label: Option<String>,
|
||||||
/// How to deal with out of bounds accesses in the u (i.e. x) direction.
|
/// How to deal with out of bounds accesses in the u (i.e. x) direction.
|
||||||
|
Loading…
Reference in New Issue
Block a user