// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Graphics/Enums.h" class String; /// /// GPU sampler filter modes. /// enum class GPUSamplerFilter { Point = 0, Bilinear = 1, Trilinear = 2, Anisotropic = 3, MAX }; /// /// GPU sampler address modes. /// enum class GPUSamplerAddressMode { Wrap = 0, Clamp = 1, Mirror = 2, Border = 3, MAX }; /// /// GPU sampler comparision function types. /// enum class GPUSamplerCompareFunction { Never = 0, Less = 1, MAX }; /// /// GPU sampler border color types. /// enum class GPUSamplerBorderColor { /// /// Indicates black, with the alpha component as fully transparent. /// TransparentBlack = 0, /// /// Indicates black, with the alpha component as fully opaque. /// OpaqueBlack = 1, /// /// Indicates white, with the alpha component as fully opaque. /// OpaqueWhite = 2, Maximum }; /// /// A common description for all samplers. /// struct FLAXENGINE_API GPUSamplerDescription { public: /// /// The filtering method to use when sampling a texture. /// GPUSamplerFilter Filter; /// /// The addressing mode for outside [0..1] range for U coordinate. /// GPUSamplerAddressMode AddressU; /// /// The addressing mode for outside [0..1] range for V coordinate. /// GPUSamplerAddressMode AddressV; /// /// The addressing mode for outside [0..1] range for W coordinate. /// GPUSamplerAddressMode AddressW; /// /// The mip bias to be added to mipmap LOD calculation. /// float MipBias; /// /// The minimum mip map level that will be used, where 0 is the highest resolution mip level. /// float MinMipLevel; /// /// The maximum mip map level that will be used, where 0 is the highest resolution mip level. To have no upper limit on LOD set this to a large value such as MAX_float. /// float MaxMipLevel; /// /// The maximum anisotropy value. /// int32 MaxAnisotropy; /// /// The border color to use if Border is specified for AddressU, AddressV, or AddressW. /// GPUSamplerBorderColor BorderColor; /// /// A function that compares sampled data against existing sampled data. /// GPUSamplerCompareFunction SamplerComparisonFunction; public: /// /// Clears description to the default values. /// void Clear(); public: /// /// Compares with other instance of SamplerDescription /// /// The other object to compare. /// True if objects are the same, otherwise false. bool Equals(const GPUSamplerDescription& other) const; /// /// Implements the operator ==. /// /// The other description. /// The result of the operator. FORCE_INLINE bool operator==(const GPUSamplerDescription& other) const { return Equals(other); } /// /// Implements the operator !=. /// /// The other description. /// The result of the operator. FORCE_INLINE bool operator!=(const GPUSamplerDescription& other) const { return !Equals(other); } public: String ToString() const; }; uint32 GetHash(const GPUSamplerDescription& key);