From af7315e58b8bfe230f7b4c5a8d5b669d67aab9f0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 26 Aug 2009 12:07:52 -0600 Subject: [PATCH] i965: added texture unit sanity check Check that all the textures needed by the current fragment program actually exist and are valid. --- src/mesa/drivers/dri/i965/brw_state_upload.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 95d42d2dcc5..414620d0b39 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -322,6 +322,19 @@ void brw_validate_state( struct brw_context *brw ) } } } + + /* Make sure that the textures which are referenced by the current + * brw fragment program are actually present/valid. + * If this fails, we can experience GPU lock-ups. + */ + { + const struct brw_fragment_program *fp; + fp = brw_fragment_program_const(brw->fragment_program); + if (fp) { + assert((fp->tex_units_used & ctx->Texture._EnabledUnits) + == fp->tex_units_used); + } + } } -- 2.30.2