mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-03-05 21:40:40 +01:00
gl: Track the VBO size as a property of the ctx
Change suggested by Chris Wilson. This will enable setting different vbo sizes for GL vs. EGL. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
036f47c345
commit
aa820c13d7
4 changed files with 17 additions and 15 deletions
|
|
@ -875,7 +875,8 @@ _cairo_gl_composite_prepare_buffer (cairo_gl_context_t *ctx,
|
|||
ctx->primitive_type = primitive_type;
|
||||
}
|
||||
|
||||
if (ctx->vb_offset + n_vertices * ctx->vertex_size > _cairo_gl_get_vbo_size())
|
||||
assert(ctx->vbo_size > 0);
|
||||
if (ctx->vb_offset + n_vertices * ctx->vertex_size > ctx->vbo_size)
|
||||
_cairo_gl_composite_flush (ctx);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,9 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
|
|||
if (unlikely (status))
|
||||
return status;
|
||||
|
||||
ctx->vb = malloc (_cairo_gl_get_vbo_size());
|
||||
ctx->vbo_size = _cairo_gl_get_vbo_size();
|
||||
|
||||
ctx->vb = malloc (ctx->vbo_size);
|
||||
if (unlikely (ctx->vb == NULL)) {
|
||||
_cairo_cache_fini (&ctx->gradients);
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
|
|
|||
|
|
@ -73,21 +73,19 @@ _cairo_gl_get_flavor (void)
|
|||
return flavor;
|
||||
}
|
||||
|
||||
long
|
||||
unsigned long
|
||||
_cairo_gl_get_vbo_size (void)
|
||||
{
|
||||
static long vbo_size = -1;
|
||||
unsigned long vbo_size;
|
||||
|
||||
if (vbo_size < 0) {
|
||||
const char *env = getenv ("CAIRO_GL_VBO_SIZE");
|
||||
if (env == NULL) {
|
||||
vbo_size = CAIRO_GL_VBO_SIZE_DEFAULT;
|
||||
} else {
|
||||
errno = 0;
|
||||
vbo_size = strtol (env, NULL, 10);
|
||||
assert (errno == 0);
|
||||
assert (vbo_size > 0);
|
||||
}
|
||||
const char *env = getenv ("CAIRO_GL_VBO_SIZE");
|
||||
if (env == NULL) {
|
||||
vbo_size = CAIRO_GL_VBO_SIZE_DEFAULT;
|
||||
} else {
|
||||
errno = 0;
|
||||
vbo_size = strtol (env, NULL, 10);
|
||||
assert (errno == 0);
|
||||
assert (vbo_size > 0);
|
||||
}
|
||||
|
||||
return vbo_size;
|
||||
|
|
|
|||
|
|
@ -362,6 +362,7 @@ struct _cairo_gl_context {
|
|||
cairo_gl_operand_t operands[2];
|
||||
cairo_bool_t spans;
|
||||
|
||||
unsigned int vbo_size;
|
||||
unsigned int vb_offset;
|
||||
unsigned int vertex_size;
|
||||
cairo_region_t *clip_region;
|
||||
|
|
@ -703,7 +704,7 @@ _cairo_gl_get_version (void);
|
|||
cairo_private cairo_gl_flavor_t
|
||||
_cairo_gl_get_flavor (void);
|
||||
|
||||
cairo_private long
|
||||
cairo_private unsigned long
|
||||
_cairo_gl_get_vbo_size (void);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue