vulkan: Add a vk_pipeline_shader_stage_is_null() helper

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17337>
This commit is contained in:
Jason Ekstrand 2022-07-07 15:03:17 -05:00 committed by Marge Bot
parent 62915eb4fe
commit c5af8bcc37
2 changed files with 20 additions and 0 deletions

View file

@ -32,6 +32,21 @@
#include "util/mesa-sha1.h"
bool
vk_pipeline_shader_stage_is_null(const VkPipelineShaderStageCreateInfo *info)
{
if (info->module != VK_NULL_HANDLE)
return false;
vk_foreach_struct_const(ext, info->pNext) {
if (ext->sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO ||
ext->sType == VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT)
return false;
}
return true;
}
static uint32_t
get_required_subgroup_size(const VkPipelineShaderStageCreateInfo *info)
{

View file

@ -26,6 +26,8 @@
#include "vulkan/vulkan_core.h"
#include <stdbool.h>
struct nir_shader;
struct nir_shader_compiler_options;
struct spirv_to_nir_options;
@ -35,6 +37,9 @@ struct vk_device;
extern "C" {
#endif
bool
vk_pipeline_shader_stage_is_null(const VkPipelineShaderStageCreateInfo *info);
VkResult
vk_pipeline_shader_stage_to_nir(struct vk_device *device,
const VkPipelineShaderStageCreateInfo *info,