Mesa (master): i965/gen6: Fix crash with VS+TF after rendering with GS

Iago Toral Quiroga itoral at kemper.freedesktop.org
Fri Jan 16 13:19:37 UTC 2015


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

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Wed Jan  7 10:08:57 2015 +0100

i965/gen6: Fix crash with VS+TF after rendering with GS

Rendering with a GS and then using transform feedback with a program that does
not have a GS can crash in gen6. The reason for this is that
brw_begin_transform_feedback checks brw->geometry_program to decide if there
is a GS program, but this is not correct: brw->geometry_program is updated when
issuing drawing commands, so after rendering with a GS it will be non-NULL
until we draw again with a program that does not have a GS. If the next
program uses TF, we will call glBegintransformFeedback before issuing
the drawing command and hence brw->geometry_program will be non-NULL if
the previous rendering used a GS. The right thing to do here is to check
ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY] instead. This is what the
gen7 code path does too.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=87694

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

---

 src/mesa/drivers/dri/i965/gen6_sol.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
index 0dafd0f..ff93de3 100644
--- a/src/mesa/drivers/dri/i965/gen6_sol.c
+++ b/src/mesa/drivers/dri/i965/gen6_sol.c
@@ -241,7 +241,7 @@ brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
 
    assert(brw->gen == 6);
 
-   if (brw->geometry_program) {
+   if (ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]) {
       /* BRW_NEW_GEOMETRY_PROGRAM */
       shaderprog =
          ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];




More information about the mesa-commit mailing list