#include "st_atom.h"
#include "st_atom_constbuf.h"
#include "st_program.h"
-
+#include "st_inlines.h"
/**
* Pass the given program parameters to the graphics pipe as a
if (params && params->NumParameters) {
const uint paramBytes = params->NumParameters * sizeof(GLfloat) * 4;
- /* Update our own dependency flags. This works because this
- * function will also be called whenever the program changes.
- */
- st->constants.tracked_state[id].dirty.mesa =
- (params->StateFlags | _NEW_PROGRAM);
-
_mesa_load_state_parameters(st->ctx, params);
/* We always need to get a new buffer, to keep the drivers simple and
* avoid gratuitous rendering synchronization.
*/
- pipe_reference_buffer(pipe, &cbuf->buffer, NULL );
- cbuf->buffer = pipe_buffer_create(pipe, 1, PIPE_BUFFER_USAGE_CONSTANT,
+ pipe_buffer_reference(&cbuf->buffer, NULL );
+ cbuf->buffer = pipe_buffer_create(pipe->screen, 16, PIPE_BUFFER_USAGE_CONSTANT,
paramBytes );
if (0)
}
/* load Mesa constants into the constant buffer */
- if (cbuf->buffer) {
- void *map = pipe_buffer_map(pipe, cbuf->buffer,
- PIPE_BUFFER_USAGE_CPU_WRITE);
- memcpy(map, params->ParameterValues, paramBytes);
- pipe_buffer_unmap(pipe, cbuf->buffer);
- }
-
- cbuf->size = paramBytes;
+ if (cbuf->buffer)
+ st_no_flush_pipe_buffer_write(st, cbuf->buffer,
+ 0, paramBytes,
+ params->ParameterValues);
st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf);
}
const struct st_tracked_state st_update_vs_constants = {
"st_update_vs_constants", /* name */
{ /* dirty */
- 0, /* set dynamically above */ /* mesa */
+ (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */
ST_NEW_VERTEX_PROGRAM, /* st */
},
update_vs_constants /* update */
const struct st_tracked_state st_update_fs_constants = {
"st_update_fs_constants", /* name */
{ /* dirty */
- 0, /* set dynamically above */ /* mesa */
+ (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS), /* mesa */
ST_NEW_FRAGMENT_PROGRAM, /* st */
},
update_fs_constants /* update */