[core] convert remaining types to use OpenGL header defined variants

This commit is contained in:
Bruno de Oliveira Abinader
2015-09-11 15:08:54 +03:00
committed by Konstantin Käfer
parent c33a6bddc6
commit a3ea4acb7c
13 changed files with 32 additions and 31 deletions

View File

@@ -110,10 +110,10 @@ public:
private:
// CPU buffer
void *array = nullptr;
GLvoid *array = nullptr;
// Byte position where we are writing.
size_t pos = 0;
GLsizeiptr pos = 0;
// Number of bytes that are valid in this buffer.
size_t length = 0;

View File

@@ -32,8 +32,8 @@ public:
// the texture is only bound when the data is out of date (=dirty).
void upload();
const uint16_t width = 0;
const uint16_t height = 0;
const GLsizei width;
const GLsizei height;
private:
struct GlyphValue {

View File

@@ -5,8 +5,8 @@
using namespace mbgl;
size_t LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar) {
size_t idx = index();
GLsizei LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar) {
GLsizei idx = index();
void *data = addElement();
int16_t *coords = static_cast<int16_t *>(data);

View File

@@ -30,7 +30,7 @@ public:
* @param {number} tx texture normal
* @param {number} ty texture normal
*/
size_t add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar = 0);
GLsizei add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar = 0);
};

View File

@@ -69,7 +69,7 @@ public:
inline const uint32_t* getData() const { return data.get(); }
private:
const dimension width, height;
const GLsizei width, height;
const dimension pixelWidth, pixelHeight;
const float pixelRatio;

View File

@@ -35,8 +35,8 @@ private:
CircleVertexBuffer& vertexBuffer_;
TriangleElementsBuffer& elementsBuffer_;
const size_t vertexStart_;
const size_t elementsStart_;
const GLsizei vertexStart_;
const GLsizei elementsStart_;
std::vector<std::unique_ptr<TriangleGroup>> triangleGroups_;
};

View File

@@ -91,7 +91,7 @@ void FillBucket::tessellate() {
return;
}
size_t total_vertex_count = 0;
GLsizei total_vertex_count = 0;
for (const auto& polygon : polygons) {
total_vertex_count += polygon.size();
}
@@ -110,7 +110,7 @@ void FillBucket::tessellate() {
GLsizei lineIndex = lineGroup.vertex_length;
for (const auto& polygon : polygons) {
const size_t group_count = polygon.size();
const GLsizei group_count = static_cast<GLsizei>(polygon.size());
assert(group_count >= 3);
std::vector<TESSreal> clipped_line;
@@ -120,8 +120,8 @@ void FillBucket::tessellate() {
vertexBuffer.add(pt.X, pt.Y);
}
for (size_t i = 0; i < group_count; i++) {
const size_t prev_i = (i == 0 ? group_count : i) - 1;
for (GLsizei i = 0; i < group_count; i++) {
const GLsizei prev_i = (i == 0 ? group_count : i) - 1;
lineElementsBuffer.add(lineIndex + prev_i, lineIndex + i);
}
@@ -134,12 +134,12 @@ void FillBucket::tessellate() {
if (tessTesselate(tesselator, TESS_WINDING_ODD, TESS_POLYGONS, vertices_per_group, vertexSize, 0)) {
const TESSreal *vertices = tessGetVertices(tesselator);
const size_t vertex_count = tessGetVertexCount(tesselator);
const GLsizei vertex_count = tessGetVertexCount(tesselator);
TESSindex *vertex_indices = const_cast<TESSindex *>(tessGetVertexIndices(tesselator));
const TESSindex *elements = tessGetElements(tesselator);
const int triangle_count = tessGetElementCount(tesselator);
for (size_t i = 0; i < vertex_count; ++i) {
for (GLsizei i = 0; i < vertex_count; ++i) {
if (vertex_indices[i] == TESS_UNDEF) {
vertexBuffer.add(::round(vertices[i * 2]), ::round(vertices[i * 2 + 1]));
vertex_indices[i] = (TESSindex)total_vertex_count;

View File

@@ -54,9 +54,9 @@ private:
LineElementsBuffer& lineElementsBuffer;
// hold information on where the vertices are located in the FillBuffer
const size_t vertex_start;
const size_t triangle_elements_start;
const size_t line_elements_start;
const GLsizei vertex_start;
const GLsizei triangle_elements_start;
const GLsizei line_elements_start;
std::vector<std::unique_ptr<TriangleGroup>> triangleGroups;
std::vector<std::unique_ptr<LineGroup>> lineGroups;

View File

@@ -32,8 +32,8 @@ void LineBucket::addGeometry(const GeometryCollection& geometryCollection) {
}
void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
const auto len = [&vertices] {
auto l = vertices.size();
const GLsizei len = [&vertices] {
GLsizei l = static_cast<GLsizei>(vertices.size());
// If the line has duplicate vertices at the end, adjust length to remove them.
while (l > 2 && vertices[l - 1] == vertices[l - 2]) {
l--;
@@ -78,7 +78,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
const GLint startVertex = vertexBuffer.index();
std::vector<TriangleElement> triangleStore;
for (size_t i = 0; i < len; ++i) {
for (GLsizei i = 0; i < len; ++i) {
if (closed && i == len - 1) {
// if the line is closed, we treat the last vertex like the first
nextVertex = vertices[1];
@@ -303,8 +303,8 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
startOfLine = false;
}
const size_t endVertex = vertexBuffer.index();
const size_t vertexCount = endVertex - startVertex;
const GLsizei endVertex = vertexBuffer.index();
const GLsizei vertexCount = endVertex - startVertex;
// Store the triangle/line groups.
{

View File

@@ -58,8 +58,8 @@ private:
LineVertexBuffer& vertexBuffer;
TriangleElementsBuffer& triangleElementsBuffer;
const size_t vertex_start;
const size_t triangle_elements_start;
const GLsizei vertex_start;
const GLsizei triangle_elements_start;
GLint e1;
GLint e2;

View File

@@ -235,7 +235,7 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
// Make a second pass, rendering translucent objects. This time, we render bottom-to-top.
renderPass(RenderPass::Translucent,
order.begin(), order.end(),
order.size() - 1, -1);
static_cast<GLsizei>(order.size()) - 1, -1);
if (debug::renderTree) { Log::Info(Event::Render, "}"); indent--; }
@@ -266,7 +266,7 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
template <class Iterator>
void Painter::renderPass(RenderPass pass_,
Iterator it, Iterator end,
std::size_t i, int8_t increment) {
GLsizei i, int8_t increment) {
pass = pass_;
MBGL_DEBUG_GROUP(pass == RenderPass::Opaque ? "opaque" : "translucent");

View File

@@ -143,7 +143,7 @@ private:
template <class Iterator>
void renderPass(RenderPass,
Iterator it, Iterator end,
std::size_t i, int8_t increment);
GLsizei i, int8_t increment);
void prepareTile(const Tile& tile);
@@ -201,7 +201,7 @@ private:
Color background = {{ 0, 0, 0, 0 }};
int numSublayers = 3;
size_t currentLayer;
GLsizei currentLayer;
float depthRangeSize;
const float depthEpsilon = 1.0f / (1 << 16);

View File

@@ -103,7 +103,8 @@ bool SymbolBucket::needsDependencies(const GeometryTileLayer& layer,
// Determine and load glyph ranges
std::set<GlyphRange> ranges;
for (std::size_t i = 0; i < layer.featureCount(); i++) {
const GLsizei featureCount = static_cast<GLsizei>(layer.featureCount());
for (GLsizei i = 0; i < featureCount; i++) {
auto feature = layer.getFeature(i);
GeometryTileFeatureExtractor extractor(*feature);