pipeline: Avoid reseting texture target for NULL textures
When setting a NULL texture on a CoglPipeline we would also reset the texture target to a dummy value of 0. Reseting the target also had the effect of making fragends discard any associated program. In cases where the NULL texture was only transient until a replacement texture could be set we were re-running lots of redundant codegen and shader compilations. Signed-off-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
parent
256274bfcc
commit
098a193802
@ -2384,10 +2384,9 @@ get_texture_target (CoglHandle texture)
|
||||
GLuint ignore_handle;
|
||||
GLenum gl_target;
|
||||
|
||||
if (texture)
|
||||
cogl_texture_get_gl_texture (texture, &ignore_handle, &gl_target);
|
||||
else
|
||||
return 0;/* XXX: An invalid GL target enum */
|
||||
g_return_val_if_fail (texture, 0);
|
||||
|
||||
cogl_texture_get_gl_texture (texture, &ignore_handle, &gl_target);
|
||||
|
||||
return gl_target;
|
||||
}
|
||||
@ -2410,9 +2409,14 @@ cogl_pipeline_set_layer_texture (CoglPipeline *pipeline,
|
||||
* do need to see if they use the same texture targets. Making this
|
||||
* distinction is much simpler if they are in different state
|
||||
* groups.
|
||||
*
|
||||
* Note: if a NULL texture is set then we leave the target unchanged
|
||||
* so we can avoid needlessly invalidating any associated fragment
|
||||
* program.
|
||||
*/
|
||||
_cogl_pipeline_set_layer_texture_target (pipeline, layer_index,
|
||||
get_texture_target (texture));
|
||||
if (texture)
|
||||
_cogl_pipeline_set_layer_texture_target (pipeline, layer_index,
|
||||
get_texture_target (texture));
|
||||
_cogl_pipeline_set_layer_texture_data (pipeline, layer_index, texture);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user