diff options
author | reduz <reduzio@gmail.com> | 2021-07-25 11:22:55 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-07-26 08:40:39 -0300 |
commit | cf3f404d312146cf46ae27fd8d220852eac27eb9 (patch) | |
tree | 4663011618e5523c29d3cf50e6a0ae18dec69ec1 /drivers/vulkan/rendering_device_vulkan.h | |
parent | e2ebc7db58c0bd61504c592f9760aaf1389af0b9 (diff) | |
download | redot-engine-cf3f404d312146cf46ae27fd8d220852eac27eb9.tar.gz |
Implement Binary Shader Compilation
* Added an extra stage before compiling shader, which is generating a binary blob.
* On Vulkan, this allows caching the SPIRV reflection information, which is expensive to parse.
* On other (future) RenderingDevices, it allows caching converted binary data, such as DXIL or MSL.
This PR makes the shader cache include the reflection information, hence editor startup times are significantly improved.
I tested this well and it appears to work, and I added a lot of consistency checks, but because it includes writing and reading binary information, rare bugs may pop up, so be aware.
There was not much of a choice for storing the reflection information, given shaders can be a lot, take a lot of space and take time to parse.
Diffstat (limited to 'drivers/vulkan/rendering_device_vulkan.h')
-rw-r--r-- | drivers/vulkan/rendering_device_vulkan.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h index 3b3582eaa3..f9ff61310a 100644 --- a/drivers/vulkan/rendering_device_vulkan.h +++ b/drivers/vulkan/rendering_device_vulkan.h @@ -1083,7 +1083,11 @@ public: /**** SHADER ****/ /****************/ - virtual RID shader_create(const Vector<ShaderStageData> &p_stages); + virtual String shader_get_binary_cache_key() const; + virtual Vector<uint8_t> shader_compile_binary_from_spirv(const Vector<ShaderStageSPIRVData> &p_spirv); + + virtual RID shader_create_from_bytecode(const Vector<uint8_t> &p_shader_binary); + virtual uint32_t shader_get_vertex_input_attribute_mask(RID p_shader); /*****************/ |