mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
gallium: Enable multiple constant buffers for vertex and geometry shaders.
This commit is contained in:
parent
44ac4c4e2c
commit
9851644435
27 changed files with 146 additions and 95 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ? */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
|||
mapped_constants = pipe_buffer_map(pipe->screen,
|
||||
st->state.constants[PIPE_SHADER_VERTEX],
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX,
|
||||
draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX, 0,
|
||||
mapped_constants,
|
||||
st->state.constants[PIPE_SHADER_VERTEX]->size);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue