2008-06-02 10:58:57 +00:00
|
|
|
/*
|
2009-04-27 14:48:12 +00:00
|
|
|
* Cogl
|
2008-06-02 10:58:57 +00:00
|
|
|
*
|
2009-04-27 14:48:12 +00:00
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
2008-06-02 10:58:57 +00:00
|
|
|
*
|
2009-04-27 14:48:12 +00:00
|
|
|
* Copyright (C) 2008,2009 Intel Corporation.
|
2008-06-02 10:58:57 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-01 12:56:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2008-06-02 10:58:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "cogl.h"
|
|
|
|
|
|
|
|
#include "cogl-internal.h"
|
|
|
|
#include "cogl-context.h"
|
|
|
|
#include "cogl-handle.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_COGL_GLES2
|
|
|
|
|
2008-06-24 16:21:40 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2008-10-30 17:25:00 +00:00
|
|
|
#include "cogl-shader-private.h"
|
2008-06-02 10:58:57 +00:00
|
|
|
#include "cogl-program.h"
|
|
|
|
|
|
|
|
static void _cogl_program_free (CoglProgram *program);
|
|
|
|
|
2009-04-01 16:16:44 +00:00
|
|
|
COGL_HANDLE_DEFINE (Program, program);
|
2010-07-09 18:09:49 +00:00
|
|
|
COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (program);
|
2008-06-02 10:58:57 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
_cogl_program_free (CoglProgram *program)
|
|
|
|
{
|
2008-06-24 16:21:40 +00:00
|
|
|
int i;
|
|
|
|
|
2008-06-02 10:58:57 +00:00
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
2008-06-24 16:21:40 +00:00
|
|
|
|
|
|
|
/* Unref all of the attached shaders */
|
2009-04-01 16:16:44 +00:00
|
|
|
g_slist_foreach (program->attached_shaders, (GFunc) cogl_handle_unref, NULL);
|
2008-06-24 16:21:40 +00:00
|
|
|
/* Destroy the list */
|
|
|
|
g_slist_free (program->attached_shaders);
|
|
|
|
|
|
|
|
_cogl_gles2_clear_cache_for_program ((CoglHandle) program);
|
|
|
|
|
2009-07-28 00:34:33 +00:00
|
|
|
if (ctx->drv.gles2.settings.user_program == (CoglHandle) program)
|
2008-06-24 16:21:40 +00:00
|
|
|
{
|
2009-07-28 00:34:33 +00:00
|
|
|
ctx->drv.gles2.settings.user_program = COGL_INVALID_HANDLE;
|
|
|
|
ctx->drv.gles2.settings_dirty = TRUE;
|
2008-06-24 16:21:40 +00:00
|
|
|
}
|
|
|
|
|
2010-06-08 22:06:50 +00:00
|
|
|
for (i = 0; i < COGL_PROGRAM_NUM_CUSTOM_UNIFORMS; i++)
|
|
|
|
{
|
|
|
|
if (program->custom_uniform_names[i])
|
|
|
|
g_free (program->custom_uniform_names[i]);
|
|
|
|
if (program->custom_uniforms[i].count > 1)
|
|
|
|
g_free (program->custom_uniforms[i].v.array);
|
|
|
|
}
|
2010-07-22 15:58:23 +00:00
|
|
|
|
|
|
|
g_slice_free (CoglProgram, program);
|
2008-06-02 10:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CoglHandle
|
|
|
|
cogl_create_program (void)
|
|
|
|
{
|
|
|
|
CoglProgram *program;
|
|
|
|
|
2010-06-08 22:06:50 +00:00
|
|
|
program = g_slice_new0 (CoglProgram);
|
2008-06-02 10:58:57 +00:00
|
|
|
|
|
|
|
return _cogl_program_handle_new (program);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_program_attach_shader (CoglHandle program_handle,
|
|
|
|
CoglHandle shader_handle)
|
|
|
|
{
|
|
|
|
CoglProgram *program;
|
|
|
|
|
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
2009-04-27 14:48:12 +00:00
|
|
|
|
2008-06-02 10:58:57 +00:00
|
|
|
if (!cogl_is_program (program_handle) || !cogl_is_shader (shader_handle))
|
|
|
|
return;
|
|
|
|
|
|
|
|
program = _cogl_program_pointer_from_handle (program_handle);
|
2008-06-24 16:21:40 +00:00
|
|
|
program->attached_shaders
|
|
|
|
= g_slist_prepend (program->attached_shaders,
|
2009-04-01 16:16:44 +00:00
|
|
|
cogl_handle_ref (shader_handle));
|
2008-06-02 10:58:57 +00:00
|
|
|
|
2008-06-24 16:21:40 +00:00
|
|
|
/* Whenever the shader changes we will need to relink the program
|
|
|
|
with the fixed functionality shaders so we should forget the
|
|
|
|
cached programs */
|
|
|
|
_cogl_gles2_clear_cache_for_program (program);
|
2008-06-02 10:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_program_link (CoglHandle handle)
|
|
|
|
{
|
2008-06-24 16:21:40 +00:00
|
|
|
/* There's no point in linking the program here because it will have
|
|
|
|
to be relinked with a different fixed functionality shader
|
|
|
|
whenever the settings change */
|
2008-06-02 10:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_program_use (CoglHandle handle)
|
|
|
|
{
|
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
2009-04-27 14:48:12 +00:00
|
|
|
|
2010-04-26 09:01:43 +00:00
|
|
|
g_return_if_fail (handle == COGL_INVALID_HANDLE ||
|
|
|
|
cogl_is_program (handle));
|
|
|
|
|
|
|
|
if (ctx->current_program == 0 && handle != 0)
|
|
|
|
ctx->legacy_state_set++;
|
|
|
|
else if (handle == 0 && ctx->current_program != 0)
|
|
|
|
ctx->legacy_state_set--;
|
2008-06-02 10:58:57 +00:00
|
|
|
|
2010-04-26 09:01:43 +00:00
|
|
|
if (handle != COGL_INVALID_HANDLE)
|
|
|
|
cogl_handle_ref (handle);
|
|
|
|
if (ctx->current_program != COGL_INVALID_HANDLE)
|
|
|
|
cogl_handle_unref (ctx->current_program);
|
|
|
|
ctx->current_program = handle;
|
2008-06-02 10:58:57 +00:00
|
|
|
}
|
|
|
|
|
2009-05-12 13:15:18 +00:00
|
|
|
int
|
2008-06-02 10:58:57 +00:00
|
|
|
cogl_program_get_uniform_location (CoglHandle handle,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
const char *uniform_name)
|
2008-06-02 10:58:57 +00:00
|
|
|
{
|
2008-06-24 16:21:40 +00:00
|
|
|
int i;
|
2008-06-02 10:58:57 +00:00
|
|
|
CoglProgram *program;
|
2008-06-24 16:21:40 +00:00
|
|
|
|
2008-06-02 10:58:57 +00:00
|
|
|
if (!cogl_is_program (handle))
|
2008-06-24 16:21:40 +00:00
|
|
|
return -1;
|
2008-06-02 10:58:57 +00:00
|
|
|
|
|
|
|
program = _cogl_program_pointer_from_handle (handle);
|
|
|
|
|
2008-06-24 16:21:40 +00:00
|
|
|
/* 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 new fixed functionality shader. Instead we make our own
|
|
|
|
mapping of uniform numbers and cache the names */
|
|
|
|
for (i = 0; program->custom_uniform_names[i]
|
2010-06-08 22:06:50 +00:00
|
|
|
&& i < COGL_PROGRAM_NUM_CUSTOM_UNIFORMS; i++)
|
2008-06-24 16:21:40 +00:00
|
|
|
if (!strcmp (program->custom_uniform_names[i], uniform_name))
|
|
|
|
return i;
|
|
|
|
|
2010-06-08 22:06:50 +00:00
|
|
|
if (i < COGL_PROGRAM_NUM_CUSTOM_UNIFORMS)
|
2008-06-24 16:21:40 +00:00
|
|
|
{
|
|
|
|
program->custom_uniform_names[i] = g_strdup (uniform_name);
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
/* We've run out of space for new uniform names so just pretend it
|
|
|
|
isn't there */
|
|
|
|
return -1;
|
2008-06-02 10:58:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_1f (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
float value)
|
2008-11-18 15:08:40 +00:00
|
|
|
{
|
|
|
|
cogl_program_uniform_float (uniform_no, 1, 1, &value);
|
|
|
|
}
|
|
|
|
|
2008-11-18 15:21:02 +00:00
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_1i (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
int value)
|
2008-11-18 15:21:02 +00:00
|
|
|
{
|
|
|
|
cogl_program_uniform_int (uniform_no, 1, 1, &value);
|
|
|
|
}
|
|
|
|
|
2008-11-18 15:08:40 +00:00
|
|
|
static void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_x (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
int size,
|
|
|
|
int count,
|
2008-11-18 15:08:40 +00:00
|
|
|
CoglBoxedType type,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
gsize value_size,
|
2008-11-18 15:08:40 +00:00
|
|
|
gconstpointer value)
|
2008-06-02 10:58:57 +00:00
|
|
|
{
|
2010-06-08 22:06:50 +00:00
|
|
|
CoglProgram *program;
|
|
|
|
|
2008-06-02 10:58:57 +00:00
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
2008-06-24 16:21:40 +00:00
|
|
|
|
2010-06-08 22:06:50 +00:00
|
|
|
program = ctx->current_program;
|
|
|
|
|
|
|
|
g_return_if_fail (program != NULL);
|
|
|
|
|
|
|
|
if (uniform_no >= 0 && uniform_no < COGL_PROGRAM_NUM_CUSTOM_UNIFORMS
|
2008-11-18 15:08:40 +00:00
|
|
|
&& size >= 1 && size <= 4 && count >= 1)
|
2008-06-24 16:21:40 +00:00
|
|
|
{
|
2010-06-08 22:06:50 +00:00
|
|
|
CoglBoxedValue *bv = program->custom_uniforms + uniform_no;
|
2008-11-18 15:08:40 +00:00
|
|
|
|
|
|
|
if (count == 1)
|
|
|
|
{
|
|
|
|
if (bv->count > 1)
|
|
|
|
g_free (bv->v.array);
|
|
|
|
|
|
|
|
memcpy (bv->v.float_value, value, value_size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bv->count > 1)
|
|
|
|
{
|
|
|
|
if (bv->count != count || bv->size != size || bv->type != type)
|
|
|
|
{
|
|
|
|
g_free (bv->v.array);
|
|
|
|
bv->v.array = g_malloc (count * value_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
bv->v.array = g_malloc (count * value_size);
|
|
|
|
|
|
|
|
memcpy (bv->v.array, value, count * value_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
bv->type = type;
|
|
|
|
bv->size = size;
|
|
|
|
bv->count = count;
|
|
|
|
|
2010-06-08 22:06:50 +00:00
|
|
|
program->dirty_custom_uniforms |= 1 << uniform_no;
|
2008-06-24 16:21:40 +00:00
|
|
|
}
|
2008-06-02 10:58:57 +00:00
|
|
|
}
|
|
|
|
|
2008-11-18 15:08:40 +00:00
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_float (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
int size,
|
|
|
|
int count,
|
2008-11-18 15:08:40 +00:00
|
|
|
const GLfloat *value)
|
|
|
|
{
|
|
|
|
cogl_program_uniform_x (uniform_no, size, count, COGL_BOXED_FLOAT,
|
|
|
|
sizeof (float) * size, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_int (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
int size,
|
|
|
|
int count,
|
2008-11-18 15:08:40 +00:00
|
|
|
const GLint *value)
|
|
|
|
{
|
|
|
|
cogl_program_uniform_x (uniform_no, size, count, COGL_BOXED_INT,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
sizeof (int) * size, value);
|
2008-11-18 15:08:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_matrix (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
int size,
|
|
|
|
int count,
|
2008-11-18 15:08:40 +00:00
|
|
|
gboolean transpose,
|
|
|
|
const GLfloat *value)
|
|
|
|
{
|
2010-06-08 22:06:50 +00:00
|
|
|
CoglProgram *program;
|
2008-11-18 15:08:40 +00:00
|
|
|
CoglBoxedValue *bv;
|
|
|
|
|
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
|
|
|
|
2010-06-08 22:06:50 +00:00
|
|
|
program = ctx->current_program;
|
|
|
|
|
|
|
|
g_return_if_fail (program != NULL);
|
|
|
|
|
|
|
|
bv = program->custom_uniforms + uniform_no;
|
2008-11-18 15:08:40 +00:00
|
|
|
|
|
|
|
cogl_program_uniform_x (uniform_no, size, count, COGL_BOXED_MATRIX,
|
|
|
|
sizeof (float) * size * size, value);
|
|
|
|
|
|
|
|
bv->transpose = transpose;
|
|
|
|
}
|
|
|
|
|
2008-06-02 10:58:57 +00:00
|
|
|
#else /* HAVE_COGL_GLES2 */
|
|
|
|
|
|
|
|
/* No support on regular OpenGL 1.1 */
|
|
|
|
|
|
|
|
CoglHandle
|
|
|
|
cogl_create_program (void)
|
|
|
|
{
|
|
|
|
return COGL_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
cogl_is_program (CoglHandle handle)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
CoglHandle
|
|
|
|
cogl_program_ref (CoglHandle handle)
|
|
|
|
{
|
|
|
|
return COGL_INVALID_HANDLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_program_unref (CoglHandle handle)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_program_attach_shader (CoglHandle program_handle,
|
|
|
|
CoglHandle shader_handle)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_program_link (CoglHandle program_handle)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_program_use (CoglHandle program_handle)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-05-12 13:15:18 +00:00
|
|
|
int
|
2008-06-02 10:58:57 +00:00
|
|
|
cogl_program_get_uniform_location (CoglHandle program_handle,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
const char *uniform_name)
|
2008-06-02 10:58:57 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_1f (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
float value)
|
2008-06-02 10:58:57 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-06-11 13:37:56 +00:00
|
|
|
void
|
|
|
|
cogl_program_uniform_1i (int uniform_no,
|
|
|
|
int value)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-11-18 15:08:40 +00:00
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_float (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
int size,
|
|
|
|
int count,
|
2008-11-18 15:08:40 +00:00
|
|
|
const GLfloat *value)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_int (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
int size,
|
|
|
|
int count,
|
2009-05-12 13:15:18 +00:00
|
|
|
const int *value)
|
2008-11-18 15:08:40 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-05-12 13:15:18 +00:00
|
|
|
cogl_program_uniform_matrix (int uniform_no,
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
int size,
|
|
|
|
int count,
|
2008-11-18 15:08:40 +00:00
|
|
|
gboolean transpose,
|
|
|
|
const GLfloat *value)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-02 10:58:57 +00:00
|
|
|
#endif /* HAVE_COGL_GLES2 */
|