summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-01 16:46:43 +0200
committerGitHub <noreply@github.com>2022-06-01 16:46:43 +0200
commit162ec3431f82c571495710d7f0344228b2ef0038 (patch)
tree68a1088185fc077fe34080b0e4921da2bfee3e88
parent0810b0d4714943d00a28a2b6d1e206a51db6619f (diff)
parent69b66ec4254def097fe4e35501a68833bfcee67f (diff)
Merge pull request #61585 from BastiaanOlij/fix_crash_server
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp4
-rw-r--r--servers/rendering/rendering_server_default.cpp8
-rw-r--r--servers/rendering_server.cpp2
-rw-r--r--servers/rendering_server.h2
5 files changed, 18 insertions, 2 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 49c5045453..012cda953c 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -442,6 +442,10 @@ bool RasterizerStorageGLES3::free(RID p_rid) {
}
bool RasterizerStorageGLES3::has_os_feature(const String &p_feature) const {
+ if (!config) {
+ return false;
+ }
+
if (p_feature == "rgtc") {
return config->rgtc_supported;
}
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index 1b9e0faa00..d5166c6905 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -592,6 +592,10 @@ void RendererStorageRD::update_dirty_resources() {
}
bool RendererStorageRD::has_os_feature(const String &p_feature) const {
+ if (!RD::get_singleton()) {
+ return false;
+ }
+
if (p_feature == "rgtc" && RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_BC5_UNORM_BLOCK, RD::TEXTURE_USAGE_SAMPLING_BIT)) {
return true;
}
diff --git a/servers/rendering/rendering_server_default.cpp b/servers/rendering/rendering_server_default.cpp
index c4538e0776..718f20f80a 100644
--- a/servers/rendering/rendering_server_default.cpp
+++ b/servers/rendering/rendering_server_default.cpp
@@ -313,7 +313,11 @@ RID RenderingServerDefault::get_test_cube() {
}
bool RenderingServerDefault::has_os_feature(const String &p_feature) const {
- return RSG::storage->has_os_feature(p_feature);
+ if (RSG::storage) {
+ return RSG::storage->has_os_feature(p_feature);
+ } else {
+ return false;
+ }
}
void RenderingServerDefault::set_debug_generate_wireframes(bool p_generate) {
@@ -384,6 +388,8 @@ void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) {
RenderingServerDefault::RenderingServerDefault(bool p_create_thread) :
command_queue(p_create_thread) {
+ RenderingServer::init();
+
create_thread = p_create_thread;
if (!p_create_thread) {
diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp
index 8f285aeaad..366c011f86 100644
--- a/servers/rendering_server.cpp
+++ b/servers/rendering_server.cpp
@@ -2821,7 +2821,9 @@ RenderingServer::RenderingServer() {
thread_pool = memnew(RendererThreadPool);
singleton = this;
+}
+void RenderingServer::init() {
GLOBAL_DEF_RST("rendering/textures/vram_compression/import_bptc", false);
GLOBAL_DEF_RST("rendering/textures/vram_compression/import_s3tc", true);
GLOBAL_DEF_RST("rendering/textures/vram_compression/import_etc", false);
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 1ac48053d8..c6c4b9d275 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -1471,7 +1471,7 @@ public:
virtual void draw(bool p_swap_buffers = true, double frame_step = 0.0) = 0;
virtual void sync() = 0;
virtual bool has_changed() const = 0;
- virtual void init() = 0;
+ virtual void init();
virtual void finish() = 0;
/* STATUS INFORMATION */