use 4-byte aligned vertex attributes for performance reason
reverts9d5f02ccaaand4c0b4a7901
This commit is contained in:
@@ -19,15 +19,17 @@ size_t IconVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, int16_t t
|
||||
shorts[3] /* offset */ = std::round(oy * 64);
|
||||
|
||||
uint8_t *ubytes = static_cast<uint8_t *>(data);
|
||||
ubytes[8] /* labelminzoom */ = labelminzoom * 10;
|
||||
ubytes[9] /* minzoom */ = minzoom * 10; // 1/10 zoom levels: z16 == 160.
|
||||
ubytes[10] /* maxzoom */ = std::fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
|
||||
// a_data1
|
||||
ubytes[8] /* tex */ = tx / 4;
|
||||
ubytes[9] /* tex */ = ty / 4;
|
||||
ubytes[10] /* labelminzoom */ = labelminzoom * 10;
|
||||
ubytes[11] /* angle */ = (int16_t)std::round(angle * angleFactor) % 256;
|
||||
ubytes[12] /* rangeend */ = util::max((int16_t)std::round(range[0] * angleFactor), (int16_t)0) % 256;
|
||||
ubytes[13] /* rangestart */ = util::min((int16_t)std::round(range[1] * angleFactor), (int16_t)255) % 256;
|
||||
|
||||
shorts[8] /* tex */ = tx;
|
||||
shorts[9] /* tex */ = ty;
|
||||
// a_data2
|
||||
ubytes[12] /* minzoom */ = minzoom * 10; // 1/10 zoom levels: z16 == 160.
|
||||
ubytes[13] /* maxzoom */ = std::fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
|
||||
ubytes[14] /* rangeend */ = util::max((int16_t)std::round(range[0] * angleFactor), (int16_t)0) % 256;
|
||||
ubytes[15] /* rangestart */ = util::min((int16_t)std::round(range[1] * angleFactor), (int16_t)255) % 256;
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace mbgl {
|
||||
|
||||
class IconVertexBuffer : public Buffer<
|
||||
20
|
||||
16
|
||||
> {
|
||||
public:
|
||||
static const double angleFactor;
|
||||
|
||||
@@ -16,8 +16,8 @@ size_t LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, i
|
||||
int8_t *extrude = static_cast<int8_t *>(data);
|
||||
extrude[4] = std::round(extrudeScale * ex);
|
||||
extrude[5] = std::round(extrudeScale * ey);
|
||||
|
||||
coords[3] = linesofar;
|
||||
extrude[6] = static_cast<int8_t>(linesofar / 128);
|
||||
extrude[7] = static_cast<int8_t>(linesofar % 128);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
@@ -78,17 +78,26 @@ void copy_bitmap(const uint32_t *src, const int src_stride, const int src_x, con
|
||||
}
|
||||
|
||||
Rect<SpriteAtlas::dimension> SpriteAtlas::allocateImage(size_t pixel_width, size_t pixel_height) {
|
||||
uint16_t pack_width = pixel_width + buffer * 2;
|
||||
uint16_t pack_height = pixel_height + buffer * 2;
|
||||
|
||||
// Increase to next number divisible by 4, but at least 1.
|
||||
// This is so we can scale down the texture coordinates and pack them
|
||||
// into 2 bytes rather than 4 bytes.
|
||||
pack_width += (4 - pack_width % 4);
|
||||
pack_height += (4 - pack_height % 4);
|
||||
|
||||
// We have to allocate a new area in the bin, and store an empty image in it.
|
||||
// Add a 1px border around every image.
|
||||
Rect<dimension> rect = bin.allocate(pixel_width + 2 * buffer, pixel_height + 2 * buffer);
|
||||
Rect<dimension> rect = bin.allocate(pack_width, pack_height);
|
||||
if (rect.w == 0) {
|
||||
return rect;
|
||||
}
|
||||
|
||||
rect.x += buffer;
|
||||
rect.y += buffer;
|
||||
rect.w -= 2 * buffer;
|
||||
rect.h -= 2 * buffer;
|
||||
rect.w = pixel_width;
|
||||
rect.h = pixel_height;
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
@@ -4,30 +4,34 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
const double TextVertexBuffer::angleFactor = 128.0 / M_PI;
|
||||
|
||||
size_t TextVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, uint16_t tx, uint16_t ty, float angle, float minzoom, std::array<float, 2> range, float maxzoom, float labelminzoom) {
|
||||
size_t idx = index();
|
||||
const size_t idx = index();
|
||||
void *data = addElement();
|
||||
|
||||
int16_t *shorts = static_cast<int16_t *>(data);
|
||||
shorts[0] = x;
|
||||
shorts[1] = y;
|
||||
shorts[2] = std::round(ox * 64); // use 1/64 pixels for placement
|
||||
shorts[3] = std::round(oy * 64);
|
||||
shorts[0] /* pos */ = x;
|
||||
shorts[1] /* pos */ = y;
|
||||
shorts[2] /* offset */ = std::round(ox * 64); // use 1/64 pixels for placement
|
||||
shorts[3] /* offset */ = std::round(oy * 64);
|
||||
|
||||
uint8_t *ubytes = static_cast<uint8_t *>(data);
|
||||
ubytes[8] = labelminzoom * 10;
|
||||
ubytes[9] = minzoom * 10; // 1/10 zoom levels: z16 == 160.
|
||||
ubytes[10] = fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
|
||||
ubytes[11] = (int16_t)round(angle * angleFactor) % 256;
|
||||
ubytes[12] = util::max((int16_t)std::round(range[0] * angleFactor), (int16_t)0) % 256;
|
||||
ubytes[13] = util::min((int16_t)std::round(range[1] * angleFactor), (int16_t)255) % 256;
|
||||
// a_data1
|
||||
ubytes[8] /* tex */ = tx / 4;
|
||||
ubytes[9] /* tex */ = ty / 4;
|
||||
ubytes[10] /* labelminzoom */ = labelminzoom * 10;
|
||||
ubytes[11] /* angle */ = (int16_t)std::round(angle * angleFactor) % 256;
|
||||
|
||||
ubytes[14] = tx / 4;
|
||||
ubytes[15] = ty / 4;
|
||||
// a_data2
|
||||
ubytes[12] /* minzoom */ = minzoom * 10; // 1/10 zoom levels: z16 == 160.
|
||||
ubytes[13] /* maxzoom */ = std::fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
|
||||
ubytes[14] /* rangeend */ = util::max((int16_t)std::round(range[0] * angleFactor), (int16_t)0) % 256;
|
||||
ubytes[15] /* rangestart */ = util::min((int16_t)std::round(range[1] * angleFactor), (int16_t)255) % 256;
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -134,11 +134,6 @@ void Painter::renderSymbol(SymbolBucket &bucket, util::ptr<StyleLayer> layer_des
|
||||
|
||||
spriteAtlas.bind(state.isChanging() || bucket.properties.placement == PlacementType::Line || angleOffset != 0 || fontScale != 1 || sdf);
|
||||
|
||||
std::array<float, 2> texsize = {{
|
||||
float(spriteAtlas.getWidth()),
|
||||
float(spriteAtlas.getHeight())
|
||||
}};
|
||||
|
||||
if (sdf) {
|
||||
renderSDF(bucket,
|
||||
id,
|
||||
@@ -146,7 +141,7 @@ void Painter::renderSymbol(SymbolBucket &bucket, util::ptr<StyleLayer> layer_des
|
||||
bucket.properties.icon,
|
||||
properties.icon,
|
||||
1.0f,
|
||||
texsize,
|
||||
{{ float(spriteAtlas.getWidth()) / 4.0f, float(spriteAtlas.getHeight()) / 4.0f }},
|
||||
*sdfIconShader,
|
||||
&SymbolBucket::drawIcons);
|
||||
} else {
|
||||
@@ -164,7 +159,7 @@ void Painter::renderSymbol(SymbolBucket &bucket, util::ptr<StyleLayer> layer_des
|
||||
useProgram(iconShader->program);
|
||||
iconShader->u_matrix = vtxMatrix;
|
||||
iconShader->u_exmatrix = exMatrix;
|
||||
iconShader->u_texsize = texsize;
|
||||
iconShader->u_texsize = {{ float(spriteAtlas.getWidth()) / 4.0f, float(spriteAtlas.getHeight()) / 4.0f }};
|
||||
|
||||
// Convert the -pi..pi to an int8 range.
|
||||
const float angle = std::round(state.getAngle() / M_PI * 128);
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
attribute vec2 a_pos;
|
||||
attribute vec2 a_offset;
|
||||
attribute vec2 a_tex;
|
||||
attribute float a_angle;
|
||||
attribute float a_minzoom;
|
||||
attribute float a_maxzoom;
|
||||
attribute float a_rangeend;
|
||||
attribute float a_rangestart;
|
||||
attribute float a_labelminzoom;
|
||||
attribute vec4 a_data1;
|
||||
attribute vec4 a_data2;
|
||||
|
||||
|
||||
// matrix is for the vertex position, exmatrix is for rotating and projecting
|
||||
@@ -28,6 +23,15 @@ varying vec2 v_tex;
|
||||
varying float v_alpha;
|
||||
|
||||
void main() {
|
||||
vec2 a_tex = a_data1.xy;
|
||||
float a_labelminzoom = a_data1[2];
|
||||
float a_angle = a_data1[3];
|
||||
vec2 a_zoom = a_data2.st;
|
||||
float a_minzoom = a_zoom[0];
|
||||
float a_maxzoom = a_zoom[1];
|
||||
vec2 a_range = a_data2.pq;
|
||||
float a_rangeend = a_range[0];
|
||||
float a_rangestart = a_range[1];
|
||||
|
||||
float a_fadedist = 10.0;
|
||||
float rev = 0.0;
|
||||
|
||||
@@ -19,17 +19,12 @@ IconShader::IconShader()
|
||||
|
||||
a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
|
||||
a_offset = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_offset"));
|
||||
a_tex = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_tex"));
|
||||
a_angle = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_angle"));
|
||||
a_minzoom = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_minzoom"));
|
||||
a_maxzoom = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_maxzoom"));
|
||||
a_rangeend = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_rangeend"));
|
||||
a_rangestart = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_rangestart"));
|
||||
a_labelminzoom = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_labelminzoom"));
|
||||
a_data1 = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data1"));
|
||||
a_data2 = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data2"));
|
||||
}
|
||||
|
||||
void IconShader::bind(char *offset) {
|
||||
const int stride = 20;
|
||||
const int stride = 16;
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, stride, offset + 0));
|
||||
@@ -37,24 +32,9 @@ void IconShader::bind(char *offset) {
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_offset));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_offset, 2, GL_SHORT, false, stride, offset + 4));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_labelminzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_labelminzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 8));
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data1));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data1, 4, GL_UNSIGNED_BYTE, false, stride, offset + 8));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_minzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_minzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 9));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_maxzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_maxzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 10));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_angle));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_angle, 1, GL_UNSIGNED_BYTE, false, stride, offset + 11));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_rangeend));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_rangeend, 1, GL_UNSIGNED_BYTE, false, stride, offset + 12));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_rangestart));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_rangestart, 1, GL_UNSIGNED_BYTE, false, stride, offset + 13));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_tex));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_tex, 2, GL_SHORT, false, stride, offset + 16));
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data2));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data2, 4, GL_UNSIGNED_BYTE, false, stride, offset + 12));
|
||||
}
|
||||
|
||||
@@ -27,13 +27,8 @@ public:
|
||||
private:
|
||||
int32_t a_pos = -1;
|
||||
int32_t a_offset = -1;
|
||||
int32_t a_tex = -1;
|
||||
int32_t a_angle = -1;
|
||||
int32_t a_minzoom = -1;
|
||||
int32_t a_maxzoom = -1;
|
||||
int32_t a_rangeend = -1;
|
||||
int32_t a_rangestart = -1;
|
||||
int32_t a_labelminzoom = -1;
|
||||
int32_t a_data1 = -1;
|
||||
int32_t a_data2 = -1;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
#define scale 0.015873016
|
||||
|
||||
attribute vec2 a_pos;
|
||||
attribute vec2 a_extrude;
|
||||
attribute float a_linesofar;
|
||||
attribute vec4 a_data;
|
||||
|
||||
// matrix is for the vertex position, exmatrix is for rotating and projecting
|
||||
// the extrusion vector.
|
||||
@@ -24,6 +23,9 @@ varying vec2 v_normal;
|
||||
varying float v_linesofar;
|
||||
|
||||
void main() {
|
||||
vec2 a_extrude = a_data.xy;
|
||||
float a_linesofar = a_data.z * 128.0 + a_data.w;
|
||||
|
||||
// We store the texture normals in the most insignificant bit
|
||||
// transform y so that 0 => -1 and 1 => 1
|
||||
// In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap
|
||||
|
||||
@@ -18,17 +18,13 @@ LineShader::LineShader()
|
||||
}
|
||||
|
||||
a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
|
||||
a_extrude = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_extrude"));
|
||||
a_linesofar = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_linesofar"));
|
||||
a_data = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data"));
|
||||
}
|
||||
|
||||
void LineShader::bind(char *offset) {
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 8, offset + 0));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_extrude));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_extrude, 2, GL_BYTE, false, 8, offset + 4));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_linesofar));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_linesofar, 1, GL_SHORT, false, 8, offset + 6));
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data, 4, GL_BYTE, false, 8, offset + 4));
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ public:
|
||||
|
||||
private:
|
||||
int32_t a_pos = -1;
|
||||
int32_t a_extrude = -1;
|
||||
int32_t a_linesofar = -1;
|
||||
int32_t a_data = -1;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
attribute vec2 a_pos;
|
||||
attribute vec2 a_offset;
|
||||
attribute vec2 a_tex;
|
||||
attribute float a_angle;
|
||||
attribute float a_minzoom;
|
||||
attribute float a_maxzoom;
|
||||
attribute float a_rangeend;
|
||||
attribute float a_rangestart;
|
||||
attribute float a_labelminzoom;
|
||||
attribute vec4 a_data1;
|
||||
attribute vec4 a_data2;
|
||||
|
||||
|
||||
// matrix is for the vertex position, exmatrix is for rotating and projecting
|
||||
@@ -27,6 +22,15 @@ varying vec2 v_tex;
|
||||
varying float v_alpha;
|
||||
|
||||
void main() {
|
||||
vec2 a_tex = a_data1.xy;
|
||||
float a_labelminzoom = a_data1[2];
|
||||
float a_angle = a_data1[3];
|
||||
vec2 a_zoom = a_data2.st;
|
||||
float a_minzoom = a_zoom[0];
|
||||
float a_maxzoom = a_zoom[1];
|
||||
vec2 a_range = a_data2.pq;
|
||||
float a_rangeend = a_range[0];
|
||||
float a_rangestart = a_range[1];
|
||||
|
||||
float rev = 0.0;
|
||||
|
||||
|
||||
@@ -19,13 +19,8 @@ SDFShader::SDFShader()
|
||||
|
||||
a_pos = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_pos"));
|
||||
a_offset = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_offset"));
|
||||
a_tex = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_tex"));
|
||||
a_angle = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_angle"));
|
||||
a_minzoom = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_minzoom"));
|
||||
a_maxzoom = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_maxzoom"));
|
||||
a_rangeend = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_rangeend"));
|
||||
a_rangestart = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_rangestart"));
|
||||
a_labelminzoom = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_labelminzoom"));
|
||||
a_data1 = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data1"));
|
||||
a_data2 = MBGL_CHECK_ERROR(glGetAttribLocation(program, "a_data2"));
|
||||
}
|
||||
|
||||
void SDFGlyphShader::bind(char *offset) {
|
||||
@@ -37,30 +32,15 @@ void SDFGlyphShader::bind(char *offset) {
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_offset));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_offset, 2, GL_SHORT, false, stride, offset + 4));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_labelminzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_labelminzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 8));
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data1));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data1, 4, GL_UNSIGNED_BYTE, false, stride, offset + 8));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_minzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_minzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 9));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_maxzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_maxzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 10));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_angle));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_angle, 1, GL_UNSIGNED_BYTE, false, stride, offset + 11));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_rangeend));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_rangeend, 1, GL_UNSIGNED_BYTE, false, stride, offset + 12));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_rangestart));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_rangestart, 1, GL_UNSIGNED_BYTE, false, stride, offset + 13));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_tex));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_tex, 2, GL_UNSIGNED_BYTE, false, stride, offset + 14));
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data2));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data2, 4, GL_UNSIGNED_BYTE, false, stride, offset + 12));
|
||||
}
|
||||
|
||||
void SDFIconShader::bind(char *offset) {
|
||||
const int stride = 20;
|
||||
const int stride = 16;
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, stride, offset + 0));
|
||||
@@ -68,24 +48,9 @@ void SDFIconShader::bind(char *offset) {
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_offset));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_offset, 2, GL_SHORT, false, stride, offset + 4));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_labelminzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_labelminzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 8));
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data1));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data1, 4, GL_UNSIGNED_BYTE, false, stride, offset + 8));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_minzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_minzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 9));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_maxzoom));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_maxzoom, 1, GL_UNSIGNED_BYTE, false, stride, offset + 10));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_angle));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_angle, 1, GL_UNSIGNED_BYTE, false, stride, offset + 11));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_rangeend));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_rangeend, 1, GL_UNSIGNED_BYTE, false, stride, offset + 12));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_rangestart));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_rangestart, 1, GL_UNSIGNED_BYTE, false, stride, offset + 13));
|
||||
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_tex));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_tex, 2, GL_SHORT, false, stride, offset + 16));
|
||||
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data2));
|
||||
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data2, 4, GL_UNSIGNED_BYTE, false, stride, offset + 12));
|
||||
}
|
||||
|
||||
@@ -29,13 +29,8 @@ public:
|
||||
protected:
|
||||
int32_t a_pos = -1;
|
||||
int32_t a_offset = -1;
|
||||
int32_t a_tex = -1;
|
||||
int32_t a_angle = -1;
|
||||
int32_t a_minzoom = -1;
|
||||
int32_t a_maxzoom = -1;
|
||||
int32_t a_rangeend = -1;
|
||||
int32_t a_rangestart = -1;
|
||||
int32_t a_labelminzoom = -1;
|
||||
int32_t a_data1 = -1;
|
||||
int32_t a_data2 = -1;
|
||||
};
|
||||
|
||||
class SDFGlyphShader : public SDFShader {
|
||||
|
||||
Reference in New Issue
Block a user