From 60d5571d6cf31c6c6aec8afe71ef295a4b45c5f8 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 --- 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 ed242e7faae6..33e257a5c259 100644 --- a/modules/noise/noise_texture_3d.cpp +++ b/modules/noise/noise_texture_3d.cpp @@ -110,6 +110,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(); } @@ -346,6 +347,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 397711ca9812..13125efe7f2a 100644 --- a/modules/noise/noise_texture_3d.h +++ b/modules/noise/noise_texture_3d.h @@ -60,6 +60,8 @@ class NoiseTexture3D : public Texture3D { 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);