summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/attribute.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-10-28 18:17:33 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-11-08 08:09:29 -0800
commit66bdbc3b969083b9d647abdf72784be64a125949 (patch)
tree9f2f1c6eb3d0569926420459c2c9afda50c66fd0 /src/mbgl/gl/attribute.hpp
parent36210fe4e9c68a52dedc90548d90e77cf39a2228 (diff)
downloadqtlocation-mapboxgl-66bdbc3b969083b9d647abdf72784be64a125949.tar.gz
[core] Introduce gl::Program template
Diffstat (limited to 'src/mbgl/gl/attribute.hpp')
-rw-r--r--src/mbgl/gl/attribute.hpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp
index e6ef5c7f89..126da38de5 100644
--- a/src/mbgl/gl/attribute.hpp
+++ b/src/mbgl/gl/attribute.hpp
@@ -1,7 +1,6 @@
#pragma once
#include <mbgl/gl/types.hpp>
-#include <mbgl/gl/shader.hpp>
#include <cstddef>
#include <functional>
@@ -18,9 +17,6 @@ public:
class State {
public:
- State(const char* name, const Shader& shader)
- : location(shader.getAttributeLocation(name)) {}
-
AttributeLocation location;
static constexpr std::size_t count = N;
static constexpr DataType type = DataTypeOf<T>::value;
@@ -134,6 +130,8 @@ const std::size_t Vertex<A1, A2, A3, A4, A5>::attributeOffsets[5] = {
} // namespace detail
+AttributeLocation attributeLocation(ProgramID, const char * name);
+
void bindAttribute(AttributeLocation location,
std::size_t count,
DataType type,
@@ -147,8 +145,8 @@ public:
using State = std::tuple<typename As::State...>;
using Vertex = detail::Vertex<As...>;
- static State state(const Shader& shader) {
- return State { { As::name, shader }... };
+ static State state(const ProgramID& id) {
+ return State { { attributeLocation(id, As::name) }... };
}
static std::function<void (std::size_t)> binder(const State& state) {