turnip: implement vk_dont_care_as_load workaround

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13367>
This commit is contained in:
Danylo Piliaiev 2021-10-14 21:01:16 +03:00 committed by Marge Bot
parent 3d69800a0b
commit ebca227db1
3 changed files with 18 additions and 2 deletions

View File

@ -319,6 +319,7 @@ static const struct debug_control tu_debug_options[] = {
{ "perfc", TU_DEBUG_PERFC },
{ "flushall", TU_DEBUG_FLUSHALL },
{ "syncdraw", TU_DEBUG_SYNCDRAW },
{ "dontcare_as_load", TU_DEBUG_DONT_CARE_AS_LOAD },
{ NULL, 0 }
};
@ -339,6 +340,7 @@ static const driOptionDescription tu_dri_options[] = {
DRI_CONF_SECTION_DEBUG
DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST(false)
DRI_CONF_VK_DONT_CARE_AS_LOAD(false)
DRI_CONF_SECTION_END
};
@ -350,6 +352,9 @@ tu_init_dri_options(struct tu_instance *instance)
driParseConfigFiles(&instance->dri_options, &instance->available_dri_options, 0, "turnip", NULL, NULL,
instance->vk.app_info.app_name, instance->vk.app_info.app_version,
instance->vk.app_info.engine_name, instance->vk.app_info.engine_version);
if (driQueryOptionb(&instance->dri_options, "vk_dont_care_as_load"))
instance->debug_flags |= TU_DEBUG_DONT_CARE_AS_LOAD;
}
VKAPI_ATTR VkResult VKAPI_CALL

View File

@ -662,9 +662,19 @@ tu_CreateRenderPass2(VkDevice _device,
att->cpp = vk_format_get_blocksize(att->format) * att->samples;
att->gmem_offset = -1;
VkAttachmentLoadOp loadOp = pCreateInfo->pAttachments[i].loadOp;
VkAttachmentLoadOp stencilLoadOp = pCreateInfo->pAttachments[i].stencilLoadOp;
if (device->instance->debug_flags & TU_DEBUG_DONT_CARE_AS_LOAD) {
if (loadOp == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
if (stencilLoadOp == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
}
attachment_set_ops(att,
pCreateInfo->pAttachments[i].loadOp,
pCreateInfo->pAttachments[i].stencilLoadOp,
loadOp,
stencilLoadOp,
pCreateInfo->pAttachments[i].storeOp,
pCreateInfo->pAttachments[i].stencilStoreOp);
}

View File

@ -239,6 +239,7 @@ enum tu_debug_flags
TU_DEBUG_PERFC = 1 << 9,
TU_DEBUG_FLUSHALL = 1 << 10,
TU_DEBUG_SYNCDRAW = 1 << 11,
TU_DEBUG_DONT_CARE_AS_LOAD = 1 << 12,
};
struct tu_instance