|
Blender V4.3
|
#include <vk_shader_module.hh>
Public Member Functions | |
| ~VKShaderModule () | |
| void | finalize (StringRefNull name) |
| void | build_sources_hash () |
Public Attributes | |
| std::string | combined_sources |
| std::string | sources_hash |
| VkShaderModule | vk_shader_module = VK_NULL_HANDLE |
| shaderc::SpvCompilationResult | compilation_result |
| Vector< uint32_t > | spirv_binary |
| bool | is_ready = true |
Shader module.
A shader module contains shader code and can be used as a vertex/geometry/fragment/compute stage of a shader. The shader code in this sense doesn't need to be GLSL, but can also be SPIR-V binary.
For now this is just a data container so code can be reused when working with multiple shader stages.
Later we could load the SPIR-V binary directly from disk to skip front end compilation phase completely or skip shader module at all when the cache is already aware of this shader by using VK_EXT_shader_module_identifier.
Definition at line 34 of file vk_shader_module.hh.
| blender::gpu::VKShaderModule::~VKShaderModule | ( | ) |
Definition at line 18 of file vk_shader_module.cc.
References blender::gpu::VKBackend::device, blender::gpu::VKDevice::discard_pool_for_current_thread(), blender::gpu::VKDiscardPool::discard_shader_module(), blender::gpu::VKBackend::get(), and vk_shader_module.
| void blender::gpu::VKShaderModule::build_sources_hash | ( | ) |
Build the sources hash from the combined_sources.
Definition at line 57 of file vk_shader_module.cc.
References BLI_assert, combined_sources, hash, and sources_hash.
Referenced by blender::gpu::read_spirv_from_disk().
| void blender::gpu::VKShaderModule::finalize | ( | StringRefNull | name | ) |
Finalize the shader module.
When compilation succeeded the VkShaderModule will be created and stored in vk_shader_module.
Definition at line 28 of file vk_shader_module.cc.
References BLI_assert, compilation_result, blender::Vector< T, InlineBufferCapacity, Allocator >::data(), blender::gpu::VKBackend::device, blender::gpu::VKBackend::get(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::gpu::debug::object_label(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), spirv_binary, VK_ALLOCATION_CALLBACKS, blender::gpu::VKDevice::vk_handle(), and vk_shader_module.
| std::string blender::gpu::VKShaderModule::combined_sources |
Single string containing GLSL source code.
Is cleared after compilation phase has completed. (VKShader::finalize_post).
Definition at line 41 of file vk_shader_module.hh.
Referenced by build_sources_hash(), and blender::gpu::compile_ex().
| shaderc::SpvCompilationResult blender::gpu::VKShaderModule::compilation_result |
Compilation result when compiling the shader module.
Is cleared after compilation phase has completed. (VKShader::finalize_post).
Definition at line 58 of file vk_shader_module.hh.
Referenced by blender::gpu::compile_ex(), finalize(), and blender::gpu::write_spirv_to_disk().
| bool blender::gpu::VKShaderModule::is_ready = true |
Is compilation needed and is the compilation step done.
Is set to false when GLSL sources are loaded and will be set to true again after the compilation step. It will also be true when compilation has failed.
Definition at line 67 of file vk_shader_module.hh.
| std::string blender::gpu::VKShaderModule::sources_hash |
Hash of the combined sources. Used to generate the name inside spirv cache.
Definition at line 46 of file vk_shader_module.hh.
Referenced by build_sources_hash(), blender::gpu::read_spirv_from_disk(), and blender::gpu::write_spirv_to_disk().
Definition at line 59 of file vk_shader_module.hh.
Referenced by finalize(), and blender::gpu::read_spirv_from_disk().
| VkShaderModule blender::gpu::VKShaderModule::vk_shader_module = VK_NULL_HANDLE |
Vulkan handler of the shader module.
Definition at line 51 of file vk_shader_module.hh.
Referenced by blender::gpu::VKShader::ensure_and_get_compute_pipeline(), blender::gpu::VKShader::ensure_and_get_graphics_pipeline(), finalize(), and ~VKShaderModule().