*/
if (buf) {
void *mapped;
- if (buf->size &&
+ if (buf->buffer && buf->buffer->size &&
(mapped = ws->buffer_map(ws, buf->buffer,
PIPE_BUFFER_USAGE_CPU_READ))) {
- memcpy(i915->current.constants[shader], mapped, buf->size);
+ memcpy(i915->current.constants[shader], mapped, buf->buffer->size);
ws->buffer_unmap(ws, buf->buffer);
i915->current.num_user_constants[shader]
- = buf->size / (4 * sizeof(float));
+ = buf->buffer->size / (4 * sizeof(float));
}
else {
i915->current.num_user_constants[shader] = 0;
if (brw->vs.prog_data->num_consts) {
/* map the vertex constant buffer and copy to curbe: */
void *data = ws->buffer_map(ws, cbuffer->buffer, 0);
- /* FIXME: this is wrong. the cbuffer->size currently
+ /* FIXME: this is wrong. the cbuffer->buffer->size currently
* represents size of consts + immediates. so if we'll
* have both we'll copy over the end of the buffer
* with the subsequent memcpy */
- memcpy(&buf[offset], data, cbuffer->size);
+ memcpy(&buf[offset], data, cbuffer->buffer->size);
ws->buffer_unmap(ws, cbuffer->buffer);
- offset += cbuffer->size;
+ offset += cbuffer->buffer->size;
}
/*immediates*/
if (brw->vs.prog_data->num_imm) {
if (buf) {
void *mapped;
- if (buf->size && (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+ if (buf->buffer && buf->buffer->size &&
+ (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
{
- memcpy(nv10->constbuf[shader], mapped, buf->size);
+ memcpy(nv10->constbuf[shader], mapped, buf->buffer->size);
nv10->constbuf_nr[shader] =
- buf->size / (4 * sizeof(float));
+ buf->buffer->size / (4 * sizeof(float));
ws->buffer_unmap(ws, buf->buffer);
}
}
if (buf) {
void *mapped;
- if (buf->size && (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+ if (buf->buffer && buf->buffer->size &&
+ (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
{
- memcpy(nv20->constbuf[shader], mapped, buf->size);
+ memcpy(nv20->constbuf[shader], mapped, buf->buffer->size);
nv20->constbuf_nr[shader] =
- buf->size / (4 * sizeof(float));
+ buf->buffer->size / (4 * sizeof(float));
ws->buffer_unmap(ws, buf->buffer);
}
}
struct nv30_context *nv30 = nv30_context(pipe);
nv30->constbuf[shader] = buf->buffer;
- nv30->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
+ nv30->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float));
if (shader == PIPE_SHADER_VERTEX) {
nv30->dirty |= NV30_NEW_VERTPROG;
struct nv40_context *nv40 = nv40_context(pipe);
nv40->constbuf[shader] = buf->buffer;
- nv40->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
+ nv40->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float));
if (shader == PIPE_SHADER_VERTEX) {
nv40->dirty |= NV40_NEW_VERTPROG;
struct pipe_winsys *ws = sp->pipe.winsys;
uint i;
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
- if (sp->constants[i].size)
+ if (sp->constants[i].buffer && sp->constants[i].buffer->size)
sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
}
draw_set_mapped_constant_buffer(sp->draw,
sp->mapped_constants[PIPE_SHADER_VERTEX],
- sp->constants[PIPE_SHADER_VERTEX].size);
+ sp->constants[PIPE_SHADER_VERTEX].buffer->size);
}
static void
draw_set_mapped_constant_buffer(sp->draw, NULL, 0);
for (i = 0; i < 2; i++) {
- if (sp->constants[i].size)
+ if (sp->constants[i].buffer && sp->constants[i].buffer->size)
ws->buffer_unmap(ws, sp->constants[i].buffer);
sp->mapped_constants[i] = NULL;
}
winsys_buffer_reference(ws,
&softpipe->constants[shader].buffer,
buf ? buf->buffer : NULL);
- softpipe->constants[shader].size = buf ? buf->size : 0;
softpipe->dirty |= SP_NEW_CONSTANTS;
}
trace_dump_struct_begin("pipe_constant_buffer");
trace_dump_member(ptr, state, buffer);
- trace_dump_member(uint, state, size);
trace_dump_struct_end();
}
struct pipe_constant_buffer
{
struct pipe_buffer *buffer;
- unsigned size; /** in bytes (XXX: redundant!) */
};
pipe_buffer_unmap(pipe->screen, cbuf->buffer);
}
- cbuf->size = paramBytes;
-
st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf);
}
else {