summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/shader/box_shader.cpp1
-rw-r--r--src/mbgl/shader/box_shader.hpp1
-rw-r--r--src/mbgl/shader/circle_shader.cpp1
-rw-r--r--src/mbgl/shader/circle_shader.hpp3
-rw-r--r--src/mbgl/shader/dot_shader.cpp1
-rw-r--r--src/mbgl/shader/dot_shader.hpp3
-rw-r--r--src/mbgl/shader/icon_shader.cpp1
-rw-r--r--src/mbgl/shader/icon_shader.hpp1
-rw-r--r--src/mbgl/shader/line_shader.cpp1
-rw-r--r--src/mbgl/shader/line_shader.hpp1
-rw-r--r--src/mbgl/shader/linepattern_shader.cpp1
-rw-r--r--src/mbgl/shader/linepattern_shader.hpp1
-rw-r--r--src/mbgl/shader/linesdf_shader.cpp1
-rw-r--r--src/mbgl/shader/linesdf_shader.hpp1
-rw-r--r--src/mbgl/shader/outline_shader.cpp1
-rw-r--r--src/mbgl/shader/outline_shader.hpp3
-rw-r--r--src/mbgl/shader/pattern_shader.cpp1
-rw-r--r--src/mbgl/shader/pattern_shader.hpp3
-rw-r--r--src/mbgl/shader/plain_shader.cpp1
-rw-r--r--src/mbgl/shader/plain_shader.hpp3
-rw-r--r--src/mbgl/shader/raster_shader.cpp1
-rw-r--r--src/mbgl/shader/raster_shader.hpp3
-rw-r--r--src/mbgl/shader/sdf_shader.cpp1
-rw-r--r--src/mbgl/shader/sdf_shader.hpp1
-rw-r--r--src/mbgl/shader/shader.cpp2
-rw-r--r--src/mbgl/shader/shader.hpp7
26 files changed, 8 insertions, 37 deletions
diff --git a/src/mbgl/shader/box_shader.cpp b/src/mbgl/shader/box_shader.cpp
index 2676223a9d..5c290718e4 100644
--- a/src/mbgl/shader/box_shader.cpp
+++ b/src/mbgl/shader/box_shader.cpp
@@ -12,7 +12,6 @@ CollisionBoxShader::CollisionBoxShader()
shaders[BOX_SHADER].vertex,
shaders[BOX_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
a_extrude = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_extrude"));
a_data = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data"));
}
diff --git a/src/mbgl/shader/box_shader.hpp b/src/mbgl/shader/box_shader.hpp
index 5c84d8906c..832d3e1c03 100644
--- a/src/mbgl/shader/box_shader.hpp
+++ b/src/mbgl/shader/box_shader.hpp
@@ -18,7 +18,6 @@ public:
Uniform<float> u_maxzoom = {"u_maxzoom", *this};
protected:
- int32_t a_pos = -1;
int32_t a_extrude = -1;
int32_t a_data = -1;
};
diff --git a/src/mbgl/shader/circle_shader.cpp b/src/mbgl/shader/circle_shader.cpp
index 074f92d68b..dc8558d108 100644
--- a/src/mbgl/shader/circle_shader.cpp
+++ b/src/mbgl/shader/circle_shader.cpp
@@ -12,7 +12,6 @@ CircleShader::CircleShader()
shaders[CIRCLE_SHADER].vertex,
shaders[CIRCLE_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
}
void CircleShader::bind(char *offset) {
diff --git a/src/mbgl/shader/circle_shader.hpp b/src/mbgl/shader/circle_shader.hpp
index 545a0baad5..ce7bb2d20f 100644
--- a/src/mbgl/shader/circle_shader.hpp
+++ b/src/mbgl/shader/circle_shader.hpp
@@ -17,9 +17,6 @@ public:
Uniform<std::array<float, 4>> u_color = {"u_color", *this};
Uniform<float> u_size = {"u_size", *this};
Uniform<float> u_blur = {"u_blur", *this};
-
-private:
- int32_t a_pos = -1;
};
}
diff --git a/src/mbgl/shader/dot_shader.cpp b/src/mbgl/shader/dot_shader.cpp
index 57a60cc519..67c4639447 100644
--- a/src/mbgl/shader/dot_shader.cpp
+++ b/src/mbgl/shader/dot_shader.cpp
@@ -12,7 +12,6 @@ DotShader::DotShader()
shaders[DOT_SHADER].vertex,
shaders[DOT_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
}
void DotShader::bind(char *offset) {
diff --git a/src/mbgl/shader/dot_shader.hpp b/src/mbgl/shader/dot_shader.hpp
index 2c4176f364..51263a7311 100644
--- a/src/mbgl/shader/dot_shader.hpp
+++ b/src/mbgl/shader/dot_shader.hpp
@@ -16,9 +16,6 @@ public:
Uniform<std::array<float, 4>> u_color = {"u_color", *this};
Uniform<float> u_size = {"u_size", *this};
Uniform<float> u_blur = {"u_blur", *this};
-
-private:
- int32_t a_pos = -1;
};
}
diff --git a/src/mbgl/shader/icon_shader.cpp b/src/mbgl/shader/icon_shader.cpp
index 0f626ec9e7..1084ab3083 100644
--- a/src/mbgl/shader/icon_shader.cpp
+++ b/src/mbgl/shader/icon_shader.cpp
@@ -12,7 +12,6 @@ IconShader::IconShader()
shaders[ICON_SHADER].vertex,
shaders[ICON_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
a_offset = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_offset"));
a_data1 = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data1"));
a_data2 = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data2"));
diff --git a/src/mbgl/shader/icon_shader.hpp b/src/mbgl/shader/icon_shader.hpp
index 18b0fce37b..20d3ebf5c5 100644
--- a/src/mbgl/shader/icon_shader.hpp
+++ b/src/mbgl/shader/icon_shader.hpp
@@ -25,7 +25,6 @@ public:
Uniform<float> u_extra = {"u_extra", *this};
private:
- int32_t a_pos = -1;
int32_t a_offset = -1;
int32_t a_data1 = -1;
int32_t a_data2 = -1;
diff --git a/src/mbgl/shader/line_shader.cpp b/src/mbgl/shader/line_shader.cpp
index c2364c9bea..66dff81c99 100644
--- a/src/mbgl/shader/line_shader.cpp
+++ b/src/mbgl/shader/line_shader.cpp
@@ -12,7 +12,6 @@ LineShader::LineShader()
shaders[LINE_SHADER].vertex,
shaders[LINE_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
a_data = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data"));
}
diff --git a/src/mbgl/shader/line_shader.hpp b/src/mbgl/shader/line_shader.hpp
index 0572cac88d..1a4289ded9 100644
--- a/src/mbgl/shader/line_shader.hpp
+++ b/src/mbgl/shader/line_shader.hpp
@@ -22,7 +22,6 @@ public:
UniformMatrix<2> u_antialiasingmatrix = {"u_antialiasingmatrix", *this};
private:
- int32_t a_pos = -1;
int32_t a_data = -1;
};
diff --git a/src/mbgl/shader/linepattern_shader.cpp b/src/mbgl/shader/linepattern_shader.cpp
index 7bfd1412db..65404cb117 100644
--- a/src/mbgl/shader/linepattern_shader.cpp
+++ b/src/mbgl/shader/linepattern_shader.cpp
@@ -12,7 +12,6 @@ LinepatternShader::LinepatternShader()
shaders[LINEPATTERN_SHADER].vertex,
shaders[LINEPATTERN_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
a_data = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data"));
}
diff --git a/src/mbgl/shader/linepattern_shader.hpp b/src/mbgl/shader/linepattern_shader.hpp
index dce065a0d5..a06135180d 100644
--- a/src/mbgl/shader/linepattern_shader.hpp
+++ b/src/mbgl/shader/linepattern_shader.hpp
@@ -30,7 +30,6 @@ public:
UniformMatrix<2> u_antialiasingmatrix = {"u_antialiasingmatrix", *this};
private:
- int32_t a_pos = -1;
int32_t a_data = -1;
};
}
diff --git a/src/mbgl/shader/linesdf_shader.cpp b/src/mbgl/shader/linesdf_shader.cpp
index bd2137de30..a08c99c747 100644
--- a/src/mbgl/shader/linesdf_shader.cpp
+++ b/src/mbgl/shader/linesdf_shader.cpp
@@ -12,7 +12,6 @@ LineSDFShader::LineSDFShader()
shaders[LINESDF_SHADER].vertex,
shaders[LINESDF_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
a_data = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data"));
}
diff --git a/src/mbgl/shader/linesdf_shader.hpp b/src/mbgl/shader/linesdf_shader.hpp
index 9928d5b304..4d08916cd5 100644
--- a/src/mbgl/shader/linesdf_shader.hpp
+++ b/src/mbgl/shader/linesdf_shader.hpp
@@ -29,7 +29,6 @@ public:
UniformMatrix<2> u_antialiasingmatrix = {"u_antialiasingmatrix", *this};
private:
- int32_t a_pos = -1;
int32_t a_data = -1;
};
diff --git a/src/mbgl/shader/outline_shader.cpp b/src/mbgl/shader/outline_shader.cpp
index ee2a6bcd40..1d2c3667f6 100644
--- a/src/mbgl/shader/outline_shader.cpp
+++ b/src/mbgl/shader/outline_shader.cpp
@@ -12,7 +12,6 @@ OutlineShader::OutlineShader()
shaders[OUTLINE_SHADER].vertex,
shaders[OUTLINE_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
}
void OutlineShader::bind(char *offset) {
diff --git a/src/mbgl/shader/outline_shader.hpp b/src/mbgl/shader/outline_shader.hpp
index f3e8175fd7..9b086594bb 100644
--- a/src/mbgl/shader/outline_shader.hpp
+++ b/src/mbgl/shader/outline_shader.hpp
@@ -15,9 +15,6 @@ public:
UniformMatrix<4> u_matrix = {"u_matrix", *this};
Uniform<std::array<float, 4>> u_color = {"u_color", *this};
Uniform<std::array<float, 2>> u_world = {"u_world", *this};
-
-private:
- int32_t a_pos = -1;
};
}
diff --git a/src/mbgl/shader/pattern_shader.cpp b/src/mbgl/shader/pattern_shader.cpp
index 66369d528a..b5883b9565 100644
--- a/src/mbgl/shader/pattern_shader.cpp
+++ b/src/mbgl/shader/pattern_shader.cpp
@@ -12,7 +12,6 @@ PatternShader::PatternShader()
shaders[PATTERN_SHADER].vertex,
shaders[PATTERN_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
}
void PatternShader::bind(char *offset) {
diff --git a/src/mbgl/shader/pattern_shader.hpp b/src/mbgl/shader/pattern_shader.hpp
index 9fc8dcfa01..5090a453e8 100644
--- a/src/mbgl/shader/pattern_shader.hpp
+++ b/src/mbgl/shader/pattern_shader.hpp
@@ -22,9 +22,6 @@ public:
Uniform<int32_t> u_image = {"u_image", *this};
UniformMatrix<3> u_patternmatrix_a = {"u_patternmatrix_a", *this};
UniformMatrix<3> u_patternmatrix_b = {"u_patternmatrix_b", *this};
-
-private:
- int32_t a_pos = -1;
};
}
diff --git a/src/mbgl/shader/plain_shader.cpp b/src/mbgl/shader/plain_shader.cpp
index 93dbb42a57..bb719f47df 100644
--- a/src/mbgl/shader/plain_shader.cpp
+++ b/src/mbgl/shader/plain_shader.cpp
@@ -12,7 +12,6 @@ PlainShader::PlainShader()
shaders[PLAIN_SHADER].vertex,
shaders[PLAIN_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
}
void PlainShader::bind(char *offset) {
diff --git a/src/mbgl/shader/plain_shader.hpp b/src/mbgl/shader/plain_shader.hpp
index 051501c3c9..266600024f 100644
--- a/src/mbgl/shader/plain_shader.hpp
+++ b/src/mbgl/shader/plain_shader.hpp
@@ -14,9 +14,6 @@ public:
UniformMatrix<4> u_matrix = {"u_matrix", *this};
Uniform<std::array<float, 4>> u_color = {"u_color", *this};
-
-private:
- int32_t a_pos = -1;
};
}
diff --git a/src/mbgl/shader/raster_shader.cpp b/src/mbgl/shader/raster_shader.cpp
index 2d69549209..ce03488ac4 100644
--- a/src/mbgl/shader/raster_shader.cpp
+++ b/src/mbgl/shader/raster_shader.cpp
@@ -12,7 +12,6 @@ RasterShader::RasterShader()
shaders[RASTER_SHADER].vertex,
shaders[RASTER_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
}
void RasterShader::bind(char *offset) {
diff --git a/src/mbgl/shader/raster_shader.hpp b/src/mbgl/shader/raster_shader.hpp
index 8cf97055a2..e869fb7411 100644
--- a/src/mbgl/shader/raster_shader.hpp
+++ b/src/mbgl/shader/raster_shader.hpp
@@ -21,9 +21,6 @@ public:
Uniform<float> u_saturation_factor = {"u_saturation_factor", *this};
Uniform<float> u_contrast_factor = {"u_contrast_factor", *this};
Uniform<std::array<float, 3>> u_spin_weights = {"u_spin_weights", *this};
-
-private:
- int32_t a_pos = -1;
};
}
diff --git a/src/mbgl/shader/sdf_shader.cpp b/src/mbgl/shader/sdf_shader.cpp
index ca1dab58dd..7b729a4588 100644
--- a/src/mbgl/shader/sdf_shader.cpp
+++ b/src/mbgl/shader/sdf_shader.cpp
@@ -12,7 +12,6 @@ SDFShader::SDFShader()
shaders[SDF_SHADER].vertex,
shaders[SDF_SHADER].fragment
) {
- a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
a_offset = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_offset"));
a_data1 = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data1"));
a_data2 = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data2"));
diff --git a/src/mbgl/shader/sdf_shader.hpp b/src/mbgl/shader/sdf_shader.hpp
index 181788ab16..f8e0aef2b6 100644
--- a/src/mbgl/shader/sdf_shader.hpp
+++ b/src/mbgl/shader/sdf_shader.hpp
@@ -27,7 +27,6 @@ public:
Uniform<float> u_extra = {"u_extra", *this};
protected:
- int32_t a_pos = -1;
int32_t a_offset = -1;
int32_t a_data1 = -1;
int32_t a_data2 = -1;
diff --git a/src/mbgl/shader/shader.cpp b/src/mbgl/shader/shader.cpp
index 6210c1c32e..1e3df1bbc2 100644
--- a/src/mbgl/shader/shader.cpp
+++ b/src/mbgl/shader/shader.cpp
@@ -97,6 +97,8 @@ Shader::Shader(const char *name_, const GLchar *vertSource, const GLchar *fragSo
MBGL_CHECK_ERROR(glDeleteShader(vertShader));
MBGL_CHECK_ERROR(glDetachShader(program, fragShader));
MBGL_CHECK_ERROR(glDeleteShader(fragShader));
+
+ a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
}
diff --git a/src/mbgl/shader/shader.hpp b/src/mbgl/shader/shader.hpp
index b3d9b4e46c..2a1cf39fe2 100644
--- a/src/mbgl/shader/shader.hpp
+++ b/src/mbgl/shader/shader.hpp
@@ -1,10 +1,12 @@
#ifndef MBGL_RENDERER_SHADER
#define MBGL_RENDERER_SHADER
+#include <mbgl/platform/gl.hpp>
+#include <mbgl/util/noncopyable.hpp>
+
#include <cstdint>
#include <array>
#include <string>
-#include <mbgl/util/noncopyable.hpp>
namespace mbgl {
@@ -19,6 +21,9 @@ public:
return program;
}
+protected:
+ GLint a_pos = -1;
+
private:
bool compileShader(uint32_t *shader, uint32_t type, const char *source);
};