MCPcopy Create free account
hub / github.com/defold/defold / ReloadShader

Function ReloadShader

engine/graphics/src/vulkan/graphics_vulkan.cpp:3614–3630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3612 }
3613
3614 static bool ReloadShader(VulkanContext* context, ShaderModule* shader, ShaderDesc::Shader* ddf, VkShaderStageFlagBits stage_flag)
3615 {
3616 ShaderModule tmp_shader;
3617 VkResult res = CreateShaderModule(context->m_LogicalDevice.m_Device, ddf->m_Source.m_Data, ddf->m_Source.m_Count, stage_flag, &tmp_shader);
3618 if (res == VK_SUCCESS)
3619 {
3620 DestroyShader(context, shader);
3621 memset(shader, 0, sizeof(*shader));
3622
3623 // Transfer created module to old pointer and recreate resource bindings
3624 shader->m_Hash = tmp_shader.m_Hash;
3625 shader->m_Module = tmp_shader.m_Module;
3626 return true;
3627 }
3628
3629 return false;
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 {

Callers 1

VulkanReloadProgramFunction · 0.70

Calls 2

DestroyShaderFunction · 0.85
CreateShaderModuleFunction · 0.70

Tested by

no test coverage detected