i915: Check the program size when uploading a program. fix bug 13494
authorXiang, Haihao <haihao.xiang@intel.com>
Fri, 7 Dec 2007 09:26:38 +0000 (17:26 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Fri, 7 Dec 2007 09:26:38 +0000 (17:26 +0800)
src/mesa/drivers/dri/i915/i915_vtbl.c

index 5decffa1165926358c69dfb54970cc72210b18b8..4590057a2fe3cbfeec753f87aba5201798b6c245 100644 (file)
@@ -442,14 +442,16 @@ i915_do_emit_state(struct intel_context *intel)
    }
 
    if (dirty & I915_UPLOAD_PROGRAM) {
-      if (INTEL_DEBUG & DEBUG_STATE)
-         fprintf(stderr, "I915_UPLOAD_PROGRAM:\n");
+      if (ProgramSize) {
+         if (INTEL_DEBUG & DEBUG_STATE)
+            fprintf(stderr, "I915_UPLOAD_PROGRAM:\n");
 
-      assert((state->Program[0] & 0x1ff) + 2 == state->ProgramSize);
+         assert((state->Program[0] & 0x1ff) + 2 == state->ProgramSize);
 
-      emit(intel, state->Program, state->ProgramSize * sizeof(GLuint));
-      if (INTEL_DEBUG & DEBUG_STATE)
-         i915_disassemble_program(state->Program, state->ProgramSize);
+         emit(intel, state->Program, state->ProgramSize * sizeof(GLuint));
+         if (INTEL_DEBUG & DEBUG_STATE)
+            i915_disassemble_program(state->Program, state->ProgramSize);
+      }
    }
 
    intel->batch->dirty_state &= ~dirty;