intel: Move the assertions about reloc delta from the macros to the function.
authorEric Anholt <eric@anholt.net>
Fri, 5 Mar 2010 20:40:45 +0000 (12:40 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 5 Mar 2010 23:23:30 +0000 (15:23 -0800)
Cuts another 1800 bytes from the driver.

src/mesa/drivers/dri/intel/intel_batchbuffer.c
src/mesa/drivers/dri/intel/intel_batchbuffer.h

index a7bfd62b285bcb2d88dde88716da796a0e38c056..9768b0deee77891b062ef3aae47377cce4a26b05 100644 (file)
@@ -210,6 +210,8 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
 {
    int ret;
 
+   assert(delta < buffer->size);
+
    if (batch->ptr - batch->map > batch->buf->size)
     printf ("bad relocation ptr %p map %p offset %d size %lu\n",
            batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size);
@@ -234,6 +236,8 @@ intel_batchbuffer_emit_reloc_fenced(struct intel_batchbuffer *batch,
 {
    int ret;
 
+   assert(delta < buffer->size);
+
    if (batch->ptr - batch->map > batch->buf->size)
     printf ("bad relocation ptr %p map %p offset %d size %lu\n",
            batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size);
index 860aa1327a15ddf00e1569a009044646ac3db29d..b7625b5b0d93077875068c3b06b9f15f4950468d 100644 (file)
@@ -128,12 +128,10 @@ static INLINE uint32_t float_as_int(float f)
                                                    float_as_int(f))
 
 #define OUT_RELOC(buf, read_domains, write_domain, delta) do {         \
-   assert((unsigned) (delta) < buf->size);                             \
    intel_batchbuffer_emit_reloc(intel->batch, buf,                     \
                                read_domains, write_domain, delta);     \
 } while (0)
 #define OUT_RELOC_FENCED(buf, read_domains, write_domain, delta) do {  \
-   assert((unsigned) (delta) < buf->size);                             \
    intel_batchbuffer_emit_reloc_fenced(intel->batch, buf,              \
                                       read_domains, write_domain, delta); \
 } while (0)