mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
cogl: Remove fixed pipeline support
We require being able to use shaders so stop supporting a pipeline that wouldn't work to begin with.
This commit is contained in:
parent
98af9bb251
commit
8f58ad02fb
@ -173,16 +173,8 @@ cogl_driver_sources += \
|
|||||||
driver/gl/cogl-pipeline-fragend-glsl-private.h \
|
driver/gl/cogl-pipeline-fragend-glsl-private.h \
|
||||||
driver/gl/gl/cogl-pipeline-fragend-arbfp.c \
|
driver/gl/gl/cogl-pipeline-fragend-arbfp.c \
|
||||||
driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h \
|
driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h \
|
||||||
driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c \
|
|
||||||
driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h \
|
|
||||||
driver/gl/cogl-pipeline-fragend-fixed.c \
|
|
||||||
driver/gl/cogl-pipeline-fragend-fixed-private.h \
|
|
||||||
driver/gl/cogl-pipeline-vertend-glsl.c \
|
driver/gl/cogl-pipeline-vertend-glsl.c \
|
||||||
driver/gl/cogl-pipeline-vertend-glsl-private.h \
|
driver/gl/cogl-pipeline-vertend-glsl-private.h \
|
||||||
driver/gl/cogl-pipeline-vertend-fixed.c \
|
|
||||||
driver/gl/cogl-pipeline-vertend-fixed-private.h \
|
|
||||||
driver/gl/cogl-pipeline-progend-fixed.c \
|
|
||||||
driver/gl/cogl-pipeline-progend-fixed-private.h \
|
|
||||||
driver/gl/cogl-pipeline-progend-glsl.c \
|
driver/gl/cogl-pipeline-progend-glsl.c \
|
||||||
driver/gl/cogl-pipeline-progend-glsl-private.h \
|
driver/gl/cogl-pipeline-progend-glsl-private.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
@ -373,8 +373,8 @@ cogl_context_new (CoglDisplay *display,
|
|||||||
context->max_texture_units = -1;
|
context->max_texture_units = -1;
|
||||||
context->max_activateable_texture_units = -1;
|
context->max_activateable_texture_units = -1;
|
||||||
|
|
||||||
context->current_fragment_program_type = COGL_PIPELINE_PROGRAM_TYPE_FIXED;
|
context->current_fragment_program_type = COGL_PIPELINE_PROGRAM_TYPE_GLSL;
|
||||||
context->current_vertex_program_type = COGL_PIPELINE_PROGRAM_TYPE_FIXED;
|
context->current_vertex_program_type = COGL_PIPELINE_PROGRAM_TYPE_GLSL;
|
||||||
context->current_gl_program = 0;
|
context->current_gl_program = 0;
|
||||||
|
|
||||||
context->current_gl_dither_enabled = TRUE;
|
context->current_gl_dither_enabled = TRUE;
|
||||||
|
@ -135,11 +135,6 @@ OPT (DISABLE_ARBFP,
|
|||||||
"disable-arbfp",
|
"disable-arbfp",
|
||||||
N_("Disable arbfp"),
|
N_("Disable arbfp"),
|
||||||
N_("Disable use of ARB fragment programs"))
|
N_("Disable use of ARB fragment programs"))
|
||||||
OPT (DISABLE_FIXED,
|
|
||||||
N_("Root Cause"),
|
|
||||||
"disable-fixed",
|
|
||||||
N_("Disable fixed"),
|
|
||||||
N_("Disable use of the fixed function pipeline backend"))
|
|
||||||
OPT (DISABLE_GLSL,
|
OPT (DISABLE_GLSL,
|
||||||
N_("Root Cause"),
|
N_("Root Cause"),
|
||||||
"disable-glsl",
|
"disable-glsl",
|
||||||
|
@ -80,7 +80,6 @@ static const GDebugKey cogl_behavioural_debug_keys[] = {
|
|||||||
{ "disable-shared-atlas", COGL_DEBUG_DISABLE_SHARED_ATLAS },
|
{ "disable-shared-atlas", COGL_DEBUG_DISABLE_SHARED_ATLAS },
|
||||||
{ "disable-texturing", COGL_DEBUG_DISABLE_TEXTURING},
|
{ "disable-texturing", COGL_DEBUG_DISABLE_TEXTURING},
|
||||||
{ "disable-arbfp", COGL_DEBUG_DISABLE_ARBFP},
|
{ "disable-arbfp", COGL_DEBUG_DISABLE_ARBFP},
|
||||||
{ "disable-fixed", COGL_DEBUG_DISABLE_FIXED},
|
|
||||||
{ "disable-glsl", COGL_DEBUG_DISABLE_GLSL},
|
{ "disable-glsl", COGL_DEBUG_DISABLE_GLSL},
|
||||||
{ "disable-blending", COGL_DEBUG_DISABLE_BLENDING},
|
{ "disable-blending", COGL_DEBUG_DISABLE_BLENDING},
|
||||||
{ "disable-npot-textures", COGL_DEBUG_DISABLE_NPOT_TEXTURES},
|
{ "disable-npot-textures", COGL_DEBUG_DISABLE_NPOT_TEXTURES},
|
||||||
|
@ -61,7 +61,6 @@ typedef enum {
|
|||||||
COGL_DEBUG_OPENGL,
|
COGL_DEBUG_OPENGL,
|
||||||
COGL_DEBUG_DISABLE_TEXTURING,
|
COGL_DEBUG_DISABLE_TEXTURING,
|
||||||
COGL_DEBUG_DISABLE_ARBFP,
|
COGL_DEBUG_DISABLE_ARBFP,
|
||||||
COGL_DEBUG_DISABLE_FIXED,
|
|
||||||
COGL_DEBUG_DISABLE_GLSL,
|
COGL_DEBUG_DISABLE_GLSL,
|
||||||
COGL_DEBUG_SHOW_SOURCE,
|
COGL_DEBUG_SHOW_SOURCE,
|
||||||
COGL_DEBUG_DISABLE_BLENDING,
|
COGL_DEBUG_DISABLE_BLENDING,
|
||||||
|
@ -51,19 +51,15 @@
|
|||||||
|
|
||||||
#ifdef HAVE_COGL_GL
|
#ifdef HAVE_COGL_GL
|
||||||
|
|
||||||
#define COGL_PIPELINE_PROGEND_FIXED_ARBFP 0
|
#define COGL_PIPELINE_PROGEND_GLSL 0
|
||||||
#define COGL_PIPELINE_PROGEND_FIXED 1
|
#define COGL_PIPELINE_N_PROGENDS 1
|
||||||
#define COGL_PIPELINE_PROGEND_GLSL 2
|
|
||||||
#define COGL_PIPELINE_N_PROGENDS 3
|
|
||||||
|
|
||||||
#define COGL_PIPELINE_VERTEND_FIXED 0
|
#define COGL_PIPELINE_VERTEND_GLSL 0
|
||||||
#define COGL_PIPELINE_VERTEND_GLSL 1
|
#define COGL_PIPELINE_N_VERTENDS 1
|
||||||
#define COGL_PIPELINE_N_VERTENDS 2
|
|
||||||
|
|
||||||
#define COGL_PIPELINE_FRAGEND_ARBFP 0
|
#define COGL_PIPELINE_FRAGEND_ARBFP 0
|
||||||
#define COGL_PIPELINE_FRAGEND_FIXED 1
|
#define COGL_PIPELINE_FRAGEND_GLSL 1
|
||||||
#define COGL_PIPELINE_FRAGEND_GLSL 2
|
#define COGL_PIPELINE_N_FRAGENDS 2
|
||||||
#define COGL_PIPELINE_N_FRAGENDS 3
|
|
||||||
|
|
||||||
#else /* HAVE_COGL_GL */
|
#else /* HAVE_COGL_GL */
|
||||||
|
|
||||||
@ -558,7 +554,6 @@ typedef enum
|
|||||||
{
|
{
|
||||||
COGL_PIPELINE_PROGRAM_TYPE_GLSL = 1,
|
COGL_PIPELINE_PROGRAM_TYPE_GLSL = 1,
|
||||||
COGL_PIPELINE_PROGRAM_TYPE_ARBFP,
|
COGL_PIPELINE_PROGRAM_TYPE_ARBFP,
|
||||||
COGL_PIPELINE_PROGRAM_TYPE_FIXED
|
|
||||||
} CoglPipelineProgramType;
|
} CoglPipelineProgramType;
|
||||||
|
|
||||||
extern const CoglPipelineFragend *
|
extern const CoglPipelineFragend *
|
||||||
|
@ -74,23 +74,11 @@ _cogl_pipeline_progends[MAX (COGL_PIPELINE_N_PROGENDS, 1)];
|
|||||||
#ifdef COGL_PIPELINE_FRAGEND_ARBFP
|
#ifdef COGL_PIPELINE_FRAGEND_ARBFP
|
||||||
#include "cogl-pipeline-fragend-arbfp-private.h"
|
#include "cogl-pipeline-fragend-arbfp-private.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef COGL_PIPELINE_FRAGEND_FIXED
|
|
||||||
#include "cogl-pipeline-fragend-fixed-private.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef COGL_PIPELINE_VERTEND_GLSL
|
#ifdef COGL_PIPELINE_VERTEND_GLSL
|
||||||
#include "cogl-pipeline-vertend-glsl-private.h"
|
#include "cogl-pipeline-vertend-glsl-private.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef COGL_PIPELINE_VERTEND_FIXED
|
|
||||||
#include "cogl-pipeline-vertend-fixed-private.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef COGL_PIPELINE_PROGEND_FIXED_ARBFP
|
|
||||||
#include "cogl-pipeline-progend-fixed-arbfp-private.h"
|
|
||||||
#endif
|
|
||||||
#ifdef COGL_PIPELINE_PROGEND_FIXED
|
|
||||||
#include "cogl-pipeline-progend-fixed-private.h"
|
|
||||||
#endif
|
|
||||||
#ifdef COGL_PIPELINE_PROGEND_GLSL
|
#ifdef COGL_PIPELINE_PROGEND_GLSL
|
||||||
#include "cogl-pipeline-progend-glsl-private.h"
|
#include "cogl-pipeline-progend-glsl-private.h"
|
||||||
#endif
|
#endif
|
||||||
@ -131,18 +119,6 @@ _cogl_pipeline_init_default_pipeline (void)
|
|||||||
_cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_ARBFP] =
|
_cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_ARBFP] =
|
||||||
&_cogl_pipeline_arbfp_fragend;
|
&_cogl_pipeline_arbfp_fragend;
|
||||||
#endif
|
#endif
|
||||||
#ifdef COGL_PIPELINE_FRAGEND_FIXED
|
|
||||||
_cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_FIXED] =
|
|
||||||
&_cogl_pipeline_fixed_fragend;
|
|
||||||
#endif
|
|
||||||
#ifdef COGL_PIPELINE_PROGEND_FIXED
|
|
||||||
_cogl_pipeline_progends[COGL_PIPELINE_PROGEND_FIXED_ARBFP] =
|
|
||||||
&_cogl_pipeline_fixed_arbfp_progend;
|
|
||||||
#endif
|
|
||||||
#ifdef COGL_PIPELINE_PROGEND_FIXED
|
|
||||||
_cogl_pipeline_progends[COGL_PIPELINE_PROGEND_FIXED] =
|
|
||||||
&_cogl_pipeline_fixed_progend;
|
|
||||||
#endif
|
|
||||||
#ifdef COGL_PIPELINE_PROGEND_GLSL
|
#ifdef COGL_PIPELINE_PROGEND_GLSL
|
||||||
_cogl_pipeline_progends[COGL_PIPELINE_PROGEND_GLSL] =
|
_cogl_pipeline_progends[COGL_PIPELINE_PROGEND_GLSL] =
|
||||||
&_cogl_pipeline_glsl_progend;
|
&_cogl_pipeline_glsl_progend;
|
||||||
@ -152,10 +128,6 @@ _cogl_pipeline_init_default_pipeline (void)
|
|||||||
_cogl_pipeline_vertends[COGL_PIPELINE_VERTEND_GLSL] =
|
_cogl_pipeline_vertends[COGL_PIPELINE_VERTEND_GLSL] =
|
||||||
&_cogl_pipeline_glsl_vertend;
|
&_cogl_pipeline_glsl_vertend;
|
||||||
#endif
|
#endif
|
||||||
#ifdef COGL_PIPELINE_VERTEND_FIXED
|
|
||||||
_cogl_pipeline_vertends[COGL_PIPELINE_VERTEND_FIXED] =
|
|
||||||
&_cogl_pipeline_fixed_vertend;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_cogl_pipeline_node_init (COGL_NODE (pipeline));
|
_cogl_pipeline_node_init (COGL_NODE (pipeline));
|
||||||
|
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Robert Bragg <robert@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H
|
|
||||||
#define __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H
|
|
||||||
|
|
||||||
#include "cogl-pipeline-private.h"
|
|
||||||
|
|
||||||
extern const CoglPipelineFragend _cogl_pipeline_fixed_fragend;
|
|
||||||
|
|
||||||
#endif /* __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H */
|
|
||||||
|
|
@ -1,422 +0,0 @@
|
|||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008,2009,2010 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Robert Bragg <robert@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "cogl-config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "cogl-context-private.h"
|
|
||||||
#include "cogl-util-gl-private.h"
|
|
||||||
#include "cogl-pipeline-private.h"
|
|
||||||
#include "cogl-pipeline-state-private.h"
|
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
|
||||||
|
|
||||||
#ifdef COGL_PIPELINE_FRAGEND_FIXED
|
|
||||||
|
|
||||||
#include "cogl-context-private.h"
|
|
||||||
#include "cogl-object-private.h"
|
|
||||||
|
|
||||||
#include "cogl-texture-private.h"
|
|
||||||
#include "cogl-blend-string.h"
|
|
||||||
#include "cogl-profile.h"
|
|
||||||
#include "cogl-program-private.h"
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib/gprintf.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifndef GL_TEXTURE_RECTANGLE_ARB
|
|
||||||
#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const CoglPipelineFragend _cogl_pipeline_fixed_fragend;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cogl_disable_texture_unit (int unit_index)
|
|
||||||
{
|
|
||||||
CoglTextureUnit *unit;
|
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
|
||||||
|
|
||||||
unit = &g_array_index (ctx->texture_units, CoglTextureUnit, unit_index);
|
|
||||||
|
|
||||||
if (unit->enabled_gl_target)
|
|
||||||
{
|
|
||||||
_cogl_set_active_texture_unit (unit_index);
|
|
||||||
GE (ctx, glDisable (unit->enabled_gl_target));
|
|
||||||
unit->enabled_gl_target = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
get_max_texture_units (void)
|
|
||||||
{
|
|
||||||
_COGL_GET_CONTEXT (ctx, 0);
|
|
||||||
|
|
||||||
/* This function is called quite often so we cache the value to
|
|
||||||
avoid too many GL calls */
|
|
||||||
if (ctx->max_texture_units == -1)
|
|
||||||
{
|
|
||||||
ctx->max_texture_units = 1;
|
|
||||||
GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_UNITS,
|
|
||||||
&ctx->max_texture_units));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ctx->max_texture_units;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cogl_pipeline_fragend_fixed_start (CoglPipeline *pipeline,
|
|
||||||
int n_layers,
|
|
||||||
unsigned long pipelines_difference)
|
|
||||||
{
|
|
||||||
_cogl_use_fragment_program (0, COGL_PIPELINE_PROGRAM_TYPE_FIXED);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
translate_sources (CoglPipeline *pipeline,
|
|
||||||
int n_sources,
|
|
||||||
CoglPipelineCombineSource *source_in,
|
|
||||||
GLenum *source_out)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* The texture source numbers specified in the layer combine are the
|
|
||||||
layer numbers so we need to map these to unit indices */
|
|
||||||
|
|
||||||
for (i = 0; i < n_sources; i++)
|
|
||||||
switch (source_in[i])
|
|
||||||
{
|
|
||||||
case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE:
|
|
||||||
source_out[i] = GL_TEXTURE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COGL_PIPELINE_COMBINE_SOURCE_CONSTANT:
|
|
||||||
source_out[i] = GL_CONSTANT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR:
|
|
||||||
source_out[i] = GL_PRIMARY_COLOR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS:
|
|
||||||
source_out[i] = GL_PREVIOUS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
int layer_num = source_in[i] - COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0;
|
|
||||||
CoglPipelineGetLayerFlags flags = COGL_PIPELINE_GET_LAYER_NO_CREATE;
|
|
||||||
CoglPipelineLayer *layer =
|
|
||||||
_cogl_pipeline_get_layer_with_flags (pipeline, layer_num, flags);
|
|
||||||
|
|
||||||
if (layer == NULL)
|
|
||||||
{
|
|
||||||
static CoglBool warning_seen = FALSE;
|
|
||||||
if (!warning_seen)
|
|
||||||
{
|
|
||||||
g_warning ("The application is trying to use a texture "
|
|
||||||
"combine with a layer number that does not exist");
|
|
||||||
warning_seen = TRUE;
|
|
||||||
}
|
|
||||||
source_out[i] = GL_PREVIOUS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
source_out[i] = (_cogl_pipeline_layer_get_unit_index (layer) +
|
|
||||||
GL_TEXTURE0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static CoglBool
|
|
||||||
_cogl_pipeline_fragend_fixed_add_layer (CoglPipeline *pipeline,
|
|
||||||
CoglPipelineLayer *layer,
|
|
||||||
unsigned long layers_difference)
|
|
||||||
{
|
|
||||||
CoglTextureUnit *unit =
|
|
||||||
_cogl_get_texture_unit (_cogl_pipeline_layer_get_unit_index (layer));
|
|
||||||
int unit_index = unit->index;
|
|
||||||
int n_rgb_func_args;
|
|
||||||
int n_alpha_func_args;
|
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
|
||||||
|
|
||||||
/* XXX: Beware that since we are changing the active texture unit we
|
|
||||||
* must make sure we don't call into other Cogl components that may
|
|
||||||
* temporarily bind texture objects to query/modify parameters since
|
|
||||||
* they will end up binding texture unit 1. See
|
|
||||||
* _cogl_bind_gl_texture_transient for more details.
|
|
||||||
*/
|
|
||||||
_cogl_set_active_texture_unit (unit_index);
|
|
||||||
|
|
||||||
if (G_UNLIKELY (unit_index >= get_max_texture_units ()))
|
|
||||||
{
|
|
||||||
_cogl_disable_texture_unit (unit_index);
|
|
||||||
/* TODO: although this isn't considered an error that
|
|
||||||
* warrants falling back to a different backend we
|
|
||||||
* should print a warning here. */
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle enabling or disabling the right texture type */
|
|
||||||
if (layers_difference & COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE)
|
|
||||||
{
|
|
||||||
CoglTextureType texture_type =
|
|
||||||
_cogl_pipeline_layer_get_texture_type (layer);
|
|
||||||
GLenum gl_target;
|
|
||||||
|
|
||||||
switch (texture_type)
|
|
||||||
{
|
|
||||||
case COGL_TEXTURE_TYPE_2D:
|
|
||||||
gl_target = GL_TEXTURE_2D;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COGL_TEXTURE_TYPE_3D:
|
|
||||||
gl_target = GL_TEXTURE_3D;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COGL_TEXTURE_TYPE_RECTANGLE:
|
|
||||||
gl_target = GL_TEXTURE_RECTANGLE_ARB;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
|
|
||||||
_cogl_set_active_texture_unit (unit_index);
|
|
||||||
|
|
||||||
/* The common GL code handles binding the right texture so we
|
|
||||||
just need to handle enabling and disabling it */
|
|
||||||
|
|
||||||
if (unit->enabled_gl_target != gl_target)
|
|
||||||
{
|
|
||||||
/* Disable the previous target if it's still enabled */
|
|
||||||
if (unit->enabled_gl_target)
|
|
||||||
GE (ctx, glDisable (unit->enabled_gl_target));
|
|
||||||
|
|
||||||
/* Enable the new target */
|
|
||||||
if (!G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
|
|
||||||
{
|
|
||||||
GE (ctx, glEnable (gl_target));
|
|
||||||
unit->enabled_gl_target = gl_target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Even though there may be no difference between the last flushed
|
|
||||||
* texture state and the current layers texture state it may be that the
|
|
||||||
* texture unit has been disabled for some time so we need to assert that
|
|
||||||
* it's enabled now.
|
|
||||||
*/
|
|
||||||
if (!G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)) &&
|
|
||||||
unit->enabled_gl_target == 0)
|
|
||||||
{
|
|
||||||
_cogl_set_active_texture_unit (unit_index);
|
|
||||||
GE (ctx, glEnable (unit->gl_target));
|
|
||||||
unit->enabled_gl_target = unit->gl_target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (layers_difference & COGL_PIPELINE_LAYER_STATE_COMBINE)
|
|
||||||
{
|
|
||||||
CoglPipelineLayer *authority =
|
|
||||||
_cogl_pipeline_layer_get_authority (layer,
|
|
||||||
COGL_PIPELINE_LAYER_STATE_COMBINE);
|
|
||||||
CoglPipelineLayerBigState *big_state = authority->big_state;
|
|
||||||
GLenum sources[3];
|
|
||||||
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE));
|
|
||||||
|
|
||||||
/* Set the combiner functions... */
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV,
|
|
||||||
GL_COMBINE_RGB,
|
|
||||||
big_state->texture_combine_rgb_func));
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV,
|
|
||||||
GL_COMBINE_ALPHA,
|
|
||||||
big_state->texture_combine_alpha_func));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Setup the function arguments...
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* For the RGB components... */
|
|
||||||
n_rgb_func_args =
|
|
||||||
_cogl_get_n_args_for_combine_func (big_state->texture_combine_rgb_func);
|
|
||||||
|
|
||||||
translate_sources (pipeline,
|
|
||||||
n_rgb_func_args,
|
|
||||||
big_state->texture_combine_rgb_src,
|
|
||||||
sources);
|
|
||||||
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_RGB,
|
|
||||||
sources[0]));
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB,
|
|
||||||
big_state->texture_combine_rgb_op[0]));
|
|
||||||
if (n_rgb_func_args > 1)
|
|
||||||
{
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_RGB,
|
|
||||||
sources[1]));
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB,
|
|
||||||
big_state->texture_combine_rgb_op[1]));
|
|
||||||
}
|
|
||||||
if (n_rgb_func_args > 2)
|
|
||||||
{
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC2_RGB,
|
|
||||||
sources[2]));
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND2_RGB,
|
|
||||||
big_state->texture_combine_rgb_op[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For the Alpha component */
|
|
||||||
n_alpha_func_args =
|
|
||||||
_cogl_get_n_args_for_combine_func (big_state->texture_combine_alpha_func);
|
|
||||||
|
|
||||||
translate_sources (pipeline,
|
|
||||||
n_alpha_func_args,
|
|
||||||
big_state->texture_combine_alpha_src,
|
|
||||||
sources);
|
|
||||||
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC0_ALPHA,
|
|
||||||
sources[0]));
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA,
|
|
||||||
big_state->texture_combine_alpha_op[0]));
|
|
||||||
if (n_alpha_func_args > 1)
|
|
||||||
{
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC1_ALPHA,
|
|
||||||
sources[1]));
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA,
|
|
||||||
big_state->texture_combine_alpha_op[1]));
|
|
||||||
}
|
|
||||||
if (n_alpha_func_args > 2)
|
|
||||||
{
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_SRC2_ALPHA,
|
|
||||||
sources[2]));
|
|
||||||
GE (ctx, glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND2_ALPHA,
|
|
||||||
big_state->texture_combine_alpha_op[2]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (layers_difference & COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT)
|
|
||||||
{
|
|
||||||
CoglPipelineLayer *authority =
|
|
||||||
_cogl_pipeline_layer_get_authority
|
|
||||||
(layer, COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT);
|
|
||||||
CoglPipelineLayerBigState *big_state = authority->big_state;
|
|
||||||
|
|
||||||
GE (ctx, glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR,
|
|
||||||
big_state->texture_combine_constant));
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CoglBool
|
|
||||||
get_highest_unit_index_cb (CoglPipelineLayer *layer,
|
|
||||||
void *user_data)
|
|
||||||
{
|
|
||||||
int unit_index = _cogl_pipeline_layer_get_unit_index (layer);
|
|
||||||
int *highest_index = user_data;
|
|
||||||
|
|
||||||
*highest_index = unit_index;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CoglBool
|
|
||||||
_cogl_pipeline_fragend_fixed_end (CoglPipeline *pipeline,
|
|
||||||
unsigned long pipelines_difference)
|
|
||||||
{
|
|
||||||
int highest_unit_index = -1;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
|
||||||
|
|
||||||
_cogl_pipeline_foreach_layer_internal (pipeline,
|
|
||||||
get_highest_unit_index_cb,
|
|
||||||
&highest_unit_index);
|
|
||||||
|
|
||||||
/* Disable additional texture units that may have previously been in use.. */
|
|
||||||
for (i = highest_unit_index + 1; i < ctx->texture_units->len; i++)
|
|
||||||
_cogl_disable_texture_unit (i);
|
|
||||||
|
|
||||||
if (pipelines_difference & COGL_PIPELINE_STATE_FOG)
|
|
||||||
{
|
|
||||||
CoglPipeline *authority =
|
|
||||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG);
|
|
||||||
CoglPipelineFogState *fog_state = &authority->big_state->fog_state;
|
|
||||||
|
|
||||||
if (fog_state->enabled)
|
|
||||||
{
|
|
||||||
GLfloat fogColor[4];
|
|
||||||
GLenum gl_mode = GL_LINEAR;
|
|
||||||
|
|
||||||
fogColor[0] = cogl_color_get_red_float (&fog_state->color);
|
|
||||||
fogColor[1] = cogl_color_get_green_float (&fog_state->color);
|
|
||||||
fogColor[2] = cogl_color_get_blue_float (&fog_state->color);
|
|
||||||
fogColor[3] = cogl_color_get_alpha_float (&fog_state->color);
|
|
||||||
|
|
||||||
GE (ctx, glEnable (GL_FOG));
|
|
||||||
|
|
||||||
GE (ctx, glFogfv (GL_FOG_COLOR, fogColor));
|
|
||||||
|
|
||||||
/* TODO: support other modes for GLES2 */
|
|
||||||
|
|
||||||
/* NB: GLES doesn't have glFogi */
|
|
||||||
GE (ctx, glFogf (GL_FOG_MODE, gl_mode));
|
|
||||||
GE (ctx, glHint (GL_FOG_HINT, GL_NICEST));
|
|
||||||
|
|
||||||
GE (ctx, glFogf (GL_FOG_DENSITY, fog_state->density));
|
|
||||||
GE (ctx, glFogf (GL_FOG_START, fog_state->z_near));
|
|
||||||
GE (ctx, glFogf (GL_FOG_END, fog_state->z_far));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GE (ctx, glDisable (GL_FOG));
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CoglPipelineFragend _cogl_pipeline_fixed_fragend =
|
|
||||||
{
|
|
||||||
_cogl_pipeline_fragend_fixed_start,
|
|
||||||
_cogl_pipeline_fragend_fixed_add_layer,
|
|
||||||
NULL, /* passthrough */
|
|
||||||
_cogl_pipeline_fragend_fixed_end,
|
|
||||||
NULL, /* pipeline_change_notify */
|
|
||||||
NULL, /* pipeline_set_parent_notify */
|
|
||||||
NULL, /* layer_change_notify */
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* COGL_PIPELINE_FRAGEND_FIXED */
|
|
||||||
|
|
@ -289,10 +289,6 @@ _cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type)
|
|||||||
GE( ctx, glDisable (GL_FRAGMENT_PROGRAM_ARB) );
|
GE( ctx, glDisable (GL_FRAGMENT_PROGRAM_ARB) );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
|
|
||||||
/* don't need to to anything */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ... and enable the new type */
|
/* ... and enable the new type */
|
||||||
@ -305,7 +301,6 @@ _cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
|
case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
|
||||||
case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
|
|
||||||
/* don't need to to anything */
|
/* don't need to to anything */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -353,10 +348,6 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
|
|||||||
/* It doesn't make sense to enable ARBfp for the vertex program */
|
/* It doesn't make sense to enable ARBfp for the vertex program */
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
|
|
||||||
/* don't need to to anything */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ... and enable the new type */
|
/* ... and enable the new type */
|
||||||
@ -368,7 +359,6 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
|
case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
|
||||||
case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
|
|
||||||
/* don't need to to anything */
|
/* don't need to to anything */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Neil Roberts <neil@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __COGL_PIPELINE_PROGEND_FIXED_PRIVATE_H
|
|
||||||
#define __COGL_PIPELINE_PROGEND_FIXED_PRIVATE_H
|
|
||||||
|
|
||||||
#include "cogl-pipeline-private.h"
|
|
||||||
|
|
||||||
extern const CoglPipelineProgend _cogl_pipeline_fixed_progend;
|
|
||||||
|
|
||||||
#endif /* __COGL_PIPELINE_PROGEND_FIXED_PRIVATE_H */
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Neil Roberts <neil@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "cogl-config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "cogl-pipeline-private.h"
|
|
||||||
#include "cogl-pipeline-state-private.h"
|
|
||||||
|
|
||||||
#ifdef COGL_PIPELINE_PROGEND_FIXED
|
|
||||||
|
|
||||||
#include "cogl-context.h"
|
|
||||||
#include "cogl-context-private.h"
|
|
||||||
#include "cogl-framebuffer-private.h"
|
|
||||||
|
|
||||||
static CoglBool
|
|
||||||
_cogl_pipeline_progend_fixed_start (CoglPipeline *pipeline)
|
|
||||||
{
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
|
||||||
|
|
||||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Vertex snippets are only supported in the GLSL fragend */
|
|
||||||
if (_cogl_pipeline_has_vertex_snippets (pipeline))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Fragment snippets are only supported in the GLSL fragend */
|
|
||||||
if (_cogl_pipeline_has_fragment_snippets (pipeline))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* If there is a user program then the appropriate backend for that
|
|
||||||
* language should handle it. */
|
|
||||||
if (cogl_pipeline_get_user_program (pipeline))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* The fixed progend can't handle the per-vertex point size
|
|
||||||
* attribute */
|
|
||||||
if (cogl_pipeline_get_per_vertex_point_size (pipeline))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cogl_pipeline_progend_fixed_pre_paint (CoglPipeline *pipeline,
|
|
||||||
CoglFramebuffer *framebuffer)
|
|
||||||
{
|
|
||||||
CoglContext *ctx = framebuffer->context;
|
|
||||||
|
|
||||||
if (ctx->current_projection_entry)
|
|
||||||
_cogl_matrix_entry_flush_to_gl_builtins (ctx,
|
|
||||||
ctx->current_projection_entry,
|
|
||||||
COGL_MATRIX_PROJECTION,
|
|
||||||
framebuffer,
|
|
||||||
FALSE /* enable flip */);
|
|
||||||
if (ctx->current_modelview_entry)
|
|
||||||
_cogl_matrix_entry_flush_to_gl_builtins (ctx,
|
|
||||||
ctx->current_modelview_entry,
|
|
||||||
COGL_MATRIX_MODELVIEW,
|
|
||||||
framebuffer,
|
|
||||||
FALSE /* enable flip */);
|
|
||||||
}
|
|
||||||
|
|
||||||
const CoglPipelineProgend _cogl_pipeline_fixed_progend =
|
|
||||||
{
|
|
||||||
COGL_PIPELINE_VERTEND_FIXED,
|
|
||||||
COGL_PIPELINE_FRAGEND_FIXED,
|
|
||||||
_cogl_pipeline_progend_fixed_start,
|
|
||||||
NULL, /* end */
|
|
||||||
NULL, /* pre_change_notify */
|
|
||||||
NULL, /* layer_pre_change_notify */
|
|
||||||
_cogl_pipeline_progend_fixed_pre_paint
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* COGL_PIPELINE_PROGEND_FIXED */
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Neil Roberts <neil@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __COGL_PIPELINE_VERTEND_FIXED_PRIVATE_H
|
|
||||||
#define __COGL_PIPELINE_VERTEND_FIXED_PRIVATE_H
|
|
||||||
|
|
||||||
#include "cogl-pipeline-private.h"
|
|
||||||
|
|
||||||
extern const CoglPipelineVertend _cogl_pipeline_fixed_vertend;
|
|
||||||
|
|
||||||
#endif /* __COGL_PIPELINE_VERTEND_FIXED_PRIVATE_H */
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008,2009,2010 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Neil Roberts <neil@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "cogl-config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "cogl-context-private.h"
|
|
||||||
#include "cogl-util-gl-private.h"
|
|
||||||
#include "cogl-pipeline-private.h"
|
|
||||||
#include "cogl-pipeline-state-private.h"
|
|
||||||
#include "cogl-pipeline-opengl-private.h"
|
|
||||||
#include "cogl-framebuffer-private.h"
|
|
||||||
|
|
||||||
#ifdef COGL_PIPELINE_VERTEND_FIXED
|
|
||||||
|
|
||||||
#include "cogl-context-private.h"
|
|
||||||
#include "cogl-object-private.h"
|
|
||||||
#include "cogl-program-private.h"
|
|
||||||
|
|
||||||
const CoglPipelineVertend _cogl_pipeline_fixed_vertend;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cogl_pipeline_vertend_fixed_start (CoglPipeline *pipeline,
|
|
||||||
int n_layers,
|
|
||||||
unsigned long pipelines_difference)
|
|
||||||
{
|
|
||||||
_cogl_use_vertex_program (0, COGL_PIPELINE_PROGRAM_TYPE_FIXED);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CoglBool
|
|
||||||
_cogl_pipeline_vertend_fixed_add_layer (CoglPipeline *pipeline,
|
|
||||||
CoglPipelineLayer *layer,
|
|
||||||
unsigned long layers_difference,
|
|
||||||
CoglFramebuffer *framebuffer)
|
|
||||||
{
|
|
||||||
CoglContext *ctx = framebuffer->context;
|
|
||||||
int unit_index = _cogl_pipeline_layer_get_unit_index (layer);
|
|
||||||
CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index);
|
|
||||||
|
|
||||||
if (layers_difference & COGL_PIPELINE_LAYER_STATE_USER_MATRIX)
|
|
||||||
{
|
|
||||||
CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_USER_MATRIX;
|
|
||||||
CoglPipelineLayer *authority =
|
|
||||||
_cogl_pipeline_layer_get_authority (layer, state);
|
|
||||||
CoglMatrixEntry *matrix_entry;
|
|
||||||
|
|
||||||
cogl_matrix_stack_set (unit->matrix_stack,
|
|
||||||
&authority->big_state->matrix);
|
|
||||||
|
|
||||||
_cogl_set_active_texture_unit (unit_index);
|
|
||||||
|
|
||||||
matrix_entry = unit->matrix_stack->last_entry;
|
|
||||||
_cogl_matrix_entry_flush_to_gl_builtins (ctx, matrix_entry,
|
|
||||||
COGL_MATRIX_TEXTURE,
|
|
||||||
framebuffer,
|
|
||||||
FALSE /* enable flip */);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CoglBool
|
|
||||||
_cogl_pipeline_vertend_fixed_end (CoglPipeline *pipeline,
|
|
||||||
unsigned long pipelines_difference)
|
|
||||||
{
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
|
||||||
|
|
||||||
if (pipelines_difference & COGL_PIPELINE_STATE_POINT_SIZE)
|
|
||||||
{
|
|
||||||
CoglPipeline *authority =
|
|
||||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE);
|
|
||||||
|
|
||||||
if (authority->big_state->point_size > 0.0f)
|
|
||||||
GE( ctx, glPointSize (authority->big_state->point_size) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CoglPipelineVertend _cogl_pipeline_fixed_vertend =
|
|
||||||
{
|
|
||||||
_cogl_pipeline_vertend_fixed_start,
|
|
||||||
_cogl_pipeline_vertend_fixed_add_layer,
|
|
||||||
_cogl_pipeline_vertend_fixed_end,
|
|
||||||
NULL, /* pipeline_change_notify */
|
|
||||||
NULL /* layer_change_notify */
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* COGL_PIPELINE_VERTEND_FIXED */
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Neil Roberts <neil@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __COGL_PIPELINE_PROGEND_FIXED_ARBFP_PRIVATE_H
|
|
||||||
#define __COGL_PIPELINE_PROGEND_FIXED_ARBFP_PRIVATE_H
|
|
||||||
|
|
||||||
#include "cogl-pipeline-private.h"
|
|
||||||
|
|
||||||
extern const CoglPipelineProgend _cogl_pipeline_fixed_arbfp_progend;
|
|
||||||
|
|
||||||
#endif /* __COGL_PIPELINE_PROGEND_FIXED_ARBFP_PRIVATE_H */
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
|||||||
/*
|
|
||||||
* Cogl
|
|
||||||
*
|
|
||||||
* A Low Level GPU Graphics and Utilities API
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 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.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Robert Bragg <robert@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "cogl-config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "cogl-pipeline-private.h"
|
|
||||||
#include "cogl-pipeline-state-private.h"
|
|
||||||
|
|
||||||
#ifdef COGL_PIPELINE_PROGEND_FIXED_ARBFP
|
|
||||||
|
|
||||||
#include "cogl-context.h"
|
|
||||||
#include "cogl-context-private.h"
|
|
||||||
#include "cogl-framebuffer-private.h"
|
|
||||||
#include "cogl-program-private.h"
|
|
||||||
|
|
||||||
static CoglBool
|
|
||||||
_cogl_pipeline_progend_fixed_arbfp_start (CoglPipeline *pipeline)
|
|
||||||
{
|
|
||||||
CoglHandle user_program;
|
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
|
||||||
|
|
||||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Vertex snippets are only supported in the GLSL fragend */
|
|
||||||
if (_cogl_pipeline_has_vertex_snippets (pipeline))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Validate that we can handle the fragment state using ARBfp
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Fragment snippets are only supported in the GLSL fragend */
|
|
||||||
if (_cogl_pipeline_has_fragment_snippets (pipeline))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
user_program = cogl_pipeline_get_user_program (pipeline);
|
|
||||||
if (user_program &&
|
|
||||||
_cogl_program_get_language (user_program) != COGL_SHADER_LANGUAGE_ARBFP)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* The ARBfp progend can't handle the per-vertex point size
|
|
||||||
* attribute */
|
|
||||||
if (cogl_pipeline_get_per_vertex_point_size (pipeline))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_cogl_pipeline_progend_fixed_arbfp_pre_paint (CoglPipeline *pipeline,
|
|
||||||
CoglFramebuffer *framebuffer)
|
|
||||||
{
|
|
||||||
CoglContext *ctx = framebuffer->context;
|
|
||||||
|
|
||||||
if (ctx->current_projection_entry)
|
|
||||||
_cogl_matrix_entry_flush_to_gl_builtins (ctx,
|
|
||||||
ctx->current_projection_entry,
|
|
||||||
COGL_MATRIX_PROJECTION,
|
|
||||||
framebuffer,
|
|
||||||
FALSE /* enable flip */);
|
|
||||||
if (ctx->current_modelview_entry)
|
|
||||||
_cogl_matrix_entry_flush_to_gl_builtins (ctx,
|
|
||||||
ctx->current_modelview_entry,
|
|
||||||
COGL_MATRIX_MODELVIEW,
|
|
||||||
framebuffer,
|
|
||||||
FALSE /* enable flip */);
|
|
||||||
}
|
|
||||||
|
|
||||||
const CoglPipelineProgend _cogl_pipeline_fixed_arbfp_progend =
|
|
||||||
{
|
|
||||||
COGL_PIPELINE_VERTEND_FIXED,
|
|
||||||
COGL_PIPELINE_FRAGEND_ARBFP,
|
|
||||||
_cogl_pipeline_progend_fixed_arbfp_start,
|
|
||||||
NULL, /* end */
|
|
||||||
NULL, /* pre_change_notify */
|
|
||||||
NULL, /* layer_pre_change_notify */
|
|
||||||
_cogl_pipeline_progend_fixed_arbfp_pre_paint
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* COGL_PIPELINE_PROGEND_FIXED_ARBFP */
|
|
@ -592,10 +592,6 @@ dnl ================================================================
|
|||||||
AC_PATH_X
|
AC_PATH_X
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(fcntl.h limits.h unistd.h)
|
AC_CHECK_HEADERS(fcntl.h limits.h unistd.h)
|
||||||
AC_CHECK_HEADER([endian.h],
|
|
||||||
[AC_CHECK_DECL([__FLOAT_WORD_ORDER],
|
|
||||||
AC_DEFINE([HAVE_FLOAT_WORD_ORDER], [1],
|
|
||||||
[Has the __FLOAT_WORD_ORDER macro]))])
|
|
||||||
|
|
||||||
dnl ================================================================
|
dnl ================================================================
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
|
@ -88,7 +88,7 @@ printf $TITLE_FORMAT "Test"
|
|||||||
|
|
||||||
if test $HAVE_GL -eq 1; then
|
if test $HAVE_GL -eq 1; then
|
||||||
GL_FORMAT=" %6s %8s %7s %6s %6s"
|
GL_FORMAT=" %6s %8s %7s %6s %6s"
|
||||||
printf "$GL_FORMAT" "GL+FF" "GL+ARBFP" "GL+GLSL" "GL-NPT" "GL3"
|
printf "$GL_FORMAT" GL+ARBFP" "GL+GLSL" "GL-NPT" "GL3"
|
||||||
fi
|
fi
|
||||||
if test $HAVE_GLES2 -eq 1; then
|
if test $HAVE_GLES2 -eq 1; then
|
||||||
GLES2_FORMAT=" %6s %7s"
|
GLES2_FORMAT=" %6s %7s"
|
||||||
@ -103,10 +103,6 @@ do
|
|||||||
export COGL_DEBUG=
|
export COGL_DEBUG=
|
||||||
|
|
||||||
if test $HAVE_GL -eq 1; then
|
if test $HAVE_GL -eq 1; then
|
||||||
export COGL_DRIVER=gl
|
|
||||||
export COGL_DEBUG=disable-glsl,disable-arbfp
|
|
||||||
run_test $test gl_ff
|
|
||||||
|
|
||||||
export COGL_DRIVER=gl
|
export COGL_DRIVER=gl
|
||||||
# NB: we can't explicitly disable fixed + glsl in this case since
|
# NB: we can't explicitly disable fixed + glsl in this case since
|
||||||
# the arbfp code only supports fragment processing so we need either
|
# the arbfp code only supports fragment processing so we need either
|
||||||
@ -140,7 +136,6 @@ do
|
|||||||
printf $TITLE_FORMAT "$test:"
|
printf $TITLE_FORMAT "$test:"
|
||||||
if test $HAVE_GL -eq 1; then
|
if test $HAVE_GL -eq 1; then
|
||||||
printf "$GL_FORMAT" \
|
printf "$GL_FORMAT" \
|
||||||
"`get_status $gl_ff_result`" \
|
|
||||||
"`get_status $gl_arbfp_result`" \
|
"`get_status $gl_arbfp_result`" \
|
||||||
"`get_status $gl_glsl_result`" \
|
"`get_status $gl_glsl_result`" \
|
||||||
"`get_status $gl_npot_result`" \
|
"`get_status $gl_npot_result`" \
|
||||||
|
Loading…
Reference in New Issue
Block a user