1
0
Fork 0
mutter-performance-source/cogl/cogl-pipeline-progend-glsl-private.h
Robert Bragg 7283e0a49c rework enabling of attributes, removing _cogl_enable()
This removes the limited caching of enabled attributes done by
_cogl_enable() and replaces it with a more generalized set of bitmasks
associated with the context that allow us to efficiently compare the set
of attribute locations that are currently enabled vs the new locations
that need enabling so we only have to inform OpenGL of the changes in
which locations are enabled/disabled.

This also adds a per-context hash table for mapping attribute names to
global name-state structs which includes a unique name-index for any
name as well as pre-validated information about builtin "cogl_"
attribute names including whether the attribute is normalized and what
texture unit a texture attribute corresponds too.

The name-state hash table means that cogl_attribute_new() now only needs
to validate names the first time they are seen.

CoglAttributes now reference a name-state structure instead of just the
attribute name, so now we can efficiently get the name-index for any
attribute and we can use that to index into a per-glsl-program cache
that maps name indices to real GL attribute locations so when we get
asked to draw a set of attributes we can very quickly determine what GL
attributes need to be setup and enabled. If we don't have a cached
location though we can still quickly access the string name so we can
query OpenGL.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-12-06 18:51:57 +00:00

41 lines
1.3 KiB
C

/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2010 Intel Corporation.
*
* 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
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
*
* Authors:
* Neil Roberts <neil@linux.intel.com>
*/
#ifndef __COGL_PIPELINE_PROGEND_GLSL_PRIVATE_H
#define __COGL_PIPELINE_PROGEND_GLSL_PRIVATE_H
#include "cogl-pipeline-private.h"
#include "cogl-attribute-private.h"
extern const CoglPipelineProgend _cogl_pipeline_glsl_progend;
int
_cogl_pipeline_progend_glsl_get_attrib_location (CoglPipeline *pipeline,
int name_index);
#endif /* __COGL_PIPELINE_PROGEND_GLSL_PRIVATE_H */