From: Corbin Simpson Date: Wed, 12 May 2010 17:14:02 +0000 (-0700) Subject: r300g: Correct viewport setup for SW TCL. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f161261c70d680c6b227bbf84735348af0973c6;p=profile%2Fivi%2Fmesa.git r300g: Correct viewport setup for SW TCL. glxgears now renders in the right place on-screen, although it is still rather...psychedelic. --- diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index e84bce0..0444fda 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -201,9 +201,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); /* Enable Draw's clipping. */ draw_set_driver_clipping(r300->draw, FALSE); - /* Force Draw to never do viewport transform, since we can do - * transform in hardware, always. */ - draw_set_viewport_state(r300->draw, &r300_viewport_identity); } r300_setup_atoms(r300); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 4b401a7..5ad4489 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -321,8 +321,6 @@ struct r300_vertex_element_state { struct r300_vertex_stream_state vertex_stream; }; -extern struct pipe_viewport_state r300_viewport_identity; - struct r300_context { /* Parent class */ struct pipe_context context; diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 3990997..e7fc872 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -395,13 +395,13 @@ static void r300_set_clip_state(struct pipe_context* pipe, if (r300->screen->caps.has_tcl) { memcpy(r300->clip_state.state, state, sizeof(struct pipe_clip_state)); r300->clip_state.size = 29; + + r300->clip_state.dirty = TRUE; } else { draw_flush(r300->draw); draw_set_clip_state(r300->draw, state); r300->clip_state.size = 2; } - - r300->clip_state.dirty = TRUE; } /* Create a new depth, stencil, and alpha state based on the CSO dsa state. @@ -1098,6 +1098,13 @@ static void r300_set_viewport_state(struct pipe_context* pipe, r300->viewport = *state; + if (r300->draw) { + draw_flush(r300->draw); + draw_set_viewport_state(r300->draw, state); + viewport->vte_control = R300_VTX_XY_FMT | R300_VTX_Z_FMT; + return; + } + /* Do the transform in HW. */ viewport->vte_control = R300_VTX_W0_FMT; diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index cd9443f..34d3a16 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -27,11 +27,6 @@ #include "r300_screen.h" #include "r300_state_invariant.h" -struct pipe_viewport_state r300_viewport_identity = { - .scale = {1.0, 1.0, 1.0, 1.0}, - .translate = {0.0, 0.0, 0.0, 0.0}, -}; - /* Calculate and emit invariant state. This is data that the 3D engine * will probably want at the beginning of every CS, but it's not currently * handled by any CSO setup, and in addition it doesn't really change much.