In i915/i830_emit_state(), check if state->draw_region is non-null.
authorBrian <brian@i915.localnet.net>
Tue, 31 Jul 2007 18:49:11 +0000 (12:49 -0600)
committerBrian <brian@i915.localnet.net>
Tue, 31 Jul 2007 18:49:11 +0000 (12:49 -0600)
This fixes a problem hit by glClear in the samples/stencil.c program.

src/mesa/drivers/dri/i915tex/i830_vtbl.c
src/mesa/drivers/dri/i915tex/i915_vtbl.c

index 20c6900025ebb7a4f49337d649228009faf28ede..5cde80a469c6ccf18e1e0818cd9459f5ae5e1b29 100644 (file)
@@ -452,13 +452,14 @@ i830_emit_state(struct intel_context *intel)
    if (dirty & I830_UPLOAD_BUFFERS) {
       DBG("I830_UPLOAD_BUFFERS:\n");
       BEGIN_BATCH(I830_DEST_SETUP_SIZE + 2, 0);
-      OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR0]);
-      OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR1]);
-      OUT_RELOC(state->draw_region->buffer,
-                DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
-                DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE,
-                state->draw_region->draw_offset);
-
+      if (state->draw_region->buffer) {
+         OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR0]);
+         OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR1]);
+         OUT_RELOC(state->draw_region->buffer,
+                   DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
+                   DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE,
+                   state->draw_region->draw_offset);
+      }
       if (state->depth_region) {
          OUT_BATCH(state->Buffer[I830_DESTREG_DBUFADDR0]);
          OUT_BATCH(state->Buffer[I830_DESTREG_DBUFADDR1]);
index cc74ceae18010bc144dffbc82a4bdf0246420d0a..b836241a638bf6716a67bd283f2ab680ffc3296c 100644 (file)
@@ -328,13 +328,14 @@ i915_emit_state(struct intel_context *intel)
       if (INTEL_DEBUG & DEBUG_STATE)
          fprintf(stderr, "I915_UPLOAD_BUFFERS:\n");
       BEGIN_BATCH(I915_DEST_SETUP_SIZE + 2, 0);
-      OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR0]);
-      OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR1]);
-      OUT_RELOC(state->draw_region->buffer,
-                DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
-                DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE,
-                state->draw_region->draw_offset);
-
+      if (state->draw_region) {
+         OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR0]);
+         OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR1]);
+         OUT_RELOC(state->draw_region->buffer,
+                   DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
+                   DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE,
+                   state->draw_region->draw_offset);
+      }
       if (state->depth_region) {
          OUT_BATCH(state->Buffer[I915_DESTREG_DBUFADDR0]);
          OUT_BATCH(state->Buffer[I915_DESTREG_DBUFADDR1]);