Browse Source

GL: don't include MAGNUM_shader_vertex_id on ES2 builds.

It makes one think such feature *could* be supported there, while it
couldn't.
pull/370/head
Vladimír Vondruš 7 years ago
parent
commit
6e97039b8d
  1. 4
      doc/opengl-support.dox
  2. 4
      src/Magnum/GL/Context.cpp
  3. 4
      src/Magnum/GL/Extensions.h
  4. 3
      src/Magnum/GL/Test/ContextTest.cpp
  5. 9
      src/Magnum/MeshTools/FullScreenTriangle.cpp
  6. 7
      src/Magnum/TextureTools/DistanceField.cpp

4
doc/opengl-support.dox

@ -397,7 +397,7 @@ Extension | Status
@gl_extension{EXT,draw_buffers} | done @gl_extension{EXT,draw_buffers} | done
@gl_extension{EXT,instanced_arrays} | done @gl_extension{EXT,instanced_arrays} | done
@gl_extension{EXT,draw_instanced} | done @gl_extension{EXT,draw_instanced} | done
`MAGNUM_shader_vertex_id` \n @m_span{m-text m-dim} Pseudo-extension denoting support for the @glsl gl_VertexID @ce \n GLSL builtin. Exposed on ES3 builds as well. @m_endspan | done `MAGNUM_shader_vertex_id` \n @m_span{m-text m-dim} Pseudo-extension denoting support for the @glsl gl_VertexID @ce \n GLSL builtin. Exposed on ES3 builds only. @m_endspan | done
@gl_extension{NV,draw_buffers} | done @gl_extension{NV,draw_buffers} | done
@gl_extension{NV,fbo_color_attachments} | done @gl_extension{NV,fbo_color_attachments} | done
@gl_extension{NV,read_buffer} | done @gl_extension{NV,read_buffer} | done
@ -500,7 +500,7 @@ Extension | Status
@webgl_extension{EXT,color_buffer_half_float} | | @webgl_extension{EXT,color_buffer_half_float} | |
@webgl_extension{EXT,blend_minmax} | done @webgl_extension{EXT,blend_minmax} | done
@webgl_extension{EXT,shader_texture_lod} | done (shading language only) @webgl_extension{EXT,shader_texture_lod} | done (shading language only)
`MAGNUM_shader_vertex_id` \n @m_span{m-text m-dim} Pseudo-extension denoting support for the @glsl gl_VertexID @ce \n GLSL builtin. Exposed on WebGL 2 builds as well. @m_endspan | done `MAGNUM_shader_vertex_id` \n @m_span{m-text m-dim} Pseudo-extension denoting support for the @glsl gl_VertexID @ce \n GLSL builtin. Exposed on WebGL 2 builds only. @m_endspan | done
@webgl_extension{OES,texture_float} | done @webgl_extension{OES,texture_float} | done
@webgl_extension{OES,texture_half_float} | done @webgl_extension{OES,texture_half_float} | done
@webgl_extension{OES,standard_derivatives} | done @webgl_extension{OES,standard_derivatives} | done

4
src/Magnum/GL/Context.cpp

@ -263,7 +263,9 @@ constexpr Extension ExtensionListES300[]{
_extension(EXT,blend_minmax), _extension(EXT,blend_minmax),
_extension(EXT,shader_texture_lod), _extension(EXT,shader_texture_lod),
#endif #endif
#ifndef MAGNUM_TARGET_GLES2
_extension(MAGNUM,shader_vertex_id), _extension(MAGNUM,shader_vertex_id),
#endif
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
_extension(OES,texture_float), _extension(OES,texture_float),
_extension(OES,texture_half_float), _extension(OES,texture_half_float),
@ -348,7 +350,9 @@ constexpr Extension ExtensionListES300[]{
_extension(EXT,instanced_arrays), _extension(EXT,instanced_arrays),
_extension(EXT,draw_instanced), _extension(EXT,draw_instanced),
#endif #endif
#ifndef MAGNUM_TARGET_GLES2
_extension(MAGNUM,shader_vertex_id), _extension(MAGNUM,shader_vertex_id),
#endif
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
_extension(NV,draw_buffers), _extension(NV,draw_buffers),
_extension(NV,fbo_color_attachments), _extension(NV,fbo_color_attachments),

4
src/Magnum/GL/Extensions.h

@ -309,7 +309,9 @@ namespace ANGLE {
_extension(30,WEBGL,compressed_texture_astc, GLES200, None) // #30 _extension(30,WEBGL,compressed_texture_astc, GLES200, None) // #30
_extension(31,WEBGL,compressed_texture_s3tc_srgb, GLES200, None) // #32 _extension(31,WEBGL,compressed_texture_s3tc_srgb, GLES200, None) // #32
} namespace MAGNUM { } namespace MAGNUM {
#ifndef MAGNUM_TARGET_GLES2
_extension(40,MAGNUM,shader_vertex_id, GLES300, GLES300) _extension(40,MAGNUM,shader_vertex_id, GLES300, GLES300)
#endif
} }
#else #else
namespace ANDROID { namespace ANDROID {
@ -489,7 +491,9 @@ namespace ANDROID {
_extension(126,OES,texture_storage_multisample_2d_array, GLES310, GLES320) // #174 _extension(126,OES,texture_storage_multisample_2d_array, GLES310, GLES320) // #174
#endif #endif
} namespace MAGNUM { } namespace MAGNUM {
#ifndef MAGNUM_TARGET_GLES2
_extension(130,MAGNUM,shader_vertex_id, GLES300, GLES300) _extension(130,MAGNUM,shader_vertex_id, GLES300, GLES300)
#endif
} }
#endif #endif
#undef _extension #undef _extension

3
src/Magnum/GL/Test/ContextTest.cpp

@ -29,6 +29,7 @@
#include <Corrade/Utility/DebugStl.h> #include <Corrade/Utility/DebugStl.h>
#include "Magnum/GL/Context.h" #include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/Version.h" #include "Magnum/GL/Version.h"
namespace Magnum { namespace GL { namespace Test { namespace { namespace Magnum { namespace GL { namespace Test { namespace {
@ -166,7 +167,7 @@ void ContextTest::extensions() {
#endif #endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2)
if(e.coreVersion() == Version::GLES300) { if(e.coreVersion() == Version::GLES300 && e.index() != Extensions::MAGNUM::shader_vertex_id::Index) {
Error{} << "Extension" << e.string() << "has core version" << e.coreVersion() << "on a GLES3 build -- it shouldn't be present at all"; Error{} << "Extension" << e.string() << "has core version" << e.coreVersion() << "on a GLES3 build -- it shouldn't be present at all";
CORRADE_VERIFY(false); CORRADE_VERIFY(false);
} }

9
src/Magnum/MeshTools/FullScreenTriangle.cpp

@ -40,7 +40,10 @@ GL::Mesh fullScreenTriangle(const GL::Version version) {
mesh.setPrimitive(GL::MeshPrimitive::Triangles) mesh.setPrimitive(GL::MeshPrimitive::Triangles)
.setCount(3); .setCount(3);
if(!GL::Context::current().isExtensionSupported<GL::Extensions::MAGNUM::shader_vertex_id>(version)) { #ifndef MAGNUM_TARGET_GLES2
if(!GL::Context::current().isExtensionSupported<GL::Extensions::MAGNUM::shader_vertex_id>(version))
#endif
{
constexpr Vector2 triangle[]{ constexpr Vector2 triangle[]{
{-1.0f, 1.0f}, {-1.0f, 1.0f},
{-1.0f, -3.0f}, {-1.0f, -3.0f},
@ -51,6 +54,10 @@ GL::Mesh fullScreenTriangle(const GL::Version version) {
mesh.addVertexBuffer(std::move(buffer), 0, GL::Attribute<0, Vector2>{}); mesh.addVertexBuffer(std::move(buffer), 0, GL::Attribute<0, Vector2>{});
} }
#ifdef MAGNUM_TARGET_GLES2
static_cast<void>(version);
#endif
return mesh; return mesh;
} }

7
src/Magnum/TextureTools/DistanceField.cpp

@ -106,7 +106,10 @@ DistanceFieldShader::DistanceFieldShader(const UnsignedInt radius) {
attachShaders({vert, frag}); attachShaders({vert, frag});
if(!GL::Context::current().isExtensionSupported<GL::Extensions::MAGNUM::shader_vertex_id>()) { #ifndef MAGNUM_TARGET_GLES2
if(!GL::Context::current().isExtensionSupported<GL::Extensions::MAGNUM::shader_vertex_id>())
#endif
{
bindAttributeLocation(Position::Location, "position"); bindAttributeLocation(Position::Location, "position");
} }
@ -154,7 +157,9 @@ DistanceField::DistanceField(const UnsignedInt radius): _state{new State{radius}
_state->mesh.setPrimitive(GL::MeshPrimitive::Triangles) _state->mesh.setPrimitive(GL::MeshPrimitive::Triangles)
.setCount(3); .setCount(3);
#ifndef MAGNUM_TARGET_GLES2
if(!GL::Context::current().isExtensionSupported<GL::Extensions::MAGNUM::shader_vertex_id>()) if(!GL::Context::current().isExtensionSupported<GL::Extensions::MAGNUM::shader_vertex_id>())
#endif
{ {
constexpr Vector2 triangle[] = { constexpr Vector2 triangle[] = {
Vector2(-1.0, 1.0), Vector2(-1.0, 1.0),

Loading…
Cancel
Save