BsGLPixelFormat.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsGLPrerequisites.h"
  5. #include "Image/BsPixelUtil.h"
  6. namespace bs { namespace ct
  7. {
  8. /** @addtogroup GL
  9. * @{
  10. */
  11. /** Converts pixel formats to OpenGL formats */
  12. class GLPixelUtil
  13. {
  14. public:
  15. /** Finds the closest pixel format that OpenGL supports. */
  16. static PixelFormat getClosestSupportedPF(PixelFormat format, TextureType texType, int usage);
  17. /** Returns matching OpenGL base pixel format type if one is found, zero otherwise. */
  18. static GLenum getGLOriginFormat(PixelFormat mFormat);
  19. /** Returns OpenGL data type used in the provided format. */
  20. static GLenum getGLOriginDataType(PixelFormat mFormat);
  21. /**
  22. * Returns matching OpenGL internal pixel format type if one is found, zero otherwise. Optionally returns an SRGB
  23. * format if @p hwGamma is specified and such format exists.
  24. */
  25. static GLenum getGLInternalFormat(PixelFormat mFormat, bool hwGamma = false);
  26. /** Returns an OpenGL type that should be used for creating a buffer for the specified depth/stencil format. */
  27. static GLenum getDepthStencilTypeFromPF(PixelFormat mFormat);
  28. /** Returns an OpenGL format that should be used for creating a buffer for the specified depth/stencil format. */
  29. static GLenum getDepthStencilFormatFromPF(PixelFormat mFormat);
  30. /** Converts engine GPU buffer format to OpenGL GPU buffer format. */
  31. static GLenum getBufferFormat(GpuBufferFormat format);
  32. };
  33. /** @} */
  34. }}