| 3630 | } |
| 3631 | |
| 3632 | static inline ShaderModule* NewShaderModule(VulkanContext* context, ShaderMeta* meta, ShaderDesc::Shader* ddf, VkShaderStageFlagBits stage, char* error_buffer, uint32_t error_buffer_size) |
| 3633 | { |
| 3634 | ShaderModule* module = new ShaderModule; |
| 3635 | memset(module, 0, sizeof(*module)); |
| 3636 | |
| 3637 | VkResult res = CreateShaderModule(context->m_LogicalDevice.m_Device, ddf->m_Source.m_Data, ddf->m_Source.m_Count, stage, module); |
| 3638 | CHECK_VK_ERROR(res); |
| 3639 | |
| 3640 | ShaderStageFlag stage_flag = (ShaderStageFlag) -1; |
| 3641 | if (stage == VK_SHADER_STAGE_VERTEX_BIT) |
| 3642 | { |
| 3643 | stage_flag = SHADER_STAGE_FLAG_VERTEX; |
| 3644 | } |
| 3645 | else if (stage == VK_SHADER_STAGE_FRAGMENT_BIT) |
| 3646 | { |
| 3647 | stage_flag = SHADER_STAGE_FLAG_FRAGMENT; |
| 3648 | } |
| 3649 | else if (stage == VK_SHADER_STAGE_COMPUTE_BIT) |
| 3650 | { |
| 3651 | stage_flag = SHADER_STAGE_FLAG_COMPUTE; |
| 3652 | } |
| 3653 | if (!ValidateShaderModule(context, meta, module, stage_flag, error_buffer, error_buffer_size)) |
| 3654 | { |
| 3655 | DestroyShader(context, module); |
| 3656 | delete module; |
| 3657 | return 0; |
| 3658 | } |
| 3659 | return module; |
| 3660 | } |
| 3661 | |
| 3662 | static HProgram VulkanNewProgram(HContext _context, ShaderDesc* ddf, char* error_buffer, uint32_t error_buffer_size) |
| 3663 | { |
no test coverage detected