aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nv10/nv10_context.h1
-rw-r--r--src/gallium/drivers/nv10/nv10_state.c2
-rw-r--r--src/gallium/drivers/nv10/nv10_vbo.c4
-rw-r--r--src/gallium/drivers/nv30/nv30_fragprog.c6
-rw-r--r--src/gallium/drivers/nv30/nv30_vertprog.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h1
-rw-r--r--src/gallium/drivers/nv40/nv40_draw.c4
-rw-r--r--src/gallium/drivers/nv40/nv40_fragprog.c8
-rw-r--r--src/gallium/drivers/nv40/nv40_state.c5
-rw-r--r--src/gallium/drivers/nv40/nv40_vertprog.c10
10 files changed, 26 insertions, 17 deletions
diff --git a/src/gallium/drivers/nv10/nv10_context.h b/src/gallium/drivers/nv10/nv10_context.h
index 5636dfc9d22..2bdba53db8a 100644
--- a/src/gallium/drivers/nv10/nv10_context.h
+++ b/src/gallium/drivers/nv10/nv10_context.h
@@ -66,6 +66,7 @@ struct nv10_context {
//struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
float *constbuf[PIPE_SHADER_TYPES][32][4];
+ unsigned constbuf_nr[PIPE_SHADER_TYPES];
struct vertex_info vertex_info;
diff --git a/src/gallium/drivers/nv10/nv10_state.c b/src/gallium/drivers/nv10/nv10_state.c
index 4dcb9a31ab1..11664fae2af 100644
--- a/src/gallium/drivers/nv10/nv10_state.c
+++ b/src/gallium/drivers/nv10/nv10_state.c
@@ -469,6 +469,8 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
if (buf->size && (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
{
memcpy(nv10->constbuf[shader], mapped, buf->size);
+ nv10->constbuf_nr[shader] =
+ buf->size / (4 * sizeof(float));
ws->buffer_unmap(ws, buf->buffer);
}
}
diff --git a/src/gallium/drivers/nv10/nv10_vbo.c b/src/gallium/drivers/nv10/nv10_vbo.c
index 2a334e137d9..f024f534209 100644
--- a/src/gallium/drivers/nv10/nv10_vbo.c
+++ b/src/gallium/drivers/nv10/nv10_vbo.c
@@ -44,7 +44,9 @@ boolean nv10_draw_elements( struct pipe_context *pipe,
draw_set_mapped_element_buffer(draw, 0, NULL);
}
- draw_set_mapped_constant_buffer(draw, nv10->constbuf[PIPE_SHADER_VERTEX]);
+ draw_set_mapped_constant_buffer(draw,
+ nv10->constbuf[PIPE_SHADER_VERTEX],
+ nv10->constbuf_nr[PIPE_SHADER_VERTEX]);
/* draw! */
draw_arrays(nv10->draw, prim, start, count);
diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c
index 51000bd6fcd..54d6bea55f7 100644
--- a/src/gallium/drivers/nv30/nv30_fragprog.c
+++ b/src/gallium/drivers/nv30/nv30_fragprog.c
@@ -645,7 +645,7 @@ nv30_fragprog_parse_decl_attrib(struct nv30_fpc *fpc,
return FALSE;
}
- fpc->attrib_map[fdec->u.DeclarationRange.First] = hw;
+ fpc->attrib_map[fdec->DeclarationRange.First] = hw;
return TRUE;
}
@@ -655,10 +655,10 @@ nv30_fragprog_parse_decl_output(struct nv30_fpc *fpc,
{
switch (fdec->Semantic.SemanticName) {
case TGSI_SEMANTIC_POSITION:
- fpc->depth_id = fdec->u.DeclarationRange.First;
+ fpc->depth_id = fdec->DeclarationRange.First;
break;
case TGSI_SEMANTIC_COLOR:
- fpc->colour_id = fdec->u.DeclarationRange.First;
+ fpc->colour_id = fdec->DeclarationRange.First;
break;
default:
NOUVEAU_ERR("bad output semantic\n");
diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c
index 71aea3a59cb..1b34d2e4b29 100644
--- a/src/gallium/drivers/nv30/nv30_vertprog.c
+++ b/src/gallium/drivers/nv30/nv30_vertprog.c
@@ -530,7 +530,7 @@ nv30_vertprog_parse_decl_output(struct nv30_vpc *vpc,
return FALSE;
}
- vpc->output_map[fdec->u.DeclarationRange.First] = hw;
+ vpc->output_map[fdec->DeclarationRange.First] = hw;
return TRUE;
}
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
index d8d1891dff0..8e60a81e68e 100644
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ b/src/gallium/drivers/nv40/nv40_context.h
@@ -136,6 +136,7 @@ struct nv40_context {
struct nv40_vertex_program *vertprog;
struct nv40_fragment_program *fragprog;
struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
+ unsigned constbuf_nr[PIPE_SHADER_TYPES];
struct nv40_rasterizer_state *rasterizer;
struct nv40_zsa_state *zsa;
struct nv40_blend_state *blend;
diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c
index 1d78324dda8..2cf58e2950a 100644
--- a/src/gallium/drivers/nv40/nv40_draw.c
+++ b/src/gallium/drivers/nv40/nv40_draw.c
@@ -253,9 +253,11 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
}
if (nv40->constbuf[PIPE_SHADER_VERTEX]) {
+ const unsigned nr = nv40->constbuf_nr[PIPE_SHADER_VERTEX];
+
map = ws->buffer_map(ws, nv40->constbuf[PIPE_SHADER_VERTEX],
PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_constant_buffer(nv40->draw, map);
+ draw_set_mapped_constant_buffer(nv40->draw, map, nr);
}
draw_arrays(nv40->draw, mode, start, count);
diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c
index 4b7667e0381..428348c3388 100644
--- a/src/gallium/drivers/nv40/nv40_fragprog.c
+++ b/src/gallium/drivers/nv40/nv40_fragprog.c
@@ -708,7 +708,7 @@ nv40_fragprog_parse_decl_attrib(struct nv40_fpc *fpc,
return FALSE;
}
- fpc->attrib_map[fdec->u.DeclarationRange.First] = hw;
+ fpc->attrib_map[fdec->DeclarationRange.First] = hw;
return TRUE;
}
@@ -716,7 +716,7 @@ static boolean
nv40_fragprog_parse_decl_output(struct nv40_fpc *fpc,
const struct tgsi_full_declaration *fdec)
{
- unsigned idx = fdec->u.DeclarationRange.First;
+ unsigned idx = fdec->DeclarationRange.First;
unsigned hw;
switch (fdec->Semantic.SemanticName) {
@@ -770,9 +770,9 @@ nv40_fragprog_prepare(struct nv40_fpc *fpc)
goto out_err;
break;
case TGSI_FILE_TEMPORARY:
- if (fdec->u.DeclarationRange.Last > high_temp) {
+ if (fdec->DeclarationRange.Last > high_temp) {
high_temp =
- fdec->u.DeclarationRange.Last;
+ fdec->DeclarationRange.Last;
}
break;
default:
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c
index 2d921d2b8a4..afcf336a65b 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -603,12 +603,13 @@ nv40_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
{
struct nv40_context *nv40 = nv40_context(pipe);
+ nv40->constbuf[shader] = buf->buffer;
+ nv40->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
+
if (shader == PIPE_SHADER_VERTEX) {
- nv40->constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
nv40->dirty |= NV40_NEW_VERTPROG;
} else
if (shader == PIPE_SHADER_FRAGMENT) {
- nv40->constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
nv40->dirty |= NV40_NEW_FRAGPROG;
}
}
diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c
index eb14869bfe0..1e486a66ef0 100644
--- a/src/gallium/drivers/nv40/nv40_vertprog.c
+++ b/src/gallium/drivers/nv40/nv40_vertprog.c
@@ -603,7 +603,7 @@ static boolean
nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc,
const struct tgsi_full_declaration *fdec)
{
- unsigned idx = fdec->u.DeclarationRange.First;
+ unsigned idx = fdec->DeclarationRange.First;
int hw;
switch (fdec->Semantic.SemanticName) {
@@ -678,16 +678,16 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc)
fdec = &p.FullToken.FullDeclaration;
switch (fdec->Declaration.File) {
case TGSI_FILE_TEMPORARY:
- if (fdec->u.DeclarationRange.Last > high_temp) {
+ if (fdec->DeclarationRange.Last > high_temp) {
high_temp =
- fdec->u.DeclarationRange.Last;
+ fdec->DeclarationRange.Last;
}
break;
#if 0 /* this would be nice.. except gallium doesn't track it */
case TGSI_FILE_ADDRESS:
- if (fdec->u.DeclarationRange.Last > high_addr) {
+ if (fdec->DeclarationRange.Last > high_addr) {
high_addr =
- fdec->u.DeclarationRange.Last;
+ fdec->DeclarationRange.Last;
}
break;
#endif