summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2011-09-21 20:04:44 +0100
committerRobert Bragg <robert@linux.intel.com>2011-09-21 20:36:00 +0100
commitebe4b73a1cec2f8624e3f960603fb1461d57d35d (patch)
tree81fdd0b92f51da0bb3243131ea874eb5f87aa5e1
parent30f8521790dd7daf052cba22037cedb87793f12b (diff)
downloadcogl-ebe4b73a1cec2f8624e3f960603fb1461d57d35d.tar.gz
arbfp: assume GL_TEXTURE_2D target for NULL texture
During arbfp codegen we weren't checking for NULL textures and so we would crash when trying to query a NULL texture's GL texture target. Since NULL texture targets result in ctx->default_gl_texture_2d_tex being bound we can assume that a NULL texture corresponds to a GL_TEXTURE_2D target.
-rw-r--r--cogl/cogl-pipeline-fragend-arbfp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cogl/cogl-pipeline-fragend-arbfp.c b/cogl/cogl-pipeline-fragend-arbfp.c
index e121e68c..1eae0e0a 100644
--- a/cogl/cogl-pipeline-fragend-arbfp.c
+++ b/cogl/cogl-pipeline-fragend-arbfp.c
@@ -390,7 +390,10 @@ setup_arg (CoglPipeline *pipeline,
arg->name = "texel%d";
arg->texture_unit = _cogl_pipeline_layer_get_unit_index (layer);
texture = _cogl_pipeline_layer_get_texture (layer);
- cogl_texture_get_gl_texture (texture, NULL, &gl_target);
+ if (texture)
+ cogl_texture_get_gl_texture (texture, NULL, &gl_target);
+ else
+ gl_target = GL_TEXTURE_2D;
setup_texture_source (shader_state, arg->texture_unit, gl_target);
break;
case COGL_PIPELINE_COMBINE_SOURCE_CONSTANT:
@@ -423,7 +426,10 @@ setup_arg (CoglPipeline *pipeline,
arg->name = "texture[%d]";
arg->texture_unit = src - GL_TEXTURE0;
texture = _cogl_pipeline_layer_get_texture (layer);
- cogl_texture_get_gl_texture (texture, NULL, &gl_target);
+ if (texture)
+ cogl_texture_get_gl_texture (texture, NULL, &gl_target);
+ else
+ gl_target = GL_TEXTURE_2D;
setup_texture_source (shader_state, arg->texture_unit, gl_target);
}