summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-06-19 17:20:40 +0200
committerMarek Olšák <maraeo@gmail.com>2010-06-19 17:20:40 +0200
commit4c761843051d7e97be828baad965c13789127dbf (patch)
treed81709bcddf024aa5af6e9044d8753f086a42fae /src/gallium/drivers
parentce4c9a7f25d57c6f2885c07743ef3d162584c997 (diff)
downloadexternal_mesa3d-4c761843051d7e97be828baad965c13789127dbf.zip
external_mesa3d-4c761843051d7e97be828baad965c13789127dbf.tar.gz
external_mesa3d-4c761843051d7e97be828baad965c13789127dbf.tar.bz2
r300g: output floats instead of halfs when passed through translate
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/r300_render_translate.c27
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 ea3c966..0ea11e5 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++;