From dfd7de8df18bc605de36aa2376625b0a868beffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 24 Aug 2014 18:35:51 +0200 Subject: [PATCH] Return 1 as implicit alignment value. Previously 0 was returned, which would fail at runtime for division-by-zero in the following sanity check: CORRADE_INTERNAL_ASSERT(!(offset % BufferTexture::offsetAlignment())); --- src/Magnum/Buffer.cpp | 4 ++-- src/Magnum/Buffer.h | 4 ++-- src/Magnum/BufferTexture.cpp | 2 +- src/Magnum/BufferTexture.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Magnum/Buffer.cpp b/src/Magnum/Buffer.cpp index 467de1adf..03696dc1b 100644 --- a/src/Magnum/Buffer.cpp +++ b/src/Magnum/Buffer.cpp @@ -39,7 +39,7 @@ namespace Magnum { #ifndef MAGNUM_TARGET_GLES Int Buffer::minMapAlignment() { if(!Context::current()->isExtensionSupported()) - return 0; + return 1; GLint& value = Context::current()->state().buffer->minMapAlignment; @@ -89,7 +89,7 @@ Int Buffer::shaderStorageOffsetAlignment() { #else if(!Context::current()->isVersionSupported(Version::GLES310)) #endif - return 0; + return 1; GLint& value = Context::current()->state().buffer->shaderStorageOffsetAlignment; diff --git a/src/Magnum/Buffer.h b/src/Magnum/Buffer.h index ce53e89ba..af196e214 100644 --- a/src/Magnum/Buffer.h +++ b/src/Magnum/Buffer.h @@ -441,7 +441,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * * The result is cached, repeated queries don't result in repeated * OpenGL calls. If extension @extension{ARB,map_buffer_alignment} - * (part of OpenGL 4.2) is not available, returns `0`. + * (part of OpenGL 4.2) is not available, returns `1`. * @see @ref map(), @fn_gl{Get} with @def_gl{MIN_MAP_BUFFER_ALIGNMENT} * @requires_gl No minimal value is specified for OpenGL ES. */ @@ -476,7 +476,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * * The result is cached, repeated queries don't result in repeated * OpenGL calls. If neither extension @extension{ARB,shader_storage_buffer_object} - * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `0`. + * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `1`. * @see @fn_gl{Get} with @def_gl{SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT} * @requires_gles30 Not defined in OpenGL ES 2.0 */ diff --git a/src/Magnum/BufferTexture.cpp b/src/Magnum/BufferTexture.cpp index 84b5ad87b..54384f45a 100644 --- a/src/Magnum/BufferTexture.cpp +++ b/src/Magnum/BufferTexture.cpp @@ -49,7 +49,7 @@ Int BufferTexture::maxSize() { Int BufferTexture::offsetAlignment() { if(!Context::current()->isExtensionSupported()) - return 0; + return 1; GLint& value = Context::current()->state().texture->bufferOffsetAlignment; diff --git a/src/Magnum/BufferTexture.h b/src/Magnum/BufferTexture.h index cf8fabf80..402edc063 100644 --- a/src/Magnum/BufferTexture.h +++ b/src/Magnum/BufferTexture.h @@ -217,7 +217,7 @@ class MAGNUM_EXPORT BufferTexture: public AbstractTexture { * * The result is cached, repeated queries don't result in repeated * OpenGL calls. If extension @extension{ARB,texture_buffer_range} - * (part of OpenGL 4.3) is not available, returns `0`. + * (part of OpenGL 4.3) is not available, returns `1`. * @see @fn_gl{Get} with @def_gl{TEXTURE_BUFFER_OFFSET_ALIGNMENT} */ static Int offsetAlignment();