/*unsigned nr = vp->max_const;*/
const struct pipe_constant_buffer *cbuffer = brw->attribs.Constants[0];
struct pipe_winsys *ws = brw->pipe.winsys;
- /* map the vertex constant buffer and copy to curbe: */
- ws->buffer_map(ws, cbuffer->buffer, 0);
- ws->buffer_get_subdata(ws, cbuffer->buffer,
- 0,
- cbuffer->size,
- &buf[offset]);
- ws->buffer_unmap(ws, cbuffer->buffer);
+ if (cbuffer->size) {
+ /* map the vertex constant buffer and copy to curbe: */
+ ws->buffer_map(ws, cbuffer->buffer, 0);
+ ws->buffer_get_subdata(ws, cbuffer->buffer,
+ 0,
+ cbuffer->size,
+ &buf[offset]);
+ ws->buffer_unmap(ws, cbuffer->buffer);
+ offset += cbuffer->size;
+ }
+ /*immediates*/
+#if 0
+ if (brw->vs.prog_data->num_imm) {
+ memcpy(&buf[offset], brw->vs.prog_data->imm_buf,
+ brw->vs.prog_data->num_imm * 4 * sizeof(float));
+ }
+#endif
}
if (1) {
case TGSI_FILE_TEMPORARY:
case TGSI_FILE_INPUT:
case TGSI_FILE_OUTPUT:
- case TGSI_FILE_CONSTANT:
assert(c->regs[file][index].nr != 0);
return c->regs[file][index];
+ case TGSI_FILE_CONSTANT:
+ case TGSI_FILE_IMMEDIATE:
+ assert(c->regs[TGSI_FILE_CONSTANT][index].nr != 0);
+ return c->regs[TGSI_FILE_CONSTANT][index];
case TGSI_FILE_ADDRESS:
assert(index == 0);
return c->regs[file][index];
}
break;
case TGSI_TOKEN_TYPE_IMMEDIATE: {
+ int i;
+ struct tgsi_full_immediate *imm = &parse.FullToken.FullImmediate;
+ /*assert(imm->Immediate.Size == 4);*/
+ c->prog_data.imm_buf[c->prog_data.num_imm][0] = imm->u.ImmediateFloat32[0].Float;
+ c->prog_data.imm_buf[c->prog_data.num_imm][1] = imm->u.ImmediateFloat32[1].Float;
+ c->prog_data.imm_buf[c->prog_data.num_imm][2] = imm->u.ImmediateFloat32[2].Float;
+ c->prog_data.imm_buf[c->prog_data.num_imm][3] = imm->u.ImmediateFloat32[3].Float;
+ c->prog_data.num_imm++;
}
break;
case TGSI_TOKEN_TYPE_INSTRUCTION: {
/* first instruction (declerations finished).
* now that we know what vars are being used allocate
* registers for them.*/
- c->prog_data.max_const = prog_info.num_consts;
+ c->prog_data.max_const = prog_info.num_consts + c->prog_data.num_imm;
brw_vs_alloc_regs(c, &prog_info);
brw_set_access_mode(p, BRW_ALIGN_1);