gallium: standardize on stride instead of pitch in the interface
authorZack Rusin <zack@tungstengraphics.com>
Mon, 26 Jan 2009 18:45:45 +0000 (13:45 -0500)
committerZack Rusin <zackr@vmware.com>
Tue, 27 Jan 2009 17:20:25 +0000 (12:20 -0500)
14 files changed:
src/gallium/auxiliary/draw/draw_pt.c
src/gallium/auxiliary/draw/draw_pt_fetch.c
src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
src/gallium/auxiliary/util/u_draw_quad.c
src/gallium/drivers/i965simple/brw_draw_upload.c
src/gallium/drivers/nv30/nv30_vbo.c
src/gallium/drivers/nv40/nv40_vbo.c
src/gallium/drivers/nv50/nv50_vbo.c
src/gallium/drivers/trace/tr_state.c
src/gallium/include/pipe/p_screen.h
src/gallium/include/pipe/p_state.h
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_draw_feedback.c

index 18f24e5..4e5ffa0 100644 (file)
@@ -228,7 +228,7 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count)
       for (j = 0; j < draw->pt.nr_vertex_elements; j++) {
          uint buf = draw->pt.vertex_element[j].vertex_buffer_index;
          ubyte *ptr = (ubyte *) draw->pt.user.vbuffer[buf];
-         ptr += draw->pt.vertex_buffer[buf].pitch * ii;
+         ptr += draw->pt.vertex_buffer[buf].stride * ii;
          ptr += draw->pt.vertex_element[j].src_offset;
 
          debug_printf("  Attr %u: ", j);
@@ -301,8 +301,8 @@ draw_arrays(struct draw_context *draw, unsigned prim,
       }
       debug_printf("Buffers:\n");
       for (i = 0; i < draw->pt.nr_vertex_buffers; i++) {
-         debug_printf("  pitch=%u offset=%u ptr=%p\n",
-                      draw->pt.vertex_buffer[i].pitch,
+         debug_printf("  stride=%u offset=%u ptr=%p\n",
+                      draw->pt.vertex_buffer[i].stride,
                       draw->pt.vertex_buffer[i].buffer_offset,
                       draw->pt.user.vbuffer[i]);
       }
index 6377f89..058caf7 100644 (file)
@@ -144,7 +144,7 @@ void draw_pt_fetch_run( struct pt_fetch *fetch,
                            i, 
                            ((char *)draw->pt.user.vbuffer[i] + 
                             draw->pt.vertex_buffer[i].buffer_offset),
-                           draw->pt.vertex_buffer[i].pitch );
+                           draw->pt.vertex_buffer[i].stride );
    }
 
    translate->run_elts( translate,
@@ -180,7 +180,7 @@ void draw_pt_fetch_run_linear( struct pt_fetch *fetch,
                            i,
                            ((char *)draw->pt.user.vbuffer[i] +
                             draw->pt.vertex_buffer[i].buffer_offset),
-                           draw->pt.vertex_buffer[i].pitch );
+                           draw->pt.vertex_buffer[i].stride );
    }
 
    translate->run( translate,
index 0227652..dcb7744 100644 (file)
@@ -195,7 +195,7 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
                                   i, 
                                   ((char *)draw->pt.user.vbuffer[i] + 
                                    draw->pt.vertex_buffer[i].buffer_offset),
-                                  draw->pt.vertex_buffer[i].pitch );
+                                  draw->pt.vertex_buffer[i].stride );
    }
 
    *max_vertices = (draw->render->max_vertex_buffer_bytes / 
index 1649cdc..84ffe32 100644 (file)
@@ -121,7 +121,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
    }
    
    for (i = 0; i < 5 && i < nr_vbs; i++) {
-      if (draw->pt.vertex_buffer[i].pitch == 0)
+      if (draw->pt.vertex_buffer[i].stride == 0)
          fse->key.const_vbuffers |= (1<<i);
    }
 
@@ -189,7 +189,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
                                i, 
                                ((const ubyte *) draw->pt.user.vbuffer[i] + 
                                 draw->pt.vertex_buffer[i].buffer_offset),
-                              draw->pt.vertex_buffer[i].pitch );
+                              draw->pt.vertex_buffer[i].stride );
    }
 
    *max_vertices = (draw->render->max_vertex_buffer_bytes / 
index d7bb74b..1af5755 100644 (file)
@@ -53,7 +53,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
 
    /* tell pipe about the vertex buffer */
    vbuffer.buffer = vbuf;
-   vbuffer.pitch = num_attribs * 4 * sizeof(float);  /* vertex size */
+   vbuffer.stride = num_attribs * 4 * sizeof(float);  /* vertex size */
    vbuffer.buffer_offset = offset;
    pipe->set_vertex_buffers(pipe, 1, &vbuffer);
 
index 7c20ea5..2d9ca3f 100644 (file)
@@ -223,7 +223,7 @@ boolean brw_upload_vertex_buffers( struct brw_context *brw )
         break;
       }
 
-      vbp.vb[i].vb0.bits.pitch = brw->vb.vbo_array[i]->pitch;
+      vbp.vb[i].vb0.bits.pitch = brw->vb.vbo_array[i]->stride;
       vbp.vb[i].vb0.bits.pad = 0;
       vbp.vb[i].vb0.bits.access_type = BRW_VERTEXBUFFER_ACCESS_VERTEXDATA;
       vbp.vb[i].vb0.bits.vb_index = i;
index 556f981..2d6d48a 100644 (file)
@@ -503,7 +503,7 @@ nv30_vbo_validate(struct nv30_context *nv30)
                ve = &nv30->vtxelt[hw];
                vb = &nv30->vtxbuf[ve->vertex_buffer_index];
 
-               if (!vb->pitch) {
+               if (!vb->stride) {
                        if (!sattr)
                                sattr = so_new(16 * 5, 0);
 
@@ -524,7 +524,7 @@ nv30_vbo_validate(struct nv30_context *nv30)
                so_reloc(vtxbuf, vb->buffer, vb->buffer_offset + ve->src_offset,
                         vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
                         0, NV34TCL_VTXBUF_ADDRESS_DMA1);
-               so_data (vtxfmt, ((vb->pitch << NV34TCL_VTXFMT_STRIDE_SHIFT) |
+               so_data (vtxfmt, ((vb->stride << NV34TCL_VTXFMT_STRIDE_SHIFT) |
                                  (ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | type));
        }
 
index 09f6e79..8f18346 100644 (file)
@@ -501,7 +501,7 @@ nv40_vbo_validate(struct nv40_context *nv40)
                ve = &nv40->vtxelt[hw];
                vb = &nv40->vtxbuf[ve->vertex_buffer_index];
 
-               if (!vb->pitch) {
+               if (!vb->stride) {
                        if (!sattr)
                                sattr = so_new(16 * 5, 0);
 
@@ -522,7 +522,7 @@ nv40_vbo_validate(struct nv40_context *nv40)
                so_reloc(vtxbuf, vb->buffer, vb->buffer_offset + ve->src_offset,
                         vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
                         0, NV40TCL_VTXBUF_ADDRESS_DMA1);
-               so_data (vtxfmt, ((vb->pitch << NV40TCL_VTXFMT_STRIDE_SHIFT) |
+               so_data (vtxfmt, ((vb->stride << NV40TCL_VTXFMT_STRIDE_SHIFT) |
                                  (ncomp << NV40TCL_VTXFMT_SIZE_SHIFT) | type));
        }
 
index 435dc97..c482a4c 100644 (file)
@@ -226,7 +226,7 @@ nv50_vbo_validate(struct nv50_context *nv50)
                }
 
                so_method(vtxbuf, tesla, 0x900 + (i * 16), 3);
-               so_data  (vtxbuf, 0x20000000 | vb->pitch);
+               so_data  (vtxbuf, 0x20000000 | vb->stride);
                so_reloc (vtxbuf, vb->buffer, vb->buffer_offset +
                          ve->src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
                          NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
index 986d939..5462316 100644 (file)
@@ -280,7 +280,7 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_
       trace_dump_member(uint, &state->stencil[i], fail_op);
       trace_dump_member(uint, &state->stencil[i], zpass_op);
       trace_dump_member(uint, &state->stencil[i], zfail_op);
-      trace_dump_member(uint, &state->stencil[i], ref_value);    
+      trace_dump_member(uint, &state->stencil[i], ref_value);
       trace_dump_member(uint, &state->stencil[i], value_mask);
       trace_dump_member(uint, &state->stencil[i], write_mask);
       trace_dump_struct_end();
@@ -435,7 +435,7 @@ void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
 
    trace_dump_struct_begin("pipe_vertex_buffer");
 
-   trace_dump_member(uint, state, pitch);
+   trace_dump_member(uint, state, stride);
    trace_dump_member(uint, state, max_index);
    trace_dump_member(uint, state, buffer_offset);
    trace_dump_member(ptr, state, buffer);
index 3bedc75..492667c 100644 (file)
@@ -103,7 +103,7 @@ struct pipe_screen {
     */
    struct pipe_texture * (*texture_blanket)(struct pipe_screen *,
                                             const struct pipe_texture *templat,
-                                            const unsigned *pitch,
+                                            const unsigned *stride,
                                             struct pipe_buffer *buffer);
 
    void (*texture_release)(struct pipe_screen *,
index abe7cbe..46f62ab 100644 (file)
@@ -337,7 +337,7 @@ struct pipe_texture
  */
 struct pipe_vertex_buffer
 {
-   unsigned pitch;    /**< stride to same attrib in next vertex, in bytes */
+   unsigned stride;    /**< stride to same attrib in next vertex, in bytes */
    unsigned max_index;   /**< number of vertices in this buffer */
    unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes */
    struct pipe_buffer *buffer;  /**< the actual buffer */
index 31383b4..630ad2b 100644 (file)
@@ -381,7 +381,7 @@ setup_interleaved_attribs(GLcontext *ctx,
             pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer);
             vbuffer->buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
          }
-         vbuffer->pitch = stride; /* in bytes */
+         vbuffer->stride = stride; /* in bytes */
          vbuffer->max_index = max_index;
       }
 
@@ -472,7 +472,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
       assert(velements[attr].src_offset <= 2048); /* 11-bit field */
 
       /* common-case setup */
-      vbuffer[attr].pitch = stride; /* in bytes */
+      vbuffer[attr].stride = stride; /* in bytes */
       vbuffer[attr].max_index = max_index;
       velements[attr].vertex_buffer_index = attr;
       velements[attr].nr_components = arrays[mesaAttr]->Size;
@@ -569,7 +569,7 @@ st_draw_vbo(GLcontext *ctx,
    {
       GLuint i;
       for (i = 0; i < num_vbuffers; i++) {
-         printf("buffers[%d].pitch = %u\n", i, vbuffer[i].pitch);
+         printf("buffers[%d].stride = %u\n", i, vbuffer[i].stride);
          printf("buffers[%d].max_index = %u\n", i, vbuffer[i].max_index);
          printf("buffers[%d].buffer_offset = %u\n", i, vbuffer[i].buffer_offset);
          printf("buffers[%d].buffer = %p\n", i, (void*) vbuffer[i].buffer);
index 834c384..5c9c450 100644 (file)
@@ -171,7 +171,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
       }
 
       /* common-case setup */
-      vbuffers[attr].pitch = arrays[mesaAttr]->StrideB; /* in bytes */
+      vbuffers[attr].stride = arrays[mesaAttr]->StrideB; /* in bytes */
       vbuffers[attr].max_index = max_index;
       velements[attr].vertex_buffer_index = attr;
       velements[attr].nr_components = arrays[mesaAttr]->Size;