cogl: Pass Context where possible
Avoids using the macro & global variable Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
This commit is contained in:
parent
24f46448ce
commit
3fd7cdba09
22 changed files with 127 additions and 194 deletions
|
@ -261,6 +261,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
|
|||
|
||||
static gboolean
|
||||
cogl_pango_glyph_cache_add_to_local_atlas (CoglPangoGlyphCache *cache,
|
||||
CoglContext *context,
|
||||
PangoFont *font,
|
||||
PangoGlyph glyph,
|
||||
CoglPangoGlyphCacheValue *value)
|
||||
|
@ -282,7 +283,8 @@ cogl_pango_glyph_cache_add_to_local_atlas (CoglPangoGlyphCache *cache,
|
|||
/* If we couldn't find one then start a new atlas */
|
||||
if (atlas == NULL)
|
||||
{
|
||||
atlas = _cogl_atlas_new (COGL_PIXEL_FORMAT_A_8,
|
||||
atlas = _cogl_atlas_new (context,
|
||||
COGL_PIXEL_FORMAT_A_8,
|
||||
COGL_ATLAS_CLEAR_TEXTURE |
|
||||
COGL_ATLAS_DISABLE_MIGRATION,
|
||||
cogl_pango_glyph_cache_update_position_cb);
|
||||
|
@ -309,6 +311,7 @@ cogl_pango_glyph_cache_add_to_local_atlas (CoglPangoGlyphCache *cache,
|
|||
|
||||
CoglPangoGlyphCacheValue *
|
||||
cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
|
||||
CoglContext *context,
|
||||
gboolean create,
|
||||
PangoFont *font,
|
||||
PangoGlyph glyph)
|
||||
|
@ -350,6 +353,7 @@ cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
|
|||
value) &&
|
||||
/* If it fails try the local atlas */
|
||||
!cogl_pango_glyph_cache_add_to_local_atlas (cache,
|
||||
context,
|
||||
font,
|
||||
glyph,
|
||||
value))
|
||||
|
|
|
@ -75,6 +75,7 @@ cogl_pango_glyph_cache_free (CoglPangoGlyphCache *cache);
|
|||
|
||||
COGL_EXPORT CoglPangoGlyphCacheValue *
|
||||
cogl_pango_glyph_cache_lookup (CoglPangoGlyphCache *cache,
|
||||
CoglContext *context,
|
||||
gboolean create,
|
||||
PangoFont *font,
|
||||
PangoGlyph glyph);
|
||||
|
|
|
@ -503,6 +503,7 @@ cogl_pango_renderer_get_cached_glyph (PangoRenderer *renderer,
|
|||
&priv->no_mipmap_caches);
|
||||
|
||||
return cogl_pango_glyph_cache_lookup (caches->glyph_cache,
|
||||
priv->ctx,
|
||||
create, font, glyph);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
static GQuark atlas_private_key = 0;
|
||||
|
||||
G_DEFINE_FINAL_TYPE (CoglAtlasTexture, cogl_atlas_texture, COGL_TYPE_TEXTURE)
|
||||
|
||||
static void
|
||||
|
@ -171,8 +169,6 @@ _cogl_atlas_texture_post_reorganize_cb (void *user_data)
|
|||
{
|
||||
CoglAtlas *atlas = user_data;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (atlas->map)
|
||||
{
|
||||
CoglAtlasTextureGetRectanglesData data;
|
||||
|
@ -204,24 +200,13 @@ _cogl_atlas_texture_post_reorganize_cb (void *user_data)
|
|||
}
|
||||
|
||||
/* Notify any listeners that an atlas has changed */
|
||||
g_hook_list_invoke (&ctx->atlas_reorganize_callbacks, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_atlas_texture_atlas_destroyed_cb (void *user_data)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* Remove the atlas from the global list */
|
||||
ctx->atlases = g_slist_remove (ctx->atlases, user_data);
|
||||
g_hook_list_invoke (&atlas->context->atlas_reorganize_callbacks, FALSE);
|
||||
}
|
||||
|
||||
static CoglAtlas *
|
||||
_cogl_atlas_texture_create_atlas (CoglContext *ctx)
|
||||
{
|
||||
atlas_private_key = g_quark_from_static_string ("-cogl-atlas-texture-create-key");
|
||||
|
||||
CoglAtlas *atlas = _cogl_atlas_new (COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
CoglAtlas *atlas = _cogl_atlas_new (ctx, COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
0,
|
||||
_cogl_atlas_texture_update_position_cb);
|
||||
|
||||
|
@ -231,17 +216,6 @@ _cogl_atlas_texture_create_atlas (CoglContext *ctx)
|
|||
atlas);
|
||||
|
||||
ctx->atlases = g_slist_prepend (ctx->atlases, atlas);
|
||||
|
||||
/* Set some data on the atlas so we can get notification when it is
|
||||
destroyed in order to remove it from the list. ctx->atlases
|
||||
effectively holds a weak reference. We don't need a strong
|
||||
reference because the atlas textures take a reference on the
|
||||
atlas so it will stay alive */
|
||||
g_object_set_qdata_full (G_OBJECT (atlas),
|
||||
atlas_private_key,
|
||||
atlas,
|
||||
_cogl_atlas_texture_atlas_destroyed_cb);
|
||||
|
||||
return atlas;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,11 @@ cogl_atlas_dispose (GObject *object)
|
|||
|
||||
COGL_NOTE (ATLAS, "%p: Atlas destroyed", atlas);
|
||||
|
||||
if (atlas->texture)
|
||||
g_object_unref (atlas->texture);
|
||||
/* Remove the atlas from the global list */
|
||||
atlas->context->atlases = g_slist_remove (atlas->context->atlases, atlas);
|
||||
|
||||
g_clear_object (&atlas->texture);
|
||||
g_clear_object (&atlas->context);
|
||||
if (atlas->map)
|
||||
_cogl_rectangle_map_free (atlas->map);
|
||||
|
||||
|
@ -79,7 +82,8 @@ cogl_atlas_class_init (CoglAtlasClass *class)
|
|||
}
|
||||
|
||||
CoglAtlas *
|
||||
_cogl_atlas_new (CoglPixelFormat texture_format,
|
||||
_cogl_atlas_new (CoglContext *context,
|
||||
CoglPixelFormat texture_format,
|
||||
CoglAtlasFlags flags,
|
||||
CoglAtlasUpdatePositionCallback update_position_cb)
|
||||
{
|
||||
|
@ -88,6 +92,7 @@ _cogl_atlas_new (CoglPixelFormat texture_format,
|
|||
atlas->update_position_cb = update_position_cb;
|
||||
atlas->map = NULL;
|
||||
atlas->texture = NULL;
|
||||
atlas->context = g_object_ref (context);
|
||||
atlas->flags = flags;
|
||||
atlas->texture_format = texture_format;
|
||||
g_hook_list_init (&atlas->pre_reorganize_callbacks, sizeof (GHook));
|
||||
|
@ -183,7 +188,8 @@ _cogl_atlas_get_next_size (unsigned int *map_width,
|
|||
}
|
||||
|
||||
static void
|
||||
_cogl_atlas_get_initial_size (CoglPixelFormat format,
|
||||
_cogl_atlas_get_initial_size (CoglContext *ctx,
|
||||
CoglPixelFormat format,
|
||||
unsigned int *map_width,
|
||||
unsigned int *map_height)
|
||||
{
|
||||
|
@ -192,8 +198,6 @@ _cogl_atlas_get_initial_size (CoglPixelFormat format,
|
|||
GLenum gl_format;
|
||||
GLenum gl_type;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (cogl_pixel_format_get_n_planes (format) == 1);
|
||||
|
||||
ctx->driver_vtable->pixel_format_to_gl (ctx,
|
||||
|
@ -228,7 +232,8 @@ _cogl_atlas_get_initial_size (CoglPixelFormat format,
|
|||
}
|
||||
|
||||
static CoglRectangleMap *
|
||||
_cogl_atlas_create_map (CoglPixelFormat format,
|
||||
_cogl_atlas_create_map (CoglContext *ctx,
|
||||
CoglPixelFormat format,
|
||||
unsigned int map_width,
|
||||
unsigned int map_height,
|
||||
unsigned int n_textures,
|
||||
|
@ -238,8 +243,6 @@ _cogl_atlas_create_map (CoglPixelFormat format,
|
|||
GLenum gl_format;
|
||||
GLenum gl_type;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
ctx->driver_vtable->pixel_format_to_gl (ctx,
|
||||
format,
|
||||
&gl_intformat,
|
||||
|
@ -299,8 +302,6 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
|
|||
CoglTexture *tex;
|
||||
GError *ignore_error = NULL;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
g_return_val_if_fail (
|
||||
cogl_pixel_format_get_n_planes (atlas->texture_format) == 1,
|
||||
NULL);
|
||||
|
@ -314,7 +315,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
|
|||
|
||||
/* Create a buffer of zeroes to initially clear the texture */
|
||||
clear_data = g_malloc0 (width * height * bpp);
|
||||
clear_bmp = cogl_bitmap_new_for_data (ctx,
|
||||
clear_bmp = cogl_bitmap_new_for_data (atlas->context,
|
||||
width,
|
||||
height,
|
||||
atlas->texture_format,
|
||||
|
@ -339,7 +340,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
|
|||
}
|
||||
else
|
||||
{
|
||||
tex = cogl_texture_2d_new_with_size (ctx, width, height);
|
||||
tex = cogl_texture_2d_new_with_size (atlas->context, width, height);
|
||||
|
||||
_cogl_texture_set_internal_format (tex,
|
||||
atlas->texture_format);
|
||||
|
@ -469,10 +470,12 @@ _cogl_atlas_reserve_space (CoglAtlas *atlas,
|
|||
_cogl_atlas_get_next_size (&map_width, &map_height);
|
||||
}
|
||||
else
|
||||
_cogl_atlas_get_initial_size (atlas->texture_format,
|
||||
_cogl_atlas_get_initial_size (atlas->context,
|
||||
atlas->texture_format,
|
||||
&map_width, &map_height);
|
||||
|
||||
new_map = _cogl_atlas_create_map (atlas->texture_format,
|
||||
new_map = _cogl_atlas_create_map (atlas->context,
|
||||
atlas->texture_format,
|
||||
map_width, map_height,
|
||||
data.n_textures, data.textures);
|
||||
|
||||
|
@ -623,10 +626,8 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
|
|||
CoglBlitData blit_data;
|
||||
GError *ignore_error = NULL;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
/* Create a new texture at the right size */
|
||||
tex = create_migration_texture (ctx, width, height, internal_format);
|
||||
tex = create_migration_texture (atlas->context, width, height, internal_format);
|
||||
if (!cogl_texture_allocate (tex, &ignore_error))
|
||||
{
|
||||
g_error_free (ignore_error);
|
||||
|
|
|
@ -58,6 +58,7 @@ struct _CoglAtlas
|
|||
GObject parent_instance;
|
||||
|
||||
CoglRectangleMap *map;
|
||||
CoglContext *context;
|
||||
|
||||
CoglTexture *texture;
|
||||
CoglPixelFormat texture_format;
|
||||
|
@ -70,8 +71,9 @@ struct _CoglAtlas
|
|||
};
|
||||
|
||||
COGL_EXPORT CoglAtlas *
|
||||
_cogl_atlas_new (CoglPixelFormat texture_format,
|
||||
CoglAtlasFlags flags,
|
||||
_cogl_atlas_new (CoglContext *context,
|
||||
CoglPixelFormat texture_format,
|
||||
CoglAtlasFlags flags,
|
||||
CoglAtlasUpdatePositionCallback update_position_cb);
|
||||
|
||||
COGL_EXPORT gboolean
|
||||
|
|
|
@ -214,8 +214,6 @@ validate_blend_statements (CoglBlendStringStatement *statements,
|
|||
const char *error_string;
|
||||
CoglBlendStringError detail = COGL_BLEND_STRING_ERROR_INVALID_ERROR;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, 0);
|
||||
|
||||
for (i = 0; i < n_statements; i++)
|
||||
for (j = 0; j < statements[i].function->argc; j++)
|
||||
{
|
||||
|
|
|
@ -303,8 +303,7 @@ cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline,
|
|||
CoglSamplerCacheWrapMode internal_mode =
|
||||
public_to_internal_wrap_mode (mode);
|
||||
const CoglSamplerCacheEntry *sampler_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
g_return_if_fail (COGL_IS_PIPELINE (pipeline));
|
||||
|
||||
|
@ -343,11 +342,12 @@ cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
|
|||
CoglSamplerCacheWrapMode internal_mode =
|
||||
public_to_internal_wrap_mode (mode);
|
||||
const CoglSamplerCacheEntry *sampler_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx;
|
||||
|
||||
g_return_if_fail (COGL_IS_PIPELINE (pipeline));
|
||||
|
||||
ctx = pipeline->context;
|
||||
|
||||
/* Note: this will ensure that the layer exists, creating one if it
|
||||
* doesn't already.
|
||||
*
|
||||
|
@ -383,11 +383,11 @@ cogl_pipeline_set_layer_wrap_mode (CoglPipeline *pipeline,
|
|||
CoglSamplerCacheWrapMode internal_mode =
|
||||
public_to_internal_wrap_mode (mode);
|
||||
const CoglSamplerCacheEntry *sampler_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx;
|
||||
|
||||
g_return_if_fail (COGL_IS_PIPELINE (pipeline));
|
||||
|
||||
ctx = pipeline->context;
|
||||
/* Note: this will ensure that the layer exists, creating one if it
|
||||
* doesn't already.
|
||||
*
|
||||
|
@ -510,8 +510,6 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
|
|||
CoglPipelineLayer *new;
|
||||
CoglPipelineLayer *authority;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
g_return_val_if_fail (COGL_IS_PIPELINE (pipeline), FALSE);
|
||||
|
||||
/* Note: this will ensure that the layer exists, creating one if it
|
||||
|
@ -1268,14 +1266,14 @@ cogl_pipeline_set_layer_filters (CoglPipeline *pipeline,
|
|||
CoglPipelineLayer *layer;
|
||||
CoglPipelineLayer *authority;
|
||||
const CoglSamplerCacheEntry *sampler_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx;
|
||||
|
||||
g_return_if_fail (COGL_IS_PIPELINE (pipeline));
|
||||
|
||||
g_return_if_fail (mag_filter == COGL_PIPELINE_FILTER_NEAREST ||
|
||||
mag_filter == COGL_PIPELINE_FILTER_LINEAR);
|
||||
|
||||
ctx = pipeline->context;
|
||||
/* Note: this will ensure that the layer exists, creating one if it
|
||||
* doesn't already.
|
||||
*
|
||||
|
|
|
@ -86,8 +86,6 @@ _cogl_pipeline_blend_state_equal (CoglPipeline *authority0,
|
|||
CoglPipelineBlendState *blend_state0 = &authority0->big_state->blend_state;
|
||||
CoglPipelineBlendState *blend_state1 = &authority1->big_state->blend_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
if (blend_state0->blend_equation_rgb != blend_state1->blend_equation_rgb)
|
||||
return FALSE;
|
||||
|
||||
|
@ -217,8 +215,7 @@ _cogl_pipeline_get_all_uniform_values (CoglPipeline *pipeline,
|
|||
const CoglBoxedValue **values)
|
||||
{
|
||||
GetUniformsClosure data;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
memset (values, 0,
|
||||
sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
|
||||
|
@ -252,8 +249,7 @@ _cogl_pipeline_uniforms_state_equal (CoglPipeline *authority0,
|
|||
const CoglBoxedValue **values0, **values1;
|
||||
int n_longs;
|
||||
int i;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
CoglContext *ctx = authority0->context;
|
||||
|
||||
if (authority0 == authority1)
|
||||
return TRUE;
|
||||
|
@ -556,8 +552,6 @@ cogl_pipeline_set_blend (CoglPipeline *pipeline,
|
|||
int count;
|
||||
CoglPipelineBlendState *blend_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
g_return_val_if_fail (COGL_IS_PIPELINE (pipeline), FALSE);
|
||||
|
||||
count =
|
||||
|
@ -633,8 +627,6 @@ cogl_pipeline_set_blend_constant (CoglPipeline *pipeline,
|
|||
CoglPipeline *authority;
|
||||
CoglPipelineBlendState *blend_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (COGL_IS_PIPELINE (pipeline));
|
||||
|
||||
authority = _cogl_pipeline_get_authority (pipeline, state);
|
||||
|
@ -740,8 +732,6 @@ cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
|
|||
CoglPipeline *authority;
|
||||
CoglDepthState *orig_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
g_return_val_if_fail (COGL_IS_PIPELINE (pipeline), FALSE);
|
||||
g_return_val_if_fail (depth_state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
|
||||
|
||||
|
@ -949,7 +939,6 @@ cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline,
|
|||
CoglPipelineState state = COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE;
|
||||
CoglPipeline *authority;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
g_return_val_if_fail (COGL_IS_PIPELINE (pipeline), FALSE);
|
||||
|
||||
authority = _cogl_pipeline_get_authority (pipeline, state);
|
||||
|
@ -996,11 +985,9 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
|
|||
CoglPipelineUniformsState *uniforms_state;
|
||||
int override_index;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
g_return_val_if_fail (COGL_IS_PIPELINE (pipeline), NULL);
|
||||
g_return_val_if_fail (location >= 0, NULL);
|
||||
g_return_val_if_fail (location < ctx->n_uniform_names, NULL);
|
||||
g_return_val_if_fail (location < pipeline->context->n_uniform_names, NULL);
|
||||
|
||||
/* - Flush journal primitives referencing the current state.
|
||||
* - Make sure the pipeline has no dependants so it may be modified.
|
||||
|
@ -1271,8 +1258,6 @@ _cogl_pipeline_hash_blend_state (CoglPipeline *authority,
|
|||
CoglPipelineBlendState *blend_state = &authority->big_state->blend_state;
|
||||
unsigned int hash;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (!authority->real_blend_enable)
|
||||
return;
|
||||
|
||||
|
|
|
@ -71,9 +71,10 @@ struct _CoglProgramUniform
|
|||
the last time it was flushed. This will cause it to requery all of
|
||||
the locations and assume that all uniforms are dirty */
|
||||
void
|
||||
_cogl_program_flush_uniforms (CoglProgram *program,
|
||||
GLuint gl_program,
|
||||
gboolean gl_program_changed);
|
||||
_cogl_program_flush_uniforms (CoglContext *ctx,
|
||||
CoglProgram *program,
|
||||
GLuint gl_program,
|
||||
gboolean gl_program_changed);
|
||||
|
||||
gboolean
|
||||
_cogl_program_has_fragment_shader (CoglProgram *self);
|
||||
|
|
|
@ -46,8 +46,6 @@ cogl_program_dispose (GObject *object)
|
|||
CoglProgram *program = COGL_PROGRAM (object);
|
||||
int i;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* Unref all of the attached shaders and destroy the list */
|
||||
g_slist_free_full (program->attached_shaders, g_object_unref);
|
||||
|
||||
|
@ -105,8 +103,6 @@ void
|
|||
cogl_program_attach_shader (CoglProgram *program,
|
||||
CoglShader *shader)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (!COGL_IS_PROGRAM (program) || !COGL_IS_SHADER (shader))
|
||||
return;
|
||||
|
||||
|
@ -247,15 +243,14 @@ cogl_program_set_uniform_matrix (CoglProgram *program,
|
|||
}
|
||||
|
||||
void
|
||||
_cogl_program_flush_uniforms (CoglProgram *program,
|
||||
_cogl_program_flush_uniforms (CoglContext *ctx,
|
||||
CoglProgram *program,
|
||||
GLuint gl_program,
|
||||
gboolean gl_program_changed)
|
||||
{
|
||||
CoglProgramUniform *uniform;
|
||||
int i;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
for (i = 0; i < program->custom_uniforms->len; i++)
|
||||
{
|
||||
uniform = &g_array_index (program->custom_uniforms,
|
||||
|
|
|
@ -45,10 +45,10 @@ static void
|
|||
cogl_shader_dispose (GObject *object)
|
||||
{
|
||||
CoglShader *shader = COGL_SHADER (object);
|
||||
CoglContext *ctx = shader->compilation_pipeline->context;
|
||||
|
||||
/* Frees shader resources but its handle is not
|
||||
released! Do that separately before this! */
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (shader->gl_handle)
|
||||
GE (ctx, glDeleteShader (shader->gl_handle));
|
||||
|
@ -74,8 +74,6 @@ cogl_create_shader (CoglShaderType type)
|
|||
{
|
||||
CoglShader *shader;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case COGL_SHADER_TYPE_VERTEX:
|
||||
|
@ -101,8 +99,6 @@ cogl_shader_source (CoglShader *self,
|
|||
{
|
||||
g_return_if_fail (COGL_IS_SHADER (self));
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
self->source = g_strdup (source);
|
||||
}
|
||||
|
||||
|
@ -111,7 +107,5 @@ cogl_shader_get_shader_type (CoglShader *self)
|
|||
{
|
||||
g_return_val_if_fail (COGL_IS_SHADER (self), COGL_SHADER_TYPE_VERTEX);
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, COGL_SHADER_TYPE_VERTEX);
|
||||
|
||||
return self->type;
|
||||
}
|
||||
|
|
|
@ -149,8 +149,7 @@ destroy_shader_state (void *user_data)
|
|||
{
|
||||
CoglPipelineFragendShaderStateCache *cache = user_data;
|
||||
CoglPipelineFragendShaderState *shader_state = cache->shader_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = cache->instance->context;
|
||||
|
||||
if (shader_state->cache_entry &&
|
||||
shader_state->cache_entry->pipeline != cache->instance)
|
||||
|
@ -297,10 +296,9 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
|
|||
CoglPipeline *authority;
|
||||
CoglPipelineCacheEntry *cache_entry = NULL;
|
||||
CoglProgram *user_program = cogl_pipeline_get_user_program (pipeline);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
int i;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* Now lookup our glsl backend private state */
|
||||
shader_state = get_shader_state (pipeline);
|
||||
|
||||
|
@ -426,8 +424,6 @@ ensure_texture_lookup_generated (CoglPipelineFragendShaderState *shader_state,
|
|||
int unit_index = _cogl_pipeline_layer_get_unit_index (layer);
|
||||
CoglPipelineSnippetData snippet_data;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (shader_state->unit_state[unit_index].sampled)
|
||||
return;
|
||||
|
||||
|
@ -990,8 +986,7 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
|
|||
unsigned long pipelines_difference)
|
||||
{
|
||||
CoglPipelineFragendShaderState *shader_state = get_shader_state (pipeline);
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
if (shader_state->source)
|
||||
{
|
||||
|
@ -1092,7 +1087,7 @@ _cogl_pipeline_fragend_glsl_pre_change_notify (CoglPipeline *pipeline,
|
|||
CoglPipelineState change,
|
||||
const CoglColor *new_color)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
if ((change & _cogl_pipeline_get_state_for_fragment_codegen (ctx)))
|
||||
dirty_shader_state (pipeline);
|
||||
|
@ -1112,7 +1107,7 @@ _cogl_pipeline_fragend_glsl_layer_pre_change_notify (
|
|||
CoglPipelineLayer *layer,
|
||||
CoglPipelineLayerState change)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = owner->context;
|
||||
|
||||
if ((change & _cogl_pipeline_get_layer_state_for_fragment_codegen (ctx)))
|
||||
{
|
||||
|
|
|
@ -123,20 +123,24 @@ typedef struct _CoglTextureUnit
|
|||
} CoglTextureUnit;
|
||||
|
||||
CoglTextureUnit *
|
||||
_cogl_get_texture_unit (int index_);
|
||||
_cogl_get_texture_unit (CoglContext *ctx,
|
||||
int index_);
|
||||
|
||||
void
|
||||
_cogl_destroy_texture_units (CoglContext *ctx);
|
||||
|
||||
void
|
||||
_cogl_set_active_texture_unit (int unit_index);
|
||||
_cogl_set_active_texture_unit (CoglContext *ctx,
|
||||
int unit_index);
|
||||
|
||||
void
|
||||
_cogl_bind_gl_texture_transient (GLenum gl_target,
|
||||
GLuint gl_texture);
|
||||
_cogl_bind_gl_texture_transient (CoglContext *ctx,
|
||||
GLenum gl_target,
|
||||
GLuint gl_texture);
|
||||
|
||||
void
|
||||
_cogl_delete_gl_texture (GLuint gl_texture);
|
||||
_cogl_delete_gl_texture (CoglContext *ctx,
|
||||
GLuint gl_texture);
|
||||
|
||||
void
|
||||
_cogl_pipeline_flush_gl_state (CoglContext *context,
|
||||
|
|
|
@ -89,9 +89,9 @@ texture_unit_free (CoglTextureUnit *unit)
|
|||
}
|
||||
|
||||
CoglTextureUnit *
|
||||
_cogl_get_texture_unit (int index_)
|
||||
_cogl_get_texture_unit (CoglContext *ctx,
|
||||
int index_)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NULL);
|
||||
CoglGLContext *glctx = _cogl_driver_gl_context(ctx);
|
||||
|
||||
if (glctx->texture_units->len < (index_ + 1))
|
||||
|
@ -128,9 +128,9 @@ _cogl_destroy_texture_units (CoglContext *ctx)
|
|||
}
|
||||
|
||||
void
|
||||
_cogl_set_active_texture_unit (int unit_index)
|
||||
_cogl_set_active_texture_unit (CoglContext *ctx,
|
||||
int unit_index)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglGLContext *glctx = _cogl_driver_gl_context(ctx);
|
||||
|
||||
if (glctx->active_texture_unit != unit_index)
|
||||
|
@ -161,13 +161,12 @@ _cogl_set_active_texture_unit (int unit_index)
|
|||
* CoglTextureUnit.
|
||||
*/
|
||||
void
|
||||
_cogl_bind_gl_texture_transient (GLenum gl_target,
|
||||
GLuint gl_texture)
|
||||
_cogl_bind_gl_texture_transient (CoglContext *ctx,
|
||||
GLenum gl_target,
|
||||
GLuint gl_texture)
|
||||
{
|
||||
CoglTextureUnit *unit;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* We choose to always make texture unit 1 active for transient
|
||||
* binds so that in the common case where multitexturing isn't used
|
||||
* we can simply ignore the state of this texture unit. Notably we
|
||||
|
@ -175,8 +174,8 @@ _cogl_bind_gl_texture_transient (GLenum gl_target,
|
|||
* in case the driver doesn't have a sparse data structure for
|
||||
* texture units.
|
||||
*/
|
||||
_cogl_set_active_texture_unit (1);
|
||||
unit = _cogl_get_texture_unit (1);
|
||||
_cogl_set_active_texture_unit (ctx, 1);
|
||||
unit = _cogl_get_texture_unit (ctx, 1);
|
||||
|
||||
if (unit->gl_texture == gl_texture && !unit->dirty_gl_texture)
|
||||
return;
|
||||
|
@ -187,11 +186,11 @@ _cogl_bind_gl_texture_transient (GLenum gl_target,
|
|||
}
|
||||
|
||||
void
|
||||
_cogl_delete_gl_texture (GLuint gl_texture)
|
||||
_cogl_delete_gl_texture (CoglContext *ctx,
|
||||
GLuint gl_texture)
|
||||
{
|
||||
int i;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglGLContext *glctx = _cogl_driver_gl_context(ctx);
|
||||
|
||||
for (i = 0; i < glctx->texture_units->len; i++)
|
||||
|
@ -220,7 +219,7 @@ _cogl_pipeline_texture_storage_change_notify (CoglTexture *texture)
|
|||
{
|
||||
int i;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = cogl_texture_get_context (texture);
|
||||
CoglGLContext *glctx = _cogl_driver_gl_context(ctx);
|
||||
|
||||
for (i = 0; i < glctx->texture_units->len; i++)
|
||||
|
@ -306,7 +305,7 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
|||
unsigned long pipelines_difference,
|
||||
gboolean with_color_attrib)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
if (pipelines_difference & COGL_PIPELINE_STATE_BLEND)
|
||||
{
|
||||
|
@ -410,10 +409,8 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
|||
}
|
||||
|
||||
static int
|
||||
get_max_activateable_texture_units (void)
|
||||
get_max_activateable_texture_units (CoglContext *ctx)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, 0);
|
||||
|
||||
if (G_UNLIKELY (ctx->max_activateable_texture_units == -1))
|
||||
{
|
||||
GLint values[3];
|
||||
|
@ -469,17 +466,16 @@ static gboolean
|
|||
flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data)
|
||||
{
|
||||
CoglPipelineFlushLayerState *flush_state = user_data;
|
||||
int unit_index = flush_state->i;
|
||||
CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index);
|
||||
unsigned long layers_difference =
|
||||
CoglContext *ctx = layer->owner->context;
|
||||
int unit_index = flush_state->i;
|
||||
CoglTextureUnit *unit = _cogl_get_texture_unit (ctx, unit_index);
|
||||
unsigned long layers_difference =
|
||||
flush_state->layer_differences[unit_index];
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
/* There may not be enough texture units so we can bail out if
|
||||
* that's the case...
|
||||
*/
|
||||
if (G_UNLIKELY (unit_index >= get_max_activateable_texture_units ()))
|
||||
if (G_UNLIKELY (unit_index >= get_max_activateable_texture_units (ctx)))
|
||||
{
|
||||
static gboolean shown_warning = FALSE;
|
||||
|
||||
|
@ -505,7 +501,7 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data)
|
|||
&gl_texture,
|
||||
&gl_target);
|
||||
|
||||
_cogl_set_active_texture_unit (unit_index);
|
||||
_cogl_set_active_texture_unit (ctx, unit_index);
|
||||
|
||||
/* NB: There are several Cogl components and some code in
|
||||
* Clutter that will temporarily bind arbitrary GL textures to
|
||||
|
@ -579,8 +575,6 @@ _cogl_pipeline_flush_common_gl_state (CoglPipeline *pipeline,
|
|||
{
|
||||
CoglPipelineFlushLayerState state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
_cogl_pipeline_flush_color_blend_alpha_depth_state (pipeline,
|
||||
pipelines_difference,
|
||||
with_color_attrib);
|
||||
|
@ -706,11 +700,10 @@ _cogl_sampler_gl_free (CoglContext *context, CoglSamplerCacheEntry *entry)
|
|||
* state.
|
||||
*/
|
||||
static void
|
||||
foreach_texture_unit_update_filter_and_wrap_modes (void)
|
||||
foreach_texture_unit_update_filter_and_wrap_modes (CoglContext *ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglGLContext *glctx = _cogl_driver_gl_context(ctx);
|
||||
|
||||
for (i = 0; i < glctx->texture_units->len; i++)
|
||||
|
@ -746,7 +739,8 @@ static gboolean
|
|||
compare_layer_differences_cb (CoglPipelineLayer *layer, void *user_data)
|
||||
{
|
||||
CoglPipelineCompareLayersState *state = user_data;
|
||||
CoglTextureUnit *unit = _cogl_get_texture_unit (state->i);
|
||||
CoglContext *ctx = layer->owner->context;
|
||||
CoglTextureUnit *unit = _cogl_get_texture_unit (ctx, state->i);
|
||||
|
||||
if (unit->layer == layer)
|
||||
state->layer_differences[state->i] = unit->layer_changes_since_flush;
|
||||
|
@ -1137,7 +1131,7 @@ done:
|
|||
/* Handle the fact that OpenGL associates texture filter and wrap
|
||||
* modes with the texture objects not the texture units... */
|
||||
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS))
|
||||
foreach_texture_unit_update_filter_and_wrap_modes ();
|
||||
foreach_texture_unit_update_filter_and_wrap_modes (ctx);
|
||||
|
||||
/* If this pipeline has more than one layer then we always need
|
||||
* to make sure we rebind the texture for unit 1.
|
||||
|
@ -1147,10 +1141,10 @@ done:
|
|||
* object parameters. cogl-pipeline.c (See
|
||||
* _cogl_bind_gl_texture_transient)
|
||||
*/
|
||||
unit1 = _cogl_get_texture_unit (1);
|
||||
unit1 = _cogl_get_texture_unit (ctx, 1);
|
||||
if (cogl_pipeline_get_n_layers (pipeline) > 1 && unit1->dirty_gl_texture)
|
||||
{
|
||||
_cogl_set_active_texture_unit (1);
|
||||
_cogl_set_active_texture_unit (ctx, 1);
|
||||
GE (ctx, glBindTexture (unit1->gl_target, unit1->gl_texture));
|
||||
unit1->dirty_gl_texture = FALSE;
|
||||
}
|
||||
|
|
|
@ -188,8 +188,7 @@ _cogl_pipeline_progend_glsl_get_attrib_location (CoglPipeline *pipeline,
|
|||
{
|
||||
CoglPipelineProgramState *program_state = get_program_state (pipeline);
|
||||
int *locations;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, -1);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
g_return_val_if_fail (program_state != NULL, -1);
|
||||
g_return_val_if_fail (program_state->program != 0, -1);
|
||||
|
@ -268,8 +267,7 @@ destroy_program_state (void *user_data)
|
|||
{
|
||||
CoglPipelineProgramStateCache *cache = user_data;
|
||||
CoglPipelineProgramState *program_state = cache->program_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = cache->instance->context;
|
||||
|
||||
/* If the program state was last used for this pipeline then clear
|
||||
it so that if same address gets used again for a new pipeline
|
||||
|
@ -338,12 +336,11 @@ dirty_program_state (CoglPipeline *pipeline)
|
|||
}
|
||||
|
||||
static void
|
||||
link_program (GLint gl_program)
|
||||
link_program (CoglContext *ctx,
|
||||
GLint gl_program)
|
||||
{
|
||||
GLint link_status;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
GE( ctx, glLinkProgram (gl_program) );
|
||||
|
||||
GE( ctx, glGetProgramiv (gl_program, GL_LINK_STATUS, &link_status) );
|
||||
|
@ -385,8 +382,7 @@ get_uniform_cb (CoglPipeline *pipeline,
|
|||
CoglPipelineProgramState *program_state = state->program_state;
|
||||
UnitState *unit_state = &program_state->unit_state[state->unit];
|
||||
GLint uniform_location;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
/* We can reuse the source buffer to create the uniform name because
|
||||
the program has now been linked */
|
||||
|
@ -438,8 +434,7 @@ update_constants_cb (CoglPipeline *pipeline,
|
|||
UpdateUniformsState *state = user_data;
|
||||
CoglPipelineProgramState *program_state = state->program_state;
|
||||
UnitState *unit_state = &program_state->unit_state[state->unit++];
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
if (unit_state->combine_constant_uniform != -1 &&
|
||||
(state->update_all || unit_state->dirty_combine_constant))
|
||||
|
@ -569,8 +564,7 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglPipeline *pipeline,
|
|||
CoglPipelineUniformsState *uniforms_state;
|
||||
FlushUniformsClosure data;
|
||||
int n_uniform_longs;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS)
|
||||
uniforms_state = &pipeline->big_state->uniforms_state;
|
||||
|
@ -664,8 +658,7 @@ _cogl_shader_compile_real (CoglShader *shader,
|
|||
{
|
||||
GLenum gl_type;
|
||||
GLint status;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
if (shader->gl_handle)
|
||||
{
|
||||
|
@ -743,8 +736,7 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
|
|||
UpdateUniformsState state;
|
||||
CoglProgram *user_program;
|
||||
CoglPipelineCacheEntry *cache_entry = NULL;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
program_state = get_program_state (pipeline);
|
||||
|
||||
|
@ -845,7 +837,7 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
|
|||
GE( ctx, glBindAttribLocation (program_state->program,
|
||||
0, "cogl_position_in"));
|
||||
|
||||
link_program (program_state->program);
|
||||
link_program (ctx, program_state->program);
|
||||
|
||||
program_changed = TRUE;
|
||||
}
|
||||
|
@ -925,7 +917,7 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
|
|||
program_changed);
|
||||
|
||||
if (user_program)
|
||||
_cogl_program_flush_uniforms (user_program,
|
||||
_cogl_program_flush_uniforms (ctx, user_program,
|
||||
gl_program,
|
||||
program_changed);
|
||||
|
||||
|
@ -939,7 +931,7 @@ _cogl_pipeline_progend_glsl_pre_change_notify (CoglPipeline *pipeline,
|
|||
CoglPipelineState change,
|
||||
const CoglColor *new_color)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
if ((change & (_cogl_pipeline_get_state_for_vertex_codegen (ctx) |
|
||||
_cogl_pipeline_get_state_for_fragment_codegen (ctx))))
|
||||
|
@ -976,8 +968,8 @@ _cogl_pipeline_progend_glsl_layer_pre_change_notify (
|
|||
CoglPipelineLayer *layer,
|
||||
CoglPipelineLayerState change)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglTextureUnit *unit;
|
||||
CoglContext *ctx = owner->context;
|
||||
|
||||
if ((change & (_cogl_pipeline_get_layer_state_for_fragment_codegen (ctx) |
|
||||
COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN)))
|
||||
|
@ -1008,7 +1000,7 @@ _cogl_pipeline_progend_glsl_layer_pre_change_notify (
|
|||
* the changes so we can try to minimize redundant OpenGL calls if
|
||||
* the same layer is flushed again.
|
||||
*/
|
||||
unit = _cogl_get_texture_unit (_cogl_pipeline_layer_get_unit_index (layer));
|
||||
unit = _cogl_get_texture_unit (ctx, _cogl_pipeline_layer_get_unit_index (layer));
|
||||
if (unit->layer == layer)
|
||||
unit->layer_changes_since_flush |= change;
|
||||
}
|
||||
|
@ -1026,8 +1018,7 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline,
|
|||
gboolean need_modelview;
|
||||
gboolean need_projection;
|
||||
graphene_matrix_t modelview, projection;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
program_state = get_program_state (pipeline);
|
||||
|
||||
|
@ -1152,8 +1143,7 @@ update_float_uniform (CoglPipeline *pipeline,
|
|||
{
|
||||
float (* float_getter_func) (CoglPipeline *) = getter_func;
|
||||
float value;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
value = float_getter_func (pipeline);
|
||||
GE( ctx, glUniform1f (uniform_location, value) );
|
||||
|
|
|
@ -108,8 +108,7 @@ destroy_shader_state (void *user_data)
|
|||
{
|
||||
CoglPipelineVertendShaderStateCache *cache = user_data;
|
||||
CoglPipelineVertendShaderState *shader_state = cache->shader_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = cache->instance->context;
|
||||
|
||||
if (shader_state->cache_entry &&
|
||||
shader_state->cache_entry->pipeline != cache->instance)
|
||||
|
@ -390,8 +389,7 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline,
|
|||
CoglPipelineVertendShaderState *shader_state;
|
||||
CoglPipelineCacheEntry *cache_entry = NULL;
|
||||
CoglProgram *user_program = cogl_pipeline_get_user_program (pipeline);
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
/* Now lookup our glsl backend private state (allocating if
|
||||
* necessary) */
|
||||
|
@ -513,8 +511,6 @@ _cogl_pipeline_vertend_glsl_add_layer (CoglPipeline *pipeline,
|
|||
CoglPipelineSnippetData snippet_data;
|
||||
int layer_index = layer->index;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
|
||||
shader_state = get_shader_state (pipeline);
|
||||
|
||||
if (shader_state->source == NULL)
|
||||
|
@ -581,8 +577,7 @@ _cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline,
|
|||
unsigned long pipelines_difference)
|
||||
{
|
||||
CoglPipelineVertendShaderState *shader_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
shader_state = get_shader_state (pipeline);
|
||||
|
||||
|
@ -728,7 +723,7 @@ _cogl_pipeline_vertend_glsl_pre_change_notify (CoglPipeline *pipeline,
|
|||
CoglPipelineState change,
|
||||
const CoglColor *new_color)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
CoglContext *ctx = pipeline->context;
|
||||
|
||||
if ((change & _cogl_pipeline_get_state_for_vertex_codegen (ctx)))
|
||||
dirty_shader_state (pipeline);
|
||||
|
|
|
@ -63,7 +63,8 @@ void
|
|||
_cogl_texture_2d_gl_free (CoglTexture2D *tex_2d)
|
||||
{
|
||||
if (tex_2d->gl_texture)
|
||||
_cogl_delete_gl_texture (tex_2d->gl_texture);
|
||||
_cogl_delete_gl_texture (cogl_texture_get_context (COGL_TEXTURE (tex_2d)),
|
||||
tex_2d->gl_texture);
|
||||
|
||||
#if defined (HAVE_EGL)
|
||||
g_clear_pointer (&tex_2d->egl_image_external.user_data,
|
||||
|
@ -161,7 +162,7 @@ allocate_with_size (CoglTexture2D *tex_2d,
|
|||
|
||||
tex_2d->gl_internal_format = gl_intformat;
|
||||
|
||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
|
||||
_cogl_bind_gl_texture_transient (ctx, GL_TEXTURE_2D,
|
||||
gl_texture);
|
||||
|
||||
/* Clear any GL errors */
|
||||
|
@ -358,7 +359,7 @@ cogl_texture_2d_gl_bind_egl_image (CoglTexture2D *tex_2d,
|
|||
{
|
||||
CoglContext *ctx = cogl_texture_get_context (COGL_TEXTURE (tex_2d));
|
||||
|
||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
|
||||
_cogl_bind_gl_texture_transient (ctx, GL_TEXTURE_2D,
|
||||
tex_2d->gl_texture);
|
||||
_cogl_gl_util_clear_gl_errors (ctx);
|
||||
|
||||
|
@ -464,7 +465,7 @@ _cogl_texture_2d_gl_flush_legacy_texobj_filters (CoglTexture *tex,
|
|||
tex_2d->gl_legacy_texobj_mag_filter = mag_filter;
|
||||
|
||||
/* Apply new filters to the texture */
|
||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
|
||||
_cogl_bind_gl_texture_transient (ctx, GL_TEXTURE_2D,
|
||||
tex_2d->gl_texture);
|
||||
GE( ctx, glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter) );
|
||||
GE( ctx, glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter) );
|
||||
|
@ -493,7 +494,7 @@ _cogl_texture_2d_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
|
|||
if (tex_2d->gl_legacy_texobj_wrap_mode_s != wrap_mode_s ||
|
||||
tex_2d->gl_legacy_texobj_wrap_mode_t != wrap_mode_t)
|
||||
{
|
||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
|
||||
_cogl_bind_gl_texture_transient (ctx, GL_TEXTURE_2D,
|
||||
tex_2d->gl_texture);
|
||||
GE( ctx, glTexParameteri (GL_TEXTURE_2D,
|
||||
GL_TEXTURE_WRAP_S,
|
||||
|
@ -530,7 +531,7 @@ _cogl_texture_2d_gl_copy_from_framebuffer (CoglTexture2D *tex_2d,
|
|||
(COGL_FRAMEBUFFER_STATE_ALL &
|
||||
~COGL_FRAMEBUFFER_STATE_CLIP));
|
||||
|
||||
_cogl_bind_gl_texture_transient (GL_TEXTURE_2D,
|
||||
_cogl_bind_gl_texture_transient (ctx, GL_TEXTURE_2D,
|
||||
tex_2d->gl_texture);
|
||||
|
||||
ctx->glCopyTexSubImage2D (GL_TEXTURE_2D,
|
||||
|
@ -645,7 +646,7 @@ _cogl_texture_2d_gl_get_data (CoglTexture2D *tex_2d,
|
|||
width,
|
||||
bpp);
|
||||
|
||||
_cogl_bind_gl_texture_transient (tex_2d->gl_target,
|
||||
_cogl_bind_gl_texture_transient (ctx, tex_2d->gl_target,
|
||||
tex_2d->gl_texture);
|
||||
|
||||
ctx->texture_driver->gl_get_tex_image (ctx,
|
||||
|
|
|
@ -122,7 +122,7 @@ cogl_texture_gl_set_max_level (CoglTexture *texture,
|
|||
|
||||
cogl_texture_set_max_level_set (texture, max_level);
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target,
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target,
|
||||
gl_handle);
|
||||
|
||||
GE( ctx, glTexParameteri (gl_target,
|
||||
|
@ -143,7 +143,7 @@ _cogl_texture_gl_generate_mipmaps (CoglTexture *texture)
|
|||
|
||||
cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target);
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target,
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target,
|
||||
gl_handle);
|
||||
GE( ctx, glGenerateMipmap (gl_target) );
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ _cogl_texture_driver_gen (CoglContext *ctx,
|
|||
|
||||
GE (ctx, glGenTextures (1, &tex));
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target, tex);
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target, tex);
|
||||
|
||||
switch (gl_target)
|
||||
{
|
||||
|
@ -213,7 +213,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
|
|||
src_y,
|
||||
bpp);
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target, gl_handle);
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target, gl_handle);
|
||||
|
||||
/* Clear any GL errors */
|
||||
_cogl_gl_util_clear_gl_errors (ctx);
|
||||
|
@ -320,7 +320,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx,
|
|||
cogl_bitmap_get_rowstride (source_bmp),
|
||||
0, 0, 0, bpp);
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target, gl_handle);
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target, gl_handle);
|
||||
|
||||
/* Clear any GL errors */
|
||||
_cogl_gl_util_clear_gl_errors (ctx);
|
||||
|
|
|
@ -79,7 +79,7 @@ _cogl_texture_driver_gen (CoglContext *ctx,
|
|||
|
||||
GE (ctx, glGenTextures (1, &tex));
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target, tex);
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target, tex);
|
||||
|
||||
switch (gl_target)
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target, gl_handle);
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target, gl_handle);
|
||||
|
||||
/* Clear any GL errors */
|
||||
_cogl_gl_util_clear_gl_errors (ctx);
|
||||
|
@ -369,7 +369,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx,
|
|||
/* Setup gl alignment to match rowstride and top-left corner */
|
||||
_cogl_texture_driver_prep_gl_for_pixels_upload (ctx, rowstride, bpp);
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target, gl_handle);
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target, gl_handle);
|
||||
|
||||
data = _cogl_bitmap_gl_bind (bmp,
|
||||
COGL_BUFFER_ACCESS_READ,
|
||||
|
|
|
@ -1329,7 +1329,7 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap,
|
|||
|
||||
COGL_NOTE (TEXTURE_PIXMAP, "Rebinding GLXPixmap for %p", tex_pixmap);
|
||||
|
||||
_cogl_bind_gl_texture_transient (gl_target, gl_handle);
|
||||
_cogl_bind_gl_texture_transient (ctx, gl_target, gl_handle);
|
||||
|
||||
if (texture_info->pixmap_bound)
|
||||
glx_renderer->glXReleaseTexImage (xlib_renderer->xdpy,
|
||||
|
|
Loading…
Reference in a new issue