DxilInterpolationMode.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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(Kind Kind);
  20. InterpolationMode(unsigned long long Kind);
  21. InterpolationMode(bool bNoInterpolation, bool bLinear, bool bNoperspective, bool bCentroid, bool bSample);
  22. InterpolationMode &operator=(const InterpolationMode &o);
  23. bool operator==(const InterpolationMode &o) const;
  24. bool IsValid() const { return m_Kind >= Kind::Undefined && m_Kind < Kind::Invalid; }
  25. bool IsUndefined() const { return m_Kind == Kind::Undefined; }
  26. bool IsConstant() const { return m_Kind == Kind::Constant; }
  27. bool IsLinear() const { return m_Kind == Kind::Linear; }
  28. bool IsLinearCentroid() const { return m_Kind == Kind::LinearCentroid; }
  29. bool IsLinearNoperspective() const { return m_Kind == Kind::LinearNoperspective; }
  30. bool IsLinearNoperspectiveCentroid() const { return m_Kind == Kind::LinearNoperspectiveCentroid; }
  31. bool IsLinearSample() const { return m_Kind == Kind::LinearSample; }
  32. bool IsLinearNoperspectiveSample() const { return m_Kind == Kind::LinearNoperspectiveSample; }
  33. bool IsAnyLinear() const;
  34. bool IsAnyNoPerspective() const;
  35. bool IsAnyCentroid() const;
  36. bool IsAnySample() const;
  37. Kind GetKind() const { return m_Kind; }
  38. const char *GetName() const;
  39. private:
  40. Kind m_Kind;
  41. };
  42. } // namespace hlsl