}
switch (desc->channel[i].type) {
- /* Half-floats, floats, doubles */
+ /* Half-floats, floats, ints */
case UTIL_FORMAT_TYPE_FLOAT:
switch (desc->channel[i].size) {
case 16:
*format = FMT_16_16_FLOAT;
break;
case 3:
- *format = FMT_16_16_16_FLOAT;
- break;
case 4:
*format = FMT_16_16_16_16_FLOAT;
break;
*format = FMT_8_8;
break;
case 3:
- // *format = FMT_8_8_8; /* fails piglit draw-vertices test */
- // break;
case 4:
*format = FMT_8_8_8_8;
break;
*format = FMT_16_16;
break;
case 3:
- // *format = FMT_16_16_16; /* fails piglit draw-vertices test */
- // break;
case 4:
*format = FMT_16_16_16_16;
break;
if (rctx->states[R600_PIPE_STATE_CLIP]) {
util_blitter_save_clip(rctx->blitter, &rctx->clip);
}
- util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer);
+ util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffers, rctx->vertex_buffer);
rctx->vertex_elements = NULL;
struct translate_cache *translate_cache;
/* The vertex buffer slot containing the translated buffer. */
unsigned vb_slot;
+ void *saved_velems;
void *new_velems;
};
struct pipe_index_buffer index_buffer;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
struct pipe_resource *real_vertex_buffer[PIPE_MAX_ATTRIBS];
- unsigned nvertex_buffer;
+ unsigned nvertex_buffers;
+ unsigned nreal_vertex_buffers; /* with the translated vertex buffer */
unsigned cb_target_mask;
/* for saving when using blitter */
struct pipe_stencil_ref stencil_ref;
}
}
- for (; i < rctx->nvertex_buffer; i++) {
+ for (; i < rctx->nreal_vertex_buffers; i++) {
pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL);
pipe_resource_reference(&rctx->real_vertex_buffer[i], NULL);
memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count);
- rctx->nvertex_buffer = count;
+ rctx->nvertex_buffers = count;
+ rctx->nreal_vertex_buffers = count;
rctx->vb_max_index = max_index;
}
FORMAT_REPLACE(R64G64_FLOAT, R32G32_FLOAT);
FORMAT_REPLACE(R64G64B64_FLOAT, R32G32B32_FLOAT);
FORMAT_REPLACE(R64G64B64A64_FLOAT, R32G32B32A32_FLOAT);
+
+ /* r600 doesn't seem to support 32_*SCALED, these formats
+ * aren't in D3D10 either. */
+ FORMAT_REPLACE(R32_UNORM, R32_FLOAT);
+ FORMAT_REPLACE(R32G32_UNORM, R32G32_FLOAT);
+ FORMAT_REPLACE(R32G32B32_UNORM, R32G32B32_FLOAT);
+ FORMAT_REPLACE(R32G32B32A32_UNORM, R32G32B32A32_FLOAT);
+
+ FORMAT_REPLACE(R32_USCALED, R32_FLOAT);
+ FORMAT_REPLACE(R32G32_USCALED, R32G32_FLOAT);
+ FORMAT_REPLACE(R32G32B32_USCALED, R32G32B32_FLOAT);
+ FORMAT_REPLACE(R32G32B32A32_USCALED,R32G32B32A32_FLOAT);
+
+ FORMAT_REPLACE(R32_SNORM, R32_FLOAT);
+ FORMAT_REPLACE(R32G32_SNORM, R32G32_FLOAT);
+ FORMAT_REPLACE(R32G32B32_SNORM, R32G32B32_FLOAT);
+ FORMAT_REPLACE(R32G32B32A32_SNORM, R32G32B32A32_FLOAT);
+
+ FORMAT_REPLACE(R32_SSCALED, R32_FLOAT);
+ FORMAT_REPLACE(R32G32_SSCALED, R32G32_FLOAT);
+ FORMAT_REPLACE(R32G32B32_SSCALED, R32G32B32_FLOAT);
+ FORMAT_REPLACE(R32G32B32A32_SSCALED,R32G32B32A32_FLOAT);
default:;
}
v->incompatible_layout =
rctx->nvs_resource = rctx->vertex_elements->count;
} else {
/* bind vertex buffer once */
- rctx->nvs_resource = rctx->nvertex_buffer;
+ rctx->nvs_resource = rctx->nreal_vertex_buffers;
}
for (i = 0 ; i < rctx->nvs_resource; i++) {
tr = translate_cache_find(rctx->tran.translate_cache, &key);
/* Map buffers we want to translate. */
- for (i = 0; i < rctx->nvertex_buffer; i++) {
+ for (i = 0; i < rctx->nvertex_buffers; i++) {
if (vb_translated[i]) {
struct pipe_vertex_buffer *vb = &rctx->vertex_buffer[i];
vb_map[i] = pipe_buffer_map(pipe, vb->buffer,
PIPE_TRANSFER_READ, &vb_transfer[i]);
- tr->set_buffer(tr, i, vb_map[i], vb->stride, vb->max_index);
+ tr->set_buffer(tr, i, vb_map[i], vb->stride, ~0);
}
}
tr->run(tr, 0, num_verts, 0, out_map);
/* Unmap all buffers. */
- for (i = 0; i < rctx->nvertex_buffer; i++) {
+ for (i = 0; i < rctx->nvertex_buffers; i++) {
if (vb_translated[i]) {
pipe_buffer_unmap(pipe, vb_transfer[i]);
}
struct pipe_vertex_buffer *vb = &rctx->vertex_buffer[i];
if (!vb->buffer) {
- pipe_resource_reference(&vb->buffer, out_buffer);
+ pipe_resource_reference(&rctx->real_vertex_buffer[i], out_buffer);
vb->buffer_offset = 0;
- vb->max_index = num_verts - 1;
vb->stride = key.output_stride;
rctx->tran.vb_slot = i;
+
+ if (i >= rctx->nvertex_buffers) {
+ rctx->nreal_vertex_buffers = i+1;
+ }
break;
}
}
}
}
+ rctx->tran.saved_velems = rctx->vertex_elements;
tmp = pipe->create_vertex_elements_state(pipe, ve->count, new_velems);
pipe->bind_vertex_elements_state(pipe, tmp);
rctx->tran.new_velems = tmp;
return;
}
/* Restore vertex elements. */
+ pipe->bind_vertex_elements_state(pipe, rctx->tran.saved_velems);
+ rctx->tran.saved_velems = NULL;
pipe->delete_vertex_elements_state(pipe, rctx->tran.new_velems);
rctx->tran.new_velems = NULL;
/* Delete the now-unused VBO. */
- pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer, NULL);
+ pipe_resource_reference(&rctx->real_vertex_buffer[rctx->tran.vb_slot], NULL);
+ rctx->nreal_vertex_buffers = rctx->nvertex_buffers;
}
void r600_translate_index_buffer(struct r600_pipe_context *r600,
*index_size = 2;
*start = 0;
break;
- case 2:
- case 4:
- break;
}
}