summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/attribute.hpp
Commit message (Collapse)AuthorAgeFilesLines
* [core] Reduce memory requirements of VertexArraysJohn Firebaugh2017-07-121-8/+14
|
* [core] Rework attribute binding (again)John Firebaugh2017-07-121-72/+78
| | | | | | | | | | 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.
* [core] GCC 4.9 does not fully support custom variable templatesBruno de Oliveira Abinader2017-07-121-4/+1
|
* [core] Bind only active attributes in order to avoid exceeding attribute ↵Lauren Budorick2017-06-291-1/+11
| | | | | limits (#9373) Introducing two new attributes to enable property functions for line-width (#9250) pushed the attribute count over GL_MAX_VERTEX_ATTRIBS on some devices. Now we selectively bind only attributes that are used, making it unlikely to surpass GL_MAX_VERTEX_ATTRIBS.
* [core] Eliminate constant attribute bindingsJohn Firebaugh2017-06-141-50/+39
| | | | Rather than binding constant attributes that will never be used, just disable the attribute.
* [core] cache binary shaders on AndroidKonstantin Käfer2017-03-221-1/+12
|
* [core] Fix overspecialization of PaintPropertyBinder templateJohn Firebaugh2017-03-171-12/+15
| | | | | | | | | | | | | | | | | | PaintPropertyBinder and subclass templates were being instantiated for every unique attribute type (e.g. a_color, a_fill_color, a_halo_color) even though they behave identically for a given property value type (e.g. Color). To fix this, a unique type such as a_color no longer derives from gl::Attribute<...> -- instead it has an inner Type typedef, which should be used wherever neither a unique type nor attribute name is required. This reduces binary size substantially: VM SIZE FILE SIZE ++++++++++++++ GROWING ++++++++++++++ -------------- SHRINKING -------------- -2.0% -49.3Ki __TEXT,__text -49.3Ki -2.0% -3.1% -5.21Ki [None] -2.79Ki -1.6% -2.1% -4.12Ki __TEXT,__const -4.12Ki -2.1% -1.4% -4.04Ki __TEXT,__gcc_except_tab -4.04Ki -1.4% -19.3% -3.62Ki __DATA,__data -3.62Ki -19.3% -2.5% -1.65Ki __TEXT,__unwind_info -1.65Ki -2.5% -4.2% -8 __DATA,__mod_init_func 0 [ = ] -1.9% -68.0Ki TOTAL -65.6Ki -1.9%
* Pack min + max into one attribute :muscle:Molly Lloyd2017-03-081-12/+34
| | | | | | | | Some devices supported by Mapbox GL provide only 8 vertex attributes; this change packs existing attributes to get us just under that limit. For properties using a composite function, pack the min and max values into a single attribute with two logical components instead of using two separate attributes and buffers. Special logic is included for color attributes, whose integer components must be packed into the available bits of floating-point attributes. (We don't have access to ivec types in GL ES 2.0.) For source functions, continue to bind just a one-component attribute even though the GLSL type is vec2 (or vec4 for colors). The type-checking done by gl::Attribute is relaxed slightly to accommodate this.
* [core] Add support for data-driven stylingJohn Firebaugh2017-02-021-44/+141
|
* [core] Assign attribute locations sequentiallyJohn Firebaugh2016-11-151-2/+5
| | | | | | | Two reasons to prefer explicit sequential location assignment, rather than relying on the GLSL linker to assign locations: * For data-driven properties, we want to have the option to use glDisableVertexAttribArray plus glVertexAttrib*. In order to use glDisableVertexAttribArray, we must avoid using attribute location 0, which cannot be disabled. * We want to use the same VAO in cases where, say, a fill layer might be rendered with FillProgram at first, and then FillPatternProgram later. VAOs do not store the program binding, only the attribute bindings, so as long as the two programs have the same attributes and attribute locations, only a single VAO (per segment) is needed.
* [core] Put ignore in util namespaceJohn Firebaugh2016-11-081-6/+6
|
* [core] Introduce and use IndexedTupleJohn Firebaugh2016-11-081-15/+11
|
* [core] Use gl::Program to resolve some rough edges in the GL binding typesJohn Firebaugh2016-11-081-9/+7
| | | | | | | | | * Extract `ignore` util to separate header. * `Segment` now tracks offset and length of indices, rather than primitives. This is more natural. * Introduce `VertexVector` and `IndexVector` types. These types carry information about the intended draw mode (`Triangles`, `LineStrip`, etc.), and ensure that elements are always appended in a group size appropriate for that draw mode, for both indexed and unindexed rendering. * `Program`, rather than `Drawable`, is now the unifying object for draw calls. `Program` is the best place to type check the draw call, because it is typed to carry information about the intended primitive, vertex type, attributes, and uniforms. * Use the debug shaders for debug tile rendering, like gl-js. * Fix the draw mode for background. It was drawing triangle strips with a triangles array. Surprised this didn’t cause issues. Now it’s type checked.
* [core] Introduce gl::Program templateJohn Firebaugh2016-11-081-6/+4
|
* [core] Make attribute binding more similar to uniform bindingJohn Firebaugh2016-11-081-23/+153
|
* [core] Modern C++ bindings for OpenGLJohn Firebaugh2016-10-281-4/+0
|
* [core] Improve attribute binding APIJohn Firebaugh2016-10-051-0/+50