aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_state.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/swr/swr_state.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_state.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp
index aa9fe099f0a..56b13746d02 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -40,6 +40,7 @@
#include "util/u_helpers.h"
#include "util/u_framebuffer.h"
#include "util/u_viewport.h"
+#include "util/u_prim.h"
#include "swr_state.h"
#include "swr_context.h"
@@ -609,7 +610,7 @@ swr_set_polygon_stipple(struct pipe_context *pipe,
{
struct swr_context *ctx = swr_context(pipe);
- ctx->poly_stipple = *stipple; /* struct copy */
+ ctx->poly_stipple.pipe = *stipple; /* struct copy */
ctx->dirty |= SWR_NEW_STIPPLE;
}
@@ -986,6 +987,17 @@ swr_user_vbuf_range(const struct pipe_draw_info *info,
}
}
+static void
+swr_update_poly_stipple(struct swr_context *ctx)
+{
+ struct swr_draw_context *pDC = &ctx->swrDC;
+
+ assert(sizeof(ctx->poly_stipple.pipe.stipple) == sizeof(pDC->polyStipple));
+ memcpy(pDC->polyStipple,
+ ctx->poly_stipple.pipe.stipple,
+ sizeof(ctx->poly_stipple.pipe.stipple));
+}
+
void
swr_update_derived(struct pipe_context *pipe,
const struct pipe_draw_info *p_draw_info)
@@ -1407,6 +1419,17 @@ swr_update_derived(struct pipe_context *pipe,
}
}
+ /* work around the fact that poly stipple also affects lines */
+ /* and points, since we rasterize them as triangles, too */
+ /* Has to be before fragment shader, since it sets SWR_NEW_FS */
+ if (p_draw_info) {
+ bool new_prim_is_poly = (u_reduced_prim(p_draw_info->mode) == PIPE_PRIM_TRIANGLES);
+ if (new_prim_is_poly != ctx->poly_stipple.prim_is_poly) {
+ ctx->dirty |= SWR_NEW_FS;
+ ctx->poly_stipple.prim_is_poly = new_prim_is_poly;
+ }
+ }
+
/* FragmentShader */
if (ctx->dirty & (SWR_NEW_FS |
SWR_NEW_VS |
@@ -1661,7 +1684,7 @@ swr_update_derived(struct pipe_context *pipe,
}
if (ctx->dirty & SWR_NEW_STIPPLE) {
- /* XXX What to do with this one??? SWR doesn't stipple */
+ swr_update_poly_stipple(ctx);
}
if (ctx->dirty & (SWR_NEW_VS | SWR_NEW_SO | SWR_NEW_RASTERIZER)) {