summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2022-10-06 20:45:56 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2022-10-06 21:08:54 +0200
commit24ff2929997302e54d4ed1b2a6787c814b22ee5a (patch)
treee8cf4f71fd80d1750cc5f888046f61dd49f2564a /servers
parent0c23a2cfe3ad897e1e49008629c135764b2c155c (diff)
Polish rendering driver refactor further
Mainly: - Make `max_descriptors_per_pool` project setting Vulkan-specific. - Use a common, render driver agnostic magic FourCC for shader binary data. - Downgrade spirv_reflect to Vulkan-only dependency. - Add a `RENDER_DRIVER_*` macro to GLSL shader code for per-driver customizations.
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/renderer_rd/shader_rd.cpp1
-rw-r--r--servers/rendering_server.cpp5
2 files changed, 4 insertions, 2 deletions
diff --git a/servers/rendering/renderer_rd/shader_rd.cpp b/servers/rendering/renderer_rd/shader_rd.cpp
index 0f2dea6fe9..5e9eadadd9 100644
--- a/servers/rendering/renderer_rd/shader_rd.cpp
+++ b/servers/rendering/renderer_rd/shader_rd.cpp
@@ -180,6 +180,7 @@ void ShaderRD::_build_variant_code(StringBuilder &builder, uint32_t p_variant, c
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
builder.append("#define MOLTENVK_USED\n");
#endif
+ builder.append(String("#define RENDER_DRIVER_") + OS::get_singleton()->get_current_rendering_driver_name().to_upper() + "\n");
} break;
case StageTemplate::Chunk::TYPE_MATERIAL_UNIFORMS: {
builder.append(p_version->uniforms.get_data()); //uniforms (same for vertex and fragment)
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 750121719f..5bd4bae4cb 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -2868,12 +2868,13 @@ void RenderingServer::init() {
GLOBAL_DEF("rendering/2d/shadow_atlas/size", 2048);
- // Already defined in RenderingDeviceVulkan::initialize which runs before this code.
+ // Already defined in some RenderingDevice*::initialize, which run before this code.
// We re-define them here just for doctool's sake. Make sure to keep default values in sync.
GLOBAL_DEF("rendering/rendering_device/staging_buffer/block_size_kb", 256);
GLOBAL_DEF("rendering/rendering_device/staging_buffer/max_size_mb", 128);
GLOBAL_DEF("rendering/rendering_device/staging_buffer/texture_upload_region_size_px", 64);
- GLOBAL_DEF("rendering/rendering_device/descriptor_pools/max_descriptors_per_pool", 64);
+ // Vulkan-specific.
+ GLOBAL_DEF("rendering/rendering_device/vulkan/max_descriptors_per_pool", 64);
GLOBAL_DEF("rendering/shader_compiler/shader_cache/enabled", true);
GLOBAL_DEF("rendering/shader_compiler/shader_cache/compress", true);