BsGLPixelFormat.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #include "BsGLPrerequisites.h"
  3. #include "BsPixelUtil.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Converts pixel formats to OpenGL formats
  8. */
  9. class BS_RSGL_EXPORT GLPixelUtil
  10. {
  11. public:
  12. /**
  13. * @brief Returns matching OpenGL base pixel format type if one is found,
  14. * zero otherwise.
  15. */
  16. static GLenum getGLOriginFormat(PixelFormat mFormat);
  17. /**
  18. * @brief Returns OpenGL data type used in the provided format.
  19. */
  20. static GLenum getGLOriginDataType(PixelFormat mFormat);
  21. /**
  22. * @brief Returns matching OpenGL internal pixel format type if one is found,
  23. * zero otherwise. Optionally returns an SRGB format if "hwGamma" is specified
  24. * and such format exists.
  25. */
  26. static GLenum getGLInternalFormat(PixelFormat mFormat, bool hwGamma = false);
  27. /**
  28. * @brief Returns matching OpenGL internal pixel format type if one is found,
  29. * otherwise it returns the closest matching format. Optionally returns an
  30. * SRGB format if "hwGamma" is specified and such format exists.
  31. */
  32. static GLenum getClosestGLInternalFormat(PixelFormat mFormat, bool hwGamma = false);
  33. /**
  34. * @brief Returns an OpenGL type that should be used for creating a buffer for the specified
  35. * depth/stencil format.
  36. */
  37. static GLenum getDepthStencilTypeFromFormat(PixelFormat mFormat);
  38. /**
  39. * @brief Returns pixel format closest to the provided internal OpenGL format.
  40. */
  41. static PixelFormat getClosestEngineFormat(GLenum fmt);
  42. /**
  43. * @brief Returns closest supported format to the provided format.
  44. */
  45. static PixelFormat getClosestValidFormat(PixelFormat fmt);
  46. /**
  47. * @brief Converts an OpenGL internal format into base format.
  48. */
  49. static GLenum getBaseFormatFromCompressedInternalFormat(GLenum internalFormat);
  50. };
  51. };