summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/classes/PhysicsDirectSpaceState3DExtension.xml3
-rw-r--r--doc/classes/Transform2D.xml4
-rw-r--r--doc/classes/Transform3D.xml2
-rw-r--r--main/main.cpp17
-rw-r--r--modules/mono/csharp_script.cpp8
-rw-r--r--platform/android/java/lib/res/xml/godot_provider_paths.xml4
-rw-r--r--platform/linuxbsd/detect.py5
-rw-r--r--scene/resources/texture.cpp7
-rw-r--r--scene/resources/texture.h1
-rw-r--r--servers/extensions/physics_server_3d_extension.cpp2
-rw-r--r--servers/extensions/physics_server_3d_extension.h4
-rw-r--r--servers/register_server_types.cpp4
-rw-r--r--servers/rendering/renderer_rd/effects/roughness_limiter.cpp79
-rw-r--r--servers/rendering/renderer_rd/effects/roughness_limiter.h (renamed from servers/rendering/renderer_rd/effects_rd.h)104
-rw-r--r--servers/rendering/renderer_rd/effects/sort_effects.cpp124
-rw-r--r--servers/rendering/renderer_rd/effects/sort_effects.h71
-rw-r--r--servers/rendering/renderer_rd/effects_rd.cpp246
-rw-r--r--servers/rendering/renderer_rd/environment/sky.cpp8
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.h3
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/roughness_limiter.glsl (renamed from servers/rendering/renderer_rd/shaders/roughness_limiter.glsl)0
-rw-r--r--servers/rendering/renderer_rd/shaders/effects/sort.glsl (renamed from servers/rendering/renderer_rd/shaders/sort.glsl)0
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp11
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.h4
24 files changed, 350 insertions, 365 deletions
diff --git a/doc/classes/PhysicsDirectSpaceState3DExtension.xml b/doc/classes/PhysicsDirectSpaceState3DExtension.xml
index 8c21cd5145..64089489c0 100644
--- a/doc/classes/PhysicsDirectSpaceState3DExtension.xml
+++ b/doc/classes/PhysicsDirectSpaceState3DExtension.xml
@@ -64,7 +64,8 @@
<param index="4" name="collide_with_areas" type="bool" />
<param index="5" name="hit_from_inside" type="bool" />
<param index="6" name="hit_back_faces" type="bool" />
- <param index="7" name="result" type="PhysicsServer3DExtensionRayResult*" />
+ <param index="7" name="pick_ray" type="bool" />
+ <param index="8" name="result" type="PhysicsServer3DExtensionRayResult*" />
<description>
</description>
</method>
diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml
index 7b33be64a1..53e9f4ea10 100644
--- a/doc/classes/Transform2D.xml
+++ b/doc/classes/Transform2D.xml
@@ -120,7 +120,7 @@
<return type="bool" />
<param index="0" name="xform" type="Transform2D" />
<description>
- Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
+ Returns [code]true[/code] if this transform and [param xform] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
</description>
</method>
<method name="is_finite" qualifiers="const">
@@ -133,7 +133,7 @@
<return type="Transform2D" />
<param index="0" name="target" type="Vector2" default="Vector2(0, 0)" />
<description>
- Returns a copy of the transform rotated such that it's rotation on the X-axis points towards the [param target] position.
+ Returns a copy of the transform rotated such that the rotated X-axis points towards the [param target] position.
Operations take place in global space.
</description>
</method>
diff --git a/doc/classes/Transform3D.xml b/doc/classes/Transform3D.xml
index 505d213cdb..5fe31bd29a 100644
--- a/doc/classes/Transform3D.xml
+++ b/doc/classes/Transform3D.xml
@@ -80,7 +80,7 @@
<return type="bool" />
<param index="0" name="xform" type="Transform3D" />
<description>
- Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
+ Returns [code]true[/code] if this transform and [param xform] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
</description>
</method>
<method name="is_finite" qualifiers="const">
diff --git a/main/main.cpp b/main/main.cpp
index b15588e700..f4d2dbef52 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -108,6 +108,10 @@
#include "modules/modules_enabled.gen.h" // For mono.
+#if defined(MODULE_MONO_ENABLED) && defined(TOOLS_ENABLED)
+#include "modules/mono/editor/bindings_generator.h"
+#endif
+
/* Static members */
// Singletons
@@ -312,7 +316,6 @@ void finalize_navigation_server() {
void initialize_theme_db() {
theme_db = memnew(ThemeDB);
- theme_db->initialize_theme();
}
void finalize_theme_db() {
@@ -532,6 +535,7 @@ Error Main::test_setup() {
// Theme needs modules to be initialized so that sub-resources can be loaded.
initialize_theme_db();
+ theme_db->initialize_theme();
register_scene_singletons();
ERR_FAIL_COND_V(TextServerManager::get_singleton()->get_interface_count() == 0, ERR_CANT_CREATE);
@@ -2314,6 +2318,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
register_platform_apis();
// Theme needs modules to be initialized so that sub-resources can be loaded.
+ // Default theme is initialized later, after ScriptServer is ready.
initialize_theme_db();
register_scene_singletons();
@@ -2341,8 +2346,18 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
// This loads global classes, so it must happen before custom loaders and savers are registered
ScriptServer::init_languages();
+ theme_db->initialize_theme();
audio_server->load_default_bus_layout();
+#if defined(MODULE_MONO_ENABLED) && defined(TOOLS_ENABLED)
+ // Hacky to have it here, but we don't have good facility yet to let modules
+ // register command line options to call at the right time. This needs to happen
+ // after init'ing the ScriptServer, but also after init'ing the ThemeDB,
+ // for the C# docs generation in the bindings.
+ List<String> cmdline_args = OS::get_singleton()->get_cmdline_args();
+ BindingsGenerator::handle_cmdline_args(cmdline_args);
+#endif
+
if (use_debug_profiler && EngineDebugger::is_active()) {
// Start the "scripts" profiler, used in local debugging.
// We could add more, and make the CLI arg require a comma-separated list of profilers.
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 932e97c46b..1dbf6b3471 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -42,7 +42,6 @@
#ifdef TOOLS_ENABLED
#include "core/os/keyboard.h"
-#include "editor/bindings_generator.h"
#include "editor/editor_internal_calls.h"
#include "editor/editor_node.h"
#include "editor/editor_settings.h"
@@ -103,13 +102,6 @@ void CSharpLanguage::init() {
}
#endif
-#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
- // Generate the bindings here, before loading assemblies. The Godot assemblies
- // may be missing if the glue wasn't generated yet in order to build them.
- List<String> cmdline_args = OS::get_singleton()->get_cmdline_args();
- BindingsGenerator::handle_cmdline_args(cmdline_args);
-#endif
-
GLOBAL_DEF("dotnet/project/assembly_name", "");
#ifdef TOOLS_ENABLED
GLOBAL_DEF("dotnet/project/solution_directory", "");
diff --git a/platform/android/java/lib/res/xml/godot_provider_paths.xml b/platform/android/java/lib/res/xml/godot_provider_paths.xml
index 1255f576bf..8ad16da879 100644
--- a/platform/android/java/lib/res/xml/godot_provider_paths.xml
+++ b/platform/android/java/lib/res/xml/godot_provider_paths.xml
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
+ <files-path
+ name="filesRoot"
+ path="/" />
+
<external-path
name="public"
path="." />
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index 549319a750..54351757cd 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -307,11 +307,12 @@ def configure(env: "Environment"):
if not env["use_sowrap"]:
if os.system("pkg-config --exists libpulse") == 0: # 0 means found
env.ParseConfig("pkg-config libpulse --cflags --libs")
- env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
+ env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"])
else:
print("Warning: PulseAudio development libraries not found. Disabling the PulseAudio audio driver.")
env["pulseaudio"] = False
- env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
+ else:
+ env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED", "_REENTRANT"])
if env["dbus"]:
if not env["use_sowrap"]:
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 651bad1aa7..282c531555 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -2935,6 +2935,10 @@ TypedArray<Image> ImageTextureLayered::_get_images() const {
return images;
}
+void ImageTextureLayered::_set_images(const TypedArray<Image> &p_images) {
+ ERR_FAIL_COND(_create_from_images(p_images) != OK);
+}
+
Error ImageTextureLayered::create_from_images(Vector<Ref<Image>> p_images) {
int new_layers = p_images.size();
ERR_FAIL_COND_V(new_layers == 0, ERR_INVALID_PARAMETER);
@@ -3014,8 +3018,9 @@ void ImageTextureLayered::_bind_methods() {
ClassDB::bind_method(D_METHOD("update_layer", "image", "layer"), &ImageTextureLayered::update_layer);
ClassDB::bind_method(D_METHOD("_get_images"), &ImageTextureLayered::_get_images);
+ ClassDB::bind_method(D_METHOD("_set_images", "images"), &ImageTextureLayered::_set_images);
- ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_images", PROPERTY_HINT_ARRAY_TYPE, "Image", PROPERTY_USAGE_INTERNAL), "create_from_images", "_get_images");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_images", PROPERTY_HINT_ARRAY_TYPE, "Image", PROPERTY_USAGE_INTERNAL), "_set_images", "_get_images");
}
ImageTextureLayered::ImageTextureLayered(LayeredType p_layered_type) {
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 7c4d479da8..50bcec58f6 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -427,6 +427,7 @@ class ImageTextureLayered : public TextureLayered {
Error _create_from_images(const TypedArray<Image> &p_images);
TypedArray<Image> _get_images() const;
+ void _set_images(const TypedArray<Image> &p_images);
protected:
static void _bind_methods();
diff --git a/servers/extensions/physics_server_3d_extension.cpp b/servers/extensions/physics_server_3d_extension.cpp
index 0d8476fd68..bea9abf328 100644
--- a/servers/extensions/physics_server_3d_extension.cpp
+++ b/servers/extensions/physics_server_3d_extension.cpp
@@ -39,7 +39,7 @@ thread_local const HashSet<RID> *PhysicsDirectSpaceState3DExtension::exclude = n
void PhysicsDirectSpaceState3DExtension::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_body_excluded_from_query", "body"), &PhysicsDirectSpaceState3DExtension::is_body_excluded_from_query);
- GDVIRTUAL_BIND(_intersect_ray, "from", "to", "collision_mask", "collide_with_bodies", "collide_with_areas", "hit_from_inside", "hit_back_faces", "result");
+ GDVIRTUAL_BIND(_intersect_ray, "from", "to", "collision_mask", "collide_with_bodies", "collide_with_areas", "hit_from_inside", "hit_back_faces", "pick_ray", "result");
GDVIRTUAL_BIND(_intersect_point, "position", "collision_mask", "collide_with_bodies", "collide_with_areas", "results", "max_results");
GDVIRTUAL_BIND(_intersect_shape, "shape_rid", "transform", "motion", "margin", "collision_mask", "collide_with_bodies", "collide_with_areas", "result_count", "max_results");
GDVIRTUAL_BIND(_cast_motion, "shape_rid", "transform", "motion", "margin", "collision_mask", "collide_with_bodies", "collide_with_areas", "closest_safe", "closest_unsafe", "info");
diff --git a/servers/extensions/physics_server_3d_extension.h b/servers/extensions/physics_server_3d_extension.h
index bec403c0ec..6c5dd38714 100644
--- a/servers/extensions/physics_server_3d_extension.h
+++ b/servers/extensions/physics_server_3d_extension.h
@@ -128,7 +128,7 @@ protected:
static void _bind_methods();
bool is_body_excluded_from_query(const RID &p_body) const;
- GDVIRTUAL8R(bool, _intersect_ray, const Vector3 &, const Vector3 &, uint32_t, bool, bool, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionRayResult>)
+ GDVIRTUAL9R(bool, _intersect_ray, const Vector3 &, const Vector3 &, uint32_t, bool, bool, bool, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionRayResult>)
GDVIRTUAL6R(int, _intersect_point, const Vector3 &, uint32_t, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionShapeResult>, int)
GDVIRTUAL9R(int, _intersect_shape, RID, const Transform3D &, const Vector3 &, real_t, uint32_t, bool, bool, GDExtensionPtr<PhysicsServer3DExtensionShapeResult>, int)
GDVIRTUAL10R(bool, _cast_motion, RID, const Transform3D &, const Vector3 &, real_t, uint32_t, bool, bool, GDExtensionPtr<real_t>, GDExtensionPtr<real_t>, GDExtensionPtr<PhysicsServer3DExtensionShapeRestInfo>)
@@ -140,7 +140,7 @@ public:
virtual bool intersect_ray(const RayParameters &p_parameters, RayResult &r_result) override {
exclude = &p_parameters.exclude;
bool ret = false;
- GDVIRTUAL_REQUIRED_CALL(_intersect_ray, p_parameters.from, p_parameters.to, p_parameters.collision_mask, p_parameters.collide_with_bodies, p_parameters.collide_with_areas, p_parameters.hit_from_inside, p_parameters.hit_back_faces, &r_result, ret);
+ GDVIRTUAL_REQUIRED_CALL(_intersect_ray, p_parameters.from, p_parameters.to, p_parameters.collision_mask, p_parameters.collide_with_bodies, p_parameters.collide_with_areas, p_parameters.hit_from_inside, p_parameters.hit_back_faces, p_parameters.pick_ray, &r_result, ret);
exclude = nullptr;
return ret;
}
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 8cc2cc0756..7cc9a82699 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -158,8 +158,8 @@ void register_server_types() {
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionRayResult, "Vector3 position;Vector3 normal;RID rid;ObjectID collider_id;Object *collider;int shape");
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionShapeResult, "RID rid;ObjectID collider_id;Object *collider;int shape");
GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionShapeRestInfo, "Vector3 point;Vector3 normal;RID rid;ObjectID collider_id;int shape;Vector3 linear_velocity");
- GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionCollision, "Vector3 position;Vector3 normal;Vector3 collider_velocity;real_t depth;int local_shape;ObjectID collider_id;RID collider;int collider_shape");
- GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionResult, "Vector3 travel;Vector3 remainder;real_t collision_safe_fraction;real_t collision_unsafe_fraction;PhysicsServer3DExtensionMotionCollision collisions[32];int collision_count");
+ GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionCollision, "Vector3 position;Vector3 normal;Vector3 collider_velocity;Vector3 collider_angular_velocity;real_t depth;int local_shape;ObjectID collider_id;RID collider;int collider_shape");
+ GDREGISTER_NATIVE_STRUCT(PhysicsServer3DExtensionMotionResult, "Vector3 travel;Vector3 remainder;real_t collision_depth;real_t collision_safe_fraction;real_t collision_unsafe_fraction;PhysicsServer3DExtensionMotionCollision collisions[32];int collision_count");
GDREGISTER_ABSTRACT_CLASS(NavigationServer2D);
GDREGISTER_ABSTRACT_CLASS(NavigationServer3D);
diff --git a/servers/rendering/renderer_rd/effects/roughness_limiter.cpp b/servers/rendering/renderer_rd/effects/roughness_limiter.cpp
new file mode 100644
index 0000000000..7200ae54ac
--- /dev/null
+++ b/servers/rendering/renderer_rd/effects/roughness_limiter.cpp
@@ -0,0 +1,79 @@
+/**************************************************************************/
+/* roughness_limiter.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#include "roughness_limiter.h"
+#include "servers/rendering/renderer_rd/storage_rd/material_storage.h"
+#include "servers/rendering/renderer_rd/uniform_set_cache_rd.h"
+
+using namespace RendererRD;
+
+RoughnessLimiter::RoughnessLimiter() {
+ // Initialize roughness limiter
+ Vector<String> shader_modes;
+ shader_modes.push_back("");
+
+ shader.initialize(shader_modes);
+
+ shader_version = shader.version_create();
+
+ pipeline = RD::get_singleton()->compute_pipeline_create(shader.version_get_shader(shader_version, 0));
+}
+
+RoughnessLimiter::~RoughnessLimiter() {
+ shader.version_free(shader_version);
+}
+
+void RoughnessLimiter::roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve) {
+ UniformSetCacheRD *uniform_set_cache = UniformSetCacheRD::get_singleton();
+ ERR_FAIL_NULL(uniform_set_cache);
+ MaterialStorage *material_storage = MaterialStorage::get_singleton();
+ ERR_FAIL_NULL(material_storage);
+
+ push_constant.screen_size[0] = p_size.x;
+ push_constant.screen_size[1] = p_size.y;
+ push_constant.curve = p_curve;
+
+ RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID rl_shader = shader.version_get_shader(shader_version, 0);
+
+ RD::Uniform u_source_normal(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_source_normal }));
+ RD::Uniform u_roughness(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_roughness }));
+
+ RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
+ RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, pipeline);
+ RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(rl_shader, 0, u_source_normal), 0);
+ RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(rl_shader, 1, u_roughness), 1);
+
+ RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(RoughnessLimiterPushConstant)); //not used but set anyway
+
+ RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_size.x, p_size.y, 1);
+
+ RD::get_singleton()->compute_list_end();
+}
diff --git a/servers/rendering/renderer_rd/effects_rd.h b/servers/rendering/renderer_rd/effects/roughness_limiter.h
index 45198e5fc5..be8f35cf99 100644
--- a/servers/rendering/renderer_rd/effects_rd.h
+++ b/servers/rendering/renderer_rd/effects/roughness_limiter.h
@@ -1,5 +1,5 @@
/**************************************************************************/
-/* effects_rd.h */
+/* roughness_limiter.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,106 +28,40 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
-#ifndef EFFECTS_RD_H
-#define EFFECTS_RD_H
+#ifndef ROUGHNESS_LIMITER_RD_H
+#define ROUGHNESS_LIMITER_RD_H
-#include "core/math/projection.h"
#include "servers/rendering/renderer_rd/pipeline_cache_rd.h"
-#include "servers/rendering/renderer_rd/shaders/roughness_limiter.glsl.gen.h"
-#include "servers/rendering/renderer_rd/shaders/sort.glsl.gen.h"
+#include "servers/rendering/renderer_rd/shaders/effects/roughness_limiter.glsl.gen.h"
#include "servers/rendering/renderer_scene_render.h"
#include "servers/rendering_server.h"
-class EffectsRD {
-private:
- bool prefer_raster_effects;
+namespace RendererRD {
+
+// Note, this logic is unused at the time of writing. It should be re-incorporated into the renderer at some point.
+class RoughnessLimiter {
+private:
struct RoughnessLimiterPushConstant {
int32_t screen_size[2];
float curve;
uint32_t pad;
};
- struct RoughnessLimiter {
- RoughnessLimiterPushConstant push_constant;
- RoughnessLimiterShaderRD shader;
- RID shader_version;
- RID pipeline;
-
- } roughness_limiter;
-
- enum SortMode {
- SORT_MODE_BLOCK,
- SORT_MODE_STEP,
- SORT_MODE_INNER,
- SORT_MODE_MAX
- };
-
- struct Sort {
- struct PushConstant {
- uint32_t total_elements;
- uint32_t pad[3];
- int32_t job_params[4];
- };
-
- SortShaderRD shader;
- RID shader_version;
- RID pipelines[SORT_MODE_MAX];
- } sort;
-
- RID default_sampler;
- RID default_mipmap_sampler;
- RID index_buffer;
- RID index_array;
-
- HashMap<RID, RID> texture_to_uniform_set_cache;
- HashMap<RID, RID> input_to_uniform_set_cache;
-
- HashMap<RID, RID> image_to_uniform_set_cache;
-
- struct TexturePair {
- RID texture1;
- RID texture2;
- _FORCE_INLINE_ bool operator<(const TexturePair &p_pair) const {
- if (texture1 == p_pair.texture1) {
- return texture2 < p_pair.texture2;
- } else {
- return texture1 < p_pair.texture1;
- }
- }
- };
-
- struct TextureSamplerPair {
- RID texture;
- RID sampler;
- _FORCE_INLINE_ bool operator<(const TextureSamplerPair &p_pair) const {
- if (texture == p_pair.texture) {
- return sampler < p_pair.sampler;
- } else {
- return texture < p_pair.texture;
- }
- }
- };
-
- RBMap<TexturePair, RID> texture_pair_to_uniform_set_cache;
- RBMap<RID, RID> texture_to_compute_uniform_set_cache;
- RBMap<TexturePair, RID> texture_pair_to_compute_uniform_set_cache;
- RBMap<TexturePair, RID> image_pair_to_compute_uniform_set_cache;
- RBMap<TextureSamplerPair, RID> texture_sampler_to_compute_uniform_set_cache;
-
- RID _get_uniform_set_from_image(RID p_texture);
- RID _get_compute_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps = false);
+ RoughnessLimiterPushConstant push_constant;
+ RoughnessLimiterShaderRD shader;
+ RID shader_version;
+ RID pipeline;
+protected:
public:
- bool get_prefer_raster_effects();
+ RoughnessLimiter();
+ ~RoughnessLimiter();
void roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve);
-
- void sort_buffer(RID p_uniform_set, int p_size);
-
- EffectsRD(bool p_prefer_raster_effects);
- ~EffectsRD();
};
-#endif // EFFECTS_RD_H
+} // namespace RendererRD
+
+#endif // ROUGHNESS_LIMITER_RD_H
diff --git a/servers/rendering/renderer_rd/effects/sort_effects.cpp b/servers/rendering/renderer_rd/effects/sort_effects.cpp
new file mode 100644
index 0000000000..cc2b863f04
--- /dev/null
+++ b/servers/rendering/renderer_rd/effects/sort_effects.cpp
@@ -0,0 +1,124 @@
+/**************************************************************************/
+/* sort_effects.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#include "sort_effects.h"
+// #include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
+#include "servers/rendering/renderer_rd/storage_rd/material_storage.h"
+#include "servers/rendering/renderer_rd/uniform_set_cache_rd.h"
+
+using namespace RendererRD;
+
+SortEffects::SortEffects() {
+ Vector<String> sort_modes;
+ sort_modes.push_back("\n#define MODE_SORT_BLOCK\n");
+ sort_modes.push_back("\n#define MODE_SORT_STEP\n");
+ sort_modes.push_back("\n#define MODE_SORT_INNER\n");
+
+ shader.initialize(sort_modes);
+
+ shader_version = shader.version_create();
+
+ for (int i = 0; i < SORT_MODE_MAX; i++) {
+ pipelines[i] = RD::get_singleton()->compute_pipeline_create(shader.version_get_shader(shader_version, i));
+ }
+}
+
+SortEffects::~SortEffects() {
+ shader.version_free(shader_version);
+}
+
+void SortEffects::sort_buffer(RID p_uniform_set, int p_size) {
+ PushConstant push_constant;
+ push_constant.total_elements = p_size;
+
+ bool done = true;
+
+ int numThreadGroups = ((p_size - 1) >> 9) + 1;
+
+ if (numThreadGroups > 1) {
+ done = false;
+ }
+
+ RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
+
+ RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, pipelines[SORT_MODE_BLOCK]);
+ RD::get_singleton()->compute_list_bind_uniform_set(compute_list, p_uniform_set, 1);
+ RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(PushConstant));
+ RD::get_singleton()->compute_list_dispatch(compute_list, numThreadGroups, 1, 1);
+
+ int presorted = 512;
+
+ while (!done) {
+ RD::get_singleton()->compute_list_add_barrier(compute_list);
+
+ done = true;
+ RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, pipelines[SORT_MODE_STEP]);
+
+ numThreadGroups = 0;
+
+ if (p_size > presorted) {
+ if (p_size > presorted * 2) {
+ done = false;
+ }
+
+ int pow2 = presorted;
+ while (pow2 < p_size) {
+ pow2 *= 2;
+ }
+ numThreadGroups = pow2 >> 9;
+ }
+
+ unsigned int nMergeSize = presorted * 2;
+
+ for (unsigned int nMergeSubSize = nMergeSize >> 1; nMergeSubSize > 256; nMergeSubSize = nMergeSubSize >> 1) {
+ push_constant.job_params[0] = nMergeSubSize;
+ if (nMergeSubSize == nMergeSize >> 1) {
+ push_constant.job_params[1] = (2 * nMergeSubSize - 1);
+ push_constant.job_params[2] = -1;
+ } else {
+ push_constant.job_params[1] = nMergeSubSize;
+ push_constant.job_params[2] = 1;
+ }
+ push_constant.job_params[3] = 0;
+
+ RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(PushConstant));
+ RD::get_singleton()->compute_list_dispatch(compute_list, numThreadGroups, 1, 1);
+ RD::get_singleton()->compute_list_add_barrier(compute_list);
+ }
+
+ RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, pipelines[SORT_MODE_INNER]);
+ RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(PushConstant));
+ RD::get_singleton()->compute_list_dispatch(compute_list, numThreadGroups, 1, 1);
+
+ presorted *= 2;
+ }
+
+ RD::get_singleton()->compute_list_end();
+}
diff --git a/servers/rendering/renderer_rd/effects/sort_effects.h b/servers/rendering/renderer_rd/effects/sort_effects.h
new file mode 100644
index 0000000000..a633ec22ac
--- /dev/null
+++ b/servers/rendering/renderer_rd/effects/sort_effects.h
@@ -0,0 +1,71 @@
+/**************************************************************************/
+/* sort_effects.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#ifndef SORT_EFFECTS_RD_H
+#define SORT_EFFECTS_RD_H
+
+#include "servers/rendering/renderer_rd/pipeline_cache_rd.h"
+#include "servers/rendering/renderer_rd/shaders/effects/sort.glsl.gen.h"
+#include "servers/rendering/renderer_scene_render.h"
+
+#include "servers/rendering_server.h"
+
+namespace RendererRD {
+
+class SortEffects {
+private:
+ enum SortMode {
+ SORT_MODE_BLOCK,
+ SORT_MODE_STEP,
+ SORT_MODE_INNER,
+ SORT_MODE_MAX
+ };
+
+ struct PushConstant {
+ uint32_t total_elements;
+ uint32_t pad[3];
+ int32_t job_params[4];
+ };
+
+ SortShaderRD shader;
+ RID shader_version;
+ RID pipelines[SORT_MODE_MAX];
+
+protected:
+public:
+ SortEffects();
+ ~SortEffects();
+
+ void sort_buffer(RID p_uniform_set, int p_size);
+};
+
+} // namespace RendererRD
+
+#endif // SORT_EFFECTS_RD_H
diff --git a/servers/rendering/renderer_rd/effects_rd.cpp b/servers/rendering/renderer_rd/effects_rd.cpp
deleted file mode 100644
index b7a1396f9c..0000000000
--- a/servers/rendering/renderer_rd/effects_rd.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/**************************************************************************/
-/* effects_rd.cpp */
-/**************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/**************************************************************************/
-/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/**************************************************************************/
-
-#include "effects_rd.h"
-
-#include "core/config/project_settings.h"
-#include "core/math/math_defs.h"
-#include "core/os/os.h"
-
-#include "servers/rendering/renderer_rd/renderer_compositor_rd.h"
-#include "thirdparty/misc/cubemap_coeffs.h"
-
-bool EffectsRD::get_prefer_raster_effects() {
- return prefer_raster_effects;
-}
-
-RID EffectsRD::_get_uniform_set_from_image(RID p_image) {
- if (image_to_uniform_set_cache.has(p_image)) {
- RID uniform_set = image_to_uniform_set_cache[p_image];
- if (RD::get_singleton()->uniform_set_is_valid(uniform_set)) {
- return uniform_set;
- }
- }
- Vector<RD::Uniform> uniforms;
- RD::Uniform u;
- u.uniform_type = RD::UNIFORM_TYPE_IMAGE;
- u.binding = 0;
- u.append_id(p_image);
- uniforms.push_back(u);
- //any thing with the same configuration (one texture in binding 0 for set 0), is good
- RID uniform_set = RD::get_singleton()->uniform_set_create(uniforms, roughness_limiter.shader.version_get_shader(roughness_limiter.shader_version, 0), 1);
-
- image_to_uniform_set_cache[p_image] = uniform_set;
-
- return uniform_set;
-}
-
-RID EffectsRD::_get_compute_uniform_set_from_texture(RID p_texture, bool p_use_mipmaps) {
- if (texture_to_compute_uniform_set_cache.has(p_texture)) {
- RID uniform_set = texture_to_compute_uniform_set_cache[p_texture];
- if (RD::get_singleton()->uniform_set_is_valid(uniform_set)) {
- return uniform_set;
- }
- }
-
- Vector<RD::Uniform> uniforms;
- RD::Uniform u;
- u.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
- u.binding = 0;
- u.append_id(p_use_mipmaps ? default_mipmap_sampler : default_sampler);
- u.append_id(p_texture);
- uniforms.push_back(u);
- //any thing with the same configuration (one texture in binding 0 for set 0), is good
- RID uniform_set = RD::get_singleton()->uniform_set_create(uniforms, roughness_limiter.shader.version_get_shader(roughness_limiter.shader_version, 0), 0);
-
- texture_to_compute_uniform_set_cache[p_texture] = uniform_set;
-
- return uniform_set;
-}
-
-void EffectsRD::roughness_limit(RID p_source_normal, RID p_roughness, const Size2i &p_size, float p_curve) {
- roughness_limiter.push_constant.screen_size[0] = p_size.x;
- roughness_limiter.push_constant.screen_size[1] = p_size.y;
- roughness_limiter.push_constant.curve = p_curve;
-
- RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
- RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, roughness_limiter.pipeline);
- RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_compute_uniform_set_from_texture(p_source_normal), 0);
- RD::get_singleton()->compute_list_bind_uniform_set(compute_list, _get_uniform_set_from_image(p_roughness), 1);
-
- RD::get_singleton()->compute_list_set_push_constant(compute_list, &roughness_limiter.push_constant, sizeof(RoughnessLimiterPushConstant)); //not used but set anyway
-
- RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_size.x, p_size.y, 1);
-
- RD::get_singleton()->compute_list_end();
-}
-
-void EffectsRD::sort_buffer(RID p_uniform_set, int p_size) {
- Sort::PushConstant push_constant;
- push_constant.total_elements = p_size;
-
- bool done = true;
-
- int numThreadGroups = ((p_size - 1) >> 9) + 1;
-
- if (numThreadGroups > 1) {
- done = false;
- }
-
- RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin();
-
- RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, sort.pipelines[SORT_MODE_BLOCK]);
- RD::get_singleton()->compute_list_bind_uniform_set(compute_list, p_uniform_set, 1);
- RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(Sort::PushConstant));
- RD::get_singleton()->compute_list_dispatch(compute_list, numThreadGroups, 1, 1);
-
- int presorted = 512;
-
- while (!done) {
- RD::get_singleton()->compute_list_add_barrier(compute_list);
-
- done = true;
- RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, sort.pipelines[SORT_MODE_STEP]);
-
- numThreadGroups = 0;
-
- if (p_size > presorted) {
- if (p_size > presorted * 2) {
- done = false;
- }
-
- int pow2 = presorted;
- while (pow2 < p_size) {
- pow2 *= 2;
- }
- numThreadGroups = pow2 >> 9;
- }
-
- unsigned int nMergeSize = presorted * 2;
-
- for (unsigned int nMergeSubSize = nMergeSize >> 1; nMergeSubSize > 256; nMergeSubSize = nMergeSubSize >> 1) {
- push_constant.job_params[0] = nMergeSubSize;
- if (nMergeSubSize == nMergeSize >> 1) {
- push_constant.job_params[1] = (2 * nMergeSubSize - 1);
- push_constant.job_params[2] = -1;
- } else {
- push_constant.job_params[1] = nMergeSubSize;
- push_constant.job_params[2] = 1;
- }
- push_constant.job_params[3] = 0;
-
- RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(Sort::PushConstant));
- RD::get_singleton()->compute_list_dispatch(compute_list, numThreadGroups, 1, 1);
- RD::get_singleton()->compute_list_add_barrier(compute_list);
- }
-
- RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, sort.pipelines[SORT_MODE_INNER]);
- RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(Sort::PushConstant));
- RD::get_singleton()->compute_list_dispatch(compute_list, numThreadGroups, 1, 1);
-
- presorted *= 2;
- }
-
- RD::get_singleton()->compute_list_end();
-}
-
-EffectsRD::EffectsRD(bool p_prefer_raster_effects) {
- prefer_raster_effects = p_prefer_raster_effects;
-
- if (!prefer_raster_effects) {
- // Initialize roughness limiter
- Vector<String> shader_modes;
- shader_modes.push_back("");
-
- roughness_limiter.shader.initialize(shader_modes);
-
- roughness_limiter.shader_version = roughness_limiter.shader.version_create();
-
- roughness_limiter.pipeline = RD::get_singleton()->compute_pipeline_create(roughness_limiter.shader.version_get_shader(roughness_limiter.shader_version, 0));
- }
-
- {
- Vector<String> sort_modes;
- sort_modes.push_back("\n#define MODE_SORT_BLOCK\n");
- sort_modes.push_back("\n#define MODE_SORT_STEP\n");
- sort_modes.push_back("\n#define MODE_SORT_INNER\n");
-
- sort.shader.initialize(sort_modes);
-
- sort.shader_version = sort.shader.version_create();
-
- for (int i = 0; i < SORT_MODE_MAX; i++) {
- sort.pipelines[i] = RD::get_singleton()->compute_pipeline_create(sort.shader.version_get_shader(sort.shader_version, i));
- }
- }
-
- RD::SamplerState sampler;
- sampler.mag_filter = RD::SAMPLER_FILTER_LINEAR;
- sampler.min_filter = RD::SAMPLER_FILTER_LINEAR;
- sampler.max_lod = 0;
-
- default_sampler = RD::get_singleton()->sampler_create(sampler);
- RD::get_singleton()->set_resource_name(default_sampler, "Default Linear Sampler");
-
- sampler.min_filter = RD::SAMPLER_FILTER_LINEAR;
- sampler.mip_filter = RD::SAMPLER_FILTER_LINEAR;
- sampler.max_lod = 1e20;
-
- default_mipmap_sampler = RD::get_singleton()->sampler_create(sampler);
- RD::get_singleton()->set_resource_name(default_mipmap_sampler, "Default MipMap Sampler");
-
- { //create index array for copy shaders
- Vector<uint8_t> pv;
- pv.resize(6 * 4);
- {
- uint8_t *w = pv.ptrw();
- int *p32 = (int *)w;
- p32[0] = 0;
- p32[1] = 1;
- p32[2] = 2;
- p32[3] = 0;
- p32[4] = 2;
- p32[5] = 3;
- }
- index_buffer = RD::get_singleton()->index_buffer_create(6, RenderingDevice::INDEX_BUFFER_FORMAT_UINT32, pv);
- index_array = RD::get_singleton()->index_array_create(index_buffer, 0, 6);
- }
-}
-
-EffectsRD::~EffectsRD() {
- RD::get_singleton()->free(default_sampler);
- RD::get_singleton()->free(default_mipmap_sampler);
- RD::get_singleton()->free(index_buffer); //array gets freed as dependency
-
- if (!prefer_raster_effects) {
- roughness_limiter.shader.version_free(roughness_limiter.shader_version);
- }
- sort.shader.version_free(sort.shader_version);
-}
diff --git a/servers/rendering/renderer_rd/environment/sky.cpp b/servers/rendering/renderer_rd/environment/sky.cpp
index 788ec1cee4..ce2a548e8a 100644
--- a/servers/rendering/renderer_rd/environment/sky.cpp
+++ b/servers/rendering/renderer_rd/environment/sky.cpp
@@ -276,9 +276,7 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
int mipmaps = p_mipmaps;
uint32_t w = p_size, h = p_size;
- EffectsRD *effects = RendererCompositorRD::get_singleton()->get_effects();
- ERR_FAIL_NULL_MSG(effects, "Effects haven't been initialized");
- bool prefer_raster_effects = effects->get_prefer_raster_effects();
+ bool render_buffers_can_be_storage = RendererSceneRenderRD::get_singleton()->_render_buffers_can_be_storage();
if (p_use_array) {
int num_layers = p_low_quality ? 8 : p_roughness_layers;
@@ -348,7 +346,7 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
tf.array_layers = 6;
tf.mipmaps = p_low_quality ? 7 : mipmaps - 1;
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
- if (RendererSceneRenderRD::get_singleton()->_render_buffers_can_be_storage()) {
+ if (render_buffers_can_be_storage) {
tf.usage_bits |= RD::TEXTURE_USAGE_STORAGE_BIT;
}
@@ -364,7 +362,7 @@ void SkyRD::ReflectionData::update_reflection_data(int p_size, int p_mipmaps, bo
mm.size.height = mmh;
mm.view = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), downsampled_radiance_cubemap, 0, j, 1, RD::TEXTURE_SLICE_CUBEMAP);
RD::get_singleton()->set_resource_name(mm.view, "Downsampled Radiance Cubemap Mip " + itos(j) + " ");
- if (prefer_raster_effects) {
+ if (render_buffers_can_be_storage) {
// we need a framebuffer for each side of our cubemap
for (int k = 0; k < 6; k++) {
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
index 94e3b01486..870da3c321 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
@@ -148,7 +148,6 @@ uint64_t RendererCompositorRD::frame = 1;
void RendererCompositorRD::finalize() {
memdelete(scene);
memdelete(canvas);
- memdelete(effects);
memdelete(fog);
memdelete(particles_storage);
memdelete(light_storage);
@@ -320,9 +319,6 @@ RendererCompositorRD::RendererCompositorRD() {
}
scene->init();
-
- // now we're ready to create our effects,
- effects = memnew(EffectsRD(!scene->_render_buffers_can_be_storage()));
}
RendererCompositorRD::~RendererCompositorRD() {
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.h b/servers/rendering/renderer_rd/renderer_compositor_rd.h
index eae4327908..14fb4e6340 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.h
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.h
@@ -33,7 +33,6 @@
#include "core/os/os.h"
#include "servers/rendering/renderer_compositor.h"
-#include "servers/rendering/renderer_rd/effects_rd.h"
#include "servers/rendering/renderer_rd/environment/fog.h"
#include "servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h"
#include "servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.h"
@@ -60,7 +59,6 @@ protected:
RendererRD::ParticlesStorage *particles_storage = nullptr;
RendererRD::TextureStorage *texture_storage = nullptr;
RendererRD::Fog *fog = nullptr;
- EffectsRD *effects = nullptr;
RendererSceneRenderRD *scene = nullptr;
enum BlitMode {
@@ -115,7 +113,6 @@ public:
return scene->get_gi();
}
RendererFog *get_fog() { return fog; }
- EffectsRD *get_effects() { return effects; }
RendererCanvasRender *get_canvas() { return canvas; }
RendererSceneRender *get_scene() { return scene; }
diff --git a/servers/rendering/renderer_rd/shaders/roughness_limiter.glsl b/servers/rendering/renderer_rd/shaders/effects/roughness_limiter.glsl
index 59027df8e9..59027df8e9 100644
--- a/servers/rendering/renderer_rd/shaders/roughness_limiter.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/roughness_limiter.glsl
diff --git a/servers/rendering/renderer_rd/shaders/sort.glsl b/servers/rendering/renderer_rd/shaders/effects/sort.glsl
index 48cf69012a..48cf69012a 100644
--- a/servers/rendering/renderer_rd/shaders/sort.glsl
+++ b/servers/rendering/renderer_rd/shaders/effects/sort.glsl
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index 3ed5d7dda8..d8b78de526 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -47,6 +47,10 @@ ParticlesStorage::ParticlesStorage() {
MaterialStorage *material_storage = MaterialStorage::get_singleton();
+ /* Effects */
+
+ sort_effects = memnew(SortEffects);
+
/* Particles */
{
@@ -206,6 +210,11 @@ ParticlesStorage::~ParticlesStorage() {
material_storage->material_free(particles_shader.default_material);
material_storage->shader_free(particles_shader.default_shader);
+ if (sort_effects) {
+ memdelete(sort_effects);
+ sort_effects = nullptr;
+ }
+
singleton = nullptr;
}
@@ -1228,7 +1237,7 @@ void ParticlesStorage::particles_set_view_axis(RID p_particles, const Vector3 &p
RD::get_singleton()->compute_list_dispatch_threads(compute_list, particles->amount, 1, 1);
RD::get_singleton()->compute_list_end();
- RendererCompositorRD::get_singleton()->get_effects()->sort_buffer(particles->particles_sort_uniform_set, particles->amount);
+ sort_effects->sort_buffer(particles->particles_sort_uniform_set, particles->amount);
}
if (particles->trails_enabled && particles->trail_bind_poses.size() > 1) {
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.h b/servers/rendering/renderer_rd/storage_rd/particles_storage.h
index 9308d3ce9e..4f9253144e 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.h
@@ -34,6 +34,7 @@
#include "core/templates/local_vector.h"
#include "core/templates/rid_owner.h"
#include "core/templates/self_list.h"
+#include "servers/rendering/renderer_rd/effects/sort_effects.h"
#include "servers/rendering/renderer_rd/shaders/particles.glsl.gen.h"
#include "servers/rendering/renderer_rd/shaders/particles_copy.glsl.gen.h"
#include "servers/rendering/renderer_rd/storage_rd/material_storage.h"
@@ -47,6 +48,9 @@ class ParticlesStorage : public RendererParticlesStorage {
private:
static ParticlesStorage *singleton;
+ /* EFFECTS */
+ SortEffects *sort_effects = nullptr;
+
/* PARTICLES */
struct ParticleData {