diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-03-07 17:50:02 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2019-03-12 11:03:54 +0100 |
commit | e27f33062994a1b0155b44b9d471e48e93b09f8e (patch) | |
tree | eff2ba71134b9721c16fd53378b9256b94396712 /test | |
parent | cb64c380fbbd209cb68af60e76b7a770805353a8 (diff) | |
download | qtlocation-mapboxgl-e27f33062994a1b0155b44b9d471e48e93b09f8e.tar.gz |
[core] add texture bindings to draw call instead of Context member fn
Diffstat (limited to 'test')
-rw-r--r-- | test/programs/binary_program.test.cpp | 7 | ||||
-rw-r--r-- | test/util/offscreen_texture.test.cpp | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/test/programs/binary_program.test.cpp b/test/programs/binary_program.test.cpp index a5cf7b6e39..c70539ea81 100644 --- a/test/programs/binary_program.test.cpp +++ b/test/programs/binary_program.test.cpp @@ -9,7 +9,8 @@ TEST(BinaryProgram, ObtainValues) { "binary code", "identifier", { { "a_pos", 1 }, { "a_data", 4 } }, - { { "u_world", 1 }, { "u_ratio", 3 } } }; + { { "u_world", 1 }, { "u_ratio", 3 } }, + { { "u_image", 0 } } }; EXPECT_EQ(42u, binaryProgram.format()); EXPECT_EQ("binary code", binaryProgram.code()); @@ -20,6 +21,8 @@ TEST(BinaryProgram, ObtainValues) { EXPECT_EQ(1, binaryProgram.uniformLocation("u_world")); EXPECT_EQ(3, binaryProgram.uniformLocation("u_ratio")); EXPECT_EQ(-1, binaryProgram.uniformLocation("a_data")); + EXPECT_EQ(0, binaryProgram.textureLocation("u_image")); + EXPECT_EQ(-1, binaryProgram.textureLocation("u_image2")); auto serialized = binaryProgram.serialize(); @@ -34,6 +37,8 @@ TEST(BinaryProgram, ObtainValues) { EXPECT_EQ(1, binaryProgram2.uniformLocation("u_world")); EXPECT_EQ(3, binaryProgram2.uniformLocation("u_ratio")); EXPECT_EQ(-1, binaryProgram2.uniformLocation("a_data")); + EXPECT_EQ(0, binaryProgram.textureLocation("u_image")); + EXPECT_EQ(-1, binaryProgram.textureLocation("u_image2")); EXPECT_THROW(BinaryProgram(""), std::runtime_error); } diff --git a/test/util/offscreen_texture.test.cpp b/test/util/offscreen_texture.test.cpp index d0a78ec968..986ec39bc1 100644 --- a/test/util/offscreen_texture.test.cpp +++ b/test/util/offscreen_texture.test.cpp @@ -2,6 +2,7 @@ #include <mbgl/platform/gl_functions.hpp> #include <mbgl/gl/context.hpp> +#include <mbgl/gl/texture.hpp> #include <mbgl/gl/defines.hpp> #include <mbgl/gl/headless_backend.hpp> #include <mbgl/renderer/backend_scope.hpp> @@ -158,7 +159,7 @@ void main() { test::checkImage("test/fixtures/offscreen_texture/render-to-fbo", image, 0, 0); // Now, composite the Framebuffer texture we've rendered to onto the main FBO. - context.bindTexture(texture.getTexture(), 0, gfx::TextureFilterType::Linear); + gl::bindTexture(context, 0, { *texture.getTexture().resource, gfx::TextureFilterType::Linear }); MBGL_CHECK_ERROR(glUseProgram(compositeShader.program)); MBGL_CHECK_ERROR(glUniform1i(u_texture, 0)); MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, viewportBuffer.buffer)); |