From 66f179f95250fbafbb13a0de23f74d334df2d5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 22 Jan 2022 18:45:20 +0100 Subject: [PATCH] Shaders: clean up GL version requirement docs for Object ID. The proper practice is to have GLES and WebGL requiurements separated, as the two editions diverge more and more and treating one as a subset of another no longer works. --- src/Magnum/Shaders/FlatGL.h | 30 ++++++++++++++++++--------- src/Magnum/Shaders/GenericGL.h | 8 +++++-- src/Magnum/Shaders/MeshVisualizerGL.h | 22 ++++++++++++++------ src/Magnum/Shaders/PhongGL.h | 30 ++++++++++++++++++--------- 4 files changed, 62 insertions(+), 28 deletions(-) diff --git a/src/Magnum/Shaders/FlatGL.h b/src/Magnum/Shaders/FlatGL.h index a7353d067..dc9aa7a63 100644 --- a/src/Magnum/Shaders/FlatGL.h +++ b/src/Magnum/Shaders/FlatGL.h @@ -131,8 +131,11 @@ If you have a batch of meshes with different object IDs, enable attribute. The output will contain a sum of the per-vertex ID and ID coming from @ref setObjectId(). -@requires_gles30 Object ID output requires integer buffer attachments, which - are not available in OpenGL ES 2.0 or WebGL 1.0. +@requires_gl30 Extension @gl_extension{EXT,texture_integer} +@requires_gles30 Object ID output requires integer support in shaders, which + is not available in OpenGL ES 2.0. +@requires_webgl20 Object ID output requires integer support in shaders, which + is not available in WebGL 1.0. @section Shaders-FlatGL-instancing Instanced rendering @@ -242,7 +245,9 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: * Used only if @ref Flag::InstancedObjectId is set. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. */ typedef typename GenericGL::ObjectId ObjectId; #endif @@ -314,8 +319,9 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: * @ref Shaders-FlatGL-object-id for more information. * @requires_gl30 Extension @gl_extension{EXT,texture_integer} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL - * 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. * @m_since{2019,10} */ ObjectIdOutput = GenericGL::ObjectIdOutput @@ -369,8 +375,9 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: * more information. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL - * 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. * @m_since{2019,10} */ ObjectId = 1 << 4, @@ -384,8 +391,9 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: * information. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL - * 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. * @m_since{2020,06} */ InstancedObjectId = (1 << 5)|ObjectId, @@ -728,7 +736,9 @@ template class MAGNUM_SHADERS_EXPORT FlatGL: public GL:: * instead. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. */ FlatGL& setObjectId(UnsignedInt id); #endif diff --git a/src/Magnum/Shaders/GenericGL.h b/src/Magnum/Shaders/GenericGL.h index eb748f994..4e0293e98 100644 --- a/src/Magnum/Shaders/GenericGL.h +++ b/src/Magnum/Shaders/GenericGL.h @@ -269,7 +269,9 @@ template struct GenericGL { * integral attachment. * @requires_gl30 Extension @gl_extension{EXT,texture_integer} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. */ ObjectIdOutput = 1 #endif @@ -361,7 +363,9 @@ template struct GenericGL { * @ref Tangent4 instead. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in shaders, - * which is not available in OpenGL ES 2.0 or WebGL 1.0. + * which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in shaders, + * which is not available in WebGL 1.0. */ typedef GL::Attribute<4, UnsignedInt> ObjectId; #endif diff --git a/src/Magnum/Shaders/MeshVisualizerGL.h b/src/Magnum/Shaders/MeshVisualizerGL.h index c066e2165..0a9e5e7c4 100644 --- a/src/Magnum/Shaders/MeshVisualizerGL.h +++ b/src/Magnum/Shaders/MeshVisualizerGL.h @@ -167,7 +167,9 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizerGL2D: public Implementation::MeshVisua * Used only if @ref Flag::InstancedObjectId is set. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. */ typedef GenericGL3D::ObjectId ObjectId; #endif @@ -783,15 +785,20 @@ triangle mesh. You can use @ref MeshTools::duplicate() (and potentially @ref MeshTools::generateIndices()) to conveniently convert the mesh to a non-indexed @ref MeshPrimitive::Triangles. -@requires_gl32 The `gl_PrimitiveID` shader variable is not available on OpenGL - 3.1 and lower. +@requires_gl30 Extension @gl_extension{EXT,gpu_shader4} for object ID input @requires_gl30 The `gl_VertexID` shader variable is not available on OpenGL 2.1. +@requires_gl32 The `gl_PrimitiveID` shader variable is not available on OpenGL + 3.1 and lower. @requires_gles32 The `gl_PrimitiveID` shader variable is not available on OpenGL ES 3.1 and lower. +@requires_gles30 Object ID input requires integer support in shaders, which + is not available in OpenGL ES 2.0. @requires_gles30 The `gl_VertexID` shader variable is not available on OpenGL ES 2.0. @requires_gles `gl_PrimitiveID` is not available in WebGL. +@requires_webgl20 Object ID input requires integer support in shaders, which + is not available in WebGL 1.0. @requires_webgl20 `gl_VertexID` is not available in WebGL 1.0. @section Shaders-MeshVisualizerGL3D-ubo Uniform buffers @@ -906,7 +913,9 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizerGL3D: public Implementation::MeshVisua * Used only if @ref Flag::InstancedObjectId is set. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. */ typedef GenericGL3D::ObjectId ObjectId; #endif @@ -956,8 +965,9 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizerGL3D: public Implementation::MeshVisua * @ref Flag::VertexId and @ref Flag::PrimitiveId. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL - * 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. * @m_since{2020,06} */ InstancedObjectId = 1 << 2, diff --git a/src/Magnum/Shaders/PhongGL.h b/src/Magnum/Shaders/PhongGL.h index 754d34cc3..93667bcbc 100644 --- a/src/Magnum/Shaders/PhongGL.h +++ b/src/Magnum/Shaders/PhongGL.h @@ -221,8 +221,11 @@ The functionality is practically the same as in the @ref FlatGL shader, see @ref Shaders-FlatGL-object-id "its documentation" for more information and usage example. -@requires_gles30 Object ID output requires integer buffer attachments, which - are not available in OpenGL ES 2.0 or WebGL 1.0. +@requires_gl30 Extension @gl_extension{EXT,texture_integer} +@requires_gles30 Object ID output requires integer support in shaders, which + is not available in OpenGL ES 2.0. +@requires_webgl20 Object ID output requires integer support in shaders, which + is not available in WebGL 1.0. @section Shaders-PhongGL-instancing Instanced rendering @@ -385,7 +388,9 @@ class MAGNUM_SHADERS_EXPORT PhongGL: public GL::AbstractShaderProgram { * Used only if @ref Flag::InstancedObjectId is set. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. */ typedef GenericGL3D::ObjectId ObjectId; #endif @@ -471,8 +476,9 @@ class MAGNUM_SHADERS_EXPORT PhongGL: public GL::AbstractShaderProgram { * @ref Shaders-PhongGL-object-id for more information. * @requires_gl30 Extension @gl_extension{EXT,texture_integer} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL - * 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. * @m_since{2019,10} */ ObjectIdOutput = GenericGL3D::ObjectIdOutput @@ -557,8 +563,9 @@ class MAGNUM_SHADERS_EXPORT PhongGL: public GL::AbstractShaderProgram { * for more information. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL - * 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. * @m_since{2019,10} */ ObjectId = 1 << 7, @@ -572,8 +579,9 @@ class MAGNUM_SHADERS_EXPORT PhongGL: public GL::AbstractShaderProgram { * information. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL - * 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. * @m_since{2020,06} */ InstancedObjectId = (1 << 8)|ObjectId, @@ -976,7 +984,9 @@ class MAGNUM_SHADERS_EXPORT PhongGL: public GL::AbstractShaderProgram { * instead. * @requires_gl30 Extension @gl_extension{EXT,gpu_shader4} * @requires_gles30 Object ID output requires integer support in - * shaders, which is not available in OpenGL ES 2.0 or WebGL 1.0. + * shaders, which is not available in OpenGL ES 2.0. + * @requires_webgl20 Object ID output requires integer support in + * shaders, which is not available in WebGL 1.0. */ PhongGL& setObjectId(UnsignedInt id); #endif