panfrost: add support for forcing sample-counts
This implements a D3D11-style forcing of the sample-counts, which will be used by the line-smoothing code we're about to add. Even though we don't actually use the single-sample mode, I left it in for completeness, as it's documented in the TRM. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26904>
This commit is contained in:

committed by
Marge Bot

parent
550cc685a7
commit
e9ada4c0a2
@@ -732,8 +732,28 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
|
|||||||
cfg.z_clear = fb->zs.clear_value.depth;
|
cfg.z_clear = fb->zs.clear_value.depth;
|
||||||
cfg.s_clear = fb->zs.clear_value.stencil;
|
cfg.s_clear = fb->zs.clear_value.stencil;
|
||||||
cfg.color_buffer_allocation = cbuf_allocation;
|
cfg.color_buffer_allocation = cbuf_allocation;
|
||||||
|
|
||||||
|
/* The force_samples setting dictates the sample-count that is used
|
||||||
|
* for rasterization, and works like D3D11's ForcedSampleCount feature:
|
||||||
|
*
|
||||||
|
* - If force_samples == 0: Let nr_samples dictate sample count
|
||||||
|
* - If force_samples == 1: force single-sampled rasterization
|
||||||
|
* - If force_samples >= 1: force multi-sampled rasterization
|
||||||
|
*
|
||||||
|
* This can be used to read SYSTEM_VALUE_SAMPLE_MASK_IN from the
|
||||||
|
* fragment shader, even when performing single-sampled rendering.
|
||||||
|
*/
|
||||||
|
if (!fb->force_samples) {
|
||||||
cfg.sample_count = fb->nr_samples;
|
cfg.sample_count = fb->nr_samples;
|
||||||
cfg.sample_pattern = pan_sample_pattern(fb->nr_samples);
|
cfg.sample_pattern = pan_sample_pattern(fb->nr_samples);
|
||||||
|
} else if (fb->force_samples == 1) {
|
||||||
|
cfg.sample_count = fb->nr_samples;
|
||||||
|
cfg.sample_pattern = pan_sample_pattern(1);
|
||||||
|
} else {
|
||||||
|
cfg.sample_count = 1;
|
||||||
|
cfg.sample_pattern = pan_sample_pattern(fb->force_samples);
|
||||||
|
}
|
||||||
|
|
||||||
cfg.z_write_enable = (fb->zs.view.zs && !fb->zs.discard.z);
|
cfg.z_write_enable = (fb->zs.view.zs && !fb->zs.discard.z);
|
||||||
cfg.s_write_enable = (fb->zs.view.s && !fb->zs.discard.s);
|
cfg.s_write_enable = (fb->zs.view.s && !fb->zs.discard.s);
|
||||||
cfg.has_zs_crc_extension = has_zs_crc_ext;
|
cfg.has_zs_crc_extension = has_zs_crc_ext;
|
||||||
|
@@ -111,6 +111,7 @@ struct pan_fb_info {
|
|||||||
unsigned minx, miny, maxx, maxy;
|
unsigned minx, miny, maxx, maxy;
|
||||||
} extent;
|
} extent;
|
||||||
unsigned nr_samples;
|
unsigned nr_samples;
|
||||||
|
unsigned force_samples; /* samples used for rasterization */
|
||||||
unsigned rt_count;
|
unsigned rt_count;
|
||||||
struct pan_fb_color_attachment rts[8];
|
struct pan_fb_color_attachment rts[8];
|
||||||
struct pan_fb_zs_attachment zs;
|
struct pan_fb_zs_attachment zs;
|
||||||
|
Reference in New Issue
Block a user