From 028459b0bf2bb778b55493f9b23ab7f2c9b355a0 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 8 Jun 2010 23:46:40 +0200 Subject: r300g: add fallback for unaligned/unsupported vertex stride/offset/format There is a problem though, the translate module cannot emit half float vertices. --- src/gallium/drivers/r300/r300_render.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/gallium/drivers/r300/r300_render.c') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 80dea8be98..e2617b8409 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -605,18 +605,20 @@ static void r300_draw_range_elements(struct pipe_context* pipe, r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0); unsigned short_count; int buffer_offset = 0, index_offset = 0; /* for index bias emulation */ + boolean translate = FALSE; if (r300->skip_rendering) { return; } - if (r300->incompatible_vb_layout || - r300->velems->incompatible_layout) { + if (!u_trim_pipe_prim(mode, &count)) { return; } - if (!u_trim_pipe_prim(mode, &count)) { - return; + /* Set up fallback for incompatible vertex layout if needed. */ + if (r300->incompatible_vb_layout || r300->velems->incompatible_layout) { + r300_begin_vertex_translate(r300); + translate = TRUE; } if (indexBias && !index_bias_supported(r300)) { @@ -681,6 +683,10 @@ static void r300_draw_range_elements(struct pipe_context* pipe, if (indexBuffer != orgIndexBuffer) { pipe_resource_reference( &indexBuffer, NULL ); } + + if (translate) { + r300_end_vertex_translate(r300); + } } /* Simple helpers for context setup. Should probably be moved to util. */ @@ -704,18 +710,20 @@ static void r300_draw_arrays(struct pipe_context* pipe, unsigned mode, count > 65536 && r300->rws->get_value(r300->rws, R300_VID_DRM_2_3_0); unsigned short_count; + boolean translate = FALSE; if (r300->skip_rendering) { return; } - if (r300->incompatible_vb_layout || - r300->velems->incompatible_layout) { + if (!u_trim_pipe_prim(mode, &count)) { return; } - if (!u_trim_pipe_prim(mode, &count)) { - return; + /* Set up fallback for incompatible vertex layout if needed. */ + if (r300->incompatible_vb_layout || r300->velems->incompatible_layout) { + r300_begin_vertex_translate(r300); + translate = TRUE; } r300_update_derived_state(r300); @@ -747,6 +755,10 @@ static void r300_draw_arrays(struct pipe_context* pipe, unsigned mode, } u_upload_flush(r300->upload_vb); } + + if (translate) { + r300_end_vertex_translate(r300); + } } /**************************************************************************** -- cgit v1.2.3