From 455c8e35842b6e149d5d390ab9692e214db63662 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 11 Mar 2020 08:44:40 +1000 Subject: [PATCH] llvmpipe: add cbuf/zsbuf + coverage samples to the fragment shader key. These will cause different fragment shaders to be generated. Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 9 +++++++++ src/gallium/drivers/llvmpipe/lp_state_fs.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 7014f6ddeb4..d44f85eb0f6 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -2768,12 +2768,15 @@ dump_fs_variant_key(struct lp_fragment_shader_variant_key *key) } if (key->multisample) { debug_printf("multisample = 1\n"); + debug_printf("coverage samples = %d\n", key->coverage_samples); } for (i = 0; i < key->nr_cbufs; ++i) { debug_printf("cbuf_format[%u] = %s\n", i, util_format_name(key->cbuf_format[i])); + debug_printf("cbuf nr_samples[%u] = %d\n", i, key->cbuf_nr_samples[i]); } if (key->depth.enabled || key->stencil[0].enabled) { debug_printf("depth.format = %s\n", util_format_name(key->zsbuf_format)); + debug_printf("depth nr_samples = %d\n", key->zsbuf_nr_samples); } if (key->depth.enabled) { debug_printf("depth.func = %s\n", util_str_func(key->depth.func, TRUE)); @@ -3346,6 +3349,7 @@ make_variant_key(struct llvmpipe_context *lp, if (llvmpipe_resource_is_1d(lp->framebuffer.zsbuf->texture)) { key->resource_1d = TRUE; } + key->zsbuf_nr_samples = util_res_sample_count(lp->framebuffer.zsbuf->texture); } /* @@ -3387,6 +3391,9 @@ make_variant_key(struct llvmpipe_context *lp, memcpy(&key->blend, lp->blend, sizeof key->blend); } + key->coverage_samples = 1; + if (key->multisample) + key->coverage_samples = util_framebuffer_get_num_samples(&lp->framebuffer); key->nr_cbufs = lp->framebuffer.nr_cbufs; if (!key->blend.independent_blend_enable) { @@ -3405,6 +3412,7 @@ make_variant_key(struct llvmpipe_context *lp, const struct util_format_description *format_desc; key->cbuf_format[i] = format; + key->cbuf_nr_samples[i] = util_res_sample_count(lp->framebuffer.cbufs[i]->texture); /* * Figure out if this is a 1d resource. Note that OpenGL allows crazy @@ -3464,6 +3472,7 @@ make_variant_key(struct llvmpipe_context *lp, else { /* no color buffer for this fragment output */ key->cbuf_format[i] = PIPE_FORMAT_NONE; + key->cbuf_nr_samples[i] = 0; blend_rt->colormask = 0x0; blend_rt->blend_enable = 0; } diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h index 7fe59629821..87bc7e3b035 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.h +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h @@ -88,6 +88,10 @@ struct lp_fragment_shader_variant_key enum pipe_format zsbuf_format; enum pipe_format cbuf_format[PIPE_MAX_COLOR_BUFS]; + uint8_t cbuf_nr_samples[PIPE_MAX_COLOR_BUFS]; + uint8_t zsbuf_nr_samples; + uint8_t coverage_samples; + struct lp_sampler_static_state samplers[1]; /* followed by variable number of images */ }; -- 2.30.2