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 18f24e5980072cc52b957944935b0d8377f31838..4e5ffa09305eb89fdf2c3ac40d1547335c84a624 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 6377f896fb058232697b1a049c6f81757ff47612..058caf7dcc34eb065823440b801db45b432b1573 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 0227652632e4d2669d393c21aa02d5e129ee1a24..dcb7744b177fa8316bc18afea768c2c7f21e4c18 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 1649cdc6cd1a8cf1bf0c1f0bc82ce91a25f0aaa3..84ffe3296af3e31577430f8afb679ac1dfed321c 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 d7bb74b87b4016f3d5aef9c0d309099cb455e0c2..1af575530f5e4158a344fe616f75b797e6b166e9 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 7c20ea52af5b6d8f60636ed83a1e18edad2837d1..2d9ca3f2ea02f53462c477b8506c06c307321a17 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 556f981d4a5781724f25bd8b7b697a0d42e402b3..2d6d48ac161f3034601e7abb20210e9c33fdf876 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 09f6e79d32a08f2196081ea5f7add7c2af457b49..8f1834628f7a010dfc234283b1355a97ce5efef2 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 435dc9777dac701063cf07640ea89507bf878f59..c482a4c241ee0dabfec09ccca66162e3ddbad913 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 986d939e0c6a2fb54269164232af41700bbb288e..546231612fb9930bfe2d9d49d9879bec2eb7f1e2 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 3bedc7529472bb0daa149f9161e117c6812308b5..492667c93ac1fff2179af2ef9642ffd07c1cb389 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 abe7cbe9e7cd143f9c983e3787da1de3cab95a73..46f62abf3fa0648e4cf2d6d4f5036a35eb59f080 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 31383b488749f2aa40a3e727be022c5d31a421d0..630ad2bcdf91e845597fd914752ebcfb607ad657 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 834c3844c4f447566f8e58153add7d3bbcdd10e2..5c9c4506c225615976aaec637ce402d02c07cc72 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;