diff options
Diffstat (limited to 'src/mesa/pipe/i965simple')
-rw-r--r-- | src/mesa/pipe/i965simple/brw_context.h | 3 | ||||
-rw-r--r-- | src/mesa/pipe/i965simple/brw_curbe.c | 24 | ||||
-rw-r--r-- | src/mesa/pipe/i965simple/brw_vs_emit.c | 15 |
3 files changed, 33 insertions, 9 deletions
diff --git a/src/mesa/pipe/i965simple/brw_context.h b/src/mesa/pipe/i965simple/brw_context.h index 59e3d24a1d..139f13ad4e 100644 --- a/src/mesa/pipe/i965simple/brw_context.h +++ b/src/mesa/pipe/i965simple/brw_context.h @@ -327,6 +327,9 @@ struct brw_vs_prog_data { unsigned max_const; + float imm_buf[PIPE_MAX_CONSTANT][4]; + unsigned num_imm; + /* Used for calculating urb partitions: */ unsigned urb_entry_size; diff --git a/src/mesa/pipe/i965simple/brw_curbe.c b/src/mesa/pipe/i965simple/brw_curbe.c index 785affa2d8..603116c863 100644 --- a/src/mesa/pipe/i965simple/brw_curbe.c +++ b/src/mesa/pipe/i965simple/brw_curbe.c @@ -252,13 +252,23 @@ static void upload_constant_buffer(struct brw_context *brw) /*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) { diff --git a/src/mesa/pipe/i965simple/brw_vs_emit.c b/src/mesa/pipe/i965simple/brw_vs_emit.c index d70df158f9..f3507f60f7 100644 --- a/src/mesa/pipe/i965simple/brw_vs_emit.c +++ b/src/mesa/pipe/i965simple/brw_vs_emit.c @@ -627,9 +627,12 @@ static struct brw_reg get_reg( struct brw_vs_compile *c, 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]; @@ -1298,6 +1301,14 @@ void brw_vs_emit(struct brw_vs_compile *c) } 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: { @@ -1306,7 +1317,7 @@ void brw_vs_emit(struct brw_vs_compile *c) /* 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); |