Path: blob/21.2-virgl/src/vulkan/util/vk_shader_module.h
7178 views
/*1* Copyright © 2017 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef VK_SHADER_MODULE_H24#define VK_SHADER_MODULE_H2526#include <vulkan/vulkan.h>27#include "vk_object.h"2829#ifdef __cplusplus30extern "C" {31#endif3233struct nir_shader;3435struct vk_shader_module {36struct vk_object_base base;37struct nir_shader *nir;38unsigned char sha1[20];39uint32_t size;40char data[0];41};4243VK_DEFINE_NONDISP_HANDLE_CASTS(vk_shader_module, base, VkShaderModule,44VK_OBJECT_TYPE_SHADER_MODULE)4546/* this should only be used for stack-allocated, temporary objects */47#define vk_shader_module_handle_from_nir(_nir) \48vk_shader_module_to_handle(&(struct vk_shader_module) { \49.base.type = VK_OBJECT_TYPE_SHADER_MODULE, \50.nir = _nir, \51})52#define vk_shader_module_from_nir(_nir) \53(struct vk_shader_module) { \54.base.type = VK_OBJECT_TYPE_SHADER_MODULE, \55.nir = _nir, \56}5758#ifdef __cplusplus59}60#endif6162#endif /* VK_SHADER_MODULE_H */636465