mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
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.
This commit is contained in:
parent
e2ebc7db58
commit
cf3f404d31
15 changed files with 609 additions and 312 deletions
|
@ -55,7 +55,7 @@ void ShaderFileEditor::_version_selected(int p_option) {
|
|||
RD::ShaderStage stage = RD::SHADER_STAGE_MAX;
|
||||
int first_found = -1;
|
||||
|
||||
Ref<RDShaderBytecode> bytecode = shader_file->get_bytecode(version_txt);
|
||||
Ref<RDShaderSPIRV> bytecode = shader_file->get_spirv(version_txt);
|
||||
ERR_FAIL_COND(bytecode.is_null());
|
||||
|
||||
for (int i = 0; i < RD::SHADER_STAGE_MAX; i++) {
|
||||
|
@ -142,7 +142,7 @@ void ShaderFileEditor::_update_options() {
|
|||
|
||||
Ref<Texture2D> icon;
|
||||
|
||||
Ref<RDShaderBytecode> bytecode = shader_file->get_bytecode(version_list[i]);
|
||||
Ref<RDShaderSPIRV> bytecode = shader_file->get_spirv(version_list[i]);
|
||||
ERR_FAIL_COND(bytecode.is_null());
|
||||
|
||||
bool failed = false;
|
||||
|
@ -175,7 +175,7 @@ void ShaderFileEditor::_update_options() {
|
|||
return;
|
||||
}
|
||||
|
||||
Ref<RDShaderBytecode> bytecode = shader_file->get_bytecode(current_version);
|
||||
Ref<RDShaderSPIRV> bytecode = shader_file->get_spirv(current_version);
|
||||
ERR_FAIL_COND(bytecode.is_null());
|
||||
int first_valid = -1;
|
||||
int current = -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue