llvmpipe: respect the sample mask in non-multisample flag

This partly revert
50987644 llvmpipe: don't use sample mask with 0 samples

since Vulkan wants this behaviour.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7435>
This commit is contained in:
Dave Airlie 2020-11-03 16:37:10 +10:00 committed by Marge Bot
parent 3dc6da1ac1
commit 47701d47e7
2 changed files with 7 additions and 0 deletions

View File

@ -1030,6 +1030,11 @@ generate_fs_loop(struct gallivm_state *gallivm,
assert(smaski >= 0);
output_smask = LLVMBuildLoad(builder, outputs[smaski][0], "smask");
output_smask = LLVMBuildBitCast(builder, output_smask, smask_bld.vec_type, "");
if (!key->multisample && key->no_ms_sample_mask_out) {
output_smask = lp_build_and(&smask_bld, output_smask, smask_bld.one);
output_smask = lp_build_cmp(&smask_bld, PIPE_FUNC_NOTEQUAL, output_smask, smask_bld.zero);
lp_build_mask_update(&mask, output_smask);
}
if (key->min_samples > 1) {
/* only the bit corresponding to this sample is to be used. */
@ -3989,6 +3994,7 @@ make_variant_key(struct llvmpipe_context *lp,
key->flatshade = lp->rasterizer->flatshade;
key->multisample = lp->rasterizer->multisample;
key->no_ms_sample_mask_out = lp->rasterizer->no_ms_sample_mask_out;
if (lp->active_occlusion_queries && !lp->queries_disabled) {
key->occlusion_count = TRUE;
}

View File

@ -84,6 +84,7 @@ struct lp_fragment_shader_variant_key
unsigned resource_1d:1;
unsigned depth_clamp:1;
unsigned multisample:1;
unsigned no_ms_sample_mask_out:1;
enum pipe_format zsbuf_format;
enum pipe_format cbuf_format[PIPE_MAX_COLOR_BUFS];