summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_render.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-06-08 23:46:40 +0200
committerMarek Olšák <[email protected]>2010-06-13 17:43:37 +0200
commit028459b0bf2bb778b55493f9b23ab7f2c9b355a0 (patch)
tree8876c86860c090fad870e67d32b3caa05f08081c /src/gallium/drivers/r300/r300_render.c
parent1384a7bccab3d5b36729d59944a76538375f5494 (diff)
r300g: add fallback for unaligned/unsupported vertex stride/offset/format
There is a problem though, the translate module cannot emit half float vertices.
Diffstat (limited to 'src/gallium/drivers/r300/r300_render.c')
-rw-r--r--src/gallium/drivers/r300/r300_render.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 80dea8be989..e2617b84090 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);
+ }
}
/****************************************************************************