#include "brw_util.h"
#include "brw_wm.h"
#include "pipe/p_state.h"
+#include "pipe/p_winsys.h"
#include "pipe/p_util.h"
#define FILE_DEBUG_FLAG DEBUG_FALLBACKS
if (brw->curbe.vs_size) {
-// unsigned offset = brw->curbe.vs_start * 16;
-// unsigned nr = vp->max_const;
-
+ unsigned offset = brw->curbe.vs_start * 16;
+ /*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: */
-
-// assert(nr == 0);
- assert(0);
+ 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 (0) {
struct brw_prog_info {
unsigned num_temps;
unsigned num_addrs;
+ unsigned num_consts;
unsigned writes_psize;
/* Vertex program parameters from curbe:
*/
-#if 0
- nr_params = c->vp->program.num_inputs; /*FIXME: i think this is wrong... */
+ nr_params = c->prog_data.max_const;
for (i = 0; i < nr_params; i++) {
- c->regs[TGSI_FILE_INPUT][i] = stride(brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1);
+ c->regs[TGSI_FILE_CONSTANT][i] = stride(brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1);
}
reg += (nr_params+1)/2;
-#endif
c->prog_data.curb_read_length = reg - 1;
{
switch(decl->Declaration.File) {
case TGSI_FILE_CONSTANT: {
+ if (decl->Declaration.Declare == TGSI_DECLARE_MASK) {
+ printf("DECLARATION MASK = %d\n",
+ decl->u.DeclarationMask.Mask);
+ assert(0);
+ } else { /*range*/
+ info->num_consts += decl->u.DeclarationRange.Last - decl->u.DeclarationRange.First + 1;
+ }
}
break;
case TGSI_FILE_INPUT: {
/* 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;
brw_vs_alloc_regs(c, &prog_info);
brw_set_access_mode(p, BRW_ALIGN_1);
brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack));
brw_set_access_mode(p, BRW_ALIGN_16);
-
allocated_registers = 1;
}
process_instruction(c, inst, &prog_info);
emit_vertex_write(c, &prog_info);
post_vs_emit(c, end_inst);
tgsi_parse_free(&parse);
+
}