summaryrefslogtreecommitdiff
path: root/cogl/cogl-pipeline-fragend-arbfp.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-06-08 18:03:58 +0100
committerNeil Roberts <neil@linux.intel.com>2011-06-08 18:03:58 +0100
commitc3c080481952b33737bea0b5b1c62b6d3b5763f5 (patch)
tree0254f3e3297eb85cd8d5624bd38099c34274c841 /cogl/cogl-pipeline-fragend-arbfp.c
parentbbfe8b8ec445bda7832e13f495e31ac0ca93aca1 (diff)
downloadcogl-c3c080481952b33737bea0b5b1c62b6d3b5763f5.tar.gz
Implement COGL_DEBUG=disable-texturing for ARBFp and GLSL fragends
The COGL_DEBUG=disable-texturing debug variable disables texturing in the fixed function fragend by not bothering to enable the texture targets. This wasn't working for the programmable fragends because the texture targets don't need to be enabled to use them. This patch modifies the two programmable backends to generate a constant value for the texture lookups in the shader when the debug variable is given.
Diffstat (limited to 'cogl/cogl-pipeline-fragend-arbfp.c')
-rw-r--r--cogl/cogl-pipeline-fragend-arbfp.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/cogl/cogl-pipeline-fragend-arbfp.c b/cogl/cogl-pipeline-fragend-arbfp.c
index 18f85536..5878be4c 100644
--- a/cogl/cogl-pipeline-fragend-arbfp.c
+++ b/cogl/cogl-pipeline-fragend-arbfp.c
@@ -381,15 +381,22 @@ setup_texture_source (ArbfpProgramState *arbfp_program_state,
{
if (!arbfp_program_state->unit_state[unit_index].sampled)
{
- g_string_append_printf (arbfp_program_state->source,
- "TEMP texel%d;\n"
- "TEX texel%d,fragment.texcoord[%d],"
- "texture[%d],%s;\n",
- unit_index,
- unit_index,
- unit_index,
- unit_index,
- gl_target_to_arbfp_string (gl_target));
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
+ g_string_append_printf (arbfp_program_state->source,
+ "TEMP texel%d;\n"
+ "MOV texel%d, one;\n",
+ unit_index,
+ unit_index);
+ else
+ g_string_append_printf (arbfp_program_state->source,
+ "TEMP texel%d;\n"
+ "TEX texel%d,fragment.texcoord[%d],"
+ "texture[%d],%s;\n",
+ unit_index,
+ unit_index,
+ unit_index,
+ unit_index,
+ gl_target_to_arbfp_string (gl_target));
arbfp_program_state->unit_state[unit_index].sampled = TRUE;
}
}