unsigned dirty;
struct pipe_scissor_state scissor;
unsigned stipple[32];
+ struct nv30_vertex_program *vertprog;
struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
unsigned constbuf_nr[PIPE_SHADER_TYPES];
struct nv30_rasterizer_state *rasterizer;
unsigned delta;
} vb[16];
- struct {
- struct nv30_vertex_program *active;
- struct nv30_vertex_program *current;
- } vertprog;
-
struct {
struct nv30_fragment_program *active;
struct nv30_fragment_program *current;
extern struct draw_stage *nv30_draw_render_stage(struct nv30_context *nv30);
/* nv30_vertprog.c */
-extern void nv30_vertprog_translate(struct nv30_context *,
- struct nv30_vertex_program *);
-extern void nv30_vertprog_bind(struct nv30_context *,
- struct nv30_vertex_program *);
extern void nv30_vertprog_destroy(struct nv30_context *,
struct nv30_vertex_program *);
extern struct nv30_state_entry nv30_state_rasterizer;
extern struct nv30_state_entry nv30_state_scissor;
extern struct nv30_state_entry nv30_state_stipple;
+extern struct nv30_state_entry nv30_state_vertprog;
extern struct nv30_state_entry nv30_state_blend;
extern struct nv30_state_entry nv30_state_blend_colour;
extern struct nv30_state_entry nv30_state_zsa;
nv30_vp_state_create(struct pipe_context *pipe,
const struct pipe_shader_state *cso)
{
+ /*struct nv30_context *nv30 = nv30_context(pipe);*/
struct nv30_vertex_program *vp;
vp = CALLOC(1, sizeof(struct nv30_vertex_program));
vp->pipe = *cso;
+ /*vp->draw = draw_create_vertex_shader(nv30->draw, &vp->pipe);*/
return (void *)vp;
}
nv30_vp_state_bind(struct pipe_context *pipe, void *hwcso)
{
struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_vertex_program *vp = hwcso;
-
- if (!hwcso) {
- return;
- }
- nv30->vertprog.current = vp;
+ nv30->vertprog = hwcso;
nv30->dirty |= NV30_NEW_VERTPROG;
+ /*nv30->draw_dirty |= NV30_NEW_VERTPROG;*/
}
static void
struct nv30_context *nv30 = nv30_context(pipe);
struct nv30_vertex_program *vp = hwcso;
+ /*draw_delete_vertex_shader(nv30->draw, vp->draw);*/
nv30_vertprog_destroy(nv30, vp);
FREE(vp);
}
struct pipe_shader_state pipe;
boolean translated;
+
struct nv30_vertex_program_exec *insns;
unsigned nr_insns;
struct nv30_vertex_program_data *consts;
uint32_t ir;
uint32_t or;
+ struct nouveau_stateobj *so;
};
struct nv30_fragment_program_data {
&nv30_state_scissor,
&nv30_state_stipple,
&nv30_state_fragtex,
+ &nv30_state_vertprog,
&nv30_state_blend,
&nv30_state_blend_colour,
&nv30_state_zsa,
states &= ~(1ULL << i);
}
- if (nv30->dirty & NV30_NEW_VERTPROG) {
- nv30_vertprog_bind(nv30, nv30->vertprog.current);
- nv30->dirty &= ~NV30_NEW_VERTPROG;
- }
-
so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_FB]);
for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
if (!(samplers & (1 << i)))
static void
nv30_vbo_arrays_update(struct nv30_context *nv30)
{
- struct nv30_vertex_program *vp = nv30->vertprog.active;
+ struct nv30_vertex_program *vp = nv30->vertprog;
uint32_t inputs, vtxfmt[16];
int hw, num_hw = 0;
return TRUE;
}
-void
+static void
nv30_vertprog_translate(struct nv30_context *nv30,
struct nv30_vertex_program *vp)
{
FREE(vpc);
}
-void
-nv30_vertprog_bind(struct nv30_context *nv30, struct nv30_vertex_program *vp)
+static boolean
+nv30_vertprog_validate(struct nv30_context *nv30)
{
struct nouveau_winsys *nvws = nv30->nvws;
struct pipe_winsys *ws = nv30->pipe.winsys;
+ struct nouveau_grobj *rankine = nv30->screen->rankine;
+ struct nv30_vertex_program *vp;
struct pipe_buffer *constbuf;
boolean upload_code = FALSE, upload_data = FALSE;
int i;
+ vp = nv30->vertprog;
constbuf = nv30->constbuf[PIPE_SHADER_VERTEX];
/* Translate TGSI shader into hw bytecode */
if (!vp->translated) {
nv30_vertprog_translate(nv30, vp);
if (!vp->translated)
- assert(0);
+ return FALSE;
}
/* Allocate hw vtxprog exec slots */
if (!vp->exec) {
struct nouveau_resource *heap = nv30->screen->vp_exec_heap;
+ struct nouveau_stateobj *so;
uint vplen = vp->nr_insns;
if (nvws->res_alloc(heap, vplen, vp, &vp->exec)) {
assert(0);
}
+ so = so_new(2, 0);
+ so_method(so, rankine, NV34TCL_VP_START_FROM_ID, 1);
+ so_data (so, vp->exec->start);
+ /* Add these, and you'll go 1/3 speed */
+ /*so_method(so, rankine, NV34TCL_VP_ATTRIB_EN, 2);
+ so_data (so, vp->ir);
+ so_data (so, vp->or);*/
+ so_ref(so, &vp->so);
+
upload_code = TRUE;
}
}
}
- BEGIN_RING(rankine, NV34TCL_VP_START_FROM_ID, 1);
- OUT_RING (vp->exec->start);
+ if (vp->so != nv30->state.hw[NV30_STATE_VERTPROG]) {
+ so_ref(vp->so, &nv30->state.hw[NV30_STATE_VERTPROG]);
+ return TRUE;
+ }
- nv30->vertprog.active = vp;
+ return FALSE;
}
void
vp->data_start = 0;
vp->data_start_min = 0;
- /* vp->ir = vp->or = vp->clip_ctrl = 0;
- so_ref(NULL, &vp->so); */
+ vp->ir = vp->or = 0;
+ so_ref(NULL, &vp->so);
}
+struct nv30_state_entry nv30_state_vertprog = {
+ .validate = nv30_vertprog_validate,
+ .dirty = {
+ .pipe = NV30_NEW_VERTPROG /*| NV30_NEW_UCP*/,
+ .hw = NV30_STATE_VERTPROG,
+ }
+};