vulkan: export vk_robustness_disabled

HK will use this for a HK_PERFTEST=norobust flag.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31466>
This commit is contained in:
Alyssa Rosenzweig
2024-09-28 20:49:54 -04:00
committed by Marge Bot
parent 1a2827e401
commit 5fe3f57d3f
2 changed files with 26 additions and 22 deletions

View File

@@ -377,6 +377,24 @@ vk_common_GetShaderBinaryDataEXT(VkDevice _device,
*/
#define VK_MAX_LINKED_SHADER_STAGES MESA_VK_MAX_GRAPHICS_PIPELINE_STAGES
const struct vk_pipeline_robustness_state vk_robustness_disabled = {
.storage_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
.uniform_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
.vertex_inputs = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
.images = VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DISABLED_EXT,
/* From the Vulkan 1.3.292 spec:
*
* "This extension [VK_EXT_robustness2] also adds support for “null
* descriptors”, where VK_NULL_HANDLE can be used instead of a valid
* handle. Accesses to null descriptors have well-defined behavior,
* and do not rely on robustness."
*
* For now, default these to true.
*/
.null_uniform_buffer_descriptor = true,
.null_storage_buffer_descriptor = true,
};
VKAPI_ATTR VkResult VKAPI_CALL
vk_common_CreateShadersEXT(VkDevice _device,
uint32_t createInfoCount,
@@ -388,24 +406,6 @@ vk_common_CreateShadersEXT(VkDevice _device,
const struct vk_device_shader_ops *ops = device->shader_ops;
VkResult first_fail_or_success = VK_SUCCESS;
struct vk_pipeline_robustness_state rs = {
.storage_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
.uniform_buffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
.vertex_inputs = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT,
.images = VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_DISABLED_EXT,
/* From the Vulkan 1.3.292 spec:
*
* "This extension [VK_EXT_robustness2] also adds support for “null
* descriptors”, where VK_NULL_HANDLE can be used instead of a valid
* handle. Accesses to null descriptors have well-defined behavior,
* and do not rely on robustness."
*
* For now, default these to true.
*/
.null_uniform_buffer_descriptor = true,
.null_storage_buffer_descriptor = true,
};
/* From the Vulkan 1.3.274 spec:
*
* "When this function returns, whether or not it succeeds, it is
@@ -463,7 +463,8 @@ vk_common_CreateShadersEXT(VkDevice _device,
.idx = i,
};
} else {
nir_shader *nir = vk_shader_to_nir(device, vk_info, &rs);
nir_shader *nir = vk_shader_to_nir(device, vk_info,
&vk_robustness_disabled);
if (nir == NULL) {
result = vk_errorf(device, VK_ERROR_UNKNOWN,
"Failed to compile shader to NIR");
@@ -473,7 +474,7 @@ vk_common_CreateShadersEXT(VkDevice _device,
struct vk_shader_compile_info info;
struct set_layouts set_layouts;
vk_shader_compile_info_init(&info, &set_layouts,
vk_info, &rs, nir);
vk_info, &vk_robustness_disabled, nir);
struct vk_shader *shader;
result = ops->compile(device, 1, &info, NULL /* state */,
@@ -508,7 +509,8 @@ vk_common_CreateShadersEXT(VkDevice _device,
for (uint32_t l = 0; l < linked_count; l++) {
const VkShaderCreateInfoEXT *vk_info = &pCreateInfos[linked[l].idx];
nir_shader *nir = vk_shader_to_nir(device, vk_info, &rs);
nir_shader *nir = vk_shader_to_nir(device, vk_info,
&vk_robustness_disabled);
if (nir == NULL) {
result = vk_errorf(device, VK_ERROR_UNKNOWN,
"Failed to compile shader to NIR");
@@ -516,7 +518,7 @@ vk_common_CreateShadersEXT(VkDevice _device,
}
vk_shader_compile_info_init(&infos[l], &set_layouts[l],
vk_info, &rs, nir);
vk_info, &vk_robustness_disabled, nir);
}
if (result == VK_SUCCESS) {

View File

@@ -253,6 +253,8 @@ struct vk_device_shader_ops {
const struct vk_dynamic_graphics_state *state);
};
extern const struct vk_pipeline_robustness_state vk_robustness_disabled;
#ifdef __cplusplus
}
#endif