From c61041b44cd9181641db2351f4657cc356300226 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 3 Jul 2017 14:05:12 -0700 Subject: [core] Rework attribute binding (again) These changes are necessary for programs whose set of active attributes is not fixed at compile time by a template parameter pack, but rather varies based on the generated shader text at runtime. In such cases, the attribute location of a given named attribute may vary between instances of the same Program. Previously, attribute bindings were implicitly associated with a location based on template parameter order, and -1 was used to indicate an inactive attribute. This left us unable to disable the appropriate attribute when it went from active to inactive. Now, the state tracker for bindings explicitly associates locations and state, and an empty optional is used to indicate an inactive attribute. In addition, a gl::VertexArray class is now exposed, allowing more flexibility in the relationship between Programs, Segments, and attribute bindings. In this commit, that relationship does not change, but the subsequent commit adjusts it to match gl-js, reduce rebinds, and work around buggy VAO implementations. VertexArray uses a pimpl idiom in order to support implementations that lack the VAO extension. In that case, all VertexArrays share global binding state, reflecting the platform reality in the absence of VAOs, while still providing a uniform API. --- cmake/core-files.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cmake/core-files.cmake') diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake index d912392e15..4ebb2a878d 100644 --- a/cmake/core-files.cmake +++ b/cmake/core-files.cmake @@ -73,8 +73,6 @@ set(MBGL_CORE_FILES src/mbgl/gl/program.hpp src/mbgl/gl/program_binary_extension.hpp src/mbgl/gl/renderbuffer.hpp - src/mbgl/gl/segment.cpp - src/mbgl/gl/segment.hpp src/mbgl/gl/state.hpp src/mbgl/gl/stencil_mode.cpp src/mbgl/gl/stencil_mode.hpp @@ -84,6 +82,8 @@ set(MBGL_CORE_FILES src/mbgl/gl/uniform.hpp src/mbgl/gl/value.cpp src/mbgl/gl/value.hpp + src/mbgl/gl/vertex_array.cpp + src/mbgl/gl/vertex_array.hpp src/mbgl/gl/vertex_array_extension.hpp src/mbgl/gl/vertex_buffer.hpp @@ -154,6 +154,8 @@ set(MBGL_CORE_FILES src/mbgl/programs/programs.hpp src/mbgl/programs/raster_program.cpp src/mbgl/programs/raster_program.hpp + src/mbgl/programs/segment.cpp + src/mbgl/programs/segment.hpp src/mbgl/programs/symbol_program.cpp src/mbgl/programs/symbol_program.hpp src/mbgl/programs/uniforms.hpp @@ -611,8 +613,8 @@ set(MBGL_CORE_FILES src/mbgl/util/stopwatch.cpp src/mbgl/util/stopwatch.hpp src/mbgl/util/string.cpp - src/mbgl/util/thread_local.hpp src/mbgl/util/thread.hpp + src/mbgl/util/thread_local.hpp src/mbgl/util/throttler.cpp src/mbgl/util/throttler.hpp src/mbgl/util/tile_coordinate.hpp -- cgit v1.2.1