panvk: Add a dummy sampler for NIR tex operations that don't take one

In the NIR domain, some texture operations don't require a sampler, but
Bifrost/Midgard always want one. Let's add a dummy sampler to handle
that case.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15334>
This commit is contained in:
Boris Brezillon 2021-09-23 18:02:41 +02:00 committed by Marge Bot
parent a35e721162
commit 9dc8382de8
2 changed files with 21 additions and 0 deletions

View File

@ -340,6 +340,15 @@ panvk_CreatePipelineLayout(VkDevice _device,
layout->num_dyn_ssbos = dyn_ssbo_idx;
layout->num_imgs = img_idx;
/* Some NIR texture operations don't require a sampler, but Bifrost/Midgard
* ones always expect one. Add a dummy sampler to deal with this limitation.
*/
if (layout->num_textures) {
layout->num_samplers++;
for (unsigned set = 0; set < pCreateInfo->setLayoutCount; set++)
layout->sets[set].sampler_offset++;
}
_mesa_sha1_final(&ctx, layout->sha1);
*pPipelineLayout = panvk_pipeline_layout_to_handle(layout);

View File

@ -492,6 +492,18 @@ panvk_cmd_prepare_samplers(struct panvk_cmd_buffer *cmdbuf,
void *sampler = samplers.cpu;
/* Prepare the dummy sampler */
pan_pack(sampler, SAMPLER, cfg) {
#if PAN_ARCH >= 6
cfg.seamless_cube_map = false;
#endif
cfg.magnify_nearest = true;
cfg.minify_nearest = true;
cfg.normalized_coordinates = false;
}
sampler += pan_size(SAMPLER);
for (unsigned i = 0; i < ARRAY_SIZE(desc_state->sets); i++) {
if (!desc_state->sets[i]) continue;