raytracing: Initial Vulkan support

- Vulkan implementations in `RenderingDeviceDriverVulkan`.
- Raytracing instruction list in `RenderingDeviceGraph`.
- Functions to create acceleration structures and raytracing pipelines
  in `RenderingDevice`.
- Raygen, Miss, and ClosestHit shader stages support.
- GDScript bindings.
- Update classes documentation.
- Unimplemented placeholders for Metal and D3D12.
- Build acceleration structure command.
- Expose a shader preprocessor define.
- Align build scratch address.
- Create STB after creating the pipeline.
- Separate acceleration structure barriers.
- Use transforms in TLAS instances.
- AnyHit and Intersection stages.
- Optionally set acceleration structure build input buffer usage.
- Introduce instances buffer.
- Move scratch buffers to RenderingDevice.
- Rename AccelerationStructureGeometryBits.
- Use regular buffer creation and free routines for scratch buffer.
- Store trackers in acceleration structures.
- Bump Shader SPIR-V version to 1.4
- Add Position attribute location in blas_create.
- Encapsulate MoltenVK check in preprocessor macro.
- Split SUPPORTS_RAYTRACING for pipeline and query.
This commit is contained in:
Antonio Caggiano 2024-11-11 08:40:38 +01:00
parent 66b9c7251e
commit 27e4f24800
No known key found for this signature in database
GPG key ID: C9D9BD410EBBEDFF
28 changed files with 2998 additions and 114 deletions

View file

@ -41,7 +41,7 @@ Error RDShaderFile::parse_versions_from_text(const String &p_text, const String
Vector<String> lines = p_text.split("\n");
bool reading_versions = false;
bool stage_found[RD::SHADER_STAGE_MAX] = { false, false, false, false, false };
bool stage_found[RD::SHADER_STAGE_MAX] = {};
RD::ShaderStage stage = RD::SHADER_STAGE_MAX;
static const char *stage_str[RD::SHADER_STAGE_MAX] = {
"vertex",
@ -49,6 +49,11 @@ Error RDShaderFile::parse_versions_from_text(const String &p_text, const String
"tesselation_control",
"tesselation_evaluation",
"compute",
"raygen",
"any_hit",
"closest_hit",
"miss",
"intersection",
};
String stage_code[RD::SHADER_STAGE_MAX];
int stages_found = 0;
@ -193,7 +198,7 @@ Error RDShaderFile::parse_versions_from_text(const String &p_text, const String
code = code.replace("VERSION_DEFINES", E.value);
String error;
#ifdef MODULE_GLSLANG_ENABLED
Vector<uint8_t> spirv = compile_glslang_shader(RD::ShaderStage(i), ShaderIncludeDB::parse_include_files(code), RD::SHADER_LANGUAGE_VULKAN_VERSION_1_1, RD::SHADER_SPIRV_VERSION_1_3, &error);
Vector<uint8_t> spirv = compile_glslang_shader(RD::ShaderStage(i), ShaderIncludeDB::parse_include_files(code), RD::SHADER_LANGUAGE_VULKAN_VERSION_1_1, RD::SHADER_SPIRV_VERSION_1_4, &error);
bytecode->set_stage_bytecode(RD::ShaderStage(i), spirv);
#else
error = "Shader compilation is not supported because glslang was not enabled.";