diff --git a/doc/opengl-mapping.dox b/doc/opengl-mapping.dox index e05a92e9f..4fbb3b5cf 100644 --- a/doc/opengl-mapping.dox +++ b/doc/opengl-mapping.dox @@ -91,7 +91,7 @@ OpenGL function | Matching API @fn_gl{CopyTexSubImage1D}, \n `glCopyTextureSubImage1D()`, \n @fn_gl_extension{CopyTextureSubImage1D,EXT,direct_state_access}, \n @fn_gl{CopyTexSubImage2D}, \n `glCopyTextureSubImage2D()`, \n @fn_gl_extension{CopyTextureSubImage2D,EXT,direct_state_access}, \n @fn_gl{CopyTexSubImage3D}, \n `glCopyTextureSubImage3D()`, \n @fn_gl_extension{CopyTextureSubImage3D,EXT,direct_state_access} | | @fn_gl{CreateProgram}, @fn_gl{DeleteProgram} | @ref AbstractShaderProgram constructor and destructor @fn_gl{CreateShader}, @fn_gl{DeleteShader} | @ref Shader constructor and destructor -@fn_gl{CreateShaderProgram} | | +@fn_gl{CreateShaderProgram} | | @fn_gl{CullFace} | @ref Renderer::setFaceCullingMode() @fn_gl{DebugMessageCallback} | @ref DebugMessage::setCallback() @fn_gl{DebugMessageControl} | @ref DebugMessage::setEnabled() @@ -277,7 +277,6 @@ OpenGL function | Matching API @def_gl{BLEND}, \n @def_gl{COLOR_LOGIC_OP}, \n @def_gl{CULL_FACE}, \n @def_gl{DEBUG_OUTPUT}, \n @def_gl{DEBUG_OUTPUT_SYNCHRONOUS}, \n @def_gl{DEPTH_CLAMP}, \n @def_gl{DEPTH_TEST}, \n @def_gl{DITHER}, \n @def_gl{MULTISAMPLE}, \n @def_gl{POLYGON_OFFSET_FILL}, \n @def_gl{POLYGON_OFFSET_LINE}, \n @def_gl{POLYGON_OFFSET_POINT}, \n @def_gl{PROGRAM_POINT_SIZE}, \n @def_gl{SCISSOR}, \n @def_gl{TEXTURE_CUBE_MAP_SEAMLESS}, \n @def_gl{STENCIL_TEST} | not queryable, @ref Renderer::setFeature() setter only @def_gl{COLOR_CLEAR_VALUE}, \n @def_gl{DEPTH_CLEAR_VALUE}, \n @def_gl{STENCIL_CLEAR_VALUE} | not queryable, @ref Renderer::setClearColor(), \n @ref Renderer::setClearDepth() and \n @ref Renderer::setClearStencil() setters only @def_gl{COLOR_WRITEMASK}, \n @def_gl{DEPTH_WRITEMASK}, \n @def_gl{STENCIL_BACK_WRITEMASK}, \n @def_gl{STENCIL_WRITEMASK} | not queryable, @ref Renderer::setColorMask(), \n @ref Renderer::setDepthMask() and \n @ref Renderer::setStencilMask() setters only -@def_gl{COMPRESSED_TEXTURE_FORMATS} | | @def_gl{CONTEXT_FLAGS} | @ref Context::flags() @def_gl{CURRENT_PROGRAM} | not queryable but tracked internally @def_gl{DEBUG_GROUP_STACK_DEPTH} | | @@ -337,7 +336,7 @@ OpenGL function | Matching API @def_gl{MAX_SERVER_WAIT_TIMEOUT} | | @def_gl{MAX_SHADER_STORAGE_BLOCK_SIZE} | @ref AbstractShaderProgram::maxShaderStorageBlockSize() @def_gl{MAX_SHADER_STORAGE_BUFFER_BINDINGS} | @ref Buffer::maxShaderStorageBindings() -@def_gl{MAX_TEXTURE_BUFFER_SIZE} | | +@def_gl{MAX_TEXTURE_BUFFER_SIZE} | @ref BufferTexture::maxSize() @def_gl_extension{MAX_TEXTURE_MAX_ANISOTROPY,EXT,texture_filter_anisotropic} | @ref Sampler::maxMaxAnisotropy() @def_gl{MAX_TEXTURE_LOD_BIAS} | @ref AbstractTexture::maxLodBias() @def_gl{MAX_UNIFORM_BLOCK_SIZE} | @ref AbstractShaderProgram::maxUniformBlockSize() @@ -350,7 +349,7 @@ OpenGL function | Matching API @def_gl{MAX_VIEWPORT_DIMS} | @ref AbstractFramebuffer::maxViewportSize() @def_gl{MIN_MAP_BUFFER_ALIGNMENT} | @ref Buffer::minMapAlignment() @def_gl{MIN_PROGRAM_TEXEL_OFFSET}, \n @def_gl{MAX_PROGRAM_TEXEL_OFFSET} | @ref AbstractShaderProgram::minTexelOffset(), \n @ref AbstractShaderProgram::maxTexelOffset() -@def_gl{NUM_COMPRESSED_TEXTURE_FORMATS} | | +@def_gl{NUM_COMPRESSED_TEXTURE_FORMATS}, \n @def_gl{COMPRESSED_TEXTURE_FORMATS} | | @def_gl{NUM_EXTENSIONS} | @ref Context::supportedExtensions() @def_gl{NUM_PROGRAM_BINARY_FORMATS}, \n @def_gl{PROGRAM_BINARY_FORMATS} | | @def_gl{NUM_SHADER_BINARY_FORMATS}, \n @def_gl{SHADER_BINARY_FORMATS} | | diff --git a/src/Magnum/AbstractQuery.cpp b/src/Magnum/AbstractQuery.cpp index 2de393661..5cc789740 100644 --- a/src/Magnum/AbstractQuery.cpp +++ b/src/Magnum/AbstractQuery.cpp @@ -153,9 +153,9 @@ void AbstractQuery::begin(const GLenum target) { CORRADE_ASSERT(!_target, "AbstractQuery::begin(): the query is already running", ); #ifndef MAGNUM_TARGET_GLES2 - glBeginQuery(_target = target, id()); + glBeginQuery(_target = target, _id); #elif !defined(CORRADE_TARGET_EMSCRIPTEN) - glBeginQueryEXT(_target = target, id()); + glBeginQueryEXT(_target = target, _id); #else static_cast(target); CORRADE_ASSERT_UNREACHABLE(); diff --git a/src/Magnum/AbstractShaderProgram.h b/src/Magnum/AbstractShaderProgram.h index 2279646ac..bb7c14d4b 100644 --- a/src/Magnum/AbstractShaderProgram.h +++ b/src/Magnum/AbstractShaderProgram.h @@ -80,8 +80,7 @@ MyShader() { CORRADE_INTERNAL_ASSERT_OUTPUT(Shader::compile({vert, frag})); // Attach the shaders - attachShader(vert); - attachShader(frag); + attachShader({vert, frag}); // Link the program together CORRADE_INTERNAL_ASSERT_OUTPUT(link()); @@ -236,7 +235,7 @@ layout(binding = 1) uniform sampler2D specularTexture; @endcode If you don't have the required extension, declare the uniforms without the -`layout()` qualifier and set the texture binding unit using +`binding` qualifier and set the texture binding unit using @ref setUniform(Int, const T&) "setUniform(Int, Int)". Note that additional syntax changes may be needed for GLSL 1.20 and GLSL ES 1.0. @code @@ -688,6 +687,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { * The same as @ref bindFragmentDataLocationIndexed(), but with `index` * set to `0`. * @see @fn_gl{BindFragDataLocation} + * @deprecated_gl Preferred usage is to specify attribute location + * explicitly in the shader instead of using this function. See + * @ref AbstractShaderProgram-attribute-location "class documentation" + * for more information. * @requires_gl30 %Extension @extension{EXT,gpu_shader4} * @requires_gl Use explicit location specification in OpenGL ES 3.0 * and `gl_FragData[n]` provided by @es_extension2{NV,draw_buffers,GL_NV_draw_buffers} diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index 2cdf30902..fed9b90c5 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -211,6 +211,9 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * texture unit is unbound. If @extension{ARB,multi_bind} (part of * OpenGL 4.4) is not available, the feature is emulated with sequence * of @ref bind(Int) / @ref unbind() calls. + * @note This function is meant to be used only internally from + * @ref AbstractShaderProgram subclasses. See its documentation + * for more information. * @see @fn_gl{BindTextures}, eventually @fn_gl{ActiveTexture}, * @fn_gl{BindTexture} or @fn_gl_extension{BindMultiTexture,EXT,direct_state_access} */ diff --git a/src/Magnum/Buffer.cpp b/src/Magnum/Buffer.cpp index 627b92f70..467de1adf 100644 --- a/src/Magnum/Buffer.cpp +++ b/src/Magnum/Buffer.cpp @@ -98,9 +98,7 @@ Int Buffer::shaderStorageOffsetAlignment() { return value; } -#endif -#ifndef MAGNUM_TARGET_GLES2 Int Buffer::maxUniformBindings() { #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) @@ -114,9 +112,7 @@ Int Buffer::maxUniformBindings() { return value; } -#endif -#ifndef MAGNUM_TARGET_GLES2 void Buffer::copy(Buffer& read, Buffer& write, const GLintptr readOffset, const GLintptr writeOffset, const GLsizeiptr size) { Context::current()->state().buffer->copyImplementation(read, write, readOffset, writeOffset, size); } diff --git a/src/Magnum/Buffer.h b/src/Magnum/Buffer.h index f3697b092..ce53e89ba 100644 --- a/src/Magnum/Buffer.h +++ b/src/Magnum/Buffer.h @@ -227,9 +227,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * 3.0 and older. */ AtomicCounter = GL_ATOMIC_COUNTER_BUFFER, - #endif - #ifndef MAGNUM_TARGET_GLES2 /** * Source for copies. See @ref copy(). * @requires_gl31 %Extension @extension{ARB,copy_buffer} @@ -245,9 +243,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * 2.0. */ CopyWrite = GL_COPY_WRITE_BUFFER, - #endif - #ifndef MAGNUM_TARGET_GLES2 /** * Indirect compute dispatch commands. * @requires_gl43 %Extension @extension{ARB,compute_shader} @@ -266,11 +262,9 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { #endif /** Used for storing vertex indices. */ - ElementArray = GL_ELEMENT_ARRAY_BUFFER + ElementArray = GL_ELEMENT_ARRAY_BUFFER, #ifndef MAGNUM_TARGET_GLES2 - , - /** * Target for pixel pack operations. * @requires_gles30 Pixel buffer objects are not available in @@ -284,9 +278,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * OpenGL ES 2.0. */ PixelUnpack = GL_PIXEL_UNPACK_BUFFER, - #endif - #ifndef MAGNUM_TARGET_GLES2 /** * Used for shader storage. * @requires_gl43 %Extension @extension{ARB,shader_storage_buffer_object} @@ -489,9 +481,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @requires_gles30 Not defined in OpenGL ES 2.0 */ static Int shaderStorageOffsetAlignment(); - #endif - #ifndef MAGNUM_TARGET_GLES2 /** * @brief Max supported uniform buffer binding count * @@ -499,12 +489,10 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * OpenGL calls. If extension @extension{ARB,uniform_buffer_object} * (part of OpenGL 3.1) is not available, returns `0`. * @see @fn_gl{Get} with @def_gl{MAX_UNIFORM_BUFFER_BINDINGS} - * @requires_gles30 Uniform blocks are not available in OpenGL ES 2.0. + * @requires_gles30 Uniform buffers are not available in OpenGL ES 2.0 */ static Int maxUniformBindings(); - #endif - #ifndef MAGNUM_TARGET_GLES2 /** * @brief Copy one buffer to another * @param read %Buffer from which to read