draw->vertex_fetch.nr_attrs = nr_attrs;
draw->vertex_fetch.fetch_func = generic_vertex_fetch;
+ printf("pouet vertex fetch %x\n",draw->vertex_fetch.fetch_func);
switch (nr_attrs) {
case 2:
default:
break;
}
+ printf("pouet vertex fetch %x\n",draw->vertex_fetch.fetch_func);
}
#define NOUVEAU_MSG(fmt, args...) \
fprintf(stderr, "nouveau: "fmt, ##args);
-#define NV10_NEW_VERTPROG (1 << 1)
-#define NV10_NEW_FRAGPROG (1 << 2)
-#define NV10_NEW_ARRAYS (1 << 3)
-#define NV10_NEW_VTXFMT (1 << 4)
-#define NV10_NEW_BLEND (1 << 5)
-#define NV10_NEW_BLENDCOL (1 << 6)
-#define NV10_NEW_RAST (1 << 7)
-#define NV10_NEW_DSA (1 << 8)
-#define NV10_NEW_VIEWPORT (1 << 9)
-#define NV10_NEW_SCISSOR (1 << 9)
-#define NV10_NEW_FRAMEBUFFER (1 << 10)
+#define NV10_NEW_VERTPROG (1 << 0)
+#define NV10_NEW_FRAGPROG (1 << 1)
+#define NV10_NEW_VTXARRAYS (1 << 2)
+#define NV10_NEW_BLEND (1 << 3)
+#define NV10_NEW_BLENDCOL (1 << 4)
+#define NV10_NEW_RAST (1 << 5)
+#define NV10_NEW_DSA (1 << 6)
+#define NV10_NEW_VIEWPORT (1 << 7)
+#define NV10_NEW_SCISSOR (1 << 8)
+#define NV10_NEW_FRAMEBUFFER (1 << 9)
#include "nv10_screen.h"
static void
nv10_fragtex_build(struct nv10_context *nv10, int unit)
{
+#if 0
struct nv10_sampler_state *ps = nv10->tex_sampler[unit];
struct nv10_miptree *nv10mt = nv10->tex_miptree[unit];
struct pipe_texture *pt = &nv10mt->base;
OUT_RING (ps->filt | 0x2000 /* magic */);
OUT_RING ((pt->width[0] << 16) | pt->height[0]);
OUT_RING (ps->bcol);
+#endif
}
void
nv10_fragtex_bind(struct nv10_context *nv10)
{
+#if 0
struct nv10_fragment_program *fp = nv10->fragprog.active;
unsigned samplers, unit;
}
nv10->fp_samplers = fp->samplers;
+#endif
}
{
struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
struct nv10_context *nv10 = nv10_render->nv10;
+
+ nv10_emit_hw_state(nv10);
+
return &nv10->vertex_info;
}
assert(!nv10_render->buffer);
nv10_render->buffer = winsys->buffer_create(winsys, 64, PIPE_BUFFER_USAGE_VERTEX, size);
- nv10->dirty |= NV10_NEW_ARRAYS;
+ nv10->dirty |= NV10_NEW_VTXARRAYS;
return winsys->buffer_map(winsys,
nv10_render->buffer,
struct nv10_context *nv10 = nv10_render->nv10;
int push, i;
+ nv10_emit_hw_state(nv10);
+
BEGIN_RING(celsius, NV10TCL_VERTEX_ARRAY_OFFSET_POS, 1);
OUT_RELOCl(nv10_render->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+#include "draw/draw_context.h"
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
#include "nv10_context.h"
#include "nv10_state.h"
-static void nv10_vertex_layout(struct pipe_context* pipe)
-{
- struct nv10_context *nv10 = nv10_context(pipe);
- struct nv10_fragment_program *fp = nv10->fragprog.current;
- uint32_t src = 0;
- int i;
- struct vertex_info vinfo;
-
- memset(&vinfo, 0, sizeof(vinfo));
-
- for (i = 0; i < fp->info.num_inputs; i++) {
- switch (fp->info.input_semantic_name[i]) {
- case TGSI_SEMANTIC_POSITION:
- draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, src++);
- break;
- case TGSI_SEMANTIC_COLOR:
- draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, src++);
- break;
- default:
- case TGSI_SEMANTIC_GENERIC:
- draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, src++);
- break;
- case TGSI_SEMANTIC_FOG:
- draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, src++);
- break;
- }
- }
- draw_compute_vertex_size(&vinfo);
-
- nv10->dirty |= NV10_NEW_VTXFMT;
-}
-
static void *
nv10_blend_state_create(struct pipe_context *pipe,
const struct pipe_blend_state *cso)
static void *
nv10_vp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *cso)
+ const struct pipe_shader_state *templ)
{
- struct nv10_vertex_program *vp;
-
- vp = CALLOC(1, sizeof(struct nv10_vertex_program));
- vp->pipe = cso;
+ struct nv10_context *nv10 = nv10_context(pipe);
- return (void *)vp;
+ return draw_create_vertex_shader(nv10->draw, templ);
}
static void
-nv10_vp_state_bind(struct pipe_context *pipe, void *hwcso)
+nv10_vp_state_bind(struct pipe_context *pipe, void *shader)
{
struct nv10_context *nv10 = nv10_context(pipe);
- struct nv10_vertex_program *vp = hwcso;
- nv10->vertprog.current = vp;
+ draw_bind_vertex_shader(nv10->draw, (struct draw_vertex_shader *) shader);
+
nv10->dirty |= NV10_NEW_VERTPROG;
}
static void
-nv10_vp_state_delete(struct pipe_context *pipe, void *hwcso)
+nv10_vp_state_delete(struct pipe_context *pipe, void *shader)
{
- //struct nv10_context *nv10 = nv10_context(pipe);
- struct nv10_vertex_program *vp = hwcso;
+ struct nv10_context *nv10 = nv10_context(pipe);
- //nv10_vertprog_destroy(nv10, vp);
- FREE(vp);
+ draw_delete_vertex_shader(nv10->draw, (struct draw_vertex_shader *) shader);
}
static void *
struct nv10_context *nv10 = nv10_context(pipe);
memcpy(nv10->vtxbuf, vb, sizeof(*vb) * count);
- nv10->dirty |= NV10_NEW_ARRAYS;
+ nv10->dirty |= NV10_NEW_VTXARRAYS;
}
static void
struct nv10_context *nv10 = nv10_context(pipe);
memcpy(nv10->vtxelt, ve, sizeof(*ve) * count);
- nv10->dirty |= NV10_NEW_ARRAYS;
+ nv10->dirty |= NV10_NEW_VTXARRAYS;
}
void
OUT_RING (((h - 1) << 16) | 0);
}
+static void nv10_vertex_layout(struct nv10_context *nv10)
+{
+ struct nv10_fragment_program *fp = nv10->fragprog.current;
+ uint32_t src = 0;
+ int i;
+ struct vertex_info vinfo;
+
+ memset(&vinfo, 0, sizeof(vinfo));
+
+ for (i = 0; i < fp->info.num_inputs; i++) {
+ switch (fp->info.input_semantic_name[i]) {
+ case TGSI_SEMANTIC_POSITION:
+ draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, src++);
+ break;
+ case TGSI_SEMANTIC_COLOR:
+ draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, src++);
+ break;
+ default:
+ case TGSI_SEMANTIC_GENERIC:
+ draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, src++);
+ break;
+ case TGSI_SEMANTIC_FOG:
+ draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, src++);
+ break;
+ }
+ }
+ draw_compute_vertex_size(&vinfo);
+}
+
void
nv10_emit_hw_state(struct nv10_context *nv10)
{
nv10->dirty &= ~NV10_NEW_FRAGPROG;
}
- if (nv10->dirty & NV10_NEW_ARRAYS) {
- nv10->dirty &= ~NV10_NEW_ARRAYS;
- // array state will be put here once it's not emitted at each frame
- }
-
- if (nv10->dirty & NV10_NEW_VTXFMT) {
- nv10->dirty &= ~NV10_NEW_VTXFMT;
+ if (nv10->dirty & NV10_NEW_VTXARRAYS) {
+ nv10->dirty &= ~NV10_NEW_VTXARRAYS;
+ nv10_vertex_layout(nv10);
nv10_vtxbuf_bind(nv10);
}
struct draw_context *draw = nv10->draw;
unsigned i;
+ nv10_emit_hw_state(nv10);
+
/*
* Map vertex buffers
*/