diff options
21 files changed, 102 insertions, 66 deletions
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index faa658971d..6dbc475bdf 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -181,7 +181,7 @@ <return type="Color" /> <param index="0" name="rgbe" type="int" /> <description> - Encodes a [Color] from a RGBE9995 format integer. See [constant Image.FORMAT_RGBE9995]. + Decodes a [Color] from a RGBE9995 format integer. See [constant Image.FORMAT_RGBE9995]. </description> </method> <method name="from_string" qualifiers="static"> diff --git a/doc/classes/LightmapGI.xml b/doc/classes/LightmapGI.xml index 723e6bbf21..235e412757 100644 --- a/doc/classes/LightmapGI.xml +++ b/doc/classes/LightmapGI.xml @@ -9,7 +9,7 @@ [b]Performance:[/b] [LightmapGI] provides the best possible run-time performance for global illumination. It is suitable for low-end hardware including integrated graphics and mobile devices. [b]Note:[/b] Due to how lightmaps work, most properties only have a visible effect once lightmaps are baked again. [b]Note:[/b] Lightmap baking on [CSGShape3D]s and [PrimitiveMesh]es is not supported, as these cannot store UV2 data required for baking. - [b]Note:[/b] If no custom lightmappers are installed, [LightmapGI] can only be baked when using the Vulkan backend (Clustered or Mobile), not OpenGL. + [b]Note:[/b] If no custom lightmappers are installed, [LightmapGI] can only be baked when using the Vulkan backend (Forward+ or Mobile), not OpenGL. </description> <tutorials> </tutorials> @@ -73,7 +73,7 @@ High bake quality (slow bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/high_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/high_quality_probe_ray_count]. </constant> <constant name="BAKE_QUALITY_ULTRA" value="3" enum="BakeQuality"> - Highest bake quality (slowest bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/high_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count]. + Highest bake quality (slowest bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count]. </constant> <constant name="GENERATE_PROBES_DISABLED" value="0" enum="GenerateProbes"> Don't generate lightmap probes for lighting dynamic objects. diff --git a/doc/classes/LightmapperRD.xml b/doc/classes/LightmapperRD.xml index e4b68a7ef8..a3c815f58e 100644 --- a/doc/classes/LightmapperRD.xml +++ b/doc/classes/LightmapperRD.xml @@ -5,7 +5,7 @@ </brief_description> <description> LightmapperRD ("RD" stands for [RenderingDevice]) is the built-in GPU-based lightmapper for use with [LightmapGI]. On most dedicated GPUs, it can bake lightmaps much faster than most CPU-based lightmappers. LightmapperRD uses compute shaders to bake lightmaps, so it does not require CUDA or OpenCL libraries to be installed to be usable. - [b]Note:[/b] Only usable when using the Vulkan backend (Clustered or Mobile), not OpenGL. + [b]Note:[/b] Only usable when using the Vulkan backend (Forward+ or Mobile), not OpenGL. </description> <tutorials> </tutorials> diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml index ece3199aab..3063e76c65 100644 --- a/doc/classes/Mesh.xml +++ b/doc/classes/Mesh.xml @@ -258,7 +258,7 @@ Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray]. </constant> <constant name="ARRAY_CUSTOM_R_FLOAT" value="4" enum="ArrayCustomFormat"> - Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only the red green channel is used. + Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only the red channel is used. </constant> <constant name="ARRAY_CUSTOM_RG_FLOAT" value="5" enum="ArrayCustomFormat"> Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red and green channels are used. diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index 103de8eddb..60d473a103 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -155,7 +155,7 @@ <return type="float" /> <param index="0" name="link" type="RID" /> <description> - Returns the [code]enter_cost[/code] of this [code]link[/code]. + Returns the enter cost of this [param link]. </description> </method> <method name="link_get_map" qualifiers="const"> @@ -190,7 +190,7 @@ <return type="float" /> <param index="0" name="link" type="RID" /> <description> - Returns the [code]travel_cost[/code] of this [code]link[/code]. + Returns the travel cost of this [param link]. </description> </method> <method name="link_is_bidirectional" qualifiers="const"> @@ -429,7 +429,7 @@ <return type="float" /> <param index="0" name="region" type="RID" /> <description> - Returns the [code]enter_cost[/code] of this [param region]. + Returns the enter cost of this [param region]. </description> </method> <method name="region_get_map" qualifiers="const"> @@ -457,7 +457,7 @@ <return type="float" /> <param index="0" name="region" type="RID" /> <description> - Returns the [code]travel_cost[/code] of this [param region]. + Returns the travel cost of this [param region]. </description> </method> <method name="region_owns_point" qualifiers="const"> diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index 0d8cb78ff9..71906729d1 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -162,7 +162,7 @@ <return type="float" /> <param index="0" name="link" type="RID" /> <description> - Returns the [code]enter_cost[/code] of this [code]link[/code]. + Returns the enter cost of this [param link]. </description> </method> <method name="link_get_map" qualifiers="const"> @@ -197,7 +197,7 @@ <return type="float" /> <param index="0" name="link" type="RID" /> <description> - Returns the [code]travel_cost[/code] of this [code]link[/code]. + Returns the travel cost of this [param link]. </description> </method> <method name="link_is_bidirectional" qualifiers="const"> @@ -477,7 +477,7 @@ <return type="float" /> <param index="0" name="region" type="RID" /> <description> - Returns the [code]enter_cost[/code] of this [param region]. + Returns the enter cost of this [param region]. </description> </method> <method name="region_get_map" qualifiers="const"> @@ -505,7 +505,7 @@ <return type="float" /> <param index="0" name="region" type="RID" /> <description> - Returns the [code]travel_cost[/code] of this [param region]. + Returns the travel cost of this [param region]. </description> </method> <method name="region_owns_point" qualifiers="const"> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 5f6a679b30..b321a1f821 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -2174,6 +2174,9 @@ Enables the use of physically based units for light sources. Physically based units tend to be much larger than the arbitrary units used by Godot, but they can be used to match lighting within Godot to real-world lighting. Due to the large dynamic range of lighting conditions present in nature, Godot bakes exposure into the various lighting quantities before rendering. Most light sources bake exposure automatically at run time based on the active [CameraAttributes] resource, but [LightmapGI] and [VoxelGI] require a [CameraAttributes] resource to be set at bake time to reduce the dynamic range. At run time, Godot will automatically reconcile the baked exposure with the active exposure to ensure lighting remains consistent. </member> <member name="rendering/limits/cluster_builder/max_clustered_elements" type="float" setter="" getter="" default="512"> + The maximum number of clustered elements ([OmniLight3D] + [SpotLight3D] + [Decal] + [ReflectionProbe]) that can be rendered at once in the camera view. If there are more clustered elements present in the camera view, some of them will not be rendered (leading to pop-in during camera movement). Enabling distance fade on lights and decals ([member Light3D.distance_fade_enabled], [member Decal.distance_fade_enabled]) can help avoid reaching this limit. + Decreasing this value may improve GPU performance on certain setups, even if the maximum number of clustered elements is never reached in the project. + [b]Note:[/b] This setting is only effective when using the Forward+ rendering method, not Mobile and Compatibility. </member> <member name="rendering/limits/forward_renderer/threaded_render_minimum_instances" type="int" setter="" getter="" default="500"> </member> diff --git a/doc/classes/ShapeCast3D.xml b/doc/classes/ShapeCast3D.xml index 735b91cee9..907ae73055 100644 --- a/doc/classes/ShapeCast3D.xml +++ b/doc/classes/ShapeCast3D.xml @@ -14,7 +14,7 @@ <methods> <method name="add_exception"> <return type="void" /> - <param index="0" name="node" type="Object" /> + <param index="0" name="node" type="CollisionObject3D" /> <description> Adds a collision exception so the shape does not report collisions with the specified [CollisionObject3D] node. </description> @@ -108,7 +108,7 @@ </method> <method name="remove_exception"> <return type="void" /> - <param index="0" name="node" type="Object" /> + <param index="0" name="node" type="CollisionObject3D" /> <description> Removes a collision exception so the shape does report collisions with the specified [CollisionObject3D] node. </description> diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml index a39a43be4c..ec2c7860d8 100644 --- a/doc/classes/TileSet.xml +++ b/doc/classes/TileSet.xml @@ -300,7 +300,7 @@ <param index="1" name="coords_from" type="Vector2i" /> <param index="2" name="alternative_from" type="int" /> <description> - Returns if there is and alternative-level proxy for the given identifiers. + Returns if there is an alternative-level proxy for the given identifiers. </description> </method> <method name="has_coords_level_tile_proxy"> diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index db4d12c761..6eef4e5a5a 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -424,8 +424,10 @@ void EditorResourcePreview::check_for_invalidation(const String &p_path) { } void EditorResourcePreview::start() { - ERR_FAIL_COND_MSG(thread.is_started(), "Thread already started."); - thread.start(_thread_func, this); + if (DisplayServer::get_singleton()->get_name() != "headless") { + ERR_FAIL_COND_MSG(thread.is_started(), "Thread already started."); + thread.start(_thread_func, this); + } } void EditorResourcePreview::stop() { diff --git a/editor/export/editor_export_platform_pc.cpp b/editor/export/editor_export_platform_pc.cpp index 7f934bc45b..f62b22881c 100644 --- a/editor/export/editor_export_platform_pc.cpp +++ b/editor/export/editor_export_platform_pc.cpp @@ -59,11 +59,10 @@ void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) { r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/embed_pck"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/bptc"), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/bptc"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/no_bptc_fallbacks"), true)); } String EditorExportPlatformPC::get_name() const { @@ -242,11 +241,6 @@ void EditorExportPlatformPC::get_platform_features(List<String> *r_features) con } void EditorExportPlatformPC::resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) { - if (p_features.has("bptc")) { - if (p_preset->has("texture_format/no_bptc_fallbacks")) { - p_features.erase("s3tc"); - } - } } int EditorExportPlatformPC::get_chmod_flags() const { diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index a09e0e7408..8471e0d8a3 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -594,6 +594,9 @@ void SceneImportSettings::open_settings(const String &p_path, bool p_for_animati // Visibility data_mode->set_tab_hidden(1, p_for_animation); data_mode->set_tab_hidden(2, p_for_animation); + if (p_for_animation) { + data_mode->set_current_tab(0); + } action_menu->get_popup()->set_item_disabled(action_menu->get_popup()->get_item_id(ACTION_EXTRACT_MATERIALS), p_for_animation); action_menu->get_popup()->set_item_disabled(action_menu->get_popup()->get_item_id(ACTION_CHOOSE_MESH_SAVE_PATHS), p_for_animation); diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 1161403c0c..e058187860 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1857,29 +1857,40 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) { push_error(vformat(R"*(Invalid call for "range()" function. Expected at most 3 arguments, %d given.)*", call->arguments.size()), call->callee); } else { // Now we can optimize it. - bool all_is_constant = true; + bool can_reduce = true; Vector<Variant> args; args.resize(call->arguments.size()); for (int i = 0; i < call->arguments.size(); i++) { GDScriptParser::ExpressionNode *argument = call->arguments[i]; reduce_expression(argument); - if (!argument->is_constant) { - all_is_constant = false; - break; - } - if (argument->reduced_value.get_type() != Variant::INT && argument->reduced_value.get_type() != Variant::FLOAT) { - push_error(vformat(R"*(Invalid argument for "range()" call. Argument %d should be int or float but "%s" was given.)*", i + 1, Variant::get_type_name(argument->reduced_value.get_type())), argument); - all_is_constant = false; - break; + if (argument->is_constant) { + if (argument->reduced_value.get_type() != Variant::INT && argument->reduced_value.get_type() != Variant::FLOAT) { + can_reduce = false; + push_error(vformat(R"*(Invalid argument for "range()" call. Argument %d should be int or float but "%s" was given.)*", i + 1, Variant::get_type_name(argument->reduced_value.get_type())), argument); + } + if (can_reduce) { + args.write[i] = argument->reduced_value; + } + } else { + can_reduce = false; + GDScriptParser::DataType argument_type = argument->get_datatype(); + if (argument_type.is_variant() || !argument_type.is_hard_type()) { + mark_node_unsafe(argument); + } + if (!argument_type.is_variant() && (argument_type.builtin_type != Variant::INT && argument_type.builtin_type != Variant::FLOAT)) { + if (!argument_type.is_hard_type()) { + downgrade_node_type_source(argument); + } else { + push_error(vformat(R"*(Invalid argument for "range()" call. Argument %d should be int or float but "%s" was given.)*", i + 1, argument_type.to_string()), argument); + } + } } - - args.write[i] = argument->reduced_value; } Variant reduced; - if (all_is_constant) { + if (can_reduce) { switch (args.size()) { case 1: reduced = (int32_t)args[0]; diff --git a/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.gd b/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.gd new file mode 100644 index 0000000000..4a7f10f1ee --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.gd @@ -0,0 +1,7 @@ +func test(): + var array := [3, 6, 9] + var result := '' + for i in range(array.size(), 0, -1): + result += str(array[i - 1]) + assert(result == '963') + print('ok') diff --git a/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.out b/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.out new file mode 100644 index 0000000000..1b47ed10dc --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.out @@ -0,0 +1,2 @@ +GDTEST_OK +ok diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index 9a7b37df21..214d4d8ec2 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -913,7 +913,7 @@ void GridMapEditor::update_palette() { } void GridMapEditor::edit(GridMap *p_gridmap) { - if (!p_gridmap && node) { + if (node) { node->disconnect("cell_size_changed", callable_mp(this, &GridMapEditor::_draw_grids)); } diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index f7d2ae7d2d..2b90a3702f 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -414,15 +414,19 @@ Camera2D::Camera2DProcessCallback Camera2D::get_process_callback() const { } void Camera2D::_make_current(Object *p_which) { + if (!viewport || (custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) { + return; + } + if (p_which == this) { if (is_inside_tree()) { - get_viewport()->_camera_2d_set(this); + viewport->_camera_2d_set(this); queue_redraw(); } } else { if (is_inside_tree()) { - if (get_viewport()->get_camera_2d() == this) { - get_viewport()->_camera_2d_set(nullptr); + if (viewport->get_camera_2d() == this) { + viewport->_camera_2d_set(nullptr); } queue_redraw(); } @@ -449,7 +453,7 @@ void Camera2D::make_current() { void Camera2D::clear_current() { ERR_FAIL_COND(!is_current()); - if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) { + if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id)) && viewport->is_inside_tree()) { viewport->assign_next_enabled_camera_2d(group_name); } } diff --git a/scene/3d/shape_cast_3d.cpp b/scene/3d/shape_cast_3d.cpp index 87361d6b38..d880e422f0 100644 --- a/scene/3d/shape_cast_3d.cpp +++ b/scene/3d/shape_cast_3d.cpp @@ -437,26 +437,18 @@ void ShapeCast3D::add_exception_rid(const RID &p_rid) { exclude.insert(p_rid); } -void ShapeCast3D::add_exception(const Object *p_object) { - ERR_FAIL_NULL(p_object); - const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object); - if (!co) { - return; - } - add_exception_rid(co->get_rid()); +void ShapeCast3D::add_exception(const CollisionObject3D *p_node) { + ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject3D."); + add_exception_rid(p_node->get_rid()); } void ShapeCast3D::remove_exception_rid(const RID &p_rid) { exclude.erase(p_rid); } -void ShapeCast3D::remove_exception(const Object *p_object) { - ERR_FAIL_NULL(p_object); - const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object); - if (!co) { - return; - } - remove_exception_rid(co->get_rid()); +void ShapeCast3D::remove_exception(const CollisionObject3D *p_node) { + ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject3D."); + remove_exception_rid(p_node->get_rid()); } void ShapeCast3D::clear_exceptions() { diff --git a/scene/3d/shape_cast_3d.h b/scene/3d/shape_cast_3d.h index 344f1d3b8a..98158d3c7c 100644 --- a/scene/3d/shape_cast_3d.h +++ b/scene/3d/shape_cast_3d.h @@ -34,6 +34,8 @@ #include "scene/3d/node_3d.h" #include "scene/resources/shape_3d.h" +class CollisionObject3D; + class ShapeCast3D : public Node3D { GDCLASS(ShapeCast3D, Node3D); @@ -133,9 +135,9 @@ public: bool is_colliding() const; void add_exception_rid(const RID &p_rid); - void add_exception(const Object *p_object); + void add_exception(const CollisionObject3D *p_node); void remove_exception_rid(const RID &p_rid); - void remove_exception(const Object *p_object); + void remove_exception(const CollisionObject3D *p_node); void clear_exceptions(); virtual PackedStringArray get_configuration_warnings() const override; diff --git a/servers/rendering/renderer_rd/effects/ss_effects.cpp b/servers/rendering/renderer_rd/effects/ss_effects.cpp index 9389f8149e..96e3683560 100644 --- a/servers/rendering/renderer_rd/effects/ss_effects.cpp +++ b/servers/rendering/renderer_rd/effects/ss_effects.cpp @@ -572,7 +572,15 @@ void SSEffects::gather_ssil(RD::ComputeListID p_compute_list, const RID *p_ssil_ RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, uniform_set_cache->get_cache(shader, 2, u_ssil_slice, u_edges_slice), 2); RD::get_singleton()->compute_list_set_push_constant(p_compute_list, &ssil.gather_push_constant, sizeof(SSILGatherPushConstant)); - Size2i size = Size2i(p_settings.full_screen_size.x >> (ssil_half_size ? 2 : 1), p_settings.full_screen_size.y >> (ssil_half_size ? 2 : 1)); + Size2i size; + // Calculate size same way as we created the buffer + if (ssil_half_size) { + size.x = (p_settings.full_screen_size.x + 3) / 4; + size.y = (p_settings.full_screen_size.y + 3) / 4; + } else { + size.x = (p_settings.full_screen_size.x + 1) / 2; + size.y = (p_settings.full_screen_size.y + 1) / 2; + } RD::get_singleton()->compute_list_dispatch_threads(p_compute_list, size.x, size.y, 1); } @@ -887,8 +895,9 @@ void SSEffects::screen_space_indirect_lighting(Ref<RenderSceneBuffersRD> p_rende RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssil.blur_push_constant, sizeof(SSILBlurPushConstant)); - int x_groups = (p_settings.full_screen_size.x >> (ssil_half_size ? 2 : 1)); - int y_groups = (p_settings.full_screen_size.y >> (ssil_half_size ? 2 : 1)); + // Use the size of the actual buffer we're processing here or we won't cover the entire image. + int x_groups = p_ssil_buffers.buffer_width; + int y_groups = p_ssil_buffers.buffer_height; RD::get_singleton()->compute_list_dispatch_threads(compute_list, x_groups, y_groups, 1); if (ssil_quality > RS::ENV_SSIL_QUALITY_VERY_LOW) { @@ -985,7 +994,15 @@ void SSEffects::gather_ssao(RD::ComputeListID p_compute_list, const RID *p_ao_sl RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, uniform_set_cache->get_cache(shader, 2, u_ao_slice), 2); RD::get_singleton()->compute_list_set_push_constant(p_compute_list, &ssao.gather_push_constant, sizeof(SSAOGatherPushConstant)); - Size2i size = Size2i(p_settings.full_screen_size.x >> (ssao_half_size ? 2 : 1), p_settings.full_screen_size.y >> (ssao_half_size ? 2 : 1)); + Size2i size; + // Make sure we use the same size as with which our buffer was created + if (ssao_half_size) { + size.x = (p_settings.full_screen_size.x + 3) / 4; + size.y = (p_settings.full_screen_size.y + 3) / 4; + } else { + size.x = (p_settings.full_screen_size.x + 1) / 2; + size.y = (p_settings.full_screen_size.y + 1) / 2; + } RD::get_singleton()->compute_list_dispatch_threads(p_compute_list, size.x, size.y, 1); } @@ -1266,8 +1283,7 @@ void SSEffects::generate_ssao(Ref<RenderSceneBuffersRD> p_render_buffers, SSAORe } RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssao.blur_push_constant, sizeof(SSAOBlurPushConstant)); - Size2i size(p_settings.full_screen_size.x >> (ssao_half_size ? 2 : 1), p_settings.full_screen_size.y >> (ssao_half_size ? 2 : 1)); - RD::get_singleton()->compute_list_dispatch_threads(compute_list, size.x, size.y, 1); + RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssao_buffers.buffer_width, p_ssao_buffers.buffer_height, 1); } if (ssao_quality > RS::ENV_SSAO_QUALITY_VERY_LOW) { diff --git a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp index e1dc9f8624..609fb2afe7 100644 --- a/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp +++ b/servers/rendering/renderer_rd/storage_rd/render_scene_buffers_rd.cpp @@ -151,11 +151,11 @@ void RenderSceneBuffersRD::configure(RID p_render_target, const Size2i p_interna uint32_t usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT; if (msaa_3d == RS::VIEWPORT_MSAA_DISABLED) { - format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D24_UNORM_S8_UINT, (RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT)) ? RD::DATA_FORMAT_D24_UNORM_S8_UINT : RD::DATA_FORMAT_D32_SFLOAT_S8_UINT; usage_bits |= RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D24_UNORM_S8_UINT, usage_bits) ? RD::DATA_FORMAT_D24_UNORM_S8_UINT : RD::DATA_FORMAT_D32_SFLOAT_S8_UINT; } else { format = RD::DATA_FORMAT_R32_SFLOAT; - usage_bits |= RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; + usage_bits |= RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | (can_be_storage ? RD::TEXTURE_USAGE_STORAGE_BIT : 0); } create_texture(RB_SCOPE_BUFFERS, RB_TEX_DEPTH, format, usage_bits); |