summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_rd/environment
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-26 15:16:33 +0200
committerGitHub <noreply@github.com>2022-07-26 15:16:33 +0200
commit2d2b85d400e341e9b62a215e7fc2f3f73c075fe7 (patch)
tree9c3d269a382f3eef852bf4c65071b6935bdc7d6f /servers/rendering/renderer_rd/environment
parent1c63fbed4366803f1c63392e8d3f30955bd05736 (diff)
parent886c2d9681e83d8e1aed2a793f5d8136c2a98c4e (diff)
Merge pull request #62972 from Chaosus/shader_groups
Implement shader uniform groups/subgroups
Diffstat (limited to 'servers/rendering/renderer_rd/environment')
-rw-r--r--servers/rendering/renderer_rd/environment/fog.cpp15
-rw-r--r--servers/rendering/renderer_rd/environment/sky.cpp16
2 files changed, 30 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/environment/fog.cpp b/servers/rendering/renderer_rd/environment/fog.cpp
index 63c227e89b..987c1dbb52 100644
--- a/servers/rendering/renderer_rd/environment/fog.cpp
+++ b/servers/rendering/renderer_rd/environment/fog.cpp
@@ -393,7 +393,22 @@ void Fog::FogShaderData::get_param_list(List<PropertyInfo> *p_param_list) const
}
}
+ String last_group;
for (const KeyValue<int, StringName> &E : order) {
+ String group = uniforms[E.value].group;
+ if (!uniforms[E.value].subgroup.is_empty()) {
+ group += "::" + uniforms[E.value].subgroup;
+ }
+
+ if (group != last_group) {
+ PropertyInfo pi;
+ pi.usage = PROPERTY_USAGE_GROUP;
+ pi.name = group;
+ p_param_list->push_back(pi);
+
+ last_group = group;
+ }
+
PropertyInfo pi = ShaderLanguage::uniform_to_property_info(uniforms[E.value]);
pi.name = E.value;
p_param_list->push_back(pi);
diff --git a/servers/rendering/renderer_rd/environment/sky.cpp b/servers/rendering/renderer_rd/environment/sky.cpp
index 0851e754ea..6f32c15d95 100644
--- a/servers/rendering/renderer_rd/environment/sky.cpp
+++ b/servers/rendering/renderer_rd/environment/sky.cpp
@@ -178,8 +178,22 @@ void SkyRD::SkyShaderData::get_param_list(List<PropertyInfo> *p_param_list) cons
order[E.value.order] = E.key;
}
}
-
+ String last_group;
for (const KeyValue<int, StringName> &E : order) {
+ String group = uniforms[E.value].group;
+ if (!uniforms[E.value].subgroup.is_empty()) {
+ group += "::" + uniforms[E.value].subgroup;
+ }
+
+ if (group != last_group) {
+ PropertyInfo pi;
+ pi.usage = PROPERTY_USAGE_GROUP;
+ pi.name = group;
+ p_param_list->push_back(pi);
+
+ last_group = group;
+ }
+
PropertyInfo pi = ShaderLanguage::uniform_to_property_info(uniforms[E.value]);
pi.name = E.value;
p_param_list->push_back(pi);