2020-04-20 04:19:21 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-03-01 01:44:37 +01:00
<class name= "RDShaderFile" inherits= "Resource" version= "4.1" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2020-04-20 04:19:21 +02:00
<brief_description >
2023-03-28 17:32:29 +02:00
Compiled shader file in SPIR-V form (used by [RenderingDevice]). Not to be confused with Godot's own [Shader].
2020-04-20 04:19:21 +02:00
</brief_description>
<description >
2023-03-28 17:32:29 +02:00
Compiled shader file in SPIR-V form.
See also [RDShaderSource]. [RDShaderFile] is only meant to be used with the [RenderingDevice] API. It should not be confused with Godot's own [Shader] resource, which is what Godot's various nodes use for high-level shader programming.
2020-04-20 04:19:21 +02:00
</description>
<tutorials >
</tutorials>
<methods >
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.
2021-07-25 16:22:55 +02:00
<method name= "get_spirv" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "RDShaderSPIRV" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "version" type= "StringName" default= "&""" />
2020-04-20 04:19:21 +02:00
<description >
2023-03-28 17:32:29 +02:00
Returns the SPIR-V intermediate representation for the specified shader [param version].
2020-04-20 04:19:21 +02:00
</description>
</method>
<method name= "get_version_list" qualifiers= "const" >
2023-04-25 00:21:32 +02:00
<return type= "StringName[]" />
2020-04-20 04:19:21 +02:00
<description >
2023-03-28 17:32:29 +02:00
Returns the list of compiled versions for this shader.
2020-04-20 04:19:21 +02:00
</description>
</method>
<method name= "set_bytecode" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "bytecode" type= "RDShaderSPIRV" />
<param index= "1" name= "version" type= "StringName" default= "&""" />
2020-04-20 04:19:21 +02:00
<description >
2023-03-28 17:32:29 +02:00
Sets the SPIR-V [param bytecode] that will be compiled for the specified [param version].
2020-04-20 04:19:21 +02:00
</description>
</method>
</methods>
<members >
<member name= "base_error" type= "String" setter= "set_base_error" getter= "get_base_error" default= """" >
2023-03-28 17:32:29 +02:00
The base compilation error message, which indicates errors not related to a specific shader stage if non-empty. If empty, shader compilation is not necessarily successful (check [RDShaderSPIRV]'s error message members).
2020-04-20 04:19:21 +02:00
</member>
</members>
</class>