Browse Source

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.
pull/547/head
Vladimír Vondruš 4 years ago
parent
commit
66f179f952
  1. 30
      src/Magnum/Shaders/FlatGL.h
  2. 8
      src/Magnum/Shaders/GenericGL.h
  3. 22
      src/Magnum/Shaders/MeshVisualizerGL.h
  4. 30
      src/Magnum/Shaders/PhongGL.h

30
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<UnsignedInt dimensions> 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<dimensions>::ObjectId ObjectId;
#endif
@ -314,8 +319,9 @@ template<UnsignedInt dimensions> 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<dimensions>::ObjectIdOutput
@ -369,8 +375,9 @@ template<UnsignedInt dimensions> 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<UnsignedInt dimensions> 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<UnsignedInt dimensions> 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<dimensions>& setObjectId(UnsignedInt id);
#endif

8
src/Magnum/Shaders/GenericGL.h

@ -269,7 +269,9 @@ template<UnsignedInt dimensions> 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<UnsignedInt dimensions> 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

22
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,

30
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

Loading…
Cancel
Save