diff options
author | Neil Roberts <neil@linux.intel.com> | 2012-02-09 12:52:45 +0000 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2012-02-13 17:09:34 +0000 |
commit | b96e6900f5865684a01cff85b46de089b89d8448 (patch) | |
tree | 2a9c9a41cd33f453ed0cf816ac329e53d813c936 /cogl/cogl-pipeline-layer.c | |
parent | 8012eee31f01011d4b6572d924d7a979470c4afe (diff) | |
download | cogl-b96e6900f5865684a01cff85b46de089b89d8448.tar.gz |
cogl-pipeline-layer: Use CoglTextureType instead of GL target enum
Instead of storing the GLenum for the target of the last used texture
for a layer it now stores the CoglTextureType instead. The state name
has been renamed to 'texture type' instead of 'texture target'.
Previously the default pipeline layer would store 0 here to represent
that there is no texture. This has been changed to store
COGL_TEXTURE_TYPE_2D instead which means that all pipeline layers
always have a valid value for the texture type. Any places that were
previously fetching the texture from a layer to determine the target
(for example when generating shaders or when enabling a particular
texture target) now use the texture type instead. This means they will
work even for layers that don't have a texture.
This also changes it so that when binding a fallback texture instead
of always using a 2D texture it will now use the default texture
corresponding to the texture type of the layer. That way when the
generated shader tries to do a texture lookup for that type of texture
it will get a valid texture object. To make this work the patch adds a
default texture for 3D textures to the context and also makes the
default rectangle texture actually be a rectangle texture instead of
using a 2D texture.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-pipeline-layer.c')
-rw-r--r-- | cogl/cogl-pipeline-layer.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cogl/cogl-pipeline-layer.c b/cogl/cogl-pipeline-layer.c index d2d799d5..558a8b61 100644 --- a/cogl/cogl-pipeline-layer.c +++ b/cogl/cogl-pipeline-layer.c @@ -165,7 +165,7 @@ _cogl_pipeline_layer_init_multi_property_sparse_state ( /* XXX: avoid using a default: label so we get a warning if we * don't explicitly handle a newly defined state-group here. */ case COGL_PIPELINE_LAYER_STATE_UNIT: - case COGL_PIPELINE_LAYER_STATE_TEXTURE_TARGET: + case COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE: case COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA: case COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS: case COGL_PIPELINE_LAYER_STATE_USER_MATRIX: @@ -544,13 +544,13 @@ _cogl_pipeline_layer_equal (CoglPipelineLayer *layer0, layers_difference, authorities1); - if (layers_difference & COGL_PIPELINE_LAYER_STATE_TEXTURE_TARGET) + if (layers_difference & COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE) { CoglPipelineLayerStateIndex state_index = - COGL_PIPELINE_LAYER_STATE_TEXTURE_TARGET_INDEX; - if (!_cogl_pipeline_layer_texture_target_equal (authorities0[state_index], - authorities1[state_index], - flags)) + COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE_INDEX; + if (!_cogl_pipeline_layer_texture_type_equal (authorities0[state_index], + authorities1[state_index], + flags)) return FALSE; } @@ -655,7 +655,7 @@ _cogl_pipeline_init_default_layers (void) layer->unit_index = 0; layer->texture = NULL; - layer->target = 0; + layer->texture_type = COGL_TEXTURE_TYPE_2D; layer->mag_filter = COGL_PIPELINE_FILTER_LINEAR; layer->min_filter = COGL_PIPELINE_FILTER_LINEAR; |