mutter/cogl/cogl-pipeline-layer-state-private.h
Neil Roberts b96e6900f5 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>
2012-02-13 17:09:34 +00:00

145 lines
5.7 KiB
C

/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2011 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:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef __COGL_PIPELINE_LAYER_STATE_PRIVATE_H
#define __COGL_PIPELINE_LAYER_STATE_PRIVATE_H
#include "cogl-pipeline-layer-state.h"
#include "cogl-pipeline-private.h"
CoglPipelineLayer *
_cogl_pipeline_set_layer_unit (CoglPipeline *required_owner,
CoglPipelineLayer *layer,
int unit_index);
CoglPipelineFilter
_cogl_pipeline_get_layer_min_filter (CoglPipeline *pipeline,
int layer_index);
CoglPipelineFilter
_cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline,
int layer_index);
gboolean
_cogl_pipeline_layer_texture_type_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1,
CoglPipelineEvalFlags flags);
gboolean
_cogl_pipeline_layer_texture_data_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1,
CoglPipelineEvalFlags flags);
gboolean
_cogl_pipeline_layer_combine_state_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1);
gboolean
_cogl_pipeline_layer_combine_constant_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1);
gboolean
_cogl_pipeline_layer_filters_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1);
gboolean
_cogl_pipeline_layer_wrap_modes_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1);
gboolean
_cogl_pipeline_layer_user_matrix_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1);
gboolean
_cogl_pipeline_layer_point_sprite_coords_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1);
gboolean
_cogl_pipeline_layer_vertex_snippets_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1);
gboolean
_cogl_pipeline_layer_fragment_snippets_equal (CoglPipelineLayer *authority0,
CoglPipelineLayer *authority1);
void
_cogl_pipeline_layer_hash_unit_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_texture_type_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_texture_data_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_filters_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_wrap_modes_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_combine_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_combine_constant_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_user_matrix_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_point_sprite_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_vertex_snippets_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
void
_cogl_pipeline_layer_hash_fragment_snippets_state (CoglPipelineLayer *authority,
CoglPipelineLayer **authorities,
CoglPipelineHashState *state);
#endif /* __COGL_PIPELINE_LAYER_STATE_PRIVATE_H */