Mesa (master): r300: Fix crash reported in bug #24066

Brian Paul brianp at kemper.freedesktop.org
Tue Sep 22 22:07:15 UTC 2009


Module: Mesa
Branch: master
Commit: 8cc12ffb34769a84050be034d19921af811a3406
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8cc12ffb34769a84050be034d19921af811a3406

Author: Nicolai Hähnle <nhaehnle at gmail.com>
Date:   Tue Sep 22 20:57:05 2009 +0200

r300: Fix crash reported in bug #24066

Signed-off-by: Nicolai Hähnle <nhaehnle at gmail.com>

---

 src/mesa/drivers/dri/r300/r300_vertprog.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 0cb7dde..2f7b67c 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -43,6 +43,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "compiler/radeon_compiler.h"
 #include "compiler/radeon_nqssadce.h"
 #include "r300_context.h"
+#include "r300_fragprog_common.h"
 #include "r300_state.h"
 
 /**
@@ -298,6 +299,20 @@ struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx)
 	struct r300_vertex_program *vp;
 
 	vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current;
+
+	if (!r300->selected_fp) {
+		/* This can happen when GetProgramiv is called to check
+		 * whether the program runs natively.
+		 *
+		 * To be honest, this is not a very good solution,
+		 * but solving the problem of reporting good values
+		 * for those queries is tough anyway considering that
+		 * we recompile vertex programs based on the precise
+		 * fragment program that is in use.
+		 */
+		r300SelectAndTranslateFragmentShader(ctx);
+	}
+
 	wanted_key.FpReads = r300->selected_fp->InputsRead;
 	wanted_key.FogAttr = r300->selected_fp->fog_attr;
 	wanted_key.WPosAttr = r300->selected_fp->wpos_attr;




More information about the mesa-commit mailing list