From 6b59c08c15db6790d80620c38ac4d0658847125f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 22 Mar 2013 21:28:24 +0100 Subject: [PATCH] Some image & texture formats are available only through ES2 extensions. And ES3 has no extensions now. --- src/AbstractImage.cpp | 22 +++++++++++++++++++++- src/AbstractImage.h | 8 ++++++++ src/AbstractTexture.cpp | 2 ++ src/AbstractTexture.h | 8 ++++++++ src/Renderbuffer.h | 4 ++++ 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/AbstractImage.cpp b/src/AbstractImage.cpp index 6d34289e3..c7bd56b2d 100644 --- a/src/AbstractImage.cpp +++ b/src/AbstractImage.cpp @@ -59,9 +59,13 @@ std::size_t AbstractImage::pixelSize(Format format, Type type) { case Type::UnsignedShort565Rev: #endif case Type::UnsignedShort4444: + #ifndef MAGNUM_TARGET_GLES3 case Type::UnsignedShort4444Rev: + #endif case Type::UnsignedShort5551: + #ifndef MAGNUM_TARGET_GLES3 case Type::UnsignedShort1555Rev: + #endif return 2; #ifndef MAGNUM_TARGET_GLES case Type::UnsignedInt8888: @@ -111,7 +115,9 @@ std::size_t AbstractImage::pixelSize(Format format, Type type) { #ifndef MAGNUM_TARGET_GLES2 case Format::RGBAInteger: #endif + #ifndef MAGNUM_TARGET_GLES3 case Format::BGRA: + #endif #ifndef MAGNUM_TARGET_GLES case Format::BGRAInteger: #endif @@ -119,7 +125,9 @@ std::size_t AbstractImage::pixelSize(Format format, Type type) { /* Handled above */ case Format::DepthComponent: + #ifndef MAGNUM_TARGET_GLES3 case Format::StencilIndex: + #endif case Format::DepthStencil: CORRADE_INTERNAL_ASSERT(false); } @@ -143,19 +151,27 @@ Debug operator<<(Debug debug, AbstractImage::Format value) { #ifndef MAGNUM_TARGET_GLES _c(BGR) #endif + #ifndef MAGNUM_TARGET_GLES3 _c(BGRA) + #endif #ifndef MAGNUM_TARGET_GLES2 _c(RedInteger) + #ifndef MAGNUM_TARGET_GLES _c(GreenInteger) _c(BlueInteger) + #endif _c(RGInteger) _c(RGBInteger) _c(RGBAInteger) + #ifndef MAGNUM_TARGET_GLES _c(BGRInteger) _c(BGRAInteger) #endif + #endif _c(DepthComponent) + #ifndef MAGNUM_TARGET_GLES3 _c(StencilIndex) + #endif _c(DepthStencil) #undef _c } @@ -180,7 +196,7 @@ Debug operator<<(Debug debug, AbstractImage::Type value) { #endif _c(HalfFloat) _c(Float) - #ifndef MAGNUM_TARGET_GLES2 + #ifndef MAGNUM_TARGET_GLES _c(UnsignedByte332) _c(UnsignedByte233Rev) #endif @@ -189,9 +205,13 @@ Debug operator<<(Debug debug, AbstractImage::Type value) { _c(UnsignedShort565Rev) #endif _c(UnsignedShort4444) + #ifndef MAGNUM_TARGET_GLES3 _c(UnsignedShort4444Rev) + #endif _c(UnsignedShort5551) + #ifndef MAGNUM_TARGET_GLES3 _c(UnsignedShort1555Rev) + #endif #ifndef MAGNUM_TARGET_GLES _c(UnsignedInt8888) _c(UnsignedInt8888Rev) diff --git a/src/AbstractImage.h b/src/AbstractImage.h index ff6964bc9..5ba4002c6 100644 --- a/src/AbstractImage.h +++ b/src/AbstractImage.h @@ -131,6 +131,7 @@ class MAGNUM_EXPORT AbstractImage { BGR = GL_BGR, #endif + #ifndef MAGNUM_TARGET_GLES3 /** * Floating-point BGRA. * @requires_es_extension %Extension @es_extension{EXT,read_format_bgra} @@ -143,6 +144,7 @@ class MAGNUM_EXPORT AbstractImage { #else BGRA = GL_BGRA_EXT, #endif + #endif #ifndef MAGNUM_TARGET_GLES2 /** @@ -230,6 +232,7 @@ class MAGNUM_EXPORT AbstractImage { */ DepthComponent = GL_DEPTH_COMPONENT, + #ifndef MAGNUM_TARGET_GLES3 /** * Stencil index. For framebuffer reading only. * @requires_es_extension %Extension @es_extension2{NV,read_stencil,GL_NV_read_depth_stencil} @@ -240,6 +243,7 @@ class MAGNUM_EXPORT AbstractImage { #else StencilIndex = 0x1901, #endif + #endif /** * Depth and stencil. @@ -369,6 +373,7 @@ class MAGNUM_EXPORT AbstractImage { */ UnsignedShort4444 = GL_UNSIGNED_SHORT_4_4_4_4, + #ifndef MAGNUM_TARGET_GLES3 /** * ABGR, unsigned short, each component 4bit. * @requires_es_extension For framebuffer reading only, extension @@ -379,6 +384,7 @@ class MAGNUM_EXPORT AbstractImage { #else UnsignedShort4444Rev = GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, #endif + #endif /** * RGBA, unsigned short, each RGB component 5bit, alpha component @@ -387,6 +393,7 @@ class MAGNUM_EXPORT AbstractImage { */ UnsignedShort5551 = GL_UNSIGNED_SHORT_5_5_5_1, + #ifndef MAGNUM_TARGET_GLES3 /** * ABGR, unsigned short, each RGB component 5bit, alpha component * 1bit. @@ -398,6 +405,7 @@ class MAGNUM_EXPORT AbstractImage { #else UnsignedShort1555Rev = GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, #endif + #endif #ifndef MAGNUM_TARGET_GLES /** diff --git a/src/AbstractTexture.cpp b/src/AbstractTexture.cpp index cdb5a305b..ab272feaf 100644 --- a/src/AbstractTexture.cpp +++ b/src/AbstractTexture.cpp @@ -96,6 +96,7 @@ Int AbstractTexture::maxSupportedLayerCount() { return Context::current()->state()->texture->maxSupportedLayerCount; } +#ifndef MAGNUM_TARGET_GLES3 Float AbstractTexture::maxSupportedAnisotropy() { GLfloat& value = Context::current()->state()->texture->maxSupportedAnisotropy; @@ -108,6 +109,7 @@ Float AbstractTexture::maxSupportedAnisotropy() { return value; } +#endif void AbstractTexture::destroy() { /* Moved out */ diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 3935d69c8..56b636c9f 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -653,6 +653,7 @@ class MAGNUM_EXPORT AbstractTexture { RGB565 = GL_RGB565, #endif + #ifndef MAGNUM_TARGET_GLES3 /** * RGB, each component normalized unsigned 10bit. * @requires_es_extension %Extension @es_extension{OES,required_internalformat} @@ -663,6 +664,7 @@ class MAGNUM_EXPORT AbstractTexture { #else RGB10 = GL_RGB10_EXT, #endif + #endif #ifndef MAGNUM_TARGET_GLES /** @@ -740,6 +742,7 @@ class MAGNUM_EXPORT AbstractTexture { RGB9E5 = GL_RGB9_E5, #endif + #ifndef MAGNUM_TARGET_GLES3 /** * sRGB, normalized unsigned, size implementation-dependent. * @todo is this allowed in core? @@ -754,6 +757,7 @@ class MAGNUM_EXPORT AbstractTexture { #else SRGB = GL_SRGB_EXT, #endif + #endif #ifndef MAGNUM_TARGET_GLES2 /** @@ -764,6 +768,7 @@ class MAGNUM_EXPORT AbstractTexture { SRGB8 = GL_SRGB8, #endif + #ifndef MAGNUM_TARGET_GLES3 /** * sRGBA, normalized unsigned, size implementation-dependent. * @todo is this allowed in core? @@ -778,6 +783,7 @@ class MAGNUM_EXPORT AbstractTexture { #else SRGBAlpha = GL_SRGB_ALPHA_EXT, #endif + #endif #ifndef MAGNUM_TARGET_GLES2 /** @@ -930,6 +936,7 @@ class MAGNUM_EXPORT AbstractTexture { DepthComponent24 = GL_DEPTH_COMPONENT24_OES, #endif + #ifndef MAGNUM_TARGET_GLES3 /** * Depth component, 32bit. * @requires_es_extension %Extension (@es_extension{OES,required_internalformat}, @@ -941,6 +948,7 @@ class MAGNUM_EXPORT AbstractTexture { #else DepthComponent32 = GL_DEPTH_COMPONENT32_OES, #endif + #endif #ifndef MAGNUM_TARGET_GLES2 /** diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index 8c9cc8957..58f1bcd3e 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -436,6 +436,7 @@ class MAGNUM_EXPORT Renderbuffer { DepthComponent24 = GL_DEPTH_COMPONENT24_OES, #endif + #ifndef MAGNUM_TARGET_GLES3 /** * Depth component, 32bit. * @requires_es_extension %Extension @es_extension{OES,depth32} @@ -445,6 +446,7 @@ class MAGNUM_EXPORT Renderbuffer { #else DepthComponent32 = GL_DEPTH_COMPONENT32_OES, #endif + #endif #ifndef MAGNUM_TARGET_GLES2 /** @@ -466,6 +468,7 @@ class MAGNUM_EXPORT Renderbuffer { StencilIndex = GL_STENCIL_INDEX, #endif + #ifndef MAGNUM_TARGET_GLES3 /** * 1-bit stencil index. * @requires_es_extension %Extension @es_extension{OES,stencil1} @@ -485,6 +488,7 @@ class MAGNUM_EXPORT Renderbuffer { #else StencilIndex4 = GL_STENCIL_INDEX4_OES, #endif + #endif /** 8-bit stencil index. */ StencilIndex8 = GL_STENCIL_INDEX8,