Browse Source

GL: EXT_texture_norm16 is not on WebGL 1 anymore.

It got changed shortly after the original implementation in
083ecf72b8 to be WebGL 2 only.
euler-xxx
Vladimír Vondruš 5 years ago
parent
commit
93fa1b9f94
  1. 20
      src/Magnum/GL/AbstractTexture.cpp
  2. 2
      src/Magnum/GL/Context.cpp
  3. 2
      src/Magnum/GL/Extensions.h
  4. 8
      src/Magnum/GL/Implementation/pixelFormatMapping.hpp
  5. 6
      src/Magnum/GL/PixelFormat.cpp
  6. 14
      src/Magnum/GL/PixelFormat.h
  7. 21
      src/Magnum/GL/RenderbufferFormat.h
  8. 2
      src/Magnum/GL/TextureFormat.cpp
  9. 27
      src/Magnum/GL/TextureFormat.h
  10. 1
      src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt
  11. 11
      src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h

20
src/Magnum/GL/AbstractTexture.cpp

@ -662,8 +662,7 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) {
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::RGB8Snorm:
#endif
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::RGB16:
case TextureFormat::RGB16Snorm:
#endif
@ -741,8 +740,7 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) {
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::RGBA8Snorm:
#endif
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::RGBA16:
case TextureFormat::RGBA16Snorm:
#endif
@ -853,16 +851,8 @@ PixelFormat pixelFormatForInternalFormat(const TextureFormat internalFormat) {
#ifdef MAGNUM_TARGET_GLES2
case TextureFormat::Luminance:
#ifdef MAGNUM_TARGET_WEBGL
case TextureFormat::R16:
case TextureFormat::R16Snorm:
#endif
return PixelFormat::Luminance;
case TextureFormat::LuminanceAlpha:
#ifdef MAGNUM_TARGET_WEBGL
case TextureFormat::RG16:
case TextureFormat::RG16Snorm:
#endif
return PixelFormat::LuminanceAlpha;
#endif
@ -1058,8 +1048,7 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) {
#endif
#endif
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::R16:
case TextureFormat::RG16:
case TextureFormat::RGB16:
@ -1080,8 +1069,7 @@ PixelType pixelTypeForInternalFormat(const TextureFormat internalFormat) {
#endif
return PixelType::UnsignedShort;
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
case TextureFormat::R16Snorm:
case TextureFormat::RG16Snorm:
case TextureFormat::RGB16Snorm:

2
src/Magnum/GL/Context.cpp

@ -285,7 +285,9 @@ constexpr Extension ExtensionList[]{
Extensions::EXT::texture_compression_bptc{},
Extensions::EXT::texture_compression_rgtc{},
Extensions::EXT::texture_filter_anisotropic{},
#ifndef MAGNUM_TARGET_GLES2
Extensions::EXT::texture_norm16{},
#endif
Extensions::OES::texture_float_linear{},
#ifndef MAGNUM_TARGET_GLES2
Extensions::OVR::multiview2{},

2
src/Magnum/GL/Extensions.h

@ -301,8 +301,8 @@ namespace ANGLE {
_extension(13,EXT,texture_compression_bptc, GLES200, None) // #39
#ifndef MAGNUM_TARGET_GLES2
_extension(14,EXT,clip_cull_distance, GLES300, None) // #43
_extension(15,EXT,texture_norm16, GLES300, None) // #44
#endif
_extension(15,EXT,texture_norm16, GLES200, None) // #44
#ifndef MAGNUM_TARGET_GLES2
_extension(16,EXT,draw_buffers_indexed, GLES300, None) // #45
#endif

8
src/Magnum/GL/Implementation/pixelFormatMapping.hpp

@ -115,17 +115,11 @@ _n(RG16Unorm, LuminanceAlpha, UnsignedShort)
_n(RGB16Unorm, RGB, UnsignedShort)
_n(RGBA16Unorm, RGBA, UnsignedShort)
#endif
/* Available everywhere except ES2 (WebGL 1 has it) */
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
_c(R16Snorm, Red, Short, R16Snorm)
_c(RG16Snorm, RG, Short, RG16Snorm)
_c(RGB16Snorm, RGB, Short, RGB16Snorm)
_c(RGBA16Snorm, RGBA, Short, RGBA16Snorm)
#elif defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)
_c(R16Snorm, Luminance, Short, R16Snorm)
_c(RG16Snorm, LuminanceAlpha, Short, RG16Snorm)
_c(RGB16Snorm, RGB, Short, RGB16Snorm)
_c(RGBA16Snorm, RGBA, Short, RGBA16Snorm)
#else
_s(R16Snorm)
_s(RG16Snorm)

6
src/Magnum/GL/PixelFormat.cpp

@ -135,8 +135,7 @@ UnsignedInt pixelSize(const PixelFormat format, const PixelType type) {
#endif
size = 1; break;
case PixelType::UnsignedShort:
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
case PixelType::Short:
#endif
case PixelType::Half:
@ -345,8 +344,7 @@ Debug& operator<<(Debug& debug, const PixelType value) {
_c(Byte)
#endif
_c(UnsignedShort)
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
_c(Short)
#endif
_c(UnsignedInt)

14
src/Magnum/GL/PixelFormat.h

@ -376,21 +376,23 @@ enum class PixelType: GLenum {
* for color texture data
* @requires_webgl20 Extension @webgl_extension{WEBGL,depth_texture} in
* WebGL 1.0 for depth texture data
* @requires_webgl_extension @webgl_extension{EXT,texture_norm16} for color
* texture data
* @requires_webgl20 For integer color texture data
* @requires_webgl_extension WebGL 2.0 and
* @webgl_extension{EXT,texture_norm16} for normalized color texture
* data
*/
UnsignedShort = GL_UNSIGNED_SHORT,
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
/**
* Each component signed short.
* @requires_gl Can't be used for framebuffer reading in OpenGL ES or
* WebGL.
* @requires_gles30 For texture data only, only @ref PixelType::UnsignedShort
* is available in OpenGL ES 2.0.
* @requires_webgl20 For texture data only, @webgl_extension{EXT,texture_norm16}
* in WebGL 1.0.
* @requires_webgl20 For integer texture data. Not available in WebGL 1.0.
* @requires_webgl_extension WebGL 2.0 and
* @webgl_extension{EXT,texture_norm16} for normalized texture data
*/
Short = GL_SHORT,
#endif

21
src/Magnum/GL/RenderbufferFormat.h

@ -125,16 +125,17 @@ enum class RenderbufferFormat: GLenum {
#endif
#endif
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
/**
* Red component, normalized unsigned short.
* @requires_gl30 Extension @gl_extension{ARB,texture_rg}
* @requires_gles31 Only byte-sized normalized formats (such as
* @ref RenderbufferFormat::RG8) are available in OpenGL ES 3.0 and
* older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_es_extension OpenGL ES 3.1 and extension
* @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
R16 = GL_R16,
@ -148,8 +149,10 @@ enum class RenderbufferFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats (such as
* @ref RenderbufferFormat::RG8) are available in OpenGL ES 3.0 and
* older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_es_extension OpenGL ES 3.1 and extension
* @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
RG16 = GL_RG16,
@ -171,8 +174,10 @@ enum class RenderbufferFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats (such as
* @ref RenderbufferFormat::RG8) are available in OpenGL ES 3.0 and
* older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_es_extension OpenGL ES 3.1 and extension
* @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
RGBA16 = GL_RGBA16,

2
src/Magnum/GL/TextureFormat.cpp

@ -89,7 +89,7 @@ Debug& operator<<(Debug& debug, const TextureFormat value) {
_c(RGB8Snorm)
_c(RGBA8Snorm)
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
_c(R16)
_c(RG16)
_c(RGB16)

27
src/Magnum/GL/TextureFormat.h

@ -335,15 +335,15 @@ enum class TextureFormat: GLenum {
RGBA8Snorm = GL_RGBA8_SNORM,
#endif
/* Available everywhere except ES2 (WebGL 1 has it) */
#if !(defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL))
#ifndef MAGNUM_TARGET_GLES2
/**
* Red component, normalized unsigned short.
* @requires_gl30 Extension @gl_extension{ARB,texture_rg}
* @requires_gles30 Only byte-sized normalized formats are available in
* OpenGL ES 2.0
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
R16 = GL_R16,
@ -357,7 +357,8 @@ enum class TextureFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats are available in
* OpenGL ES 3.0 and older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
RG16 = GL_RG16,
@ -370,7 +371,8 @@ enum class TextureFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats are available in
* OpenGL ES 3.0 and older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
RGB16 = GL_RGB16,
@ -383,7 +385,8 @@ enum class TextureFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats are available in
* OpenGL ES 3.0 and older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
RGBA16 = GL_RGBA16,
@ -397,7 +400,8 @@ enum class TextureFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats are available in
* OpenGL ES 3.0 and older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
R16Snorm = GL_R16_SNORM,
@ -411,7 +415,8 @@ enum class TextureFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats are available in
* OpenGL ES 3.0 and older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
RG16Snorm = GL_RG16_SNORM,
@ -425,7 +430,8 @@ enum class TextureFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats are available in
* OpenGL ES 3.0 and older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
RGB16Snorm = GL_RGB16_SNORM,
@ -439,7 +445,8 @@ enum class TextureFormat: GLenum {
* @requires_gles31 Only byte-sized normalized formats are available in
* OpenGL ES 3.0 and older; not defined on ES2
* @requires_es_extension OpenGL ES 3.1 and @gl_extension{EXT,texture_norm16}
* @requires_webgl_extension Extension @webgl_extension{EXT,texture_norm16}
* @requires_webgl_extension WebGL 2.0 and extension
* @webgl_extension{EXT,texture_norm16}
*/
#ifndef MAGNUM_TARGET_GLES
RGBA16Snorm = GL_RGBA16_SNORM,

1
src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt vendored

@ -27,7 +27,6 @@ extension EXT_texture_filter_anisotropic optional
extension EXT_disjoint_timer_query optional
extension EXT_texture_compression_rgtc optional
extension EXT_texture_compression_bptc optional
extension EXT_texture_norm16 optional
# These are used as a base for WEBGL_* extensions
extension EXT_color_buffer_float optional
extension EXT_texture_compression_s3tc optional

11
src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h vendored

@ -506,17 +506,6 @@ typedef khronos_uint64_t GLuint64;
#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F
/* GL_EXT_texture_norm16 */
#define GL_R16_EXT 0x822A
#define GL_RG16_EXT 0x822C
#define GL_RGBA16_EXT 0x805B
#define GL_RGB16_EXT 0x8054
#define GL_R16_SNORM_EXT 0x8F98
#define GL_RG16_SNORM_EXT 0x8F99
#define GL_RGB16_SNORM_EXT 0x8F9A
#define GL_RGBA16_SNORM_EXT 0x8F9B
/* GL_EXT_texture_compression_s3tc */
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0

Loading…
Cancel
Save