diff --git a/src/Magnum/Shaders/Flat.frag b/src/Magnum/Shaders/Flat.frag index 623216fe7..15cf8d1fe 100644 --- a/src/Magnum/Shaders/Flat.frag +++ b/src/Magnum/Shaders/Flat.frag @@ -23,6 +23,10 @@ DEALINGS IN THE SOFTWARE. */ +#if defined(OBJECT_ID) && !defined(GL_ES) && !defined(NEW_GLSL) +#extension GL_EXT_gpu_shader4: require +#endif + #ifndef NEW_GLSL #define fragmentColor gl_FragColor #define texture texture2D diff --git a/src/Magnum/Shaders/Flat.h b/src/Magnum/Shaders/Flat.h index 9489b698f..15f79816c 100644 --- a/src/Magnum/Shaders/Flat.h +++ b/src/Magnum/Shaders/Flat.h @@ -198,9 +198,9 @@ template class MAGNUM_SHADERS_EXPORT Flat: public GL::Ab * * @ref shaders-generic "Generic attribute", @ref Magnum::UnsignedInt. * Used only if @ref Flag::InstancedObjectId is set. - * @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,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. */ typedef typename Generic::ObjectId ObjectId; #endif @@ -251,9 +251,10 @@ template class MAGNUM_SHADERS_EXPORT Flat: public GL::Ab * single-component unsigned integral attachment. Writes the value * set in @ref setObjectId() there, see * @ref Shaders-Phong-object-id for more information. - * @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 or WebGL + * 1.0. * @m_since{2019,10} */ ObjectIdOutput = Generic::ObjectIdOutput @@ -305,9 +306,10 @@ template class MAGNUM_SHADERS_EXPORT Flat: public GL::Ab /** * Enable object ID output. See @ref Shaders-Flat-object-id for * more information. - * @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,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. * @m_since{2019,10} */ ObjectId = 1 << 4, @@ -318,9 +320,10 @@ template class MAGNUM_SHADERS_EXPORT Flat: public GL::Ab * the per-vertex ID and ID coming from @ref setObjectId(). * Implicitly enables @ref Flag::ObjectId. See * @ref Shaders-Flat-object-id for more information. - * @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,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. * @m_since_latest */ InstancedObjectId = (1 << 5)|ObjectId, @@ -473,9 +476,9 @@ template class MAGNUM_SHADERS_EXPORT Flat: public GL::Ab * @ref Shaders-Flat-object-id for more information. Default is * @cpp 0 @ce. If @ref Flag::InstancedObjectId is enabled as well, this * value is combined with ID coming from the @ref ObjectId attribute. - * @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,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. */ Flat& setObjectId(UnsignedInt id); #endif diff --git a/src/Magnum/Shaders/Flat.vert b/src/Magnum/Shaders/Flat.vert index 08bf36814..a89d2bb61 100644 --- a/src/Magnum/Shaders/Flat.vert +++ b/src/Magnum/Shaders/Flat.vert @@ -23,6 +23,10 @@ DEALINGS IN THE SOFTWARE. */ +#if defined(INSTANCED_OBJECT_ID) && !defined(GL_ES) && !defined(NEW_GLSL) +#extension GL_EXT_gpu_shader4: require +#endif + #ifndef NEW_GLSL #define in attribute #define out varying diff --git a/src/Magnum/Shaders/Generic.h b/src/Magnum/Shaders/Generic.h index cb1e9f9a1..43858c0cd 100644 --- a/src/Magnum/Shaders/Generic.h +++ b/src/Magnum/Shaders/Generic.h @@ -247,9 +247,9 @@ template struct Generic { /** * Object ID shader output. Expects a single-component unsigned * integral attachment. - * @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 or WebGL 1.0. */ ObjectIdOutput = 1 #endif @@ -339,9 +339,9 @@ template struct Generic { * This attribute conflicts with @ref Bitangent, if you want to use both * instanced object ID and bitangents, you need to reconstruct them from * @ref Tangent4 instead. - * - * @requires_gles30 Object ID output requires integer attributes, which are - * not available in OpenGL ES 2.0 or WebGL 1.0. + * @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. */ typedef GL::Attribute<4, UnsignedInt> ObjectId; #endif diff --git a/src/Magnum/Shaders/MeshVisualizer.h b/src/Magnum/Shaders/MeshVisualizer.h index c2cfee7d0..bd4cffad0 100644 --- a/src/Magnum/Shaders/MeshVisualizer.h +++ b/src/Magnum/Shaders/MeshVisualizer.h @@ -145,10 +145,9 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer2D: public Implementation::MeshVisuali * * @ref shaders-generic "Generic attribute", @ref Magnum::UnsignedInt. * Used only if @ref Flag::InstancedObjectId is set. - * @requires_gles30 Object ID input requires integer attributes, which - * are not available in OpenGL ES 2.0. - * @requires_webgl20 Object ID input requires integer attributes, which - * are not available in WebGL 1.0. + * @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. */ typedef Generic3D::ObjectId ObjectId; #endif @@ -558,10 +557,9 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer3D: public Implementation::MeshVisuali * * @ref shaders-generic "Generic attribute", @ref Magnum::UnsignedInt. * Used only if @ref Flag::InstancedObjectId is set. - * @requires_gles30 Object ID input requires integer attributes, which - * are not available in OpenGL ES 2.0. - * @requires_webgl20 Object ID input requires integer attributes, which - * are not available in WebGL 1.0. + * @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. */ typedef Generic3D::ObjectId ObjectId; #endif @@ -609,8 +607,10 @@ class MAGNUM_SHADERS_EXPORT MeshVisualizer3D: public Implementation::MeshVisuali * Visualize instanced object ID. You need to provide the * @ref ObjectId attribute in the mesh. Mutually exclusive with * @ref Flag::PrimitiveId. - * @requires_gles30 Object ID input requires integer attributes, - * which are not available in OpenGL ES 2.0 or WebGL 1.0. + * @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. * @m_since_latest */ InstancedObjectId = 1 << 2, diff --git a/src/Magnum/Shaders/MeshVisualizer.vert b/src/Magnum/Shaders/MeshVisualizer.vert index 11108f30f..e8ff213e6 100644 --- a/src/Magnum/Shaders/MeshVisualizer.vert +++ b/src/Magnum/Shaders/MeshVisualizer.vert @@ -23,6 +23,10 @@ DEALINGS IN THE SOFTWARE. */ +#if defined(INSTANCED_OBJECT_ID) && !defined(GL_ES) && !defined(NEW_GLSL) +#extension GL_EXT_gpu_shader4: require +#endif + #ifndef NEW_GLSL #define in attribute #define out varying diff --git a/src/Magnum/Shaders/Phong.frag b/src/Magnum/Shaders/Phong.frag index 034fbee25..47f739be2 100644 --- a/src/Magnum/Shaders/Phong.frag +++ b/src/Magnum/Shaders/Phong.frag @@ -23,6 +23,10 @@ DEALINGS IN THE SOFTWARE. */ +#if defined(OBJECT_ID) && !defined(GL_ES) && !defined(NEW_GLSL) +#extension GL_EXT_gpu_shader4: require +#endif + #ifndef NEW_GLSL #define in varying #define fragmentColor gl_FragColor diff --git a/src/Magnum/Shaders/Phong.h b/src/Magnum/Shaders/Phong.h index 234328cda..fc75fddb0 100644 --- a/src/Magnum/Shaders/Phong.h +++ b/src/Magnum/Shaders/Phong.h @@ -214,9 +214,9 @@ class MAGNUM_SHADERS_EXPORT Phong: public GL::AbstractShaderProgram { * * @ref shaders-generic "Generic attribute", @ref Magnum::UnsignedInt. * Used only if @ref Flag::InstancedObjectId is set. - * @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,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. */ typedef Generic3D::ObjectId ObjectId; #endif @@ -282,9 +282,10 @@ class MAGNUM_SHADERS_EXPORT Phong: public GL::AbstractShaderProgram { * single-component unsigned integral attachment. Writes the value * set in @ref setObjectId() there, see * @ref Shaders-Phong-object-id for more information. - * @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 or WebGL + * 1.0. * @m_since{2019,10} */ ObjectIdOutput = Generic3D::ObjectIdOutput @@ -357,9 +358,10 @@ class MAGNUM_SHADERS_EXPORT Phong: public GL::AbstractShaderProgram { /** * Enable object ID output. See @ref Shaders-Phong-object-id * for more information. - * @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,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. * @m_since{2019,10} */ ObjectId = 1 << 7, @@ -370,9 +372,10 @@ class MAGNUM_SHADERS_EXPORT Phong: public GL::AbstractShaderProgram { * the per-vertex ID and ID coming from @ref setObjectId(). * Implicitly enables @ref Flag::ObjectId. See * @ref Shaders-Phong-object-id for more information. - * @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,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. * @m_since_latest */ InstancedObjectId = (1 << 8)|ObjectId, @@ -593,9 +596,9 @@ class MAGNUM_SHADERS_EXPORT Phong: public GL::AbstractShaderProgram { * enabled. Value set here is written to the @ref ObjectIdOutput, see * @ref Shaders-Phong-object-id for more information. Default is * @cpp 0 @ce. - * @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,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. */ Phong& setObjectId(UnsignedInt id); #endif diff --git a/src/Magnum/Shaders/Phong.vert b/src/Magnum/Shaders/Phong.vert index 2868f706d..e13c75176 100644 --- a/src/Magnum/Shaders/Phong.vert +++ b/src/Magnum/Shaders/Phong.vert @@ -23,6 +23,10 @@ DEALINGS IN THE SOFTWARE. */ +#if defined(INSTANCED_OBJECT_ID) && !defined(GL_ES) && !defined(NEW_GLSL) +#extension GL_EXT_gpu_shader4: require +#endif + #ifndef NEW_GLSL #define in attribute #define out varying