gallium: standardize on stride instead of pitch in the interface
[mesa.git] / src / gallium / drivers / nv40 / nv40_vbo.c
index e5f9bd5668a307737ff2ba6c0ea62d9637b12acb..8f1834628f7a010dfc234283b1355a97ce5efef2 100644 (file)
@@ -1,6 +1,5 @@
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
-#include "pipe/p_util.h"
 
 #include "nv40_context.h"
 #include "nv40_state.h"
@@ -14,8 +13,6 @@
 static INLINE int
 nv40_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
 {
-       char fs[128];
-
        switch (pipe) {
        case PIPE_FORMAT_R32_FLOAT:
        case PIPE_FORMAT_R32G32_FLOAT:
@@ -36,8 +33,7 @@ nv40_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
                *fmt = NV40TCL_VTXFMT_TYPE_USHORT;
                break;
        default:
-               pf_sprint_name(fs, pipe);
-               NOUVEAU_ERR("Unknown format %s\n", fs);
+               NOUVEAU_ERR("Unknown format %s\n", pf_name(pipe));
                return 1;
        }
 
@@ -63,8 +59,7 @@ nv40_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
                *ncomp = 4;
                break;
        default:
-               pf_sprint_name(fs, pipe);
-               NOUVEAU_ERR("Unknown format %s\n", fs);
+               NOUVEAU_ERR("Unknown format %s\n", pf_name(pipe));
                return 1;
        }
 
@@ -149,7 +144,7 @@ nv40_vbo_static_attrib(struct nv40_context *nv40, struct nouveau_stateobj *so,
                        so_data  (so, fui(v[1]));
                        break;
                case 1:
-                       so_method(so, curie, 0x1e40 + (attrib * 4), 1);
+                       so_method(so, curie, NV40TCL_VTX_ATTR_1F(attrib), 1);
                        so_data  (so, fui(v[0]));
                        break;
                default:
@@ -506,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);
 
@@ -527,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));
        }