DxilInterpolationMode.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // DxilInterpolationMode.h //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // Representation of HLSL interpolation mode. //
  9. // //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #pragma once
  12. #include "DxilConstants.h"
  13. namespace hlsl {
  14. /// Use this class to represent signature element interpolation mode.
  15. class InterpolationMode {
  16. public:
  17. using Kind = DXIL::InterpolationMode;
  18. InterpolationMode();
  19. InterpolationMode(const InterpolationMode &Mode) = default;
  20. InterpolationMode(Kind Kind);
  21. InterpolationMode(unsigned long long Kind);
  22. InterpolationMode(bool bNoInterpolation, bool bLinear, bool bNoperspective, bool bCentroid, bool bSample);
  23. InterpolationMode &operator=(const InterpolationMode &o);
  24. bool operator==(const InterpolationMode &o) const;
  25. bool IsValid() const { return m_Kind >= Kind::Undefined && m_Kind < Kind::Invalid; }
  26. bool IsUndefined() const { return m_Kind == Kind::Undefined; }
  27. bool IsConstant() const { return m_Kind == Kind::Constant; }
  28. bool IsLinear() const { return m_Kind == Kind::Linear; }
  29. bool IsLinearCentroid() const { return m_Kind == Kind::LinearCentroid; }
  30. bool IsLinearNoperspective() const { return m_Kind == Kind::LinearNoperspective; }
  31. bool IsLinearNoperspectiveCentroid() const { return m_Kind == Kind::LinearNoperspectiveCentroid; }
  32. bool IsLinearSample() const { return m_Kind == Kind::LinearSample; }
  33. bool IsLinearNoperspectiveSample() const { return m_Kind == Kind::LinearNoperspectiveSample; }
  34. bool IsAnyLinear() const;
  35. bool IsAnyNoPerspective() const;
  36. bool IsAnyCentroid() const;
  37. bool IsAnySample() const;
  38. Kind GetKind() const { return m_Kind; }
  39. const char *GetName() const;
  40. private:
  41. Kind m_Kind;
  42. };
  43. } // namespace hlsl