summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-03-30 18:21:50 -0400
committerIlia Mirkin <[email protected]>2014-04-26 11:52:52 -0400
commitc5d822dad902b19f06c9be3c6863a51e1881ec5b (patch)
tree4d2f07f9cb6f0aad08c594759b2a631bdda54b8e /src/gallium/auxiliary
parent88d8d88d8c151ca1e8ec3af0caba16a4e34ca281 (diff)
mesa/st: add support for ARB_sample_shading
Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c19
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h4
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c3
-rw-r--r--src/gallium/auxiliary/postprocess/pp_run.c3
-rw-r--r--src/gallium/auxiliary/util/u_blit.c3
5 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index dd0e3df8537..47c40a54aae 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -120,6 +120,7 @@ struct cso_context {
struct pipe_viewport_state vp, vp_saved;
struct pipe_blend_color blend_color;
unsigned sample_mask, sample_mask_saved;
+ unsigned min_samples, min_samples_saved;
struct pipe_stencil_ref stencil_ref, stencil_ref_saved;
};
@@ -716,6 +717,24 @@ void cso_restore_sample_mask(struct cso_context *ctx)
cso_set_sample_mask(ctx, ctx->sample_mask_saved);
}
+void cso_set_min_samples(struct cso_context *ctx, unsigned min_samples)
+{
+ if (ctx->min_samples != min_samples && ctx->pipe->set_min_samples) {
+ ctx->min_samples = min_samples;
+ ctx->pipe->set_min_samples(ctx->pipe, min_samples);
+ }
+}
+
+void cso_save_min_samples(struct cso_context *ctx)
+{
+ ctx->min_samples_saved = ctx->min_samples;
+}
+
+void cso_restore_min_samples(struct cso_context *ctx)
+{
+ cso_set_min_samples(ctx, ctx->min_samples_saved);
+}
+
void cso_set_stencil_ref(struct cso_context *ctx,
const struct pipe_stencil_ref *sr)
{
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 1aa99986f54..f0a08bb0d2c 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -164,6 +164,10 @@ void cso_set_sample_mask(struct cso_context *cso, unsigned stencil_mask);
void cso_save_sample_mask(struct cso_context *ctx);
void cso_restore_sample_mask(struct cso_context *ctx);
+void cso_set_min_samples(struct cso_context *cso, unsigned min_samples);
+void cso_save_min_samples(struct cso_context *ctx);
+void cso_restore_min_samples(struct cso_context *ctx);
+
void cso_set_stencil_ref(struct cso_context *cso,
const struct pipe_stencil_ref *sr);
void cso_save_stencil_ref(struct cso_context *cso);
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index ccf020bed16..b6e018423ed 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -412,6 +412,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
cso_save_framebuffer(cso);
cso_save_sample_mask(cso);
+ cso_save_min_samples(cso);
cso_save_blend(cso);
cso_save_depth_stencil_alpha(cso);
cso_save_fragment_shader(cso);
@@ -450,6 +451,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
cso_set_framebuffer(cso, &fb);
cso_set_sample_mask(cso, ~0);
+ cso_set_min_samples(cso, 1);
cso_set_blend(cso, &hud->alpha_blend);
cso_set_depth_stencil_alpha(cso, &hud->dsa);
cso_set_rasterizer(cso, &hud->rasterizer);
@@ -538,6 +540,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
/* restore states */
cso_restore_framebuffer(cso);
cso_restore_sample_mask(cso);
+ cso_restore_min_samples(cso);
cso_restore_blend(cso);
cso_restore_depth_stencil_alpha(cso);
cso_restore_fragment_shader(cso);
diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c
index 7d9330c745f..06281c8ce34 100644
--- a/src/gallium/auxiliary/postprocess/pp_run.c
+++ b/src/gallium/auxiliary/postprocess/pp_run.c
@@ -122,6 +122,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
cso_save_geometry_shader(cso);
cso_save_rasterizer(cso);
cso_save_sample_mask(cso);
+ cso_save_min_samples(cso);
cso_save_samplers(cso, PIPE_SHADER_FRAGMENT);
cso_save_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_save_stencil_ref(cso);
@@ -136,6 +137,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
/* set default state */
cso_set_sample_mask(cso, ~0);
+ cso_set_min_samples(cso, 1);
cso_set_stream_outputs(cso, 0, NULL, NULL);
cso_set_geometry_shader_handle(cso, NULL);
cso_set_render_condition(cso, NULL, FALSE, 0);
@@ -187,6 +189,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
cso_restore_geometry_shader(cso);
cso_restore_rasterizer(cso);
cso_restore_sample_mask(cso);
+ cso_restore_min_samples(cso);
cso_restore_samplers(cso, PIPE_SHADER_FRAGMENT);
cso_restore_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_restore_stencil_ref(cso);
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 4b25b93dd17..f69b4b1ab2a 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -520,6 +520,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_save_depth_stencil_alpha(ctx->cso);
cso_save_rasterizer(ctx->cso);
cso_save_sample_mask(ctx->cso);
+ cso_save_min_samples(ctx->cso);
cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_save_stream_outputs(ctx->cso);
@@ -535,6 +536,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_set_blend(ctx->cso, &ctx->blend_write_color);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_keep_depthstencil);
cso_set_sample_mask(ctx->cso, ~0);
+ cso_set_min_samples(ctx->cso, 1);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, NULL);
@@ -597,6 +599,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_restore_depth_stencil_alpha(ctx->cso);
cso_restore_rasterizer(ctx->cso);
cso_restore_sample_mask(ctx->cso);
+ cso_restore_min_samples(ctx->cso);
cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_restore_viewport(ctx->cso);