#include "vk_extensions.h"
#include "vk_instance.h"
#include "vk_physical_device.h"
+#include "vk_shader_module.h"
#include "wsi_common.h"
#include "ir3/ir3_compiler.h"
struct tu_bo bo;
};
-struct tu_shader_module
-{
- struct vk_object_base base;
-
- uint32_t code_size;
- uint32_t code[];
-};
-
struct tu_push_constant_range
{
uint32_t lo;
TU_DEFINE_NONDISP_HANDLE_CASTS(tu_render_pass, VkRenderPass)
TU_DEFINE_NONDISP_HANDLE_CASTS(tu_sampler, VkSampler)
TU_DEFINE_NONDISP_HANDLE_CASTS(tu_sampler_ycbcr_conversion, VkSamplerYcbcrConversion)
-TU_DEFINE_NONDISP_HANDLE_CASTS(tu_shader_module, VkShaderModule)
/* for TU_FROM_HANDLE with both VkFence and VkSemaphore: */
#define tu_syncobj_from_handle(x) ((struct tu_syncobj*) (uintptr_t) (x))
num_spec = spec_info->mapEntryCount;
}
- struct tu_shader_module *module =
- tu_shader_module_from_handle(stage_info->module);
- assert(module->code_size % 4 == 0);
+ struct vk_shader_module *module =
+ vk_shader_module_from_handle(stage_info->module);
+ assert(module->size % 4 == 0);
nir_shader *nir =
- spirv_to_nir(module->code, module->code_size / 4,
+ spirv_to_nir((void*)module->data, module->size / 4,
spec, num_spec, stage, stage_info->pName,
&spirv_options, nir_options);
vk_free2(&dev->vk.alloc, alloc, shader);
}
-
-VkResult
-tu_CreateShaderModule(VkDevice _device,
- const VkShaderModuleCreateInfo *pCreateInfo,
- const VkAllocationCallbacks *pAllocator,
- VkShaderModule *pShaderModule)
-{
- TU_FROM_HANDLE(tu_device, device, _device);
- struct tu_shader_module *module;
-
- assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO);
- assert(pCreateInfo->flags == 0);
- assert(pCreateInfo->codeSize % 4 == 0);
-
- module = vk_object_alloc(&device->vk, pAllocator,
- sizeof(*module) + pCreateInfo->codeSize,
- VK_OBJECT_TYPE_SHADER_MODULE);
- if (module == NULL)
- return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
-
- module->code_size = pCreateInfo->codeSize;
- memcpy(module->code, pCreateInfo->pCode, pCreateInfo->codeSize);
-
- *pShaderModule = tu_shader_module_to_handle(module);
-
- return VK_SUCCESS;
-}
-
-void
-tu_DestroyShaderModule(VkDevice _device,
- VkShaderModule _module,
- const VkAllocationCallbacks *pAllocator)
-{
- TU_FROM_HANDLE(tu_device, device, _device);
- TU_FROM_HANDLE(tu_shader_module, module, _module);
-
- if (!module)
- return;
-
- vk_object_free(&device->vk, pAllocator, module);
-}