unsigned dirty;
struct pipe_scissor_state scissor;
unsigned stipple[32];
+ struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
+ unsigned constbuf_nr[PIPE_SHADER_TYPES];
struct nv30_rasterizer_state *rasterizer;
struct nv30_zsa_state *zsa;
struct nv30_blend_state *blend;
struct {
struct nv30_vertex_program *active;
-
struct nv30_vertex_program *current;
- struct pipe_buffer *constant_buf;
} vertprog;
struct {
struct nv30_fragment_program *active;
-
struct nv30_fragment_program *current;
- struct pipe_buffer *constant_buf;
} fragprog;
struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
void
nv30_fragprog_bind(struct nv30_context *nv30, struct nv30_fragment_program *fp)
{
+ struct pipe_buffer *constbuf =
+ nv30->constbuf[PIPE_SHADER_FRAGMENT];
struct pipe_winsys *ws = nv30->pipe.winsys;
int i;
}
if (fp->nr_consts) {
- float *map = ws->buffer_map(ws, nv30->fragprog.constant_buf,
- PIPE_BUFFER_USAGE_CPU_READ);
+ float *map;
+
+ map = ws->buffer_map(ws, constbuf, PIPE_BUFFER_USAGE_CPU_READ);
for (i = 0; i < fp->nr_consts; i++) {
struct nv30_fragment_program_data *fpd = &fp->consts[i];
uint32_t *p = &fp->insn[fpd->offset];
memcpy(p, cb, 4 * sizeof(float));
fp->on_hw = 0;
}
- ws->buffer_unmap(ws, nv30->fragprog.constant_buf);
+ ws->buffer_unmap(ws, constbuf);
}
if (!fp->on_hw) {
- const uint32_t le = 1;
- uint32_t *map;
-
if (!fp->buffer)
fp->buffer = ws->buffer_create(ws, 0x100, 0,
fp->insn_len * 4);
{
struct nv30_context *nv30 = nv30_context(pipe);
+ nv30->constbuf[shader] = buf->buffer;
+ nv30->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
+
if (shader == PIPE_SHADER_VERTEX) {
- nv30->vertprog.constant_buf = buf->buffer;
nv30->dirty |= NV30_NEW_VERTPROG;
} else
if (shader == PIPE_SHADER_FRAGMENT) {
- nv30->fragprog.constant_buf = buf->buffer;
nv30->dirty |= NV30_NEW_FRAGPROG;
}
}
/*
* |VVV|
- * d°.°b
+ * d�.�b
* \u/
*
*/
{
struct nouveau_winsys *nvws = nv30->nvws;
struct pipe_winsys *ws = nv30->pipe.winsys;
+ struct pipe_buffer *constbuf;
boolean upload_code = FALSE, upload_data = FALSE;
int i;
+ constbuf = nv30->constbuf[PIPE_SHADER_VERTEX];
+
/* Translate TGSI shader into hw bytecode */
if (!vp->translated) {
nv30_vertprog_translate(nv30, vp);
if (vp->nr_consts) {
float *map = NULL;
- if (nv30->vertprog.constant_buf) {
- map = ws->buffer_map(ws, nv30->vertprog.constant_buf,
+ if (constbuf) {
+ map = ws->buffer_map(ws, constbuf,
PIPE_BUFFER_USAGE_CPU_READ);
}
BEGIN_RING(rankine, NV34TCL_VP_UPLOAD_CONST_ID, 5);
OUT_RING (i + vp->data->start);
OUT_RINGp ((uint32_t *)vpd->value, 4);
-#if 0
- NOUVEAU_MSG("VP const %d: %f %f %f %f\n",
- i, vpd->value[0], vpd->value[1],
- vpd->value[2], vpd->value[3]);
-#endif
}
- if (map) {
- ws->buffer_unmap(ws, nv30->vertprog.constant_buf);
+ if (constbuf) {
+ ws->buffer_unmap(ws, constbuf);
}
}