Mesa (r300g-polystip): r300g: add pipe stipple stage for non-tcl

Dave Airlie airlied at kemper.freedesktop.org
Sun Sep 26 10:14:55 UTC 2010


Module: Mesa
Branch: r300g-polystip
Commit: c9d045cf41463543e91e985f35ac367abd00943d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9d045cf41463543e91e985f35ac367abd00943d

Author: Dave Airlie <airlied at redhat.com>
Date:   Sun Sep 26 20:08:03 2010 +1000

r300g: add pipe stipple stage for non-tcl

This doesn't work for some reason, but I can see the FS being modified,
so may need to fix up some routing somewhere.

---

 src/gallium/auxiliary/draw/draw_context.h       |    4 ++++
 src/gallium/auxiliary/draw/draw_pipe_pstipple.c |   21 +++++++++++++++++++++
 src/gallium/drivers/r300/r300_blit.c            |   11 +++++++++--
 src/gallium/drivers/r300/r300_context.c         |   17 +++++++++--------
 src/gallium/drivers/r300/r300_render.c          |    1 +
 5 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 1f27cbf..536cb26 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -91,6 +91,10 @@ draw_install_aapoint_stage(struct draw_context *draw, struct pipe_context *pipe)
 boolean
 draw_install_pstipple_stage(struct draw_context *draw, struct pipe_context *pipe);
 
+struct blitter_context;
+void
+draw_pstipple_save_states(struct blitter_context *blitter,
+			  struct draw_context *draw, boolean save_sampler);
 
 int
 draw_find_shader_output(const struct draw_context *draw,
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index ed9a53e..928940d 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -39,6 +39,8 @@
 #include "pipe/p_shader_tokens.h"
 #include "util/u_inlines.h"
 
+#include "util/u_blitter.h"
+
 #include "util/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
@@ -811,3 +813,22 @@ draw_install_pstipple_stage(struct draw_context *draw,
 
    return FALSE;
 }
+
+void
+draw_pstipple_save_states(struct blitter_context *blitter,
+			  struct draw_context *draw, boolean save_sampler)
+{
+
+   struct pstip_stage *pstip = pstip_stage(draw->pipeline.pstipple);
+
+   util_blitter_save_fragment_shader(blitter, pstip->fs);
+
+   if (save_sampler) {
+      util_blitter_save_fragment_sampler_states(blitter,
+						pstip->num_samplers, pstip->state.samplers);
+
+      util_blitter_save_fragment_sampler_views(blitter,
+					       pstip->num_samplers, pstip->state.sampler_views);
+   }
+
+}
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 91a374a..158afa3 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -29,6 +29,8 @@
 #include "util/u_format.h"
 #include "util/u_pack_color.h"
 
+#include "draw/draw_context.h"
+
 enum r300_blitter_op /* bitmask */
 {
     R300_CLEAR         = 1,
@@ -43,6 +45,11 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
         r300_stop_query(r300);
     }
 
+    if (!r300->screen->caps.has_tcl) {
+	draw_pstipple_save_states(r300->blitter, r300->draw, (op & R300_COPY));
+    } else {
+	util_blitter_save_fragment_shader(r300->blitter, r300->fs.state);
+    }
     /* Yeah we have to save all those states to ensure the blitter operation
      * is really transparent. The states will be restored by the blitter once
      * copying is done. */
@@ -50,7 +57,7 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
     util_blitter_save_depth_stencil_alpha(r300->blitter, r300->dsa_state.state);
     util_blitter_save_stencil_ref(r300->blitter, &(r300->stencil_ref));
     util_blitter_save_rasterizer(r300->blitter, r300->rs_state.state);
-    util_blitter_save_fragment_shader(r300->blitter, r300->fs.state);
+
     util_blitter_save_vertex_shader(r300->blitter, r300->vs_state.state);
     util_blitter_save_viewport(r300->blitter, &r300->viewport);
     util_blitter_save_clip(r300->blitter, (struct pipe_clip_state*)r300->clip_state.state);
@@ -61,7 +68,7 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
     if (op & (R300_CLEAR_SURFACE | R300_COPY))
         util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
 
-    if (op & R300_COPY) {
+    if ((op & R300_COPY) && !r300->screen->caps.has_tcl) {
         struct r300_textures_state* state =
             (struct r300_textures_state*)r300->textures_state.state;
 
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 624dadd..77ed5b4 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -426,6 +426,15 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     if (r300->cs == NULL)
         goto fail;
 
+
+    r300_setup_atoms(r300);
+
+    r300_init_blit_functions(r300);
+    r300_init_flush_functions(r300);
+    r300_init_query_functions(r300);
+    r300_init_state_functions(r300);
+    r300_init_resource_functions(r300);
+
     if (!r300screen->caps.has_tcl) {
         /* Create a Draw. This is used for SW TCL. */
         r300->draw = draw_create(&r300->context);
@@ -436,14 +445,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         draw_wide_point_threshold(r300->draw, 10000000.f);
     }
 
-    r300_setup_atoms(r300);
-
-    r300_init_blit_functions(r300);
-    r300_init_flush_functions(r300);
-    r300_init_query_functions(r300);
-    r300_init_state_functions(r300);
-    r300_init_resource_functions(r300);
-
     r300->blitter = util_blitter_create(&r300->context);
     if (r300->blitter == NULL)
         goto fail;
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 2f00c87..a91bdb3 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -1068,6 +1068,7 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300)
 
     draw_set_render(r300->draw, render);
 
+    draw_install_pstipple_stage(r300->draw, &r300->context);
     return stage;
 }
 




More information about the mesa-commit mailing list