X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fprogram_backend.cpp;h=728bacbce7c6f75217c258691287e9ee164a2597;hb=a3252b69d94004bcb55a51ea1023ac0cbdbde32d;hp=61b5efaefd93f4b96fdef3892cf09fc9ff29468b;hpb=99ca354f18119f82f1adeca100cd665a8f640317;p=libs%2Fgl.git diff --git a/source/backends/vulkan/program_backend.cpp b/source/backends/vulkan/program_backend.cpp index 61b5efae..728bacbc 100644 --- a/source/backends/vulkan/program_backend.cpp +++ b/source/backends/vulkan/program_backend.cpp @@ -19,9 +19,11 @@ VulkanProgram::VulkanProgram(): VulkanProgram::VulkanProgram(VulkanProgram &&other): device(other.device), n_stages(other.n_stages), + stage_flags(other.stage_flags), creation_info(move(other.creation_info)), desc_set_layout_handles(move(other.desc_set_layout_handles)), - layout_handle(other.layout_handle) + layout_handle(other.layout_handle), + debug_name(move(other.debug_name)) { other.desc_set_layout_handles.clear(); other.layout_handle = 0; @@ -42,7 +44,7 @@ bool VulkanProgram::has_stages() const return n_stages; } -void VulkanProgram::add_glsl_stages(const GlslModule &, const map &, TransientData &) +void VulkanProgram::add_glsl_stages(const GlslModule &, const map &) { throw invalid_operation("VulkanProgram::add_glsl_stages"); } @@ -86,8 +88,11 @@ void VulkanProgram::add_spirv_stages(const SpirVModule &mod, const map(get_vulkan_stage(e.stage)); + stage_infos[i].stage = static_cast(stage_bit); stage_infos[i].module = handle_cast<::VkShaderModule>(mod.handle); strcpy(name_ptr, e.name.c_str()); stage_infos[i].pName = name_ptr; @@ -95,6 +100,12 @@ void VulkanProgram::add_spirv_stages(const SpirVModule &mod, const map(this)->specialized_spirv) + spirv->set_debug_name(debug_name); +#endif } void VulkanProgram::finalize_uniforms() @@ -114,10 +125,10 @@ void VulkanProgram::finalize_uniforms() { bindings.emplace_back(); VkDescriptorSetLayoutBinding &binding = bindings.back(); - binding.binding = b.bind_point; + binding.binding = b.bind_point&0xFFFFF; binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; binding.descriptorCount = 1; - binding.stageFlags = VK_SHADER_STAGE_ALL; + binding.stageFlags = stage_flags; binding.pImmutableSamplers = 0; } @@ -126,10 +137,10 @@ void VulkanProgram::finalize_uniforms() { bindings.emplace_back(); VkDescriptorSetLayoutBinding &binding = bindings.back(); - binding.binding = u.binding; + binding.binding = u.binding&0xFFFFF; binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; binding.descriptorCount = 1; - binding.stageFlags = VK_SHADER_STAGE_ALL; + binding.stageFlags = stage_flags; binding.pImmutableSamplers = 0; } @@ -142,7 +153,7 @@ void VulkanProgram::finalize_uniforms() } VkPushConstantRange push_const_range = { }; - push_const_range.stageFlags = VK_SHADER_STAGE_ALL; + push_const_range.stageFlags = stage_flags; push_const_range.offset = 0; push_const_range.size = (push_const_block ? push_const_block->data_size : 0); @@ -156,5 +167,16 @@ void VulkanProgram::finalize_uniforms() vk.CreatePipelineLayout(layout_info, layout_handle); } +void VulkanProgram::set_debug_name(const string &name) +{ +#ifdef DEBUG + debug_name = name; + if(SpirVModule *spirv = static_cast(this)->specialized_spirv) + spirv->set_debug_name(debug_name); +#else + (void)name; +#endif +} + } // namespace GL } // namespace Msp