diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-09-27 17:52:14 +0200 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-27 11:03:29 -0700 |
commit | 44c7e9d05edbe6fee9e8f98b91380b6c07e57ac7 (patch) | |
tree | cb2ee7fed51efe737543bb6f2444fac885571c41 /test | |
parent | ce42d22984d19fa020e6fba77e2585c0fd9dacf4 (diff) | |
download | qtlocation-mapboxgl-44c7e9d05edbe6fee9e8f98b91380b6c07e57ac7.tar.gz |
[core] merge gl::ObjectStore into gl::Context
Diffstat (limited to 'test')
-rw-r--r-- | test/gl/object.cpp | 53 | ||||
-rw-r--r-- | test/util/offscreen_texture.cpp | 12 |
2 files changed, 32 insertions, 33 deletions
diff --git a/test/gl/object.cpp b/test/gl/object.cpp index c70f3ad489..2722669e84 100644 --- a/test/gl/object.cpp +++ b/test/gl/object.cpp @@ -5,7 +5,6 @@ #include <mbgl/gl/gl.hpp> #include <mbgl/gl/context.hpp> -#include <mbgl/gl/object_store.hpp> #include <memory> @@ -71,48 +70,48 @@ TEST(GLObject, Store) { mbgl::HeadlessView view(std::make_shared<mbgl::HeadlessDisplay>(), 1); view.activate(); - mbgl::gl::ObjectStore store; - EXPECT_TRUE(store.empty()); + mbgl::gl::Context context; + EXPECT_TRUE(context.empty()); - mbgl::gl::UniqueProgram program = store.createProgram(); + mbgl::gl::UniqueProgram program = context.createProgram(); EXPECT_NE(program.get(), 0u); program.reset(); - EXPECT_FALSE(store.empty()); - store.performCleanup(); - EXPECT_TRUE(store.empty()); + EXPECT_FALSE(context.empty()); + context.performCleanup(); + EXPECT_TRUE(context.empty()); - mbgl::gl::UniqueShader shader = store.createShader(GL_VERTEX_SHADER); + mbgl::gl::UniqueShader shader = context.createShader(GL_VERTEX_SHADER); EXPECT_NE(shader.get(), 0u); shader.reset(); - EXPECT_FALSE(store.empty()); - store.performCleanup(); - EXPECT_TRUE(store.empty()); + EXPECT_FALSE(context.empty()); + context.performCleanup(); + EXPECT_TRUE(context.empty()); - mbgl::gl::UniqueBuffer buffer = store.createBuffer(); + mbgl::gl::UniqueBuffer buffer = context.createBuffer(); EXPECT_NE(buffer.get(), 0u); buffer.reset(); - EXPECT_FALSE(store.empty()); - store.performCleanup(); - EXPECT_TRUE(store.empty()); + EXPECT_FALSE(context.empty()); + context.performCleanup(); + EXPECT_TRUE(context.empty()); - mbgl::gl::UniqueTexture texture = store.createTexture(); + mbgl::gl::UniqueTexture texture = context.createTexture(); EXPECT_NE(texture.get(), 0u); texture.reset(); - EXPECT_FALSE(store.empty()); - store.performCleanup(); - EXPECT_FALSE(store.empty()); - store.reset(); - EXPECT_TRUE(store.empty()); + EXPECT_FALSE(context.empty()); + context.performCleanup(); + EXPECT_FALSE(context.empty()); + context.reset(); + EXPECT_TRUE(context.empty()); - mbgl::gl::UniqueVAO vao = store.createVAO(); + mbgl::gl::UniqueVAO vao = context.createVAO(); EXPECT_NE(vao.get(), 0u); vao.reset(); - EXPECT_FALSE(store.empty()); - store.performCleanup(); - EXPECT_TRUE(store.empty()); + EXPECT_FALSE(context.empty()); + context.performCleanup(); + EXPECT_TRUE(context.empty()); - store.reset(); - EXPECT_TRUE(store.empty()); + context.reset(); + EXPECT_TRUE(context.empty()); view.deactivate(); } diff --git a/test/util/offscreen_texture.cpp b/test/util/offscreen_texture.cpp index 64b7608906..2c80c04c41 100644 --- a/test/util/offscreen_texture.cpp +++ b/test/util/offscreen_texture.cpp @@ -68,8 +68,8 @@ TEST(OffscreenTexture, RenderToTexture) { HeadlessView view(1.0f, 512, 256); view.activate(); gl::Context context; - gl::ObjectStore store; - + context.viewport.setDefaultValue(gl::value::Viewport::Get()); + context.bindFramebuffer.setDefaultValue(gl::value::BindFramebuffer::Get()); MBGL_CHECK_ERROR(glEnable(GL_BLEND)); MBGL_CHECK_ERROR(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); @@ -105,7 +105,7 @@ void main() { Buffer triangleBuffer({ 0, 0.5, 0.5, -0.5, -0.5, -0.5 }); Buffer viewportBuffer({ -1, -1, 1, -1, -1, 1, 1, 1 }); - // Make sure the texture gets destructed before we call store.reset(); + // Make sure the texture gets destructed before we call context.reset(); { // First, draw red to the bound FBO. context.clearColor = { 1, 0, 0, 1 }; @@ -114,7 +114,7 @@ void main() { // Then, create a texture, bind it, and render yellow to that texture. This should not // affect the originally bound FBO. OffscreenTexture texture; - texture.bind(store, context, {{ 128, 128 }}); + texture.bind(context, {{ 128, 128 }}); context.clearColor = { 0, 0, 0, 0 }; MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT)); @@ -137,7 +137,7 @@ void main() { // Now, composite the Framebuffer texture we've rendered to onto the main FBO. context.program = compositeShader.program; - texture.getTexture().bind(store, context, 0, Raster::Scaling::Linear); + texture.getTexture().bind(context, 0, Raster::Scaling::Linear); MBGL_CHECK_ERROR(glUniform1i(u_texture, 0)); MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, viewportBuffer.buffer)); MBGL_CHECK_ERROR(glEnableVertexAttribArray(compositeShader.a_pos)); @@ -149,5 +149,5 @@ void main() { test::checkImage("test/fixtures/offscreen_texture/render-to-fbo-composited", image, 0, 0.1); } - store.reset(); + context.reset(); } |