Skip to content

Commit

Permalink
Deprecate RenderingServer's has_feature and Features enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickeon committed Jan 10, 2024
1 parent 9b522ac commit 63a08f2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
12 changes: 6 additions & 6 deletions doc/classes/RenderingServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1556,11 +1556,11 @@
Returns [code]true[/code] if changes have been made to the RenderingServer's data. [method force_draw] is usually called if this happens.
</description>
</method>
<method name="has_feature" qualifiers="const">
<method name="has_feature" qualifiers="const" is_deprecated="true">
<return type="bool" />
<param index="0" name="feature" type="int" enum="RenderingServer.Features" />
<description>
Not yet implemented. Always returns [code]false[/code].
[i]Deprecated.[/i] This method has not been used since Godot 3.0. Always returns false.
</description>
</method>
<method name="has_os_feature" qualifiers="const">
Expand Down Expand Up @@ -5332,11 +5332,11 @@
<constant name="RENDERING_INFO_VIDEO_MEM_USED" value="5" enum="RenderingInfo">
Video memory used (in bytes). When using the Forward+ or mobile rendering backends, this is always greater than the sum of [constant RENDERING_INFO_TEXTURE_MEM_USED] and [constant RENDERING_INFO_BUFFER_MEM_USED], since there is miscellaneous data not accounted for by those two metrics. When using the GL Compatibility backend, this is equal to the sum of [constant RENDERING_INFO_TEXTURE_MEM_USED] and [constant RENDERING_INFO_BUFFER_MEM_USED].
</constant>
<constant name="FEATURE_SHADERS" value="0" enum="Features">
Hardware supports shaders. This enum is currently unused in Godot 3.x.
<constant name="FEATURE_SHADERS" value="0" enum="Features" is_deprecated="true">
[i]Deprecated.[/i] This constant has not been used since Godot 3.0.
</constant>
<constant name="FEATURE_MULTITHREADED" value="1" enum="Features">
Hardware supports multithreading. This enum is currently unused in Godot 3.x.
<constant name="FEATURE_MULTITHREADED" value="1" enum="Features" is_deprecated="true">
[i]Deprecated.[/i] This constant has not been used since Godot 3.0.
</constant>
</constants>
</class>
2 changes: 2 additions & 0 deletions servers/rendering/rendering_server_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,11 @@ void RenderingServerDefault::set_default_clear_color(const Color &p_color) {
RSG::viewport->set_default_clear_color(p_color);
}

#ifndef DISABLE_DEPRECATED
bool RenderingServerDefault::has_feature(Features p_feature) const {
return false;
}
#endif

void RenderingServerDefault::sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) {
RSG::scene->sdfgi_set_debug_probe_select(p_position, p_dir);
Expand Down
2 changes: 2 additions & 0 deletions servers/rendering/rendering_server_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,9 @@ class RenderingServerDefault : public RenderingServer {
virtual Color get_default_clear_color() override;
virtual void set_default_clear_color(const Color &p_color) override;

#ifndef DISABLE_DEPRECATED
virtual bool has_feature(Features p_feature) const override;
#endif

virtual bool has_os_feature(const String &p_feature) const override;
virtual void set_debug_generate_wireframes(bool p_generate) override;
Expand Down
11 changes: 7 additions & 4 deletions servers/rendering_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,6 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_default_clear_color"), &RenderingServer::get_default_clear_color);
ClassDB::bind_method(D_METHOD("set_default_clear_color", "color"), &RenderingServer::set_default_clear_color);

ClassDB::bind_method(D_METHOD("has_feature", "feature"), &RenderingServer::has_feature);
ClassDB::bind_method(D_METHOD("has_os_feature", "feature"), &RenderingServer::has_os_feature);
ClassDB::bind_method(D_METHOD("set_debug_generate_wireframes", "generate"), &RenderingServer::set_debug_generate_wireframes);

Expand All @@ -3380,9 +3379,6 @@ void RenderingServer::_bind_methods() {
BIND_ENUM_CONSTANT(RENDERING_INFO_BUFFER_MEM_USED);
BIND_ENUM_CONSTANT(RENDERING_INFO_VIDEO_MEM_USED);

BIND_ENUM_CONSTANT(FEATURE_SHADERS);
BIND_ENUM_CONSTANT(FEATURE_MULTITHREADED);

ADD_SIGNAL(MethodInfo("frame_pre_draw"));
ADD_SIGNAL(MethodInfo("frame_post_draw"));

Expand All @@ -3392,6 +3388,13 @@ void RenderingServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("create_local_rendering_device"), &RenderingServer::create_local_rendering_device);

ClassDB::bind_method(D_METHOD("call_on_render_thread", "callable"), &RenderingServer::call_on_render_thread);

#ifndef DISABLE_DEPRECATED
ClassDB::bind_method(D_METHOD("has_feature", "feature"), &RenderingServer::has_feature);

BIND_ENUM_CONSTANT(FEATURE_SHADERS);
BIND_ENUM_CONSTANT(FEATURE_MULTITHREADED);
#endif
}

void RenderingServer::mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry3D::MeshData &p_mesh_data) {
Expand Down
10 changes: 7 additions & 3 deletions servers/rendering_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -1612,13 +1612,14 @@ class RenderingServer : public Object {
virtual Color get_default_clear_color() = 0;
virtual void set_default_clear_color(const Color &p_color) = 0;

#ifndef DISABLE_DEPRECATED
// Never actually used, should be removed when we can break compatibility.
enum Features {
FEATURE_SHADERS,
FEATURE_MULTITHREADED,
};

virtual bool has_feature(Features p_feature) const = 0;

#endif
virtual bool has_os_feature(const String &p_feature) const = 0;

virtual void set_debug_generate_wireframes(bool p_generate) = 0;
Expand Down Expand Up @@ -1748,10 +1749,13 @@ VARIANT_ENUM_CAST(RenderingServer::CanvasLightShadowFilter);
VARIANT_ENUM_CAST(RenderingServer::CanvasOccluderPolygonCullMode);
VARIANT_ENUM_CAST(RenderingServer::GlobalShaderParameterType);
VARIANT_ENUM_CAST(RenderingServer::RenderingInfo);
VARIANT_ENUM_CAST(RenderingServer::Features);
VARIANT_ENUM_CAST(RenderingServer::CanvasTextureChannel);
VARIANT_ENUM_CAST(RenderingServer::BakeChannels);

#ifndef DISABLE_DEPRECATED
VARIANT_ENUM_CAST(RenderingServer::Features);
#endif

// Alias to make it easier to use.
#define RS RenderingServer

Expand Down

0 comments on commit 63a08f2

Please sign in to comment.