diff --git a/src/Magnum/GL/Test/FramebufferGLTest.cpp b/src/Magnum/GL/Test/FramebufferGLTest.cpp index 52acd5af1..a2581b8ae 100644 --- a/src/Magnum/GL/Test/FramebufferGLTest.cpp +++ b/src/Magnum/GL/Test/FramebufferGLTest.cpp @@ -1159,7 +1159,7 @@ void FramebufferGLTest::clearColorI() { {PixelFormat::RGBAInteger, PixelType::Int}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(colorImage.data()[0], (Vector4i{-124, 67, 37, 17})); + CORRADE_COMPARE(Containers::arrayCast(colorImage.data())[0], (Vector4i{-124, 67, 37, 17})); } void FramebufferGLTest::clearColorUI() { @@ -1186,7 +1186,7 @@ void FramebufferGLTest::clearColorUI() { {PixelFormat::RGBAInteger, PixelType::UnsignedInt}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(colorImage.data()[0], (Vector4ui{240, 67, 37, 17})); + CORRADE_COMPARE(Containers::arrayCast(colorImage.data())[0], (Vector4ui{240, 67, 37, 17})); } void FramebufferGLTest::clearColorF() { @@ -1213,7 +1213,7 @@ void FramebufferGLTest::clearColorF() { {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(colorImage.data()[0], (Color4ub{128, 64, 32, 17})); + CORRADE_COMPARE(Containers::arrayCast(colorImage.data())[0], (Color4ub{128, 64, 32, 17})); } void FramebufferGLTest::clearDepth() { @@ -1254,7 +1254,7 @@ void FramebufferGLTest::clearDepth() { Image2D depthImage = framebuffer.read({{}, Vector2i{1}}, {PixelFormat::DepthComponent, PixelType::UnsignedShort}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(depthImage.data()[0], 48352); + CORRADE_COMPARE(Containers::arrayCast(depthImage.data())[0], 48352); } #endif } @@ -1295,7 +1295,7 @@ void FramebufferGLTest::clearStencil() { Image2D stencilImage = framebuffer.read({{}, Vector2i{1}}, {PixelFormat::StencilIndex, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(stencilImage.data()[0], 67); + CORRADE_COMPARE(Containers::arrayCast(stencilImage.data())[0], 67); } #endif } @@ -1337,8 +1337,8 @@ void FramebufferGLTest::clearDepthStencil() { MAGNUM_VERIFY_NO_GL_ERROR(); /** @todo This will probably fail on different systems */ - CORRADE_COMPARE(depthStencilImage.data()[0] >> 8, 12378300); - CORRADE_COMPARE(depthStencilImage.data()[0], 67); + CORRADE_COMPARE(Containers::arrayCast(depthStencilImage.data())[0] >> 8, 12378300); + CORRADE_COMPARE(Containers::arrayCast(depthStencilImage.data())[0], 67); } #endif } @@ -1475,9 +1475,9 @@ void FramebufferGLTest::read() { CORRADE_COMPARE(colorImage.size(), Vector2i(8, 16)); CORRADE_COMPARE(colorImage.data().size(), (DataOffset + 8*16)*sizeof(Color4ub)); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(colorImage.data()[DataOffset], 0x80402011_rgba); + CORRADE_COMPARE(Containers::arrayCast(colorImage.data())[DataOffset], 0x80402011_rgba); #else /* using only RGBA4, less precision */ - CORRADE_COMPARE(colorImage.data()[DataOffset], 0x88442211_rgba); + CORRADE_COMPARE(Containers::arrayCast(colorImage.data())[DataOffset], 0x88442211_rgba); #endif #ifndef MAGNUM_TARGET_WEBGL @@ -1492,7 +1492,7 @@ void FramebufferGLTest::read() { Image2D depthImage = framebuffer.read({{}, Vector2i{1}}, {PixelFormat::DepthComponent, PixelType::UnsignedShort}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(depthImage.data()[0], 48352); + CORRADE_COMPARE(Containers::arrayCast(depthImage.data())[0], 48352); } #ifdef MAGNUM_TARGET_GLES @@ -1506,7 +1506,7 @@ void FramebufferGLTest::read() { Image2D stencilImage = framebuffer.read({{}, Vector2i{1}}, {PixelFormat::StencilIndex, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(stencilImage.data()[0], 67); + CORRADE_COMPARE(Containers::arrayCast(stencilImage.data())[0], 67); } #ifdef MAGNUM_TARGET_GLES @@ -1521,8 +1521,8 @@ void FramebufferGLTest::read() { MAGNUM_VERIFY_NO_GL_ERROR(); /** @todo This will probably fail on different systems */ - CORRADE_COMPARE(depthStencilImage.data()[0] >> 8, 12378300); - CORRADE_COMPARE(depthStencilImage.data()[0], 67); + CORRADE_COMPARE(Containers::arrayCast(depthStencilImage.data())[0] >> 8, 12378300); + CORRADE_COMPARE(Containers::arrayCast(depthStencilImage.data())[0], 67); } #endif } @@ -2127,14 +2127,14 @@ void FramebufferGLTest::blit() { Image2D imageBefore = b.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(imageBefore.data()[0], Color4ub()); + CORRADE_COMPARE(Containers::arrayCast(imageBefore.data())[0], Color4ub()); /* And have given color after */ Framebuffer::blit(a, b, a.viewport(), FramebufferBlit::Color); Image2D imageAfter = b.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(imageAfter.data()[0], Color4ub(128, 64, 32, 17)); + CORRADE_COMPARE(Containers::arrayCast(imageAfter.data())[0], Color4ub(128, 64, 32, 17)); } #endif diff --git a/src/Magnum/GL/Test/MeshGLTest.cpp b/src/Magnum/GL/Test/MeshGLTest.cpp index af5668e76..cc6a20411 100644 --- a/src/Magnum/GL/Test/MeshGLTest.cpp +++ b/src/Magnum/GL/Test/MeshGLTest.cpp @@ -403,9 +403,9 @@ void MeshGLTest::constructMove() { MAGNUM_VERIFY_NO_GL_ERROR(); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data()[0], 96); + CORRADE_COMPARE(Containers::arrayCast(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data())[0], 96); #else /* RGBA4, so less precision */ - CORRADE_COMPARE(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data()[0], 85); + CORRADE_COMPARE(Containers::arrayCast(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data())[0], 85); #endif } } @@ -668,7 +668,7 @@ Checker::Checker(AbstractShaderProgram&& shader, RenderbufferFormat format, Mesh } template T Checker::get(PixelFormat format, PixelType type) { - return framebuffer.read({{}, Vector2i{1}}, {format, type}).data()[0]; + return Containers::arrayCast(framebuffer.read({{}, Vector2i{1}}, {format, type}).data())[0]; } #endif @@ -847,10 +847,10 @@ void MeshGLTest::addVertexBufferVectorNui() { MAGNUM_VERIFY_NO_GL_ERROR(); const auto value = Checker(IntegerShader("uvec3"), RenderbufferFormat::RGBA32UI, mesh) - .get(PixelFormat::RGBAInteger, PixelType::UnsignedInt); + .get(PixelFormat::RGBAInteger, PixelType::UnsignedInt); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(value, Vector3ui(27592, 157, 25)); + CORRADE_COMPARE(value.xyz(), Vector3ui(27592, 157, 25)); } void MeshGLTest::addVertexBufferVectorNi() { @@ -923,13 +923,13 @@ void MeshGLTest::addVertexBufferVectorN() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_GL_ERROR(); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(value, 0x60189c_rgb); + CORRADE_COMPARE(value.xyz(), 0x60189c_rgb); #else /* RGBA4, so less precision */ - CORRADE_COMPARE(value, 0x551199_rgb); + CORRADE_COMPARE(value.xyz(), 0x551199_rgb); #endif } @@ -1018,13 +1018,13 @@ void MeshGLTest::addVertexBufferMatrixNxN() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_GL_ERROR(); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(value, 0x60189c_rgb); + CORRADE_COMPARE(value.xyz(), 0x60189c_rgb); #else /* RGBA4, so less precision */ - CORRADE_COMPARE(value, 0x551199_rgb); + CORRADE_COMPARE(value.xyz(), 0x551199_rgb); #endif } @@ -1067,7 +1067,7 @@ void MeshGLTest::addVertexBufferMatrixNxNd() { const auto value = Checker(DoubleShader("dmat3", "vec4", "vec4(value[0][0], value[1][1], value[2][2], 0.0)"), - RenderbufferFormat::RGBA16, mesh).get>(PixelFormat::RGB, PixelType::UnsignedShort); + RenderbufferFormat::RGBA16, mesh).get>(PixelFormat::RGBA, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_GL_ERROR(); @@ -1077,13 +1077,13 @@ void MeshGLTest::addVertexBufferMatrixNxNd() { drivers |= Context::DetectedDriver::IntelWindows; #endif CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & drivers, "Somehow only first two values are extracted on AMD, NVidia and Intel Windows drivers."); - CORRADE_COMPARE(value, Math::Vector3(315, 65201, 2576)); + CORRADE_COMPARE(value.xyz(), Math::Vector3(315, 65201, 2576)); } /* This is wrong, but check if it's still the right wrong. Fails on AMD 15.201.1151 but seems to be fixed in 15.300.1025.0 */ if(Context::current().detectedDriver() & (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia)) - CORRADE_COMPARE(value, Math::Vector3(315, 65201, 0)); + CORRADE_COMPARE(value.xyz(), Math::Vector3(315, 65201, 0)); } #endif @@ -1123,10 +1123,10 @@ void MeshGLTest::addVertexBufferMatrixMxN() { const auto value = Checker(FloatShader("mat3x4", "vec4(valueInterpolated[0][0], valueInterpolated[1][1], valueInterpolated[2][2], 0.0)"), - RenderbufferFormat::RGBA8, mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); + RenderbufferFormat::RGBA8, mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(value, Color3ub(96, 24, 156)); + CORRADE_COMPARE(value.xyz(), Color3ub(96, 24, 156)); } #endif @@ -1169,7 +1169,7 @@ void MeshGLTest::addVertexBufferMatrixMxNd() { const auto value = Checker(DoubleShader("dmat3x4", "vec4", "vec4(value[0][0], value[1][1], value[2][2], 0.0)"), - RenderbufferFormat::RGBA16, mesh).get>(PixelFormat::RGB, PixelType::UnsignedShort); + RenderbufferFormat::RGBA16, mesh).get>(PixelFormat::RGBA, PixelType::UnsignedShort); MAGNUM_VERIFY_NO_GL_ERROR(); @@ -1179,13 +1179,13 @@ void MeshGLTest::addVertexBufferMatrixMxNd() { drivers |= Context::DetectedDriver::IntelWindows; #endif CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & drivers, "Somehow only first two values are extracted on AMD, NVidia and Intel Windows drivers."); - CORRADE_COMPARE(value, Math::Vector3(315, 65201, 2576)); + CORRADE_COMPARE(value.xyz(), Math::Vector3(315, 65201, 2576)); } /* This is wrong, but check if it's still the right wrong. Fails on AMD 15.201.1151 but seems to be fixed in 15.300.1025.0 */ if(Context::current().detectedDriver() & (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia)) - CORRADE_COMPARE(value, Math::Vector3(315, 65201, 0)); + CORRADE_COMPARE(value.xyz(), Math::Vector3(315, 65201, 0)); } #endif @@ -1579,13 +1579,13 @@ void MeshGLTest::addVertexBufferNormalized() { #else RenderbufferFormat::RGBA4, #endif - mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); + mesh).get(PixelFormat::RGBA, PixelType::UnsignedByte); MAGNUM_VERIFY_NO_GL_ERROR(); #ifndef MAGNUM_TARGET_GLES2 - CORRADE_COMPARE(value, 0x209ce4_rgb); + CORRADE_COMPARE(value.xyz(), 0x209ce4_rgb); #else /* RGBA4, so less precision */ - CORRADE_COMPARE(value, 0x1199dd_rgb); + CORRADE_COMPARE(value.xyz(), 0x1199dd_rgb); #endif } @@ -2966,7 +2966,7 @@ void MeshGLTest::resetDivisorAfterInstancedDraw() { MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data()[0], 96); + CORRADE_COMPARE(Containers::arrayCast(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data())[0], 96); } /* Draw normal after. One two-vertex instance of an attribute with divisor @@ -2982,7 +2982,7 @@ void MeshGLTest::resetDivisorAfterInstancedDraw() { MAGNUM_VERIFY_NO_GL_ERROR(); - CORRADE_COMPARE(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data()[0], 48); + CORRADE_COMPARE(Containers::arrayCast(framebuffer.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data())[0], 48); } } @@ -3030,7 +3030,7 @@ MultiChecker::MultiChecker(AbstractShaderProgram&& shader, Mesh& mesh): framebuf } template T MultiChecker::get(PixelFormat format, PixelType type) { - return framebuffer.read({{}, Vector2i{1}}, {format, type}).data()[0]; + return Containers::arrayCast(framebuffer.read({{}, Vector2i{1}}, {format, type}).data())[0]; } #endif diff --git a/src/Magnum/GL/Test/TransformFeedbackGLTest.cpp b/src/Magnum/GL/Test/TransformFeedbackGLTest.cpp index b1cce5a38..663a23db6 100644 --- a/src/Magnum/GL/Test/TransformFeedbackGLTest.cpp +++ b/src/Magnum/GL/Test/TransformFeedbackGLTest.cpp @@ -706,7 +706,7 @@ void TransformFeedbackGLTest::draw() { MAGNUM_VERIFY_NO_GL_ERROR(); CORRADE_COMPARE(q.result(), DrawData[testCaseInstanceId()].countDraw); - CORRADE_COMPARE(fb.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data()[0], 153); + CORRADE_COMPARE(Containers::arrayCast(fb.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data())[0], 153); MAGNUM_VERIFY_NO_GL_ERROR(); }