Undo indexOffset change (I think, git???)
authorBrian <brian.paul@tungstengraphics.com>
Wed, 24 Oct 2007 20:34:40 +0000 (14:34 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 24 Oct 2007 20:34:40 +0000 (14:34 -0600)
src/mesa/pipe/failover/fo_context.c
src/mesa/pipe/i915simple/i915_context.c
src/mesa/pipe/p_context.h
src/mesa/pipe/softpipe/sp_draw_arrays.c
src/mesa/pipe/softpipe/sp_state.h
src/mesa/state_tracker/st_draw.c

index 076d5165833d783fc8f8dc1795d22ffdab30b23e..b836ef29f3099002be3a89748726ec1efcc45bb7 100644 (file)
@@ -47,7 +47,7 @@ static void failover_destroy( struct pipe_context *pipe )
 
 static boolean failover_draw_elements( struct pipe_context *pipe,
                                       struct pipe_buffer_handle *indexBuffer,
-                                      unsigned indexSize,
+                                      unsigned indexSize, unsigned indexOffset,
                                       unsigned prim, unsigned start, unsigned count)
 {
    struct failover_context *failover = failover_context( pipe );
@@ -65,6 +65,7 @@ static boolean failover_draw_elements( struct pipe_context *pipe,
       if (!failover->hw->draw_elements( failover->hw, 
                                        indexBuffer, 
                                        indexSize, 
+                                        indexOffset,
                                        prim, 
                                        start, 
                                        count )) {
@@ -84,6 +85,7 @@ static boolean failover_draw_elements( struct pipe_context *pipe,
       failover->sw->draw_elements( failover->sw, 
                                   indexBuffer, 
                                   indexSize, 
+                                   indexOffset,
                                   prim, 
                                   start, 
                                   count );
@@ -102,7 +104,7 @@ static boolean failover_draw_elements( struct pipe_context *pipe,
 static boolean failover_draw_arrays( struct pipe_context *pipe,
                                     unsigned prim, unsigned start, unsigned count)
 {
-   return failover_draw_elements(pipe, NULL, 0, prim, start, count);
+   return failover_draw_elements(pipe, NULL, 0, 0, prim, start, count);
 }
 
 
index 161f8ce697280fa9b2813ea3a650840914527c24..adc91fb473694246ef829c87b3049f2fd0e00665 100644 (file)
@@ -178,7 +178,7 @@ i915_end_query(struct pipe_context *pipe, struct pipe_query_object *q)
 static boolean
 i915_draw_elements( struct pipe_context *pipe,
                     struct pipe_buffer_handle *indexBuffer,
-                    unsigned indexSize,
+                    unsigned indexSize, unsigned indexOffset,
                     unsigned prim, unsigned start, unsigned count)
 {
    struct i915_context *i915 = i915_context( pipe );
@@ -202,9 +202,10 @@ i915_draw_elements( struct pipe_context *pipe,
    }
    /* Map index buffer, if present */
    if (indexBuffer) {
-      void *mapped_indexes
+      ubyte *mapped_indexes
          = pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
                                     PIPE_BUFFER_FLAG_READ);
+      mapped_indexes += indexOffset;
       draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
    }
    else {
@@ -262,7 +263,7 @@ i915_draw_elements( struct pipe_context *pipe,
 static boolean i915_draw_arrays( struct pipe_context *pipe,
                                 unsigned prim, unsigned start, unsigned count)
 {
-   return i915_draw_elements(pipe, NULL, 0, prim, start, count);
+   return i915_draw_elements(pipe, NULL, 0, 0, prim, start, count);
 }
 
 
index 2558a6341ce53bc7481c40d8dbd78bb6c3471f57..08082f9367f87972abf4df71824e07f23c22dec3 100644 (file)
@@ -71,7 +71,7 @@ struct pipe_context {
 
    boolean (*draw_elements)( struct pipe_context *pipe,
                             struct pipe_buffer_handle *indexBuffer,
-                            unsigned indexSize,
+                            unsigned indexSize, unsigned indexOffset,
                             unsigned mode, unsigned start, unsigned count);
 
    /** Clear a surface to given value (no scissor; clear whole surface) */
index 64a4fbe333e0b9b74cf1728029ed3b2ba958678f..d5cd6beae893d41f98b6129209657d09ab2276dc 100644 (file)
@@ -75,7 +75,7 @@ boolean
 softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
                      unsigned start, unsigned count)
 {
-   return softpipe_draw_elements(pipe, NULL, 0, mode, start, count);
+   return softpipe_draw_elements(pipe, NULL, 0, 0, mode, start, count);
 }
 
 
@@ -90,7 +90,7 @@ softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
 boolean
 softpipe_draw_elements(struct pipe_context *pipe,
                        struct pipe_buffer_handle *indexBuffer,
-                       unsigned indexSize,
+                       unsigned indexSize, unsigned indexOffset,
                        unsigned mode, unsigned start, unsigned count)
 {
    struct softpipe_context *sp = softpipe_context(pipe);
@@ -130,9 +130,10 @@ softpipe_draw_elements(struct pipe_context *pipe,
    }
    /* Map index buffer, if present */
    if (indexBuffer) {
-      void *mapped_indexes
+      ubyte *mapped_indexes
          = pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
                                     PIPE_BUFFER_FLAG_READ);
+      mapped_indexes += indexOffset;
       draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
    }
    else {
index c194f0ea0db1276566a9118826a0061e7f20620a..8747f34cdd9becaee8053f9c178e50d4f8b559e5 100644 (file)
@@ -131,7 +131,7 @@ boolean softpipe_draw_arrays(struct pipe_context *pipe, unsigned mode,
 
 boolean softpipe_draw_elements(struct pipe_context *pipe,
                               struct pipe_buffer_handle *indexBuffer,
-                              unsigned indexSize,
+                              unsigned indexSize, unsigned indexOffset,
                               unsigned mode, unsigned start, unsigned count);
 
 
index fbf7713f58d054d94a729c47bd0c37de3f3934e1..50251a816b82cff5891878520c438d20272ac3df 100644 (file)
@@ -197,7 +197,7 @@ st_draw_vbo(GLcontext *ctx,
       /* indexed primitive */
       struct gl_buffer_object *bufobj = ib->obj;
       struct pipe_buffer_handle *indexBuf = NULL;
-      unsigned indexSize, i;
+      unsigned indexSize, indexOffset, i;
 
       switch (ib->type) {
       case GL_UNSIGNED_INT:
@@ -218,17 +218,19 @@ st_draw_vbo(GLcontext *ctx,
          /* elements/indexes are in a real VBO */
          struct st_buffer_object *stobj = st_buffer_object(bufobj);
          winsys->buffer_reference(winsys, &indexBuf, stobj->buffer);
+         indexOffset = (unsigned) ib->ptr;
       }
       else {
          /* element/indicies are in user space memory */
          indexBuf = winsys->user_buffer_create(winsys,
                                                (void *) ib->ptr,
                                                ib->count * indexSize);
+         indexOffset = 0;
       }
 
       /* draw */
       for (i = 0; i < nr_prims; i++) {
-         pipe->draw_elements(pipe, indexBuf, indexSize,
+         pipe->draw_elements(pipe, indexBuf, indexSize, indexOffset,
                              prims[i].mode, prims[i].start, prims[i].count);
       }