panfrost: Handle per-sample shading

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5929>
This commit is contained in:
Alyssa Rosenzweig 2020-07-15 11:38:39 -04:00 committed by Marge Bot
parent 080b751d4a
commit 8225604fd5
4 changed files with 19 additions and 0 deletions

View file

@ -567,6 +567,10 @@ panfrost_frag_meta_rasterizer_update(struct panfrost_context *ctx,
/* TODO: Sample size */
SET_BIT(fragmeta->unknown2_3, MALI_HAS_MSAA, msaa);
SET_BIT(fragmeta->unknown2_4, MALI_NO_MSAA, !msaa);
SET_BIT(fragmeta->unknown2_3, MALI_PER_SAMPLE,
msaa && ctx->min_samples > 1);
fragmeta->depth_units = rast->offset_units * 2.0f;
fragmeta->depth_factor = rast->offset_scale;

View file

@ -1202,6 +1202,15 @@ panfrost_set_sample_mask(struct pipe_context *pipe,
ctx->sample_mask = sample_mask;
}
static void
panfrost_set_min_samples(struct pipe_context *pipe,
unsigned min_samples)
{
struct panfrost_context *ctx = pan_context(pipe);
ctx->min_samples = min_samples;
}
static void
panfrost_set_clip_state(struct pipe_context *pipe,
const struct pipe_clip_state *clip)
@ -1509,6 +1518,7 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
gallium->delete_depth_stencil_alpha_state = panfrost_delete_depth_stencil_state;
gallium->set_sample_mask = panfrost_set_sample_mask;
gallium->set_min_samples = panfrost_set_min_samples;
gallium->set_clip_state = panfrost_set_clip_state;
gallium->set_viewport_states = panfrost_set_viewport_states;

View file

@ -164,6 +164,7 @@ struct panfrost_context {
struct pipe_depth_stencil_alpha_state *depth_stencil;
struct pipe_stencil_ref stencil_ref;
unsigned sample_mask;
unsigned min_samples;
};
/* Corresponds to the CSO */

View file

@ -122,6 +122,10 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
return 1;
case PIPE_CAP_SAMPLE_SHADING:
/* WIP */
return is_gl3 ? 1 : 0;
/* Throttling frames breaks pipelining */
case PIPE_CAP_THROTTLE:
return 0;