mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 12:18:30 +09:00
[Feat] (MG_Util/Converters): Implement texture enum converters.
This commit is contained in:
@@ -0,0 +1,238 @@
|
||||
#include "TextureEnumConverter.h"
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
TextureTarget ConvertGLEnumToTextureTarget(GLenum target) {
|
||||
switch (target) {
|
||||
case GL_TEXTURE_1D:
|
||||
return TextureTarget::Texture1D;
|
||||
case GL_TEXTURE_2D:
|
||||
return TextureTarget::Texture2D;
|
||||
case GL_TEXTURE_3D:
|
||||
return TextureTarget::Texture3D;
|
||||
case GL_TEXTURE_CUBE_MAP:
|
||||
return TextureTarget::TextureCubeMap;
|
||||
case GL_TEXTURE_2D_ARRAY:
|
||||
return TextureTarget::Texture2DArray;
|
||||
case GL_TEXTURE_2D_MULTISAMPLE:
|
||||
return TextureTarget::Texture2DMultisample;
|
||||
case GL_TEXTURE_CUBE_MAP_ARRAY:
|
||||
return TextureTarget::TextureCubeMapArray;
|
||||
default:
|
||||
return TextureTarget::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
TextureInputFormat ConvertGLEnumToTextureInputFormat(GLenum format) {
|
||||
switch (format) {
|
||||
case GL_RED:
|
||||
return TextureInputFormat::Red;
|
||||
case GL_RG:
|
||||
return TextureInputFormat::RG;
|
||||
case GL_RGB:
|
||||
return TextureInputFormat::RGB;
|
||||
case GL_BGR:
|
||||
return TextureInputFormat::BGR;
|
||||
case GL_RGBA:
|
||||
return TextureInputFormat::RGBA;
|
||||
case GL_BGRA:
|
||||
return TextureInputFormat::BGRA;
|
||||
case GL_RED_INTEGER:
|
||||
return TextureInputFormat::RInteger;
|
||||
case GL_RG_INTEGER:
|
||||
return TextureInputFormat::RGInteger;
|
||||
case GL_RGB_INTEGER:
|
||||
return TextureInputFormat::RGBInteger;
|
||||
case GL_BGR_INTEGER:
|
||||
return TextureInputFormat::BGRInteger;
|
||||
case GL_RGBA_INTEGER:
|
||||
return TextureInputFormat::RGBAInteger;
|
||||
case GL_BGRA_INTEGER:
|
||||
return TextureInputFormat::BGRAInteger;
|
||||
case GL_STENCIL_INDEX:
|
||||
return TextureInputFormat::StencilIndex;
|
||||
case GL_DEPTH_COMPONENT:
|
||||
return TextureInputFormat::DepthComponent;
|
||||
case GL_DEPTH_STENCIL:
|
||||
return TextureInputFormat::DepthStencil;
|
||||
default:
|
||||
return TextureInputFormat::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
TextureSizedInternalFormat ConvertGLEnumToTextureSizedInternalFormat(GLenum internalformat) {
|
||||
switch (internalformat) {
|
||||
case GL_R8:
|
||||
return TextureSizedInternalFormat::R8;
|
||||
case GL_R8_SNORM:
|
||||
return TextureSizedInternalFormat::R8Snorm;
|
||||
case GL_R16:
|
||||
return TextureSizedInternalFormat::R16;
|
||||
case GL_R16_SNORM:
|
||||
return TextureSizedInternalFormat::R16Snorm;
|
||||
case GL_RG8:
|
||||
return TextureSizedInternalFormat::RG8;
|
||||
case GL_RG8_SNORM:
|
||||
return TextureSizedInternalFormat::RG8Snorm;
|
||||
case GL_RG16:
|
||||
return TextureSizedInternalFormat::RG16;
|
||||
case GL_RG16_SNORM:
|
||||
return TextureSizedInternalFormat::RG16Snorm;
|
||||
case GL_R3_G3_B2:
|
||||
return TextureSizedInternalFormat::R3G3B2;
|
||||
case GL_RGB4:
|
||||
return TextureSizedInternalFormat::RGB4;
|
||||
case GL_RGB5:
|
||||
return TextureSizedInternalFormat::RGB5;
|
||||
case GL_RGB8:
|
||||
return TextureSizedInternalFormat::RGB8;
|
||||
case GL_RGB8_SNORM:
|
||||
return TextureSizedInternalFormat::RGB8Snorm;
|
||||
case GL_RGB10:
|
||||
return TextureSizedInternalFormat::RGB10;
|
||||
case GL_RGB12:
|
||||
return TextureSizedInternalFormat::RGB12;
|
||||
case GL_RGB16_SNORM:
|
||||
return TextureSizedInternalFormat::RGB16Snorm;
|
||||
case GL_RGBA2:
|
||||
return TextureSizedInternalFormat::RGBA2;
|
||||
case GL_RGBA4:
|
||||
return TextureSizedInternalFormat::RGBA4;
|
||||
case GL_RGB5_A1:
|
||||
return TextureSizedInternalFormat::RGB5A1;
|
||||
case GL_RGBA8:
|
||||
return TextureSizedInternalFormat::RGBA8;
|
||||
case GL_RGBA8_SNORM:
|
||||
return TextureSizedInternalFormat::RGBA8Snorm;
|
||||
case GL_RGB10_A2:
|
||||
return TextureSizedInternalFormat::RGB10A2;
|
||||
case GL_RGB10_A2UI:
|
||||
return TextureSizedInternalFormat::RGB10A2UI;
|
||||
case GL_RGBA12:
|
||||
return TextureSizedInternalFormat::RGBA12;
|
||||
case GL_RGBA16:
|
||||
return TextureSizedInternalFormat::RGBA16;
|
||||
case GL_SRGB8:
|
||||
return TextureSizedInternalFormat::SRGB8;
|
||||
case GL_SRGB8_ALPHA8:
|
||||
return TextureSizedInternalFormat::SRGB8Alpha8;
|
||||
case GL_R16F:
|
||||
return TextureSizedInternalFormat::R16F;
|
||||
case GL_RG16F:
|
||||
return TextureSizedInternalFormat::RG16F;
|
||||
case GL_RGB16F:
|
||||
return TextureSizedInternalFormat::RGB16F;
|
||||
case GL_RGBA16F:
|
||||
return TextureSizedInternalFormat::RGBA16F;
|
||||
case GL_R32F:
|
||||
return TextureSizedInternalFormat::R32F;
|
||||
case GL_RG32F:
|
||||
return TextureSizedInternalFormat::RG32F;
|
||||
case GL_RGB32F:
|
||||
return TextureSizedInternalFormat::RGB32F;
|
||||
case GL_RGBA32F:
|
||||
return TextureSizedInternalFormat::RGBA32F;
|
||||
case GL_R11F_G11F_B10F:
|
||||
return TextureSizedInternalFormat::R11FG11FB10F;
|
||||
case GL_RGB9_E5:
|
||||
return TextureSizedInternalFormat::RGB9E5;
|
||||
case GL_R8I:
|
||||
return TextureSizedInternalFormat::R8I;
|
||||
case GL_R8UI:
|
||||
return TextureSizedInternalFormat::R8UI;
|
||||
case GL_R16I:
|
||||
return TextureSizedInternalFormat::R16I;
|
||||
case GL_R16UI:
|
||||
return TextureSizedInternalFormat::R16UI;
|
||||
case GL_R32I:
|
||||
return TextureSizedInternalFormat::R32I;
|
||||
case GL_R32UI:
|
||||
return TextureSizedInternalFormat::R32UI;
|
||||
case GL_RG8I:
|
||||
return TextureSizedInternalFormat::RG8I;
|
||||
case GL_RG8UI:
|
||||
return TextureSizedInternalFormat::RG8UI;
|
||||
case GL_RG16I:
|
||||
return TextureSizedInternalFormat::RG16I;
|
||||
case GL_RG16UI:
|
||||
return TextureSizedInternalFormat::RG16UI;
|
||||
case GL_RG32I:
|
||||
return TextureSizedInternalFormat::RG32I;
|
||||
case GL_RG32UI:
|
||||
return TextureSizedInternalFormat::RG32UI;
|
||||
case GL_RGB8I:
|
||||
return TextureSizedInternalFormat::RGB8I;
|
||||
case GL_RGB8UI:
|
||||
return TextureSizedInternalFormat::RGB8UI;
|
||||
case GL_RGB16I:
|
||||
return TextureSizedInternalFormat::RGB16I;
|
||||
case GL_RGB16UI:
|
||||
return TextureSizedInternalFormat::RGB16UI;
|
||||
case GL_RGB32I:
|
||||
return TextureSizedInternalFormat::RGB32I;
|
||||
case GL_RGB32UI:
|
||||
return TextureSizedInternalFormat::RGB32UI;
|
||||
case GL_RGBA8I:
|
||||
return TextureSizedInternalFormat::RGBA8I;
|
||||
case GL_RGBA8UI:
|
||||
return TextureSizedInternalFormat::RGBA8UI;
|
||||
case GL_RGBA16I:
|
||||
return TextureSizedInternalFormat::RGBA16I;
|
||||
case GL_RGBA16UI:
|
||||
return TextureSizedInternalFormat::RGBA16UI;
|
||||
case GL_RGBA32I:
|
||||
return TextureSizedInternalFormat::RGBA32I;
|
||||
case GL_RGBA32UI:
|
||||
return TextureSizedInternalFormat::RGBA32UI;
|
||||
default:
|
||||
return TextureSizedInternalFormat::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
TexturePixelDataType ConvertGLEnumToTexturePixelDataType(GLenum type) {
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
return TexturePixelDataType::UnsignedByte;
|
||||
case GL_BYTE:
|
||||
return TexturePixelDataType::Byte;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
return TexturePixelDataType::UnsignedShort;
|
||||
case GL_SHORT:
|
||||
return TexturePixelDataType::Short;
|
||||
case GL_UNSIGNED_INT:
|
||||
return TexturePixelDataType::UnsignedInt;
|
||||
case GL_INT:
|
||||
return TexturePixelDataType::Int;
|
||||
case GL_FLOAT:
|
||||
return TexturePixelDataType::Float;
|
||||
case GL_UNSIGNED_BYTE_3_3_2:
|
||||
return TexturePixelDataType::UnsignedByte332;
|
||||
case GL_UNSIGNED_BYTE_2_3_3_REV:
|
||||
return TexturePixelDataType::UnsignedByte233Rev;
|
||||
case GL_UNSIGNED_SHORT_5_6_5:
|
||||
return TexturePixelDataType::UnsignedShort565;
|
||||
case GL_UNSIGNED_SHORT_5_6_5_REV:
|
||||
return TexturePixelDataType::UnsignedShort565Rev;
|
||||
case GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
return TexturePixelDataType::UnsignedShort4444;
|
||||
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
|
||||
return TexturePixelDataType::UnsignedShort4444Rev;
|
||||
case GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
return TexturePixelDataType::UnsignedShort5551;
|
||||
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
|
||||
return TexturePixelDataType::UnsignedShort1555Rev;
|
||||
case GL_UNSIGNED_INT_8_8_8_8:
|
||||
return TexturePixelDataType::UnsignedInt8888;
|
||||
case GL_UNSIGNED_INT_8_8_8_8_REV:
|
||||
return TexturePixelDataType::UnsignedInt8888Rev;
|
||||
case GL_UNSIGNED_INT_10F_11F_11F_REV:
|
||||
return TexturePixelDataType::UnsignedInt1010102;
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||
return TexturePixelDataType::UnsignedInt2101010Rev;
|
||||
default:
|
||||
return TexturePixelDataType::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <Includes.h>
|
||||
#include <MG_State/GLState/TextureState/TextureObject.h>
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
TextureTarget ConvertGLEnumToTextureTarget(GLenum target);
|
||||
TextureInputFormat ConvertGLEnumToTextureInputFormat(GLenum format);
|
||||
TextureSizedInternalFormat ConvertGLEnumToTextureSizedInternalFormat(GLenum internalformat);
|
||||
TexturePixelDataType ConvertGLEnumToTexturePixelDataType(GLenum type);
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -0,0 +1,234 @@
|
||||
#include "TextureEnumConverter.h"
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
GLenum ConvertTextureTargetToGLEnum(TextureTarget target) {
|
||||
switch (target) {
|
||||
case TextureTarget::Texture1D:
|
||||
return GL_TEXTURE_1D;
|
||||
case TextureTarget::Texture2D:
|
||||
return GL_TEXTURE_2D;
|
||||
case TextureTarget::Texture3D:
|
||||
return GL_TEXTURE_3D;
|
||||
case TextureTarget::TextureCubeMap:
|
||||
return GL_TEXTURE_CUBE_MAP;
|
||||
case TextureTarget::Texture2DArray:
|
||||
return GL_TEXTURE_2D_ARRAY;
|
||||
case TextureTarget::Texture2DMultisample:
|
||||
return GL_TEXTURE_2D_MULTISAMPLE;
|
||||
case TextureTarget::TextureCubeMapArray:
|
||||
return GL_TEXTURE_CUBE_MAP_ARRAY;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
|
||||
GLenum ConvertTextureInputFormatToGLEnum(TextureInputFormat format) {
|
||||
switch (format) {
|
||||
case TextureInputFormat::Red:
|
||||
return GL_RED;
|
||||
case TextureInputFormat::RG:
|
||||
return GL_RG;
|
||||
case TextureInputFormat::RGB:
|
||||
return GL_RGB;
|
||||
case TextureInputFormat::BGR:
|
||||
return GL_BGR;
|
||||
case TextureInputFormat::RGBA:
|
||||
return GL_RGBA;
|
||||
case TextureInputFormat::BGRA:
|
||||
return GL_BGRA;
|
||||
case TextureInputFormat::RInteger:
|
||||
return GL_RED_INTEGER;
|
||||
case TextureInputFormat::RGInteger:
|
||||
return GL_RG_INTEGER;
|
||||
case TextureInputFormat::RGBInteger:
|
||||
return GL_RGB_INTEGER;
|
||||
case TextureInputFormat::BGRInteger:
|
||||
return GL_BGR_INTEGER;
|
||||
case TextureInputFormat::RGBAInteger:
|
||||
return GL_RGBA_INTEGER;
|
||||
case TextureInputFormat::BGRAInteger:
|
||||
return GL_BGRA_INTEGER;
|
||||
case TextureInputFormat::StencilIndex:
|
||||
return GL_STENCIL_INDEX;
|
||||
case TextureInputFormat::DepthComponent:
|
||||
return GL_DEPTH_COMPONENT;
|
||||
case TextureInputFormat::DepthStencil:
|
||||
return GL_DEPTH_STENCIL;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
|
||||
GLenum ConvertTextureSizedInternalFormatToGLEnum(TextureSizedInternalFormat format) {
|
||||
switch (format) {
|
||||
case TextureSizedInternalFormat::R8:
|
||||
return GL_R8;
|
||||
case TextureSizedInternalFormat::R8Snorm:
|
||||
return GL_R8_SNORM;
|
||||
case TextureSizedInternalFormat::R16:
|
||||
return GL_R16;
|
||||
case TextureSizedInternalFormat::R16Snorm:
|
||||
return GL_R16_SNORM;
|
||||
case TextureSizedInternalFormat::RG8:
|
||||
return GL_RG8;
|
||||
case TextureSizedInternalFormat::RG8Snorm:
|
||||
return GL_RG8_SNORM;
|
||||
case TextureSizedInternalFormat::RG16:
|
||||
return GL_RG16;
|
||||
case TextureSizedInternalFormat::RG16Snorm:
|
||||
return GL_RG16_SNORM;
|
||||
case TextureSizedInternalFormat::R3G3B2:
|
||||
return GL_R3_G3_B2;
|
||||
case TextureSizedInternalFormat::RGB4:
|
||||
return GL_RGB4;
|
||||
case TextureSizedInternalFormat::RGB5:
|
||||
return GL_RGB5;
|
||||
case TextureSizedInternalFormat::RGB8:
|
||||
return GL_RGB8;
|
||||
case TextureSizedInternalFormat::RGB8Snorm:
|
||||
return GL_RGB8_SNORM;
|
||||
case TextureSizedInternalFormat::RGB10:
|
||||
return GL_RGB10;
|
||||
case TextureSizedInternalFormat::RGB12:
|
||||
return GL_RGB12;
|
||||
case TextureSizedInternalFormat::RGB16Snorm:
|
||||
return GL_RGB16_SNORM;
|
||||
case TextureSizedInternalFormat::RGBA2:
|
||||
return GL_RGBA2;
|
||||
case TextureSizedInternalFormat::RGBA4:
|
||||
return GL_RGBA4;
|
||||
case TextureSizedInternalFormat::RGB5A1:
|
||||
return GL_RGB5_A1;
|
||||
case TextureSizedInternalFormat::RGBA8:
|
||||
return GL_RGBA8;
|
||||
case TextureSizedInternalFormat::RGBA8Snorm:
|
||||
return GL_RGBA8_SNORM;
|
||||
case TextureSizedInternalFormat::RGB10A2:
|
||||
return GL_RGB10_A2;
|
||||
case TextureSizedInternalFormat::RGB10A2UI:
|
||||
return GL_RGB10_A2UI;
|
||||
case TextureSizedInternalFormat::RGBA12:
|
||||
return GL_RGBA12;
|
||||
case TextureSizedInternalFormat::RGBA16:
|
||||
return GL_RGBA16;
|
||||
case TextureSizedInternalFormat::SRGB8:
|
||||
return GL_SRGB8;
|
||||
case TextureSizedInternalFormat::SRGB8Alpha8:
|
||||
return GL_SRGB8_ALPHA8;
|
||||
case TextureSizedInternalFormat::R16F:
|
||||
return GL_R16F;
|
||||
case TextureSizedInternalFormat::RG16F:
|
||||
return GL_RG16F;
|
||||
case TextureSizedInternalFormat::RGB16F:
|
||||
return GL_RGB16F;
|
||||
case TextureSizedInternalFormat::RGBA16F:
|
||||
return GL_RGBA16F;
|
||||
case TextureSizedInternalFormat::R32F:
|
||||
return GL_R32F;
|
||||
case TextureSizedInternalFormat::RG32F:
|
||||
return GL_RG32F;
|
||||
case TextureSizedInternalFormat::RGB32F:
|
||||
return GL_RGB32F;
|
||||
case TextureSizedInternalFormat::RGBA32F:
|
||||
return GL_RGBA32F;
|
||||
case TextureSizedInternalFormat::R11FG11FB10F:
|
||||
return GL_R11F_G11F_B10F;
|
||||
case TextureSizedInternalFormat::RGB9E5:
|
||||
return GL_RGB9_E5;
|
||||
case TextureSizedInternalFormat::R8I:
|
||||
return GL_R8I;
|
||||
case TextureSizedInternalFormat::R8UI:
|
||||
return GL_R8UI;
|
||||
case TextureSizedInternalFormat::R16I:
|
||||
return GL_R16I;
|
||||
case TextureSizedInternalFormat::R16UI:
|
||||
return GL_R16UI;
|
||||
case TextureSizedInternalFormat::R32I:
|
||||
return GL_R32I;
|
||||
case TextureSizedInternalFormat::R32UI:
|
||||
return GL_R32UI;
|
||||
case TextureSizedInternalFormat::RG8I:
|
||||
return GL_RG8I;
|
||||
case TextureSizedInternalFormat::RG8UI:
|
||||
return GL_RG8UI;
|
||||
case TextureSizedInternalFormat::RG16I:
|
||||
return GL_RG16I;
|
||||
case TextureSizedInternalFormat::RG16UI:
|
||||
return GL_RG16UI;
|
||||
case TextureSizedInternalFormat::RG32I:
|
||||
return GL_RG32I;
|
||||
case TextureSizedInternalFormat::RG32UI:
|
||||
return GL_RG32UI;
|
||||
case TextureSizedInternalFormat::RGB8I:
|
||||
return GL_RGB8I;
|
||||
case TextureSizedInternalFormat::RGB8UI:
|
||||
return GL_RGB8UI;
|
||||
case TextureSizedInternalFormat::RGB16I:
|
||||
return GL_RGB16I;
|
||||
case TextureSizedInternalFormat::RGB16UI:
|
||||
return GL_RGB16UI;
|
||||
case TextureSizedInternalFormat::RGB32I:
|
||||
return GL_RGB32I;
|
||||
case TextureSizedInternalFormat::RGB32UI:
|
||||
return GL_RGB32UI;
|
||||
case TextureSizedInternalFormat::RGBA8I:
|
||||
return GL_RGBA8I;
|
||||
case TextureSizedInternalFormat::RGBA8UI:
|
||||
return GL_RGBA8UI;
|
||||
case TextureSizedInternalFormat::RGBA16I:
|
||||
return GL_RGBA16I;
|
||||
case TextureSizedInternalFormat::RGBA16UI:
|
||||
return GL_RGBA16UI;
|
||||
case TextureSizedInternalFormat::RGBA32I:
|
||||
return GL_RGBA32I;
|
||||
case TextureSizedInternalFormat::RGBA32UI:
|
||||
return GL_RGBA32UI;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
|
||||
GLenum ConvertTexturePixelDataTypeToGLEnum(TexturePixelDataType type) {
|
||||
switch (type) {
|
||||
case TexturePixelDataType::UnsignedByte:
|
||||
return GL_UNSIGNED_BYTE;
|
||||
case TexturePixelDataType::Byte:
|
||||
return GL_BYTE;
|
||||
case TexturePixelDataType::UnsignedShort:
|
||||
return GL_UNSIGNED_SHORT;
|
||||
case TexturePixelDataType::Short:
|
||||
return GL_SHORT;
|
||||
case TexturePixelDataType::UnsignedInt:
|
||||
return GL_UNSIGNED_INT;
|
||||
case TexturePixelDataType::Int:
|
||||
return GL_INT;
|
||||
case TexturePixelDataType::Float:
|
||||
return GL_FLOAT;
|
||||
case TexturePixelDataType::UnsignedByte332:
|
||||
return GL_UNSIGNED_BYTE_3_3_2;
|
||||
case TexturePixelDataType::UnsignedByte233Rev:
|
||||
return GL_UNSIGNED_BYTE_2_3_3_REV;
|
||||
case TexturePixelDataType::UnsignedShort565:
|
||||
return GL_UNSIGNED_SHORT_5_6_5;
|
||||
case TexturePixelDataType::UnsignedShort565Rev:
|
||||
return GL_UNSIGNED_SHORT_5_6_5_REV;
|
||||
case TexturePixelDataType::UnsignedShort4444:
|
||||
return GL_UNSIGNED_SHORT_4_4_4_4;
|
||||
case TexturePixelDataType::UnsignedShort4444Rev:
|
||||
return GL_UNSIGNED_SHORT_4_4_4_4_REV;
|
||||
case TexturePixelDataType::UnsignedShort5551:
|
||||
return GL_UNSIGNED_SHORT_5_5_5_1;
|
||||
case TexturePixelDataType::UnsignedShort1555Rev:
|
||||
return GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
case TexturePixelDataType::UnsignedInt8888Rev:
|
||||
return GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
case TexturePixelDataType::UnsignedInt1010102:
|
||||
return GL_UNSIGNED_INT_10_10_10_2;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <Includes.h>
|
||||
#include <MG_State/GLState/TextureState/TextureObject.h>
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
GLenum ConvertTextureTargetToGLEnum(TextureTarget target);
|
||||
GLenum ConvertTextureInputFormatToGLEnum(TextureInputFormat format);
|
||||
GLenum ConvertTextureSizedInternalFormatToGLEnum(TextureSizedInternalFormat internalformat);
|
||||
GLenum ConvertTexturePixelDataTypeToGLEnum(TexturePixelDataType type);
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -0,0 +1,230 @@
|
||||
#include "TextureEnumConverter.h"
|
||||
#include "MG_Util/Types.h"
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
String ConvertTextureTargetToString(TextureTarget target) {
|
||||
switch (target) {
|
||||
case TextureTarget::Texture1D:
|
||||
return "Texture1D";
|
||||
case TextureTarget::Texture2D:
|
||||
return "Texture2D";
|
||||
case TextureTarget::Texture3D:
|
||||
return "Texture3D";
|
||||
case TextureTarget::TextureCubeMap:
|
||||
return "TextureCubeMap";
|
||||
case TextureTarget::Texture2DArray:
|
||||
return "Texture2DArray";
|
||||
case TextureTarget::Texture2DMultisample:
|
||||
return "Texture2DMultisample";
|
||||
case TextureTarget::TextureCubeMapArray:
|
||||
return "TextureCubeMapArray";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
String ConvertTextureInputFormatToString(TextureInputFormat format) {
|
||||
switch (format) {
|
||||
case TextureInputFormat::Red:
|
||||
return "Red";
|
||||
case TextureInputFormat::RG:
|
||||
return "RG";
|
||||
case TextureInputFormat::RGB:
|
||||
return "RGB";
|
||||
case TextureInputFormat::BGR:
|
||||
return "BGR";
|
||||
case TextureInputFormat::RGBA:
|
||||
return "RGBA";
|
||||
case TextureInputFormat::BGRA:
|
||||
return "BGRA";
|
||||
case TextureInputFormat::RInteger:
|
||||
return "RInteger";
|
||||
case TextureInputFormat::RGInteger:
|
||||
return "RGInteger";
|
||||
case TextureInputFormat::RGBInteger:
|
||||
return "RGBInteger";
|
||||
case TextureInputFormat::BGRInteger:
|
||||
return "BGRInteger";
|
||||
case TextureInputFormat::RGBAInteger:
|
||||
return "RGBAInteger";
|
||||
case TextureInputFormat::BGRAInteger:
|
||||
return "BGRAInteger";
|
||||
case TextureInputFormat::StencilIndex:
|
||||
return "StencilIndex";
|
||||
case TextureInputFormat::DepthComponent:
|
||||
return "DepthComponent";
|
||||
case TextureInputFormat::DepthStencil:
|
||||
return "DepthStencil";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
String ConvertTextureSizedInternalFormatToString(TextureSizedInternalFormat format) {
|
||||
switch (format) {
|
||||
case TextureSizedInternalFormat::R8:
|
||||
return "R8";
|
||||
case TextureSizedInternalFormat::R8Snorm:
|
||||
return "R8Snorm";
|
||||
case TextureSizedInternalFormat::R16:
|
||||
return "R16";
|
||||
case TextureSizedInternalFormat::R16Snorm:
|
||||
return "R16Snorm";
|
||||
case TextureSizedInternalFormat::RG8:
|
||||
return "RG8";
|
||||
case TextureSizedInternalFormat::RG8Snorm:
|
||||
return "RG8Snorm";
|
||||
case TextureSizedInternalFormat::RG16:
|
||||
return "RG16";
|
||||
case TextureSizedInternalFormat::RG16Snorm:
|
||||
return "RG16Snorm";
|
||||
case TextureSizedInternalFormat::R3G3B2:
|
||||
return "R3G3B2";
|
||||
case TextureSizedInternalFormat::RGB4:
|
||||
return "RGB4";
|
||||
case TextureSizedInternalFormat::RGB5:
|
||||
return "RGB5";
|
||||
case TextureSizedInternalFormat::RGB8:
|
||||
return "RGB8";
|
||||
case TextureSizedInternalFormat::RGB8Snorm:
|
||||
return "RGB8Snorm";
|
||||
case TextureSizedInternalFormat::RGB10:
|
||||
return "RGB10";
|
||||
case TextureSizedInternalFormat::RGB12:
|
||||
return "RGB12";
|
||||
case TextureSizedInternalFormat::RGB16Snorm:
|
||||
return "RGB16Snorm";
|
||||
case TextureSizedInternalFormat::RGBA2:
|
||||
return "RGBA2";
|
||||
case TextureSizedInternalFormat::RGBA4:
|
||||
return "RGBA4";
|
||||
case TextureSizedInternalFormat::RGB5A1:
|
||||
return "RGB5A1";
|
||||
case TextureSizedInternalFormat::RGBA8:
|
||||
return "RGBA8";
|
||||
case TextureSizedInternalFormat::RGBA8Snorm:
|
||||
return "RGBA8Snorm";
|
||||
case TextureSizedInternalFormat::RGB10A2:
|
||||
return "RGB10A2";
|
||||
case TextureSizedInternalFormat::RGB10A2UI:
|
||||
return "RGB10A2UI";
|
||||
case TextureSizedInternalFormat::RGBA12:
|
||||
return "RGBA12";
|
||||
case TextureSizedInternalFormat::RGBA16:
|
||||
return "RGBA16";
|
||||
case TextureSizedInternalFormat::SRGB8:
|
||||
return "SRGB8";
|
||||
case TextureSizedInternalFormat::SRGB8Alpha8:
|
||||
return "SRGB8Alpha8";
|
||||
case TextureSizedInternalFormat::R16F:
|
||||
return "R16F";
|
||||
case TextureSizedInternalFormat::RG16F:
|
||||
return "RG16F";
|
||||
case TextureSizedInternalFormat::RGB16F:
|
||||
return "RGB16F";
|
||||
case TextureSizedInternalFormat::RGBA16F:
|
||||
return "RGBA16F";
|
||||
case TextureSizedInternalFormat::R32F:
|
||||
return "R32F";
|
||||
case TextureSizedInternalFormat::RG32F:
|
||||
return "RG32F";
|
||||
case TextureSizedInternalFormat::RGB32F:
|
||||
return "RGB32F";
|
||||
case TextureSizedInternalFormat::RGBA32F:
|
||||
return "RGBA32F";
|
||||
case TextureSizedInternalFormat::R11FG11FB10F:
|
||||
return "R11FG11FB10F";
|
||||
case TextureSizedInternalFormat::RGB9E5:
|
||||
return "RGB9E5";
|
||||
case TextureSizedInternalFormat::R8I:
|
||||
return "R8I";
|
||||
case TextureSizedInternalFormat::R8UI:
|
||||
return "R8UI";
|
||||
case TextureSizedInternalFormat::R16I:
|
||||
return "R16I";
|
||||
case TextureSizedInternalFormat::R16UI:
|
||||
return "R16UI";
|
||||
case TextureSizedInternalFormat::R32I:
|
||||
return "R32I";
|
||||
case TextureSizedInternalFormat::R32UI:
|
||||
return "R32UI";
|
||||
case TextureSizedInternalFormat::RG8I:
|
||||
return "RG8I";
|
||||
case TextureSizedInternalFormat::RG8UI:
|
||||
return "RG8UI";
|
||||
case TextureSizedInternalFormat::RG16I:
|
||||
return "RG16I";
|
||||
case TextureSizedInternalFormat::RG16UI:
|
||||
return "RG16UI";
|
||||
case TextureSizedInternalFormat::RG32I:
|
||||
return "RG32I";
|
||||
case TextureSizedInternalFormat::RG32UI:
|
||||
return "RG32UI";
|
||||
case TextureSizedInternalFormat::RGB8I:
|
||||
return "RGB8I";
|
||||
case TextureSizedInternalFormat::RGB8UI:
|
||||
return "RGB8UI";
|
||||
case TextureSizedInternalFormat::RGB16I:
|
||||
return "RGB16I";
|
||||
case TextureSizedInternalFormat::RGB16UI:
|
||||
return "RGB16UI";
|
||||
case TextureSizedInternalFormat::RGB32I:
|
||||
return "RGB32I";
|
||||
case TextureSizedInternalFormat::RGB32UI:
|
||||
return "RGB32UI";
|
||||
case TextureSizedInternalFormat::RGBA8I:
|
||||
return "RGBA8I";
|
||||
case TextureSizedInternalFormat::RGBA8UI:
|
||||
return "RGBA8UI";
|
||||
case TextureSizedInternalFormat::RGBA16I:
|
||||
return "RGBA16I";
|
||||
case TextureSizedInternalFormat::RGBA16UI:
|
||||
return "RGBA16UI";
|
||||
case TextureSizedInternalFormat::RGBA32I:
|
||||
return "RGBA32I";
|
||||
case TextureSizedInternalFormat::RGBA32UI:
|
||||
return "RGBA32UI";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
String ConvertTexturePixelDataTypeToString(TexturePixelDataType type) {
|
||||
switch (type) {
|
||||
case TexturePixelDataType::UnsignedByte:
|
||||
return "UnsignedByte";
|
||||
case TexturePixelDataType::Byte:
|
||||
return "Byte";
|
||||
case TexturePixelDataType::UnsignedShort:
|
||||
return "UnsignedShort";
|
||||
case TexturePixelDataType::Short:
|
||||
return "Short";
|
||||
case TexturePixelDataType::UnsignedInt:
|
||||
return "UnsignedInt";
|
||||
case TexturePixelDataType::Int:
|
||||
return "Int";
|
||||
case TexturePixelDataType::Float:
|
||||
return "Float";
|
||||
case TexturePixelDataType::UnsignedByte332:
|
||||
return "UnsignedByte332";
|
||||
case TexturePixelDataType::UnsignedByte233Rev:
|
||||
return "UnsignedByte233Rev";
|
||||
case TexturePixelDataType::UnsignedShort565:
|
||||
return "UnsignedShort565";
|
||||
case TexturePixelDataType::UnsignedShort565Rev:
|
||||
return "UnsignedShort565Rev";
|
||||
case TexturePixelDataType::UnsignedShort4444:
|
||||
return "UnsignedShort4444";
|
||||
case TexturePixelDataType::UnsignedShort4444Rev:
|
||||
return "UnsignedShort4444Rev";
|
||||
case TexturePixelDataType::UnsignedShort5551:
|
||||
return "UnsignedShort5551";
|
||||
case TexturePixelDataType::UnsignedShort1555Rev:
|
||||
return "UnsignedShort1555Rev";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <Includes.h>
|
||||
#include <MG_State/GLState/TextureState/TextureObject.h>
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
String ConvertTextureTargetToString(TextureTarget target);
|
||||
String ConvertTextureInputFormatToString(TextureInputFormat format);
|
||||
String ConvertTextureSizedInternalFormatToString(TextureSizedInternalFormat internalformat);
|
||||
String ConvertTexturePixelDataTypeToString(TexturePixelDataType type);
|
||||
} // namespace MG_Util
|
||||
} // namespace MobileGL
|
||||
Reference in New Issue
Block a user