Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash issue with server init moved #2

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/gles3/rasterizer_storage_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions servers/rendering/renderer_rd/renderer_storage_rd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 7 additions & 1 deletion servers/rendering/rendering_server_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions servers/rendering_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ class RenderingServer : public Object {
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 */
Expand Down