summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv30/nv30_vbo.c
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-02-20 18:37:43 +0100
committerYounes Manton <[email protected]>2010-03-15 00:03:01 -0400
commitb8e56d4cddbd9c491b940e3ce5974c526802c752 (patch)
tree6ae0a1030c6a43c6596393b787cea3d7b7e23352 /src/gallium/drivers/nv30/nv30_vbo.c
parentd673c92810636dcc6de33d3618d494ce9f5717c1 (diff)
nv30, nv40: unify all structures and headers, except shaders
This patch unifies nv[34]0_screen.h, nv[34]0_context.h and nv[34]0_state.h The unified files are put in a new "nvfx" directory. nv30_context.h and nv40_context.h still exist to hold the function prototypes and include nvfx_context.h nv[34]0_screen.h and nv[34]0_state.h are deleted, replaced by the unified versions. nv40 includes some extra fields for swtnl and user clip planes support. These fields will be unused on nv30 until that functionality gets added to it too (by unification with nv40).
Diffstat (limited to 'src/gallium/drivers/nv30/nv30_vbo.c')
-rw-r--r--src/gallium/drivers/nv30/nv30_vbo.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c
index c7f119e90a0..119fa59890e 100644
--- a/src/gallium/drivers/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nv30/nv30_vbo.c
@@ -4,7 +4,7 @@
#include "util/u_format.h"
#include "nv30_context.h"
-#include "nv30_state.h"
+#include "nvfx_state.h"
#include "nouveau/nouveau_channel.h"
#include "nouveau/nouveau_pushbuf.h"
@@ -69,15 +69,15 @@ nv30_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
}
static boolean
-nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib,
+nv30_vbo_set_idxbuf(struct nvfx_context *nvfx, struct pipe_buffer *ib,
unsigned ib_size)
{
- struct pipe_screen *pscreen = &nv30->screen->base.base;
+ struct pipe_screen *pscreen = &nvfx->screen->base.base;
unsigned type;
if (!ib) {
- nv30->idxbuf = NULL;
- nv30->idxbuf_format = 0xdeadbeef;
+ nvfx->idxbuf = NULL;
+ nvfx->idxbuf_format = 0xdeadbeef;
return FALSE;
}
@@ -95,23 +95,23 @@ nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib,
return FALSE;
}
- if (ib != nv30->idxbuf ||
- type != nv30->idxbuf_format) {
- nv30->dirty |= NV30_NEW_ARRAYS;
- nv30->idxbuf = ib;
- nv30->idxbuf_format = type;
+ if (ib != nvfx->idxbuf ||
+ type != nvfx->idxbuf_format) {
+ nvfx->dirty |= NVFX_NEW_ARRAYS;
+ nvfx->idxbuf = ib;
+ nvfx->idxbuf_format = type;
}
return TRUE;
}
static boolean
-nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
+nv30_vbo_static_attrib(struct nvfx_context *nvfx, struct nouveau_stateobj *so,
int attrib, struct pipe_vertex_element *ve,
struct pipe_vertex_buffer *vb)
{
- struct pipe_screen *pscreen = nv30->pipe.screen;
- struct nouveau_grobj *eng3d = nv30->screen->eng3d;
+ struct pipe_screen *pscreen = nvfx->pipe.screen;
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
unsigned type, ncomp;
void *map;
@@ -168,14 +168,14 @@ void
nv30_draw_arrays(struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
struct nouveau_grobj *eng3d = screen->eng3d;
unsigned restart = 0;
- nv30_vbo_set_idxbuf(nv30, NULL, 0);
- if (FORCE_SWTNL || !nv30_state_validate(nv30)) {
+ nv30_vbo_set_idxbuf(nvfx, NULL, 0);
+ if (FORCE_SWTNL || !nv30_state_validate(nvfx)) {
/*return nv30_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);*/
return;
@@ -184,7 +184,7 @@ nv30_draw_arrays(struct pipe_context *pipe,
while (count) {
unsigned vc, nr;
- nv30_state_emit(nv30);
+ nv30_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
mode, start, count, &restart);
@@ -227,10 +227,10 @@ nv30_draw_arrays(struct pipe_context *pipe,
}
static INLINE void
-nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
+nv30_draw_elements_u08(struct nvfx_context *nvfx, void *ib,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
struct nouveau_grobj *eng3d = screen->eng3d;
@@ -238,7 +238,7 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
uint8_t *elts = (uint8_t *)ib + start;
unsigned vc, push, restart = 0;
- nv30_state_emit(nv30);
+ nv30_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
mode, start, count, &restart);
@@ -278,10 +278,10 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
}
static INLINE void
-nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
+nv30_draw_elements_u16(struct nvfx_context *nvfx, void *ib,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
struct nouveau_grobj *eng3d = screen->eng3d;
@@ -289,7 +289,7 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
uint16_t *elts = (uint16_t *)ib + start;
unsigned vc, push, restart = 0;
- nv30_state_emit(nv30);
+ nv30_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
mode, start, count, &restart);
@@ -329,10 +329,10 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
}
static INLINE void
-nv30_draw_elements_u32(struct nv30_context *nv30, void *ib,
+nv30_draw_elements_u32(struct nvfx_context *nvfx, void *ib,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
struct nouveau_grobj *eng3d = screen->eng3d;
@@ -340,7 +340,7 @@ nv30_draw_elements_u32(struct nv30_context *nv30, void *ib,
uint32_t *elts = (uint32_t *)ib + start;
unsigned vc, push, restart = 0;
- nv30_state_emit(nv30);
+ nv30_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1,
mode, start, count, &restart);
@@ -375,7 +375,7 @@ nv30_draw_elements_inline(struct pipe_context *pipe,
struct pipe_buffer *ib, unsigned ib_size,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_context *nv30 = nv30_context(pipe);
+ struct nvfx_context *nvfx = nvfx_context(pipe);
struct pipe_screen *pscreen = pipe->screen;
void *map;
@@ -387,13 +387,13 @@ nv30_draw_elements_inline(struct pipe_context *pipe,
switch (ib_size) {
case 1:
- nv30_draw_elements_u08(nv30, map, mode, start, count);
+ nv30_draw_elements_u08(nvfx, map, mode, start, count);
break;
case 2:
- nv30_draw_elements_u16(nv30, map, mode, start, count);
+ nv30_draw_elements_u16(nvfx, map, mode, start, count);
break;
case 4:
- nv30_draw_elements_u32(nv30, map, mode, start, count);
+ nv30_draw_elements_u32(nvfx, map, mode, start, count);
break;
default:
NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size);
@@ -407,8 +407,8 @@ static void
nv30_draw_elements_vbo(struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
struct nouveau_grobj *eng3d = screen->eng3d;
unsigned restart = 0;
@@ -416,7 +416,7 @@ nv30_draw_elements_vbo(struct pipe_context *pipe,
while (count) {
unsigned nr, vc;
- nv30_state_emit(nv30);
+ nv30_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
mode, start, count, &restart);
@@ -461,11 +461,11 @@ nv30_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer, unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_context *nv30 = nv30_context(pipe);
+ struct nvfx_context *nvfx = nvfx_context(pipe);
boolean idxbuf;
- idxbuf = nv30_vbo_set_idxbuf(nv30, indexBuffer, indexSize);
- if (FORCE_SWTNL || !nv30_state_validate(nv30)) {
+ idxbuf = nv30_vbo_set_idxbuf(nvfx, indexBuffer, indexSize);
+ if (FORCE_SWTNL || !nv30_state_validate(nvfx)) {
/*return nv30_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);*/
return;
@@ -482,33 +482,33 @@ nv30_draw_elements(struct pipe_context *pipe,
}
static boolean
-nv30_vbo_validate(struct nv30_context *nv30)
+nv30_vbo_validate(struct nvfx_context *nvfx)
{
struct nouveau_stateobj *vtxbuf, *vtxfmt, *sattr = NULL;
- struct nouveau_grobj *eng3d = nv30->screen->eng3d;
- struct pipe_buffer *ib = nv30->idxbuf;
- unsigned ib_format = nv30->idxbuf_format;
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+ struct pipe_buffer *ib = nvfx->idxbuf;
+ unsigned ib_format = nvfx->idxbuf_format;
unsigned vb_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
int hw;
vtxbuf = so_new(3, 17, 18);
- so_method(vtxbuf, eng3d, NV34TCL_VTXBUF_ADDRESS(0), nv30->vtxelt->num_elements);
+ so_method(vtxbuf, eng3d, NV34TCL_VTXBUF_ADDRESS(0), nvfx->vtxelt->num_elements);
vtxfmt = so_new(1, 16, 0);
- so_method(vtxfmt, eng3d, NV34TCL_VTXFMT(0), nv30->vtxelt->num_elements);
+ so_method(vtxfmt, eng3d, NV34TCL_VTXFMT(0), nvfx->vtxelt->num_elements);
- for (hw = 0; hw < nv30->vtxelt->num_elements; hw++) {
+ for (hw = 0; hw < nvfx->vtxelt->num_elements; hw++) {
struct pipe_vertex_element *ve;
struct pipe_vertex_buffer *vb;
unsigned type, ncomp;
- ve = &nv30->vtxelt->pipe[hw];
- vb = &nv30->vtxbuf[ve->vertex_buffer_index];
+ ve = &nvfx->vtxelt->pipe[hw];
+ vb = &nvfx->vtxbuf[ve->vertex_buffer_index];
if (!vb->stride) {
if (!sattr)
sattr = so_new(16, 16 * 4, 0);
- if (nv30_vbo_static_attrib(nv30, sattr, hw, ve, vb)) {
+ if (nv30_vbo_static_attrib(nvfx, sattr, hw, ve, vb)) {
so_data(vtxbuf, 0);
so_data(vtxfmt, NV34TCL_VTXFMT_TYPE_FLOAT);
continue;
@@ -516,7 +516,7 @@ nv30_vbo_validate(struct nv30_context *nv30)
}
if (nv30_vbo_format_to_hw(ve->src_format, &type, &ncomp)) {
- /*nv30->fallback_swtnl |= NV30_NEW_ARRAYS;*/
+ /*nvfx->fallback_swtnl |= NVFX_NEW_ARRAYS;*/
so_ref(NULL, &vtxbuf);
so_ref(NULL, &vtxfmt);
return FALSE;
@@ -541,22 +541,22 @@ nv30_vbo_validate(struct nv30_context *nv30)
so_method(vtxbuf, eng3d, 0x1710, 1);
so_data (vtxbuf, 0);
- so_ref(vtxbuf, &nv30->state.hw[NV30_STATE_VTXBUF]);
+ so_ref(vtxbuf, &nvfx->state.hw[NVFX_STATE_VTXBUF]);
so_ref(NULL, &vtxbuf);
- nv30->state.dirty |= (1ULL << NV30_STATE_VTXBUF);
- so_ref(vtxfmt, &nv30->state.hw[NV30_STATE_VTXFMT]);
+ nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXBUF);
+ so_ref(vtxfmt, &nvfx->state.hw[NVFX_STATE_VTXFMT]);
so_ref(NULL, &vtxfmt);
- nv30->state.dirty |= (1ULL << NV30_STATE_VTXFMT);
- so_ref(sattr, &nv30->state.hw[NV30_STATE_VTXATTR]);
+ nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXFMT);
+ so_ref(sattr, &nvfx->state.hw[NVFX_STATE_VTXATTR]);
so_ref(NULL, &sattr);
- nv30->state.dirty |= (1ULL << NV30_STATE_VTXATTR);
+ nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXATTR);
return FALSE;
}
-struct nv30_state_entry nv30_state_vbo = {
+struct nvfx_state_entry nv30_state_vbo = {
.validate = nv30_vbo_validate,
.dirty = {
- .pipe = NV30_NEW_ARRAYS,
+ .pipe = NVFX_NEW_ARRAYS,
.hw = 0,
}
};