Browse Source

Compressed image support, part 10: support ETC2/EAC formats.

pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
75ef110efe
  1. 2
      doc/opengl-support.dox
  2. 30
      src/Magnum/AbstractTexture.cpp
  3. 12
      src/Magnum/ColorFormat.cpp
  4. 94
      src/Magnum/ColorFormat.h
  5. 94
      src/Magnum/TextureFormat.h

2
doc/opengl-support.dox

@ -172,7 +172,7 @@ Extension | Status
------------------------------------------- | ------
GLSL 4.30 | done
@extension{ARB,arrays_of_arrays} | done (shading language only)
@extension{ARB,ES3_compatibility} | only conservative sample query
@extension{ARB,ES3_compatibility} | only conservative sample query and compression formats
@extension{ARB,clear_buffer_object} | |
@extension{ARB,compute_shader} | |
@extension{ARB,copy_image} | |

30
src/Magnum/AbstractTexture.cpp

@ -487,6 +487,10 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
case TextureFormat::CompressedRed:
case TextureFormat::CompressedRedRgtc1:
case TextureFormat::CompressedSignedRedRgtc1:
#endif
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::CompressedR11Eac:
case TextureFormat::CompressedSignedR11Eac:
#endif
return ColorFormat::Red;
#endif
@ -519,6 +523,10 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
case TextureFormat::CompressedRG:
case TextureFormat::CompressedRGRgtc2:
case TextureFormat::CompressedSignedRGRgtc2:
#endif
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::CompressedRG11Eac:
case TextureFormat::CompressedSignedRG11Eac:
#endif
return ColorFormat::RG;
#endif
@ -575,6 +583,10 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
case TextureFormat::CompressedRGBBptcUnsignedFloat:
case TextureFormat::CompressedRGBBptcSignedFloat:
#endif
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::CompressedRGB8Etc2:
case TextureFormat::CompressedSRGB8Etc2:
#endif
case TextureFormat::CompressedRGBS3tcDxt1:
return ColorFormat::RGB;
@ -625,6 +637,12 @@ ColorFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
case TextureFormat::CompressedRGBABptcUnorm:
case TextureFormat::CompressedSRGBAlphaBptcUnorm:
#endif
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::CompressedRGB8PunchthroughAlpha1Etc2:
case TextureFormat::CompressedSRGB8PunchthroughAlpha1Etc2:
case TextureFormat::CompressedRGBA8Etc2Eac:
case TextureFormat::CompressedSRGB8Alpha8Etc2Eac:
#endif
case TextureFormat::CompressedRGBAS3tcDxt1:
case TextureFormat::CompressedRGBAS3tcDxt3:
case TextureFormat::CompressedRGBAS3tcDxt5:
@ -722,6 +740,18 @@ ColorType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern
case TextureFormat::CompressedRGBABptcUnorm:
case TextureFormat::CompressedSRGBAlphaBptcUnorm:
#endif
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::CompressedRGB8Etc2:
case TextureFormat::CompressedSRGB8Etc2:
case TextureFormat::CompressedRGB8PunchthroughAlpha1Etc2:
case TextureFormat::CompressedSRGB8PunchthroughAlpha1Etc2:
case TextureFormat::CompressedRGBA8Etc2Eac:
case TextureFormat::CompressedSRGB8Alpha8Etc2Eac:
case TextureFormat::CompressedR11Eac:
case TextureFormat::CompressedSignedR11Eac:
case TextureFormat::CompressedRG11Eac:
case TextureFormat::CompressedSignedRG11Eac:
#endif
case TextureFormat::CompressedRGBS3tcDxt1:
case TextureFormat::CompressedRGBAS3tcDxt1:
case TextureFormat::CompressedRGBAS3tcDxt3:

12
src/Magnum/ColorFormat.cpp

@ -154,6 +154,18 @@ Debug operator<<(Debug debug, const CompressedColorFormat value) {
_c(RGBABptcUnorm)
_c(SRGBAlphaBptcUnorm)
#endif
#ifndef MAGNUM_TARGET_GLES2
_c(RGB8Etc2)
_c(SRGB8Etc2)
_c(RGB8PunchthroughAlpha1Etc2)
_c(SRGB8PunchthroughAlpha1Etc2)
_c(RGBA8Etc2Eac)
_c(SRGB8Alpha8Etc2Eac)
_c(R11Eac)
_c(SignedR11Eac)
_c(RG11Eac)
_c(SignedRG11Eac)
#endif
_c(RGBS3tcDxt1)
_c(RGBAS3tcDxt1)
_c(RGBAS3tcDxt3)

94
src/Magnum/ColorFormat.h

@ -667,6 +667,100 @@ enum class CompressedColorFormat: GLenum {
SRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM,
#endif
#ifndef MAGNUM_TARGET_GLES2
/**
* ETC2 compressed RGB, normalized unsigned. **Available only on 2D, 2D
* array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
RGB8Etc2 = GL_COMPRESSED_RGB8_ETC2,
/**
* ETC2 compressed sRGB, normalized unsigned. **Available only on 2D, 2D
* array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
SRGB8Etc2 = GL_COMPRESSED_SRGB8_ETC2,
/**
* ETC2 compressed RGB with punchthrough (single-bit) alpha, normalized
* unsigned. **Available only on 2D, 2D array, cube map and cube map array
* textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
RGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
/**
* ETC2 compressed sRGB with punchthrough (single-bit) alpha, normalized
* unsigned. **Available only on 2D, 2D array, cube map and cube map array
* textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
SRGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
/**
* ETC2/EAC compressed RGBA, normalized unsigned. **Available only on 2D,
* 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
RGBA8Etc2Eac = GL_COMPRESSED_RGBA8_ETC2_EAC,
/**
* ETC2/EAC compressed sRGB with alpha, normalized unsigned. **Available
* only on 2D, 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
SRGB8Alpha8Etc2Eac = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
/**
* EAC compressed red channel, normalized unsigned. **Available only on 2D,
* 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
R11Eac = GL_COMPRESSED_R11_EAC,
/**
* EAC compressed red channel, normalized signed. **Available only on 2D,
* 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
SignedR11Eac = GL_COMPRESSED_SIGNED_R11_EAC,
/**
* EAC compressed red and green channel, normalized unsigned. **Available
* only on 2D, 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
RG11Eac = GL_COMPRESSED_RG11_EAC,
/**
* EAC compressed red and green channel, normalized signed. **Available
* only on 2D, 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
SignedRG11Eac = GL_COMPRESSED_SIGNED_RG11_EAC,
#endif
/**
* S3TC DXT1 compressed RGB. **Available only for 2D, 3D, 2D array, cube
* map and cube map array textures.**

94
src/Magnum/TextureFormat.h

@ -926,6 +926,100 @@ enum class TextureFormat: GLenum {
CompressedSRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM,
#endif
#ifndef MAGNUM_TARGET_GLES2
/**
* ETC2 compressed RGB, normalized unsigned. **Available only on 2D, 2D
* array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedRGB8Etc2 = GL_COMPRESSED_RGB8_ETC2,
/**
* ETC2 compressed sRGB, normalized unsigned. **Available only on 2D, 2D
* array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedSRGB8Etc2 = GL_COMPRESSED_SRGB8_ETC2,
/**
* ETC2 compressed RGB with punchthrough (single-bit) alpha, normalized
* unsigned. **Available only on 2D, 2D array, cube map and cube map array
* textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedRGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
/**
* ETC2 compressed sRGB with punchthrough (single-bit) alpha, normalized
* unsigned. **Available only on 2D, 2D array, cube map and cube map array
* textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedSRGB8PunchthroughAlpha1Etc2 = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
/**
* ETC2/EAC compressed RGBA, normalized unsigned. **Available only on 2D,
* 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedRGBA8Etc2Eac = GL_COMPRESSED_RGBA8_ETC2_EAC,
/**
* ETC2/EAC compressed sRGB with alpha, normalized unsigned. **Available
* only on 2D, 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedSRGB8Alpha8Etc2Eac = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
/**
* EAC compressed red channel, normalized unsigned. **Available only on 2D,
* 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedR11Eac = GL_COMPRESSED_R11_EAC,
/**
* EAC compressed red channel, normalized signed. **Available only on 2D,
* 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedSignedR11Eac = GL_COMPRESSED_SIGNED_R11_EAC,
/**
* EAC compressed red and green channel, normalized unsigned. **Available
* only on 2D, 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedRG11Eac = GL_COMPRESSED_RG11_EAC,
/**
* EAC compressed red and green channel, normalized signed. **Available
* only on 2D, 2D array, cube map and cube map array textures.**
* @requires_gl43 Extension @extension{ARB,ES3_compatibility}
* @requires_gles30 ETC2 texture compression is not available in OpenGL ES
* 2.0.
*/
CompressedSignedRG11Eac = GL_COMPRESSED_SIGNED_RG11_EAC,
#endif
/**
* S3TC DXT1 compressed RGB. **Available only on 2D, 3D, 2D array, cube map
* and cube map array textures.**

Loading…
Cancel
Save