diff --git a/src/Magnum/DebugTools/BufferData.h b/src/Magnum/DebugTools/BufferData.h index 178a13a57..8fa8af909 100644 --- a/src/Magnum/DebugTools/BufferData.h +++ b/src/Magnum/DebugTools/BufferData.h @@ -59,7 +59,7 @@ WebGL 2.0 it's just an alias to @ref GL::Buffer::subData(). @requires_webgl20 Buffer data queries or buffer mapping are not available in WebGL 1.0. */ -template Containers::Array inline bufferSubData(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) { +template Containers::Array inline bufferSubData(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) { if(!size) return {}; #if !defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_TARGET_WEBGL) Containers::Array data = buffer.subData(offset, size*sizeof(T)); diff --git a/src/Magnum/DebugTools/Test/BufferDataGLTest.cpp b/src/Magnum/DebugTools/Test/BufferDataGLTest.cpp index 057a3fe8c..b697e69f0 100644 --- a/src/Magnum/DebugTools/Test/BufferDataGLTest.cpp +++ b/src/Magnum/DebugTools/Test/BufferDataGLTest.cpp @@ -59,9 +59,15 @@ void BufferDataGLTest::data() { CORRADE_VERIFY(emptyContents.isEmpty()); buffer.setData(Data, GL::BufferUsage::StaticDraw); - const Containers::Array contents = bufferData(buffer); + + const Containers::Array contents = bufferData(buffer); + MAGNUM_VERIFY_NO_GL_ERROR(); + CORRADE_COMPARE_AS(contents, + Containers::arrayCast(Containers::arrayView(Data)), + TestSuite::Compare::Container); + const Containers::Array intContents = bufferData(buffer); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE_AS(contents, Containers::arrayView(Data), + CORRADE_COMPARE_AS(intContents, Containers::arrayView(Data), TestSuite::Compare::Container); } @@ -73,11 +79,16 @@ void BufferDataGLTest::subData() { GL::Buffer buffer; buffer.setData(Data, GL::BufferUsage::StaticDraw); - const Containers::Array contents = bufferSubData(buffer, 4, 3); + + const Containers::Array contents = bufferSubData(buffer, 4, 3*4); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE_AS(contents, Containers::arrayView(Data).slice(1, 4), + CORRADE_COMPARE_AS(contents, + Containers::arrayCast(Containers::arrayView(Data).slice(1, 4)), + TestSuite::Compare::Container); + const Containers::Array intContents = bufferSubData(buffer, 4, 3); + MAGNUM_VERIFY_NO_GL_ERROR(); + CORRADE_COMPARE_AS(intContents, Containers::arrayView(Data).slice(1, 4), TestSuite::Compare::Container); - const Containers::Array emptyContents = bufferSubData(buffer, 4, 0); MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_VERIFY(emptyContents.isEmpty());