From 2c9901af360a9002e85eb0ca787b16bf9c900fc2 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 8 Aug 2023 10:56:54 +0200 Subject: [PATCH] Remove GPU readback from NoiseTexture3D.get_format (cherry picked from commit 60d5571d6cf31c6c6aec8afe71ef295a4b45c5f8) --- modules/noise/noise_texture_3d.cpp | 4 ++-- modules/noise/noise_texture_3d.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/noise/noise_texture_3d.cpp b/modules/noise/noise_texture_3d.cpp index f6c67b0f2de..bc17c951ffb 100644 --- a/modules/noise/noise_texture_3d.cpp +++ b/modules/noise/noise_texture_3d.cpp @@ -112,6 +112,7 @@ void NoiseTexture3D::_set_texture_data(const TypedArray &p_data) { } else { texture = RS::get_singleton()->texture_3d_create(data[0]->get_format(), data[0]->get_width(), data[0]->get_height(), data.size(), false, data); } + format = data[0]->get_format(); } emit_changed(); } @@ -348,6 +349,5 @@ Vector> NoiseTexture3D::get_data() const { } Image::Format NoiseTexture3D::get_format() const { - ERR_FAIL_COND_V(!texture.is_valid(), Image::FORMAT_L8); - return RS::get_singleton()->texture_3d_get(texture)[0]->get_format(); + return format; } diff --git a/modules/noise/noise_texture_3d.h b/modules/noise/noise_texture_3d.h index 397711ca981..13125efe7f2 100644 --- a/modules/noise/noise_texture_3d.h +++ b/modules/noise/noise_texture_3d.h @@ -60,6 +60,8 @@ private: Ref color_ramp; Ref noise; + Image::Format format = Image::FORMAT_L8; + void _thread_done(const TypedArray &p_data); static void _thread_function(void *p_ud);