cogl: Port Program away from CoglObject

This also switches from using CoglHandle to CoglProgram where
appropriate
which allowed dropping a duplicated function that had the wrong
signature...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
This commit is contained in:
Bilal Elmoussaoui 2023-08-18 11:47:23 +02:00 committed by Marge Bot
parent 3aaae11d6b
commit bbdc0b42fc
16 changed files with 176 additions and 160 deletions

View File

@ -135,7 +135,7 @@ struct _ClutterShaderEffectPrivate
ClutterShaderType shader_type;
CoglHandle program;
CoglProgram *program;
CoglShader *shader;
GHashTable *uniforms;
@ -147,7 +147,7 @@ typedef struct _ClutterShaderEffectClassPrivate
used when the class implements get_static_shader_source without
calling set_shader_source. They will be shared by all instances
of this class */
CoglHandle program;
CoglProgram *program;
CoglShader *shader;
} ClutterShaderEffectClassPrivate;
@ -184,7 +184,7 @@ clutter_shader_effect_clear (ClutterShaderEffect *self,
if (priv->program != NULL)
{
cogl_object_unref (priv->program);
g_object_unref (priv->program);
priv->program = NULL;
}
@ -364,7 +364,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
priv->shader = g_object_ref (class_priv->shader);
if (class_priv->program != NULL)
priv->program = cogl_object_ref (class_priv->program);
priv->program = g_object_ref (class_priv->program);
}
}
@ -524,7 +524,7 @@ clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
* Return value: (transfer none): a pointer to the program's handle,
* or %NULL
*/
CoglHandle
CoglProgram*
clutter_shader_effect_get_program (ClutterShaderEffect *effect)
{
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),

View File

@ -95,6 +95,6 @@ void clutter_shader_effect_set_uniform_value (ClutterShaderEffect *ef
CLUTTER_EXPORT
CoglShader* clutter_shader_effect_get_shader (ClutterShaderEffect *effect);
CLUTTER_EXPORT
CoglHandle clutter_shader_effect_get_program (ClutterShaderEffect *effect);
CoglProgram* clutter_shader_effect_get_program (ClutterShaderEffect *effect);
G_END_DECLS

View File

@ -214,7 +214,7 @@ typedef struct
{
CoglPipelineAlphaFuncState alpha_state;
CoglPipelineBlendState blend_state;
CoglHandle user_program;
CoglProgram *user_program;
CoglDepthState depth_state;
float point_size;
unsigned int non_zero_point_size : 1;

View File

@ -33,9 +33,6 @@
#pragma once
CoglPipeline *
_cogl_pipeline_get_user_program (CoglPipeline *pipeline);
gboolean
_cogl_pipeline_has_vertex_snippets (CoglPipeline *pipeline);

View File

@ -47,19 +47,6 @@
#define GL_FUNC_ADD 0x8006
#endif
CoglPipeline *
_cogl_pipeline_get_user_program (CoglPipeline *pipeline)
{
CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER);
return authority->big_state->user_program;
}
gboolean
_cogl_pipeline_color_equal (CoglPipeline *authority0,
CoglPipeline *authority1)
@ -707,7 +694,7 @@ cogl_pipeline_set_blend_constant (CoglPipeline *pipeline,
pipeline->dirty_real_blend_enable = TRUE;
}
CoglHandle
CoglProgram*
cogl_pipeline_get_user_program (CoglPipeline *pipeline)
{
CoglPipeline *authority;
@ -728,7 +715,7 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline)
*/
void
cogl_pipeline_set_user_program (CoglPipeline *pipeline,
CoglHandle program)
CoglProgram *program)
{
CoglPipelineState state = COGL_PIPELINE_STATE_USER_SHADER;
CoglPipeline *authority;
@ -770,10 +757,10 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
}
if (program != NULL)
cogl_object_ref (program);
g_object_ref (program);
if (authority == pipeline &&
pipeline->big_state->user_program != NULL)
cogl_object_unref (pipeline->big_state->user_program);
g_object_unref (pipeline->big_state->user_program);
pipeline->big_state->user_program = program;
pipeline->dirty_real_blend_enable = TRUE;
@ -1359,7 +1346,7 @@ void
_cogl_pipeline_hash_user_shader_state (CoglPipeline *authority,
CoglPipelineHashState *state)
{
CoglHandle user_program = authority->big_state->user_program;
CoglProgram *user_program = authority->big_state->user_program;
state->hash = _cogl_util_one_at_a_time_hash (state->hash, &user_program,
sizeof (user_program));
}

View File

@ -37,6 +37,7 @@
#include "cogl/cogl-pipeline.h"
#include "cogl/cogl-color.h"
#include "cogl/cogl-depth-state.h"
#include "cogl/deprecated/cogl-program.h"
G_BEGIN_DECLS
@ -352,13 +353,13 @@ cogl_pipeline_get_per_vertex_point_size (CoglPipeline *pipeline);
*
* Return value: (transfer none): The current user program or %NULL.
*/
COGL_EXPORT CoglHandle
COGL_EXPORT CoglProgram*
cogl_pipeline_get_user_program (CoglPipeline *pipeline);
/**
* cogl_pipeline_set_user_program:
* @pipeline: a #CoglPipeline object.
* @program: A #CoglHandle to a linked CoglProgram
* @program: A linked CoglProgram
*
* Associates a linked CoglProgram with the given pipeline so that the
* program can take full control of vertex and/or fragment processing.
@ -367,7 +368,7 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline);
* program with a #CoglPipeline:
* |[
* CoglShader *shader;
* CoglHandle program;
* CoglProgram *program;
* CoglPipeline *pipeline;
*
* shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
@ -396,7 +397,7 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline);
*/
COGL_EXPORT void
cogl_pipeline_set_user_program (CoglPipeline *pipeline,
CoglHandle program);
CoglProgram *program);
/**
* cogl_pipeline_set_depth_state: (skip)

View File

@ -363,7 +363,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
if (pipeline->differences & COGL_PIPELINE_STATE_USER_SHADER &&
pipeline->big_state->user_program)
cogl_object_unref (pipeline->big_state->user_program);
g_object_unref (pipeline->big_state->user_program);
if (pipeline->differences & COGL_PIPELINE_STATE_UNIFORMS)
{
@ -675,7 +675,7 @@ _cogl_pipeline_change_implies_transparency (CoglPipeline *pipeline,
*
* TODO: check that it isn't just a vertex shader!
*/
if (_cogl_pipeline_get_user_program (pipeline) != NULL)
if (cogl_pipeline_get_user_program (pipeline) != NULL)
return TRUE;
}
@ -862,7 +862,7 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
{
if (src->big_state->user_program)
big_state->user_program =
cogl_object_ref (src->big_state->user_program);
g_object_ref (src->big_state->user_program);
else
big_state->user_program = NULL;
}

View File

@ -30,14 +30,13 @@
#pragma once
#include "cogl/cogl-object-private.h"
#include "cogl/deprecated/cogl-shader-private.h"
#include "cogl/cogl-boxed-value.h"
typedef struct _CoglProgram CoglProgram;
struct _CoglProgram
{
CoglObject _parent;
GObject parent_instance;
GSList *attached_shaders;
@ -47,6 +46,7 @@ struct _CoglProgram
unsigned int age;
};
typedef struct _CoglProgramUniform CoglProgramUniform;
struct _CoglProgramUniform
@ -76,7 +76,7 @@ _cogl_program_flush_uniforms (CoglProgram *program,
gboolean gl_program_changed);
gboolean
_cogl_program_has_fragment_shader (CoglHandle handle);
_cogl_program_has_fragment_shader (CoglProgram *self);
gboolean
_cogl_program_has_vertex_shader (CoglHandle handle);
_cogl_program_has_vertex_shader (CoglProgram *self);

View File

@ -32,27 +32,18 @@
#include "cogl/cogl-util.h"
#include "cogl/cogl-context-private.h"
#include "cogl/cogl-object-private.h"
#include "cogl/deprecated/cogl-shader-private.h"
#include "cogl/deprecated/cogl-program-private.h"
#include <string.h>
static void _cogl_program_free (CoglProgram *program);
COGL_HANDLE_DEFINE (Program, program);
/* A CoglProgram is effectively just a list of shaders that will be
used together and a set of values for the custom uniforms. No
actual GL program is created - instead this is the responsibility
of the GLSL material backend. The uniform values are collected in
an array and then flushed whenever the material backend requests
it. */
G_DEFINE_TYPE (CoglProgram, cogl_program, G_TYPE_OBJECT);
static void
_cogl_program_free (CoglProgram *program)
cogl_program_dispose (GObject *object)
{
CoglProgram *program = COGL_PROGRAM (object);
int i;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
@ -73,36 +64,52 @@ _cogl_program_free (CoglProgram *program)
g_array_free (program->custom_uniforms, TRUE);
g_free (program);
G_OBJECT_CLASS (cogl_program_parent_class)->dispose (object);
}
CoglHandle
static void
cogl_program_init (CoglProgram *program)
{
}
static void
cogl_program_class_init (CoglProgramClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->dispose = cogl_program_dispose;
}
/* A CoglProgram is effectively just a list of shaders that will be
used together and a set of values for the custom uniforms. No
actual GL program is created - instead this is the responsibility
of the GLSL material backend. The uniform values are collected in
an array and then flushed whenever the material backend requests
it. */
CoglProgram*
cogl_create_program (void)
{
CoglProgram *program;
program = g_new0 (CoglProgram, 1);
program = g_object_new (COGL_TYPE_PROGRAM, NULL);
program->custom_uniforms =
g_array_new (FALSE, FALSE, sizeof (CoglProgramUniform));
program->age = 0;
return _cogl_program_handle_new (program);
return program;
}
void
cogl_program_attach_shader (CoglHandle program_handle,
CoglShader *shader)
cogl_program_attach_shader (CoglProgram *program,
CoglShader *shader)
{
CoglProgram *program;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (!cogl_is_program (program_handle) || !COGL_IS_SHADER (shader))
if (!COGL_IS_PROGRAM (program) || !COGL_IS_SHADER (shader))
return;
program = program_handle;
program->attached_shaders
= g_slist_prepend (program->attached_shaders,
g_object_ref (shader));
@ -111,7 +118,7 @@ cogl_program_attach_shader (CoglHandle program_handle,
}
void
cogl_program_link (CoglHandle handle)
cogl_program_link (CoglProgram *program)
{
/* There's no point in linking the program here because it will have
to be relinked with a different fixed functionality shader
@ -119,18 +126,14 @@ cogl_program_link (CoglHandle handle)
}
int
cogl_program_get_uniform_location (CoglHandle handle,
const char *uniform_name)
cogl_program_get_uniform_location (CoglProgram *program,
const char *uniform_name)
{
g_return_val_if_fail (COGL_IS_PROGRAM (program), -1);
int i;
CoglProgram *program;
CoglProgramUniform *uniform;
if (!cogl_is_program (handle))
return -1;
program = handle;
/* We can't just ask the GL program object for the uniform location
directly because it will change every time the program is linked
with a different shader. Instead we make our own mapping of
@ -165,7 +168,7 @@ cogl_program_modify_uniform (CoglProgram *program,
{
CoglProgramUniform *uniform;
g_return_val_if_fail (cogl_is_program (program), NULL);
g_return_val_if_fail (COGL_IS_PROGRAM (program), NULL);
g_return_val_if_fail (uniform_no >= 0 &&
uniform_no < program->custom_uniforms->len,
NULL);
@ -178,64 +181,64 @@ cogl_program_modify_uniform (CoglProgram *program,
}
void
cogl_program_set_uniform_1f (CoglHandle handle,
int uniform_location,
float value)
cogl_program_set_uniform_1f (CoglProgram *program,
int uniform_location,
float value)
{
CoglProgramUniform *uniform;
uniform = cogl_program_modify_uniform (handle, uniform_location);
uniform = cogl_program_modify_uniform (program, uniform_location);
_cogl_boxed_value_set_1f (&uniform->value, value);
}
void
cogl_program_set_uniform_1i (CoglHandle handle,
int uniform_location,
int value)
cogl_program_set_uniform_1i (CoglProgram *program,
int uniform_location,
int value)
{
CoglProgramUniform *uniform;
uniform = cogl_program_modify_uniform (handle, uniform_location);
uniform = cogl_program_modify_uniform (program, uniform_location);
_cogl_boxed_value_set_1i (&uniform->value, value);
}
void
cogl_program_set_uniform_float (CoglHandle handle,
int uniform_location,
int n_components,
int count,
cogl_program_set_uniform_float (CoglProgram *program,
int uniform_location,
int n_components,
int count,
const float *value)
{
CoglProgramUniform *uniform;
uniform = cogl_program_modify_uniform (handle, uniform_location);
uniform = cogl_program_modify_uniform (program, uniform_location);
_cogl_boxed_value_set_float (&uniform->value, n_components, count, value);
}
void
cogl_program_set_uniform_int (CoglHandle handle,
int uniform_location,
int n_components,
int count,
const int *value)
cogl_program_set_uniform_int (CoglProgram *program,
int uniform_location,
int n_components,
int count,
const int *value)
{
CoglProgramUniform *uniform;
uniform = cogl_program_modify_uniform (handle, uniform_location);
uniform = cogl_program_modify_uniform (program, uniform_location);
_cogl_boxed_value_set_int (&uniform->value, n_components, count, value);
}
void
cogl_program_set_uniform_matrix (CoglHandle handle,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
cogl_program_set_uniform_matrix (CoglProgram *program,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value)
{
CoglProgramUniform *uniform;
uniform = cogl_program_modify_uniform (handle, uniform_location);
uniform = cogl_program_modify_uniform (program, uniform_location);
_cogl_boxed_value_set_matrix (&uniform->value,
dimensions,
count,
@ -245,8 +248,8 @@ cogl_program_set_uniform_matrix (CoglHandle handle,
void
_cogl_program_flush_uniforms (CoglProgram *program,
GLuint gl_program,
gboolean gl_program_changed)
GLuint gl_program,
gboolean gl_program_changed)
{
CoglProgramUniform *uniform;
int i;
@ -300,13 +303,13 @@ _cogl_program_has_shader_type (CoglProgram *program,
}
gboolean
_cogl_program_has_fragment_shader (CoglHandle handle)
_cogl_program_has_fragment_shader (CoglProgram *program)
{
return _cogl_program_has_shader_type (handle, COGL_SHADER_TYPE_FRAGMENT);
return _cogl_program_has_shader_type (program, COGL_SHADER_TYPE_FRAGMENT);
}
gboolean
_cogl_program_has_vertex_shader (CoglHandle handle)
_cogl_program_has_vertex_shader (CoglProgram *program)
{
return _cogl_program_has_shader_type (handle, COGL_SHADER_TYPE_VERTEX);
return _cogl_program_has_shader_type (program, COGL_SHADER_TYPE_VERTEX);
}

View File

@ -0,0 +1,40 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2008,2009 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#pragma once
#define COGL_TYPE_PROGRAM (cogl_program_get_type ())
COGL_EXPORT
G_DECLARE_FINAL_TYPE (CoglProgram,
cogl_program,
COGL,
PROGRAM,
GObject)

View File

@ -37,6 +37,7 @@
#include "cogl/cogl-types.h"
#include "cogl/cogl-defines.h"
#include "cogl/cogl-macros.h"
#include "cogl/deprecated/cogl-program.h"
G_BEGIN_DECLS
@ -294,31 +295,16 @@ cogl_shader_get_shader_type (CoglShader *self);
* Create a new cogl program object that can be used to replace parts of the GL
* rendering pipeline with custom code.
*
* Returns: a new cogl program.
* Returns: (transfer full): a new cogl program.
* Deprecated: 1.16: Use #CoglSnippet api
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT CoglHandle
COGL_EXPORT CoglProgram*
cogl_create_program (void);
/**
* cogl_is_program:
* @handle: A CoglHandle
*
* Gets whether the given handle references an existing program object.
*
* Returns: %TRUE if the handle references a program,
* %FALSE otherwise
*
* Deprecated: 1.16: Use #CoglSnippet api
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT gboolean
cogl_is_program (CoglHandle handle);
/**
* cogl_program_attach_shader:
* @program_handle: a #CoglHandle for a shdaer program.
* @program: a #CoglProgram for a shader program.
* @shader: a #CoglShader for a vertex of fragment shader.
*
* Attaches a shader to a program object. A program can have multiple
@ -330,12 +316,12 @@ cogl_is_program (CoglHandle handle);
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT void
cogl_program_attach_shader (CoglHandle program_handle,
CoglShader *shader);
cogl_program_attach_shader (CoglProgram *program,
CoglShader *shader);
/**
* cogl_program_link:
* @handle: a #CoglHandle for a shader program.
* @program: A shader program.
*
* Links a program making it ready for use. Note that calling this
* function is optional. If it is not called the program will
@ -345,11 +331,11 @@ cogl_program_attach_shader (CoglHandle program_handle,
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT void
cogl_program_link (CoglHandle handle);
cogl_program_link (CoglProgram *program);
/**
* cogl_program_get_uniform_location:
* @handle: a #CoglHandle for a shader program.
* @program: A shader program.
* @uniform_name: the name of a uniform.
*
* Retrieve the location (offset) of a uniform variable in a shader program,
@ -361,12 +347,12 @@ cogl_program_link (CoglHandle handle);
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT int
cogl_program_get_uniform_location (CoglHandle handle,
const char *uniform_name);
cogl_program_get_uniform_location (CoglProgram *program,
const char *uniform_name);
/**
* cogl_program_set_uniform_1f:
* @program: A #CoglHandle for a linked program
* @program: A linked program
* @uniform_location: the uniform location retrieved from
* cogl_program_get_uniform_location().
* @value: the new value of the uniform.
@ -377,13 +363,13 @@ cogl_program_get_uniform_location (CoglHandle handle,
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT void
cogl_program_set_uniform_1f (CoglHandle program,
int uniform_location,
float value);
cogl_program_set_uniform_1f (CoglProgram *program,
int uniform_location,
float value);
/**
* cogl_program_set_uniform_1i:
* @program: A #CoglHandle for a linked program
* @program: A linked program
* @uniform_location: the uniform location retrieved from
* cogl_program_get_uniform_location().
* @value: the new value of the uniform.
@ -394,13 +380,13 @@ cogl_program_set_uniform_1f (CoglHandle program,
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT void
cogl_program_set_uniform_1i (CoglHandle program,
int uniform_location,
int value);
cogl_program_set_uniform_1i (CoglProgram *program,
int uniform_location,
int value);
/**
* cogl_program_set_uniform_float:
* @program: A #CoglHandle for a linked program
* @program: A linked program
* @uniform_location: the uniform location retrieved from
* cogl_program_get_uniform_location().
* @n_components: The number of components for the uniform. For
@ -415,15 +401,15 @@ cogl_program_set_uniform_1i (CoglHandle program,
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT void
cogl_program_set_uniform_float (CoglHandle program,
int uniform_location,
int n_components,
int count,
cogl_program_set_uniform_float (CoglProgram *program,
int uniform_location,
int n_components,
int count,
const float *value);
/**
* cogl_program_set_uniform_int:
* @program: A #CoglHandle for a linked program
* @program: A linked program
* @uniform_location: the uniform location retrieved from
* cogl_program_get_uniform_location().
* @n_components: The number of components for the uniform. For
@ -438,15 +424,15 @@ cogl_program_set_uniform_float (CoglHandle program,
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT void
cogl_program_set_uniform_int (CoglHandle program,
int uniform_location,
int n_components,
int count,
const int *value);
cogl_program_set_uniform_int (CoglProgram *program,
int uniform_location,
int n_components,
int count,
const int *value);
/**
* cogl_program_set_uniform_matrix:
* @program: A #CoglHandle for a linked program
* @program: A linked program
* @uniform_location: the uniform location retrieved from
* cogl_program_get_uniform_location().
* @dimensions: The dimensions of the matrix. So for for example pass
@ -462,11 +448,11 @@ cogl_program_set_uniform_int (CoglHandle program,
*/
COGL_DEPRECATED_FOR (cogl_snippet_)
COGL_EXPORT void
cogl_program_set_uniform_matrix (CoglHandle program,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
cogl_program_set_uniform_matrix (CoglProgram *program,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
G_END_DECLS

View File

@ -52,6 +52,7 @@
#include "cogl/driver/gl/cogl-pipeline-vertend-glsl-private.h"
#include "cogl/driver/gl/cogl-pipeline-progend-glsl-private.h"
#include "deprecated/cogl-program-private.h"
#include "deprecated/cogl-shader-private.h"
/* These are used to generalise updating some uniforms that are
required when building for drivers missing some fixed function

View File

@ -58,6 +58,7 @@ cogl_egl_defines_h = configure_file(
)
cogl_deprecated_headers = [
'deprecated/cogl-program.h',
'deprecated/cogl-shader.h',
'deprecated/cogl-clutter.h',
'deprecated/cogl-type-casts.h',

View File

@ -188,7 +188,7 @@ static void
set_shader_num (int new_no)
{
CoglShader *shader;
CoglHandle program;
CoglProgram *program;
CoglPipeline *pipeline;
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
@ -225,7 +225,7 @@ set_shader_num (int new_no)
cogl_program_set_uniform_1f (program, uniform_no, 1.0f / image_height);
cogl_pipeline_set_user_program (pipeline, program);
cogl_object_unref (program);
g_object_unref (program);
shader_no = new_no;
}

View File

@ -32,7 +32,7 @@ paint (TestState *state)
CoglColor color;
GError *error = NULL;
CoglShader *shader;
CoglHandle program;
CoglProgram *program;
cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
cogl_framebuffer_clear (test_fb, COGL_BUFFER_BIT_COLOR, &color);
@ -80,7 +80,7 @@ paint (TestState *state)
/* Draw it again using the program. It should look exactly the same */
cogl_pipeline_set_user_program (pipeline, program);
cogl_object_unref (program);
g_object_unref (program);
cogl_framebuffer_draw_rectangle (test_fb, pipeline,
50, 0, 100, 50);

View File

@ -88,7 +88,7 @@ create_pipeline_for_shader (TestState *state, const char *shader_source)
{
CoglPipeline *pipeline;
CoglShader *shader;
CoglHandle program;
CoglProgram *program;
pipeline = cogl_pipeline_new (test_ctx);
@ -101,7 +101,7 @@ create_pipeline_for_shader (TestState *state, const char *shader_source)
cogl_pipeline_set_user_program (pipeline, program);
g_object_unref (shader);
cogl_object_unref (program);
g_object_unref (program);
return pipeline;
}