summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry (Yu) Song <hsong@sisa.samsung.com>2011-12-22 17:24:01 -0800
committerMartin Robinson <mrobinson@igalia.com>2012-05-17 12:49:55 -0700
commitac8d50f04ca24fb24f354dea597513ec43f5ebb6 (patch)
tree2b34e25eaffed5d66f1900f4a76c1dfd57117671
parent5ae53c933ae4baefdedb8ca795ee25dfcba9f5b0 (diff)
gl/msaa: Use unsigned short to build the index array
Some GPUs have trouble accepting vertex index data as integers. Using unsigned shorts expands support.
-rw-r--r--src/cairo-gl-composite.c10
-rw-r--r--src/cairo-gl-device.c2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index 05046ecb..c4d6e0b5 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -590,7 +590,7 @@ static inline void
_cairo_gl_composite_draw_tristrip (cairo_gl_context_t *ctx)
{
cairo_array_t* indices = &ctx->tristrip_indices;
- const int *indices_array = _cairo_array_index_const (indices, 0);
+ const unsigned short *indices_array = _cairo_array_index_const (indices, 0);
if (ctx->pre_shader) {
@@ -598,13 +598,13 @@ _cairo_gl_composite_draw_tristrip (cairo_gl_context_t *ctx)
_cairo_gl_set_shader (ctx, ctx->pre_shader);
_cairo_gl_set_operator (ctx, CAIRO_OPERATOR_DEST_OUT, TRUE);
- glDrawElements (GL_TRIANGLE_STRIP, _cairo_array_num_elements (indices), GL_UNSIGNED_INT, indices_array);
+ glDrawElements (GL_TRIANGLE_STRIP, _cairo_array_num_elements (indices), GL_UNSIGNED_SHORT, indices_array);
_cairo_gl_set_shader (ctx, prev_shader);
_cairo_gl_set_operator (ctx, CAIRO_OPERATOR_ADD, TRUE);
}
- glDrawElements (GL_TRIANGLE_STRIP, _cairo_array_num_elements (indices), GL_UNSIGNED_INT, indices_array);
+ glDrawElements (GL_TRIANGLE_STRIP, _cairo_array_num_elements (indices), GL_UNSIGNED_SHORT, indices_array);
_cairo_array_truncate (indices, 0);
}
@@ -835,7 +835,7 @@ _cairo_gl_composite_append_vertex_indices (cairo_gl_context_t *ctx,
cairo_int_status_t status = CAIRO_INT_STATUS_SUCCESS;
cairo_array_t *indices = &ctx->tristrip_indices;
int number_of_indices = _cairo_array_num_elements (indices);
- int current_vertex_index = 0;
+ unsigned short current_vertex_index = 0;
int i;
assert (number_of_new_indices > 0);
@@ -844,7 +844,7 @@ _cairo_gl_composite_append_vertex_indices (cairo_gl_context_t *ctx,
context, we insert a set of degenerate triangles from the last
preexisting vertex to our first one. */
if (number_of_indices > 0) {
- const int *indices_array = _cairo_array_index_const (indices, 0);
+ const unsigned short *indices_array = _cairo_array_index_const (indices, 0);
current_vertex_index = indices_array[number_of_indices - 1];
status = _cairo_array_append (indices, &current_vertex_index);
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index f710ab07..88656a68 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -264,7 +264,7 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
}
}
- _cairo_array_init (&ctx->tristrip_indices, sizeof(int));
+ _cairo_array_init (&ctx->tristrip_indices, sizeof (unsigned short));
/* PBO for any sort of texture upload */
dispatch->GenBuffers (1, &ctx->texture_load_pbo);