summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/evergreen_state.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-10-01 13:09:09 +1000
committerDave Airlie <[email protected]>2010-10-01 13:36:56 +1000
commitd662195f00fe60349cdda368eeb065910764842f (patch)
tree667cd52ad6656d5cdb05eae4f106d8eb302c57d1 /src/gallium/drivers/r600/evergreen_state.c
parente973221538d5edfad62abedf5b37a4fb774d71fc (diff)
r600g: fixup vertex format picking.
there are some vertex formats defined in r600c not in the docs.
Diffstat (limited to 'src/gallium/drivers/r600/evergreen_state.c')
-rw-r--r--src/gallium/drivers/r600/evergreen_state.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 06dc8407a18..2f5f1bff28e 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1334,7 +1334,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_state *rstate;
struct r600_resource *rbuffer;
- unsigned i, j, offset, format, prim;
+ unsigned i, j, offset, prim;
u32 vgt_dma_index_type, vgt_draw_initiator, mask;
struct pipe_vertex_buffer *vertex_buffer;
struct r600_draw rdraw;
@@ -1402,34 +1402,28 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info)
return;
for (i = 0 ; i < rctx->vertex_elements->count; i++) {
- unsigned num_format = 0, format_comp = 0;
-
+ uint32_t word3, word2;
+ uint32_t format;
rstate = &rctx->vs_resource[i];
+
+ rstate->id = R600_PIPE_STATE_RESOURCE;
+ rstate->nregs = 0;
+
j = rctx->vertex_elements->elements[i].vertex_buffer_index;
vertex_buffer = &rctx->vertex_buffer[j];
rbuffer = (struct r600_resource*)vertex_buffer->buffer;
offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset;
- format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format);
- rstate->id = R600_PIPE_STATE_RESOURCE;
- rstate->nregs = 0;
- r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp);
+ format = r600_translate_vertex_data_type(rctx->vertex_elements->elements[i].src_format);
+
+ word2 = format | S_030008_STRIDE(vertex_buffer->stride);
+
+ word3 = r600_translate_vertex_data_swizzle(rctx->vertex_elements->elements[i].src_format);
+
r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo);
r600_pipe_state_add_reg(rstate, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate,
- R_030008_RESOURCE0_WORD2,
- S_030008_STRIDE(vertex_buffer->stride) |
- S_030008_DATA_FORMAT(format) |
- S_030008_NUM_FORMAT_ALL(num_format) |
- S_030008_FORMAT_COMP_ALL(format_comp),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate,
- R_03000C_RESOURCE0_WORD3,
- S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) |
- S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) |
- S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) |
- S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W),
- 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2, word2, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3, word3, 0xFFFFFFFF, NULL);
r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL);
r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL);
r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6, 0x00000000, 0xFFFFFFFF, NULL);