summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2010-01-25 12:36:50 +0100
committerMichal Krol <michal@vmware.com>2010-01-28 14:07:53 +0100
commit9851644435f991a1a1bbb145333a97601627b37d (patch)
tree20351d0e1cdf5e0bb80d928cad27b77fbb7015af /src/gallium
parent44ac4c4e2c7890236ee7e9cd0cf82b58710d57ef (diff)
gallium: Enable multiple constant buffers for vertex and geometry shaders.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c11
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h10
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h28
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c12
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.c40
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.h8
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.c10
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos_machine.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_exec.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_llvm.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_ppc.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_sse.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_varient.c4
-rw-r--r--src/gallium/drivers/cell/ppu/cell_draw_arrays.c2
-rw-r--r--src/gallium/drivers/i915/i915_context.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c2
-rw-r--r--src/gallium/drivers/nv04/nv04_vbo.c2
-rw-r--r--src/gallium/drivers/nv10/nv10_vbo.c1
-rw-r--r--src/gallium/drivers/nv20/nv20_vbo.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_draw.c2
-rw-r--r--src/gallium/drivers/r300/r300_render.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_draw_arrays.c48
-rw-r--r--src/gallium/drivers/svga/svga_swtnl_draw.c2
26 files changed, 145 insertions, 94 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 1639043832..a52b93e122 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -234,17 +234,20 @@ draw_set_mapped_vertex_buffer(struct draw_context *draw,
void
draw_set_mapped_constant_buffer(struct draw_context *draw,
unsigned shader_type,
+ unsigned slot,
const void *buffer,
unsigned size )
{
debug_assert(shader_type == PIPE_SHADER_VERTEX ||
shader_type == PIPE_SHADER_GEOMETRY);
+ debug_assert(slot < PIPE_MAX_CONSTANT);
+
if (shader_type == PIPE_SHADER_VERTEX) {
- draw->pt.user.vs_constants = buffer;
- draw_vs_set_constants( draw, (const float (*)[4])buffer, size );
+ draw->pt.user.vs_constants[slot] = buffer;
+ draw_vs_set_constants(draw, slot, buffer, size);
} else if (shader_type == PIPE_SHADER_GEOMETRY) {
- draw->pt.user.gs_constants = buffer;
- draw_gs_set_constants( draw, (const float (*)[4])buffer, size );
+ draw->pt.user.gs_constants[slot] = buffer;
+ draw_gs_set_constants(draw, slot, buffer, size);
}
}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 8a64c06efc..acd81b9712 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -151,10 +151,12 @@ void draw_set_mapped_element_buffer( struct draw_context *draw,
void draw_set_mapped_vertex_buffer(struct draw_context *draw,
unsigned attr, const void *buffer);
-void draw_set_mapped_constant_buffer(struct draw_context *draw,
- unsigned shader_type,
- const void *buffer,
- unsigned size );
+void
+draw_set_mapped_constant_buffer(struct draw_context *draw,
+ unsigned shader_type,
+ unsigned slot,
+ const void *buffer,
+ unsigned size);
/***********************************************************************
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index c3cc365a8d..96be5dba0b 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -69,9 +69,11 @@ void draw_gs_destroy( struct draw_context *draw )
tgsi_exec_machine_destroy(draw->gs.machine);
}
-void draw_gs_set_constants( struct draw_context *draw,
- const float (*constants)[4],
- unsigned size )
+void
+draw_gs_set_constants(struct draw_context *draw,
+ unsigned slot,
+ const void *constants,
+ unsigned size)
{
}
@@ -291,7 +293,7 @@ draw_geometry_fetch_outputs(struct draw_geometry_shader *shader,
void draw_geometry_shader_run(struct draw_geometry_shader *shader,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT],
unsigned count,
unsigned input_stride,
unsigned vertex_size)
@@ -302,7 +304,9 @@ void draw_geometry_shader_run(struct draw_geometry_shader *shader,
unsigned num_primitives = count/num_vertices;
unsigned inputs_from_vs = 0;
- machine->Consts[0] = constants;
+ for (i = 0; i < PIPE_MAX_CONSTANT; i++) {
+ machine->Consts[i] = constants[i];
+ }
for (i = 0; i < shader->info.num_inputs; ++i) {
if (shader->info.input_semantic_name[i] != TGSI_SEMANTIC_PRIMID)
diff --git a/src/gallium/auxiliary/draw/draw_gs.h b/src/gallium/auxiliary/draw/draw_gs.h
index d6a97d9c4e..e055c8a05c 100644
--- a/src/gallium/auxiliary/draw/draw_gs.h
+++ b/src/gallium/auxiliary/draw/draw_gs.h
@@ -62,7 +62,7 @@ struct draw_geometry_shader {
void draw_geometry_shader_run(struct draw_geometry_shader *shader,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT],
unsigned count,
unsigned input_stride,
unsigned output_stride);
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index ef49e57536..ecb17cbbe2 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -153,8 +153,8 @@ struct draw_context
const void *vbuffer[PIPE_MAX_ATTRIBS];
/** constant buffer (for vertex/geometry shader) */
- const void *vs_constants;
- const void *gs_constants;
+ const void *vs_constants[PIPE_MAX_CONSTANT];
+ const void *gs_constants[PIPE_MAX_CONSTANT];
} user;
boolean test_fse; /* enable FSE even though its not correct (eg for softpipe) */
@@ -202,10 +202,10 @@ struct draw_context
struct aos_machine *aos_machine;
- const float (*aligned_constants)[4];
+ const void *aligned_constants[PIPE_MAX_CONSTANT];
- const float (*aligned_constant_storage)[4];
- unsigned const_storage_size;
+ const void *aligned_constant_storage[PIPE_MAX_CONSTANT];
+ unsigned const_storage_size[PIPE_MAX_CONSTANT];
struct translate *fetch;
@@ -256,9 +256,11 @@ void draw_vs_destroy( struct draw_context *draw );
void draw_vs_set_viewport( struct draw_context *,
const struct pipe_viewport_state * );
-void draw_vs_set_constants( struct draw_context *,
- const float (*constants)[4],
- unsigned size );
+void
+draw_vs_set_constants(struct draw_context *,
+ unsigned slot,
+ const void *constants,
+ unsigned size);
@@ -266,9 +268,13 @@ void draw_vs_set_constants( struct draw_context *,
* Geometry shading code:
*/
boolean draw_gs_init( struct draw_context *draw );
-void draw_gs_set_constants( struct draw_context *,
- const float (*constants)[4],
- unsigned size );
+
+void
+draw_gs_set_constants(struct draw_context *,
+ unsigned slot,
+ const void *constants,
+ unsigned size);
+
void draw_gs_destroy( struct draw_context *draw );
/*******************************************************************************
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index 2c996e7308..56b69354b2 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -163,7 +163,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
vshader->run_linear(vshader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.vs_constants,
+ draw->pt.user.vs_constants,
fetch_count,
fpme->vertex_size,
fpme->vertex_size);
@@ -171,7 +171,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
draw_geometry_shader_run(gshader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.gs_constants,
+ draw->pt.user.gs_constants,
fetch_count,
fpme->vertex_size,
fpme->vertex_size);
@@ -248,7 +248,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
shader->run_linear(shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.vs_constants,
+ draw->pt.user.vs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
@@ -257,7 +257,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
draw_geometry_shader_run(geometry_shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.gs_constants,
+ draw->pt.user.gs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
@@ -328,7 +328,7 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
shader->run_linear(shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.vs_constants,
+ draw->pt.user.vs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
@@ -337,7 +337,7 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
draw_geometry_shader_run(geometry_shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.gs_constants,
+ draw->pt.user.gs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index e03ac8c229..120b976d9f 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -48,24 +48,27 @@
-void draw_vs_set_constants( struct draw_context *draw,
- const float (*constants)[4],
- unsigned size )
+void
+draw_vs_set_constants(struct draw_context *draw,
+ unsigned slot,
+ const void *constants,
+ unsigned size)
{
if (((uintptr_t)constants) & 0xf) {
- if (size > draw->vs.const_storage_size) {
- if (draw->vs.aligned_constant_storage)
- align_free((void *)draw->vs.aligned_constant_storage);
- draw->vs.aligned_constant_storage = align_malloc( size, 16 );
+ if (size > draw->vs.const_storage_size[slot]) {
+ if (draw->vs.aligned_constant_storage[slot]) {
+ align_free((void *)draw->vs.aligned_constant_storage[slot]);
+ }
+ draw->vs.aligned_constant_storage[slot] = align_malloc(size, 16);
}
- memcpy( (void*)draw->vs.aligned_constant_storage,
- constants,
- size );
- constants = draw->vs.aligned_constant_storage;
+ memcpy((void *)draw->vs.aligned_constant_storage[slot],
+ constants,
+ size);
+ constants = draw->vs.aligned_constant_storage[slot];
}
-
- draw->vs.aligned_constants = constants;
- draw_vs_aos_machine_constants( draw->vs.aos_machine, constants );
+
+ draw->vs.aligned_constants[slot] = constants;
+ draw_vs_aos_machine_constants(draw->vs.aos_machine, slot, constants);
}
@@ -182,6 +185,8 @@ draw_vs_init( struct draw_context *draw )
void
draw_vs_destroy( struct draw_context *draw )
{
+ uint i;
+
if (draw->vs.fetch_cache)
translate_cache_destroy(draw->vs.fetch_cache);
@@ -191,8 +196,11 @@ draw_vs_destroy( struct draw_context *draw )
if (draw->vs.aos_machine)
draw_vs_aos_machine_destroy(draw->vs.aos_machine);
- if (draw->vs.aligned_constant_storage)
- align_free((void*)draw->vs.aligned_constant_storage);
+ for (i = 0; i < PIPE_MAX_CONSTANT; i++) {
+ if (draw->vs.aligned_constant_storage[i]) {
+ align_free((void *)draw->vs.aligned_constant_storage[i]);
+ }
+ }
tgsi_exec_machine_destroy(draw->vs.machine);
}
diff --git a/src/gallium/auxiliary/draw/draw_vs.h b/src/gallium/auxiliary/draw/draw_vs.h
index 00036cfe68..6bd3683d39 100644
--- a/src/gallium/auxiliary/draw/draw_vs.h
+++ b/src/gallium/auxiliary/draw/draw_vs.h
@@ -132,7 +132,7 @@ struct draw_vertex_shader {
void (*run_linear)( struct draw_vertex_shader *shader,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT],
unsigned count,
unsigned input_stride,
unsigned output_stride );
@@ -212,8 +212,10 @@ static INLINE int draw_vs_varient_key_compare( const struct draw_vs_varient_key
struct aos_machine *draw_vs_aos_machine( void );
void draw_vs_aos_machine_destroy( struct aos_machine *machine );
-void draw_vs_aos_machine_constants( struct aos_machine *machine,
- const float (*constants)[4] );
+void
+draw_vs_aos_machine_constants(struct aos_machine *machine,
+ unsigned slot,
+ const void *constants);
void draw_vs_aos_machine_viewport( struct aos_machine *machine,
const struct pipe_viewport_state *viewport );
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c
index 1aaae4ab7a..4d73de413d 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.c
@@ -2114,11 +2114,14 @@ static void PIPE_CDECL vaos_run_elts( struct draw_vs_varient *varient,
{
struct draw_vs_varient_aos_sse *vaos = (struct draw_vs_varient_aos_sse *)varient;
struct aos_machine *machine = vaos->draw->vs.aos_machine;
+ unsigned i;
if (0) debug_printf("%s %d\n", __FUNCTION__, count);
machine->internal[IMM_PSIZE][0] = vaos->draw->rasterizer->point_size;
- machine->constants = vaos->draw->vs.aligned_constants;
+ for (i = 0; i < PIPE_MAX_CONSTANT; i++) {
+ machine->constants[i] = vaos->draw->vs.aligned_constants[i];
+ }
machine->immediates = vaos->base.vs->immediates;
machine->buffer = vaos->buffer;
@@ -2135,12 +2138,15 @@ static void PIPE_CDECL vaos_run_linear( struct draw_vs_varient *varient,
{
struct draw_vs_varient_aos_sse *vaos = (struct draw_vs_varient_aos_sse *)varient;
struct aos_machine *machine = vaos->draw->vs.aos_machine;
+ unsigned i;
if (0) debug_printf("%s %d %d const: %x\n", __FUNCTION__, start, count,
vaos->base.key.const_vbuffers);
machine->internal[IMM_PSIZE][0] = vaos->draw->rasterizer->point_size;
- machine->constants = vaos->draw->vs.aligned_constants;
+ for (i = 0; i < PIPE_MAX_CONSTANT; i++) {
+ machine->constants[i] = vaos->draw->vs.aligned_constants[i];
+ }
machine->immediates = vaos->base.vs->immediates;
machine->buffer = vaos->buffer;
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.h b/src/gallium/auxiliary/draw/draw_vs_aos.h
index 2cf72ddf7b..eefc097464 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.h
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.h
@@ -122,7 +122,7 @@ struct aos_machine {
ushort fpucntl; /* one of FPU_* above */
const float (*immediates)[4]; /* points to shader data */
- const float (*constants)[4]; /* points to draw data */
+ const void *constants[PIPE_MAX_CONSTANT]; /* points to draw data */
const struct aos_buffer *buffer; /* points to ? */
};
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos_machine.c b/src/gallium/auxiliary/draw/draw_vs_aos_machine.c
index 3240e3745d..0eda414ee6 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos_machine.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos_machine.c
@@ -219,10 +219,12 @@ static void PIPE_CDECL populate_lut( struct aos_machine *machine,
}
-void draw_vs_aos_machine_constants( struct aos_machine *machine,
- const float (*constants)[4] )
+void
+draw_vs_aos_machine_constants(struct aos_machine *machine,
+ unsigned slot,
+ const void *constants)
{
- machine->constants = constants;
+ machine->constants[slot] = constants;
{
unsigned i;
@@ -307,8 +309,10 @@ void draw_vs_aos_machine_viewport( struct aos_machine *machine,
{
}
-void draw_vs_aos_machine_constants( struct aos_machine *machine,
- const float (*constants)[4] )
+void
+draw_vs_aos_machine_constants(struct aos_machine *machine,
+ unsigned slot,
+ const void *constants)
{
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index 3f7a5ca14b..652c844654 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -85,7 +85,7 @@ static void
vs_exec_run_linear( struct draw_vertex_shader *shader,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT],
unsigned count,
unsigned input_stride,
unsigned output_stride )
@@ -95,7 +95,9 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
unsigned int i, j;
unsigned slot;
- machine->Consts[0] = constants;
+ for (i = 0; i < PIPE_MAX_CONSTANT; i++) {
+ machine->Consts[i] = constants[i];
+ }
for (i = 0; i < count; i += MAX_TGSI_VERTICES) {
unsigned int max_vertices = MIN2(MAX_TGSI_VERTICES, count - i);
diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c
index b3535c0e48..e8e72f06ec 100644
--- a/src/gallium/auxiliary/draw/draw_vs_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c
@@ -64,7 +64,7 @@ static void
vs_llvm_run_linear( struct draw_vertex_shader *base,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT],
unsigned count,
unsigned input_stride,
unsigned output_stride )
@@ -74,7 +74,8 @@ vs_llvm_run_linear( struct draw_vertex_shader *base,
gallivm_cpu_vs_exec(shader->llvm_prog, shader->machine,
input, base->info.num_inputs, output, base->info.num_outputs,
- constants, count, input_stride, output_stride);
+ (const float (*)[4])constants[0],
+ count, input_stride, output_stride);
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_ppc.c b/src/gallium/auxiliary/draw/draw_vs_ppc.c
index da9f3e3d35..9952b40fcc 100644
--- a/src/gallium/auxiliary/draw/draw_vs_ppc.c
+++ b/src/gallium/auxiliary/draw/draw_vs_ppc.c
@@ -85,7 +85,7 @@ static void
vs_ppc_run_linear( struct draw_vertex_shader *base,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT],
unsigned count,
unsigned input_stride,
unsigned output_stride )
@@ -125,7 +125,7 @@ vs_ppc_run_linear( struct draw_vertex_shader *base,
*/
shader->func(inputs_soa, outputs_soa, temps_soa,
(float (*)[4]) shader->base.immediates,
- (float (*)[4]) constants,
+ (const float (*)[4])constants[0],
ppc_builtin_constants);
/* convert (up to) four output verts from SoA back to AoS format */
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
index 702051387a..297013dc74 100644
--- a/src/gallium/auxiliary/draw/draw_vs_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -83,7 +83,7 @@ static void
vs_sse_run_linear( struct draw_vertex_shader *base,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT],
unsigned count,
unsigned input_stride,
unsigned output_stride )
@@ -112,7 +112,7 @@ vs_sse_run_linear( struct draw_vertex_shader *base,
/* run compiled shader
*/
shader->func(machine,
- constants,
+ (const float (*)[4])constants[0],
shader->base.immediates,
input,
base->info.num_inputs,
diff --git a/src/gallium/auxiliary/draw/draw_vs_varient.c b/src/gallium/auxiliary/draw/draw_vs_varient.c
index b87a465f6b..5ed706cb4f 100644
--- a/src/gallium/auxiliary/draw/draw_vs_varient.c
+++ b/src/gallium/auxiliary/draw/draw_vs_varient.c
@@ -147,7 +147,7 @@ static void PIPE_CDECL vsvg_run_elts( struct draw_vs_varient *varient,
vsvg->base.vs->run_linear( vsvg->base.vs,
temp_buffer,
temp_buffer,
- (const float (*)[4])vsvg->base.vs->draw->pt.user.vs_constants,
+ vsvg->base.vs->draw->pt.user.vs_constants,
count,
temp_vertex_stride,
temp_vertex_stride);
@@ -210,7 +210,7 @@ static void PIPE_CDECL vsvg_run_linear( struct draw_vs_varient *varient,
vsvg->base.vs->run_linear( vsvg->base.vs,
temp_buffer,
temp_buffer,
- (const float (*)[4])vsvg->base.vs->draw->pt.user.vs_constants,
+ vsvg->base.vs->draw->pt.user.vs_constants,
count,
temp_vertex_stride,
temp_vertex_stride);
diff --git a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
index 0a4da8ecc8..c674d0be63 100644
--- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
+++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
@@ -59,7 +59,7 @@ cell_map_constant_buffers(struct cell_context *sp)
}
}
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX, 0,
sp->mapped_constants[PIPE_SHADER_VERTEX],
sp->constants[PIPE_SHADER_VERTEX]->size);
}
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 4c5ff37ca8..a0c80d0228 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -81,7 +81,7 @@ i915_draw_range_elements(struct pipe_context *pipe,
}
- draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
i915->current.constants[PIPE_SHADER_VERTEX],
(i915->current.num_user_constants[PIPE_SHADER_VERTEX] *
4 * sizeof(float)));
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 70e2a082cc..0cb335fe27 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -731,7 +731,7 @@ llvmpipe_set_constant_buffer(struct pipe_context *pipe,
}
if(shader == PIPE_SHADER_VERTEX) {
- draw_set_mapped_constant_buffer(llvmpipe->draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(llvmpipe->draw, PIPE_SHADER_VERTEX, 0,
data, size);
}
diff --git a/src/gallium/drivers/nv04/nv04_vbo.c b/src/gallium/drivers/nv04/nv04_vbo.c
index 3484771814..2db61d8941 100644
--- a/src/gallium/drivers/nv04/nv04_vbo.c
+++ b/src/gallium/drivers/nv04/nv04_vbo.c
@@ -45,7 +45,7 @@ void nv04_draw_elements( struct pipe_context *pipe,
draw_set_mapped_element_buffer(draw, 0, NULL);
}
- draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
nv04->constbuf[PIPE_SHADER_VERTEX],
nv04->constbuf_nr[PIPE_SHADER_VERTEX]);
diff --git a/src/gallium/drivers/nv10/nv10_vbo.c b/src/gallium/drivers/nv10/nv10_vbo.c
index 9180c72c9b..da5c93f081 100644
--- a/src/gallium/drivers/nv10/nv10_vbo.c
+++ b/src/gallium/drivers/nv10/nv10_vbo.c
@@ -46,6 +46,7 @@ void nv10_draw_elements( struct pipe_context *pipe,
draw_set_mapped_constant_buffer(draw,
PIPE_SHADER_VERTEX,
+ 0,
nv10->constbuf[PIPE_SHADER_VERTEX],
nv10->constbuf_nr[PIPE_SHADER_VERTEX]);
diff --git a/src/gallium/drivers/nv20/nv20_vbo.c b/src/gallium/drivers/nv20/nv20_vbo.c
index 52991a0d85..6dc9538901 100644
--- a/src/gallium/drivers/nv20/nv20_vbo.c
+++ b/src/gallium/drivers/nv20/nv20_vbo.c
@@ -45,7 +45,7 @@ void nv20_draw_elements( struct pipe_context *pipe,
draw_set_mapped_element_buffer(draw, 0, NULL);
}
- draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
nv20->constbuf[PIPE_SHADER_VERTEX],
nv20->constbuf_nr[PIPE_SHADER_VERTEX]);
diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c
index d826f8c2f5..a2fd5f6c02 100644
--- a/src/gallium/drivers/nv40/nv40_draw.c
+++ b/src/gallium/drivers/nv40/nv40_draw.c
@@ -271,7 +271,7 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
map = pipe_buffer_map(pscreen,
nv40->constbuf[PIPE_SHADER_VERTEX],
PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_constant_buffer(nv40->draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(nv40->draw, PIPE_SHADER_VERTEX, 0,
map, nr);
}
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index bcb3707149..95b7cb5fa4 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -462,6 +462,7 @@ void r300_swtcl_draw_arrays(struct pipe_context* pipe,
draw_set_mapped_constant_buffer(r300->draw,
PIPE_SHADER_VERTEX,
+ 0,
r300->shader_constants[PIPE_SHADER_VERTEX].constants,
r300->shader_constants[PIPE_SHADER_VERTEX].count *
(sizeof(float) * 4));
@@ -506,6 +507,7 @@ void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
draw_set_mapped_constant_buffer(r300->draw,
PIPE_SHADER_VERTEX,
+ 0,
r300->shader_constants[PIPE_SHADER_VERTEX].constants,
r300->shader_constants[PIPE_SHADER_VERTEX].count *
(sizeof(float) * 4));
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index cbb9631fa5..06b97ab7c9 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -49,7 +49,7 @@ static void
softpipe_map_constant_buffers(struct softpipe_context *sp)
{
struct pipe_winsys *ws = sp->pipe.winsys;
- uint i, vssize, gssize;
+ uint i;
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
uint j;
@@ -63,22 +63,22 @@ softpipe_map_constant_buffers(struct softpipe_context *sp)
}
}
- if (sp->constants[PIPE_SHADER_VERTEX][0])
- vssize = sp->constants[PIPE_SHADER_VERTEX][0]->size;
- else
- vssize = 0;
-
- if (sp->constants[PIPE_SHADER_GEOMETRY][0])
- gssize = sp->constants[PIPE_SHADER_GEOMETRY][0]->size;
- else
- gssize = 0;
-
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX,
- sp->mapped_constants[PIPE_SHADER_VERTEX][0],
- vssize);
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_GEOMETRY,
- sp->mapped_constants[PIPE_SHADER_GEOMETRY][0],
- gssize);
+ for (i = 0; i < PIPE_MAX_CONSTANT; i++) {
+ if (sp->constants[PIPE_SHADER_VERTEX][i]) {
+ draw_set_mapped_constant_buffer(sp->draw,
+ PIPE_SHADER_VERTEX,
+ i,
+ sp->mapped_constants[PIPE_SHADER_VERTEX][i],
+ sp->constants[PIPE_SHADER_VERTEX][i]->size);
+ }
+ if (sp->constants[PIPE_SHADER_GEOMETRY][i]) {
+ draw_set_mapped_constant_buffer(sp->draw,
+ PIPE_SHADER_GEOMETRY,
+ i,
+ sp->mapped_constants[PIPE_SHADER_GEOMETRY][i],
+ sp->constants[PIPE_SHADER_GEOMETRY][i]->size);
+ }
+ }
}
@@ -93,8 +93,18 @@ softpipe_unmap_constant_buffers(struct softpipe_context *sp)
*/
draw_flush(sp->draw);
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX, NULL, 0);
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_GEOMETRY, NULL, 0);
+ for (i = 0; i < PIPE_MAX_CONSTANT; i++) {
+ draw_set_mapped_constant_buffer(sp->draw,
+ PIPE_SHADER_VERTEX,
+ i,
+ NULL,
+ 0);
+ draw_set_mapped_constant_buffer(sp->draw,
+ PIPE_SHADER_GEOMETRY,
+ i,
+ NULL,
+ 0);
+ }
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
uint j;
diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c
index 0ae58c7d9d..5e6e30c7df 100644
--- a/src/gallium/drivers/svga/svga_swtnl_draw.c
+++ b/src/gallium/drivers/svga/svga_swtnl_draw.c
@@ -89,7 +89,7 @@ svga_swtnl_draw_range_elements(struct svga_context *svga,
PIPE_BUFFER_USAGE_CPU_READ);
assert(map);
draw_set_mapped_constant_buffer(
- draw, PIPE_SHADER_VERTEX,
+ draw, PIPE_SHADER_VERTEX, 0,
map,
svga->curr.cb[PIPE_SHADER_VERTEX]->size);
}