GrUpscaler.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Gr/GrObject.h>
  7. #include <AnKi/Math.h>
  8. #include <AnKi/Util/WeakArray.h>
  9. #include <AnKi/Util/Enum.h>
  10. namespace anki {
  11. /// @addtogroup graphics
  12. /// @{
  13. /// Different upscalers supported internally by GrUpscaler
  14. enum class GrUpscalerType : U8
  15. {
  16. kDlss2 = 0,
  17. kCount
  18. };
  19. /// Quality preset to be used by the upscaler if available
  20. enum class GrUpscalerQualityMode : U8
  21. {
  22. kPerformance,
  23. kBalanced,
  24. kQuality,
  25. kCount
  26. };
  27. ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(GrUpscalerQualityMode)
  28. /// Initialization structure for the upscaler
  29. class GrUpscalerInitInfo : public GrBaseInitInfo
  30. {
  31. public:
  32. UVec2 m_sourceTextureResolution = UVec2(0u);
  33. UVec2 m_targetTextureResolution = UVec2(0u);
  34. GrUpscalerType m_upscalerType = GrUpscalerType::kCount;
  35. GrUpscalerQualityMode m_qualityMode = GrUpscalerQualityMode::kPerformance;
  36. };
  37. class GrUpscaler : public GrObject
  38. {
  39. ANKI_GR_OBJECT
  40. public:
  41. static constexpr GrObjectType kClassType = GrObjectType::kGrUpscaler;
  42. GrUpscalerType getUpscalerType() const
  43. {
  44. ANKI_ASSERT(m_upscalerType != GrUpscalerType::kCount);
  45. return m_upscalerType;
  46. }
  47. protected:
  48. GrUpscalerType m_upscalerType = GrUpscalerType::kCount;
  49. /// Construct.
  50. GrUpscaler(CString name)
  51. : GrObject(kClassType, name)
  52. {
  53. }
  54. /// Destroy.
  55. ~GrUpscaler()
  56. {
  57. }
  58. private:
  59. /// Allocate and initialize a new instance.
  60. [[nodiscard]] static GrUpscaler* newInstance(const GrUpscalerInitInfo& initInfo);
  61. };
  62. /// @}
  63. } // end namespace anki