summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_state.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-04-19 01:19:54 +0200
committerMarek Olšák <[email protected]>2016-04-22 01:14:13 +0200
commit698821bda32eb9958e105c38087b49b6f307128d (patch)
tree204fecafd4a4b33a1b9ce66cdffc2febd8289402 /src/gallium/drivers/radeonsi/si_state.c
parentbb1e647adaff7f9f379501864918d92f5fe3e2a6 (diff)
radeonsi: rework polygon stippling to use constant buffer instead of texture
add it to the RW_BUFFERS descriptor array now the slot masks don't have to have 64 bits Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 8603f3ecb6b..e726196d07a 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3374,60 +3374,6 @@ static void si_set_index_buffer(struct pipe_context *ctx,
/*
* Misc
*/
-static void si_set_polygon_stipple(struct pipe_context *ctx,
- const struct pipe_poly_stipple *state)
-{
- struct si_context *sctx = (struct si_context *)ctx;
- struct pipe_resource *tex;
- struct pipe_sampler_view *view;
- bool is_zero = true;
- bool is_one = true;
- int i;
-
- /* The hardware obeys 0 and 1 swizzles in the descriptor even if
- * the resource is NULL/invalid. Take advantage of this fact and skip
- * texture allocation if the stipple pattern is constant.
- *
- * This is an optimization for the common case when stippling isn't
- * used but set_polygon_stipple is still called by st/mesa.
- */
- for (i = 0; i < Elements(state->stipple); i++) {
- is_zero = is_zero && state->stipple[i] == 0;
- is_one = is_one && state->stipple[i] == 0xffffffff;
- }
-
- if (is_zero || is_one) {
- struct pipe_sampler_view templ = {{0}};
-
- templ.swizzle_r = PIPE_SWIZZLE_ZERO;
- templ.swizzle_g = PIPE_SWIZZLE_ZERO;
- templ.swizzle_b = PIPE_SWIZZLE_ZERO;
- /* The pattern should be inverted in the texture. */
- templ.swizzle_a = is_zero ? PIPE_SWIZZLE_ONE : PIPE_SWIZZLE_ZERO;
-
- view = ctx->create_sampler_view(ctx, NULL, &templ);
- } else {
- /* Create a new texture. */
- tex = util_pstipple_create_stipple_texture(ctx, state->stipple);
- if (!tex)
- return;
-
- view = util_pstipple_create_sampler_view(ctx, tex);
- pipe_resource_reference(&tex, NULL);
- }
-
- ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT,
- SI_POLY_STIPPLE_SAMPLER, 1, &view);
- pipe_sampler_view_reference(&view, NULL);
-
- /* Bind the sampler state if needed. */
- if (!sctx->pstipple_sampler_state) {
- sctx->pstipple_sampler_state = util_pstipple_create_sampler(ctx);
- ctx->bind_sampler_states(ctx, PIPE_SHADER_FRAGMENT,
- SI_POLY_STIPPLE_SAMPLER, 1,
- &sctx->pstipple_sampler_state);
- }
-}
static void si_set_tess_state(struct pipe_context *ctx,
const float default_outer_level[4],
@@ -3590,7 +3536,6 @@ void si_init_state_functions(struct si_context *sctx)
sctx->b.b.texture_barrier = si_texture_barrier;
sctx->b.b.memory_barrier = si_memory_barrier;
- sctx->b.b.set_polygon_stipple = si_set_polygon_stipple;
sctx->b.b.set_min_samples = si_set_min_samples;
sctx->b.b.set_tess_state = si_set_tess_state;