diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/r300/r300_render_translate.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c index ea3c9668f7e..0ea11e5bfc2 100644 --- a/src/gallium/drivers/r300/r300_render_translate.c +++ b/src/gallium/drivers/r300/r300_render_translate.c @@ -49,6 +49,8 @@ void r300_begin_vertex_translate(struct r300_context *r300) for (i = 0; i < ve->count; i++) { struct pipe_vertex_buffer *vb = &r300->vertex_buffer[ve->velem[i].vertex_buffer_index]; + enum pipe_format output_format = ve->hw_format[i]; + unsigned output_format_size = ve->hw_format_size[i]; /* Check for support. */ if (ve->velem[i].src_format == ve->hw_format[i] && @@ -57,6 +59,27 @@ void r300_begin_vertex_translate(struct r300_context *r300) continue; } + /* Workaround for translate: output floats instead of halfs. */ + switch (output_format) { + case PIPE_FORMAT_R16_FLOAT: + output_format = PIPE_FORMAT_R32_FLOAT; + output_format_size = 4; + break; + case PIPE_FORMAT_R16G16_FLOAT: + output_format = PIPE_FORMAT_R32G32_FLOAT; + output_format_size = 8; + break; + case PIPE_FORMAT_R16G16B16_FLOAT: + output_format = PIPE_FORMAT_R32G32B32_FLOAT; + output_format_size = 12; + break; + case PIPE_FORMAT_R16G16B16A16_FLOAT: + output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + output_format_size = 16; + break; + default:; + } + /* Add this vertex element. */ te = &key.element[key.nr_elements]; /*te->type; @@ -64,10 +87,10 @@ void r300_begin_vertex_translate(struct r300_context *r300) te->input_buffer = ve->velem[i].vertex_buffer_index; te->input_format = ve->velem[i].src_format; te->input_offset = vb->buffer_offset + ve->velem[i].src_offset; - te->output_format = ve->hw_format[i]; + te->output_format = output_format; te->output_offset = key.output_stride; - key.output_stride += ve->hw_format_size[i]; + key.output_stride += output_format_size; vb_translated[ve->velem[i].vertex_buffer_index] = TRUE; tr_elem_index[i] = key.nr_elements; key.nr_elements++; |