summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nv30/Makefile1
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h3
-rw-r--r--src/gallium/drivers/nv30/nv30_draw.c61
-rw-r--r--src/gallium/drivers/nv40/Makefile1
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h8
-rw-r--r--src/gallium/drivers/nv40/nv40_vbo.c4
-rw-r--r--src/gallium/drivers/nvfx/Makefile1
-rw-r--r--src/gallium/drivers/nvfx/nvfx_context.h8
-rw-r--r--src/gallium/drivers/nvfx/nvfx_draw.c (renamed from src/gallium/drivers/nv40/nv40_draw.c)83
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_emit.c6
12 files changed, 61 insertions, 119 deletions
diff --git a/src/gallium/drivers/nv30/Makefile b/src/gallium/drivers/nv30/Makefile
index 196cc9a1ef7..791b0040bb8 100644
--- a/src/gallium/drivers/nv30/Makefile
+++ b/src/gallium/drivers/nv30/Makefile
@@ -5,7 +5,6 @@ LIBNAME = nv30
C_SOURCES = \
nv30_context.c \
- nv30_draw.c \
nv30_fragtex.c \
nv30_screen.c \
nv30_state.c \
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
index f13458d50a3..671a1939e8d 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -84,7 +84,7 @@ nv30_create(struct pipe_screen *pscreen, void *priv)
draw_wide_line_threshold(nvfx->draw, 9999999.0);
draw_enable_line_stipple(nvfx->draw, FALSE);
draw_enable_point_sprites(nvfx->draw, FALSE);
- draw_set_rasterize_stage(nvfx->draw, nv30_draw_render_stage(nvfx));
+ draw_set_rasterize_stage(nvfx->draw, nvfx_draw_render_stage(nvfx));
return &nvfx->pipe;
}
diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h
index 7840318363a..ebdd5455ca8 100644
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ b/src/gallium/drivers/nv30/nv30_context.h
@@ -5,9 +5,6 @@
extern void nv30_init_state_functions(struct nvfx_context *nvfx);
-/* nv30_draw.c */
-extern struct draw_stage *nv30_draw_render_stage(struct nvfx_context *nvfx);
-
/* nv30_vertprog.c */
extern void nv30_vertprog_destroy(struct nvfx_context *,
struct nvfx_vertex_program *);
diff --git a/src/gallium/drivers/nv30/nv30_draw.c b/src/gallium/drivers/nv30/nv30_draw.c
deleted file mode 100644
index 5d22e78abf7..00000000000
--- a/src/gallium/drivers/nv30/nv30_draw.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "draw/draw_pipe.h"
-
-#include "nv30_context.h"
-
-struct nv30_draw_stage {
- struct draw_stage draw;
- struct nvfx_context *nvfx;
-};
-
-static void
-nv30_draw_point(struct draw_stage *draw, struct prim_header *prim)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv30_draw_line(struct draw_stage *draw, struct prim_header *prim)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv30_draw_tri(struct draw_stage *draw, struct prim_header *prim)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv30_draw_flush(struct draw_stage *draw, unsigned flags)
-{
-}
-
-static void
-nv30_draw_reset_stipple_counter(struct draw_stage *draw)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv30_draw_destroy(struct draw_stage *draw)
-{
- FREE(draw);
-}
-
-struct draw_stage *
-nv30_draw_render_stage(struct nvfx_context *nvfx)
-{
- struct nv30_draw_stage *nv30draw = CALLOC_STRUCT(nv30_draw_stage);
-
- nv30draw->nvfx = nvfx;
- nv30draw->draw.draw = nvfx->draw;
- nv30draw->draw.point = nv30_draw_point;
- nv30draw->draw.line = nv30_draw_line;
- nv30draw->draw.tri = nv30_draw_tri;
- nv30draw->draw.flush = nv30_draw_flush;
- nv30draw->draw.reset_stipple_counter = nv30_draw_reset_stipple_counter;
- nv30draw->draw.destroy = nv30_draw_destroy;
-
- return &nv30draw->draw;
-}
-
diff --git a/src/gallium/drivers/nv40/Makefile b/src/gallium/drivers/nv40/Makefile
index f3ff376dfde..7529e33a741 100644
--- a/src/gallium/drivers/nv40/Makefile
+++ b/src/gallium/drivers/nv40/Makefile
@@ -5,7 +5,6 @@ LIBNAME = nv40
C_SOURCES = \
nv40_context.c \
- nv40_draw.c \
nv40_fragtex.c \
nv40_screen.c \
nv40_state.c \
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
index 441b038b052..eb831317720 100644
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ b/src/gallium/drivers/nv40/nv40_context.c
@@ -84,7 +84,7 @@ nv40_create(struct pipe_screen *pscreen, void *priv)
draw_wide_line_threshold(nvfx->draw, 9999999.0);
draw_enable_line_stipple(nvfx->draw, FALSE);
draw_enable_point_sprites(nvfx->draw, FALSE);
- draw_set_rasterize_stage(nvfx->draw, nv40_draw_render_stage(nvfx));
+ draw_set_rasterize_stage(nvfx->draw, nvfx_draw_render_stage(nvfx));
return &nvfx->pipe;
}
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
index 4cd56af8f7b..a8aba0c0cab 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -5,13 +5,6 @@
extern void nv40_init_state_functions(struct nvfx_context *nvfx);
-/* nv40_draw.c */
-extern struct draw_stage *nv40_draw_render_stage(struct nvfx_context *nvfx);
-extern void nv40_draw_elements_swtnl(struct pipe_context *pipe,
- struct pipe_buffer *idxbuf,
- unsigned ib_size, unsigned mode,
- unsigned start, unsigned count);
-
/* nv40_vertprog.c */
extern void nv40_vertprog_destroy(struct nvfx_context *,
struct nvfx_vertex_program *);
@@ -23,7 +16,6 @@ extern void nv40_fragtex_bind(struct nvfx_context *);
extern struct nvfx_state_entry nv40_state_vertprog;
extern struct nvfx_state_entry nv40_state_fragtex;
extern struct nvfx_state_entry nv40_state_vbo;
-extern struct nvfx_state_entry nv40_state_vtxfmt;
/* nv40_vbo.c */
extern void nv40_draw_arrays(struct pipe_context *, unsigned mode,
diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c
index 456b508d438..196a12b1f6b 100644
--- a/src/gallium/drivers/nv40/nv40_vbo.c
+++ b/src/gallium/drivers/nv40/nv40_vbo.c
@@ -177,7 +177,7 @@ nv40_draw_arrays(struct pipe_context *pipe,
nv40_vbo_set_idxbuf(nvfx, NULL, 0);
if (FORCE_SWTNL || !nvfx_state_validate(nvfx)) {
- nv40_draw_elements_swtnl(pipe, NULL, 0,
+ nvfx_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);
return;
}
@@ -467,7 +467,7 @@ nv40_draw_elements(struct pipe_context *pipe,
idxbuf = nv40_vbo_set_idxbuf(nvfx, indexBuffer, indexSize);
if (FORCE_SWTNL || !nvfx_state_validate(nvfx)) {
- nv40_draw_elements_swtnl(pipe, NULL, 0,
+ nvfx_draw_elements_swtnl(pipe, NULL, 0,
mode, start, count);
return;
}
diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile
index f8c10a249b5..a23d024f118 100644
--- a/src/gallium/drivers/nvfx/Makefile
+++ b/src/gallium/drivers/nvfx/Makefile
@@ -5,6 +5,7 @@ LIBNAME = nvfx
C_SOURCES = \
nvfx_clear.c \
+ nvfx_draw.c \
nvfx_fragprog.c \
nvfx_miptree.c \
nvfx_query.c \
diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h
index 0a7a0f12527..75008f8dddc 100644
--- a/src/gallium/drivers/nvfx/nvfx_context.h
+++ b/src/gallium/drivers/nvfx/nvfx_context.h
@@ -190,6 +190,7 @@ extern struct nvfx_state_entry nvfx_state_scissor;
extern struct nvfx_state_entry nvfx_state_sr;
extern struct nvfx_state_entry nvfx_state_stipple;
extern struct nvfx_state_entry nvfx_state_viewport;
+extern struct nvfx_state_entry nvfx_state_vtxfmt;
extern struct nvfx_state_entry nvfx_state_zsa;
extern void nvfx_init_query_functions(struct nvfx_context *nvfx);
@@ -199,6 +200,13 @@ extern void nvfx_init_surface_functions(struct nvfx_context *nvfx);
extern void nvfx_clear(struct pipe_context *pipe, unsigned buffers,
const float *rgba, double depth, unsigned stencil);
+/* nvfx_draw.c */
+extern struct draw_stage *nvfx_draw_render_stage(struct nvfx_context *nvfx);
+extern void nvfx_draw_elements_swtnl(struct pipe_context *pipe,
+ struct pipe_buffer *idxbuf,
+ unsigned ib_size, unsigned mode,
+ unsigned start, unsigned count);
+
/* nvfx_fragprog.c */
extern void nvfx_fragprog_destroy(struct nvfx_context *,
struct nvfx_fragment_program *);
diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nvfx/nvfx_draw.c
index 4ed87779fd6..8700e143297 100644
--- a/src/gallium/drivers/nv40/nv40_draw.c
+++ b/src/gallium/drivers/nvfx/nvfx_draw.c
@@ -7,29 +7,30 @@
#include "draw/draw_vertex.h"
#include "draw/draw_pipe.h"
-#include "nv40_context.h"
+#include "nvfx_context.h"
#define NVFX_SHADER_NO_FUCKEDNESS
-#include "nv40_shader.h"
+#include "nv30/nv30_shader.h"
+#include "nv40/nv40_shader.h"
/* Simple, but crappy, swtnl path, hopefully we wont need to hit this very
* often at all. Uses "quadro style" vertex submission + a fixed vertex
* layout to avoid the need to generate a vertex program or vtxfmt.
*/
-struct nv40_render_stage {
+struct nvfx_render_stage {
struct draw_stage stage;
struct nvfx_context *nvfx;
unsigned prim;
};
-static INLINE struct nv40_render_stage *
-nv40_render_stage(struct draw_stage *stage)
+static INLINE struct nvfx_render_stage *
+nvfx_render_stage(struct draw_stage *stage)
{
- return (struct nv40_render_stage *)stage;
+ return (struct nvfx_render_stage *)stage;
}
static INLINE void
-nv40_render_vertex(struct nvfx_context *nvfx, const struct vertex_header *v)
+nvfx_render_vertex(struct nvfx_context *nvfx, const struct vertex_header *v)
{
struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
@@ -80,10 +81,10 @@ nv40_render_vertex(struct nvfx_context *nvfx, const struct vertex_header *v)
}
static INLINE void
-nv40_render_prim(struct draw_stage *stage, struct prim_header *prim,
+nvfx_render_prim(struct draw_stage *stage, struct prim_header *prim,
unsigned mode, unsigned count)
{
- struct nv40_render_stage *rs = nv40_render_stage(stage);
+ struct nvfx_render_stage *rs = nvfx_render_stage(stage);
struct nvfx_context *nvfx = rs->nvfx;
struct nvfx_screen *screen = nvfx->screen;
@@ -115,7 +116,7 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim,
/* Emit vertex data */
for (i = 0; i < count; i++)
- nv40_render_vertex(nvfx, prim->v[i]);
+ nvfx_render_vertex(nvfx, prim->v[i]);
/* If it's likely we'll need to empty the push buffer soon, finish
* off the primitive now.
@@ -128,27 +129,27 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim,
}
static void
-nv40_render_point(struct draw_stage *draw, struct prim_header *prim)
+nvfx_render_point(struct draw_stage *draw, struct prim_header *prim)
{
- nv40_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_POINTS, 1);
+ nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_POINTS, 1);
}
static void
-nv40_render_line(struct draw_stage *draw, struct prim_header *prim)
+nvfx_render_line(struct draw_stage *draw, struct prim_header *prim)
{
- nv40_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_LINES, 2);
+ nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_LINES, 2);
}
static void
-nv40_render_tri(struct draw_stage *draw, struct prim_header *prim)
+nvfx_render_tri(struct draw_stage *draw, struct prim_header *prim)
{
- nv40_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_TRIANGLES, 3);
+ nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_TRIANGLES, 3);
}
static void
-nv40_render_flush(struct draw_stage *draw, unsigned flags)
+nvfx_render_flush(struct draw_stage *draw, unsigned flags)
{
- struct nv40_render_stage *rs = nv40_render_stage(draw);
+ struct nvfx_render_stage *rs = nvfx_render_stage(draw);
struct nvfx_context *nvfx = rs->nvfx;
struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
@@ -162,12 +163,12 @@ nv40_render_flush(struct draw_stage *draw, unsigned flags)
}
static void
-nv40_render_reset_stipple_counter(struct draw_stage *draw)
+nvfx_render_reset_stipple_counter(struct draw_stage *draw)
{
}
static void
-nv40_render_destroy(struct draw_stage *draw)
+nvfx_render_destroy(struct draw_stage *draw)
{
FREE(draw);
}
@@ -201,14 +202,17 @@ create_drawvp(struct nvfx_context *nvfx)
struct nvfx_vertex_program *vp = CALLOC_STRUCT(nvfx_vertex_program);
unsigned i;
- emit_mov(vp, NV40_VP_INST_DEST_POS, 0, ~0, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_COL0, 3, 0, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_COL1, 4, 1, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_BFC0, 3, 2, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_BFC1, 4, 3, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_FOGC, 5, 4, 0x8);
+ // nv30 support comes in a later patch
+ assert(nvfx->is_nv4x);
+
+ emit_mov(vp, NVFX_VP(INST_DEST_POS), 0, ~0, 0xf);
+ emit_mov(vp, NVFX_VP(INST_DEST_COL0), 3, 0, 0xf);
+ emit_mov(vp, NVFX_VP(INST_DEST_COL1), 4, 1, 0xf);
+ emit_mov(vp, NVFX_VP(INST_DEST_BFC0), 3, 2, 0xf);
+ emit_mov(vp, NVFX_VP(INST_DEST_BFC1), 4, 3, 0xf);
+ emit_mov(vp, NVFX_VP(INST_DEST_FOGC), 5, 4, 0x8);
for (i = 0; i < 8; i++)
- emit_mov(vp, NV40_VP_INST_DEST_TC(i), 8 + i, 14 + i, 0xf);
+ emit_mov(vp, NVFX_VP(INST_DEST_TC(i)), 8 + i, 14 + i, 0xf);
vp->insns[vp->nr_insns - 1].data[3] |= 1;
vp->translated = TRUE;
@@ -216,27 +220,27 @@ create_drawvp(struct nvfx_context *nvfx)
}
struct draw_stage *
-nv40_draw_render_stage(struct nvfx_context *nvfx)
+nvfx_draw_render_stage(struct nvfx_context *nvfx)
{
- struct nv40_render_stage *render = CALLOC_STRUCT(nv40_render_stage);
+ struct nvfx_render_stage *render = CALLOC_STRUCT(nvfx_render_stage);
if (!nvfx->swtnl.vertprog)
nvfx->swtnl.vertprog = create_drawvp(nvfx);
render->nvfx = nvfx;
render->stage.draw = nvfx->draw;
- render->stage.point = nv40_render_point;
- render->stage.line = nv40_render_line;
- render->stage.tri = nv40_render_tri;
- render->stage.flush = nv40_render_flush;
- render->stage.reset_stipple_counter = nv40_render_reset_stipple_counter;
- render->stage.destroy = nv40_render_destroy;
+ render->stage.point = nvfx_render_point;
+ render->stage.line = nvfx_render_line;
+ render->stage.tri = nvfx_render_tri;
+ render->stage.flush = nvfx_render_flush;
+ render->stage.reset_stipple_counter = nvfx_render_reset_stipple_counter;
+ render->stage.destroy = nvfx_render_destroy;
return &render->stage;
}
void
-nv40_draw_elements_swtnl(struct pipe_context *pipe,
+nvfx_draw_elements_swtnl(struct pipe_context *pipe,
struct pipe_buffer *idxbuf, unsigned idxbuf_size,
unsigned mode, unsigned start, unsigned count)
{
@@ -302,7 +306,7 @@ emit_attrib(struct nvfx_context *nvfx, unsigned hw, unsigned emit,
}
static boolean
-nv40_state_vtxfmt_validate(struct nvfx_context *nvfx)
+nvfx_state_vtxfmt_validate(struct nvfx_context *nvfx)
{
struct nvfx_fragment_program *fp = nvfx->fragprog;
unsigned colour = 0, texcoords = 0, fog = 0, i;
@@ -350,11 +354,10 @@ nv40_state_vtxfmt_validate(struct nvfx_context *nvfx)
return FALSE;
}
-struct nvfx_state_entry nv40_state_vtxfmt = {
- .validate = nv40_state_vtxfmt_validate,
+struct nvfx_state_entry nvfx_state_vtxfmt = {
+ .validate = nvfx_state_vtxfmt_validate,
.dirty = {
.pipe = NVFX_NEW_ARRAYS | NVFX_NEW_FRAGPROG,
.hw = 0
}
};
-
diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c
index d6fbc5d8dcb..9961dacce4c 100644
--- a/src/gallium/drivers/nvfx/nvfx_state_emit.c
+++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c
@@ -3,6 +3,10 @@
#include "nvfx_state.h"
#include "draw/draw_context.h"
+/* temporary, will be removed in next patch */
+#define nv30_state_vtxfmt nvfx_state_vtxfmt
+#define nv40_state_vtxfmt nvfx_state_vtxfmt
+
#define RENDER_STATES(name, nvxx, vbo) \
static struct nvfx_state_entry *name##_render_states[] = { \
&nvfx_state_framebuffer, \
@@ -22,7 +26,7 @@ static struct nvfx_state_entry *name##_render_states[] = { \
}
RENDER_STATES(nv30, nv30, vbo);
-RENDER_STATES(nv30_swtnl, nv30, vbo); /* TODO: replace with vtxfmt once draw is unified */
+RENDER_STATES(nv30_swtnl, nv30, vtxfmt);
RENDER_STATES(nv40, nv40, vbo);
RENDER_STATES(nv40_swtnl, nv40, vtxfmt);