Remove GPU readback from NoiseTexture3D.get_format

This commit is contained in:
clayjohn 2023-08-08 10:56:54 +02:00
parent 16a93563bf
commit 60d5571d6c
2 changed files with 4 additions and 2 deletions

View file

@ -110,6 +110,7 @@ void NoiseTexture3D::_set_texture_data(const TypedArray<Image> &p_data) {
} else { } else {
texture = RS::get_singleton()->texture_3d_create(data[0]->get_format(), data[0]->get_width(), data[0]->get_height(), data.size(), false, data); 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(); emit_changed();
} }
@ -346,6 +347,5 @@ Vector<Ref<Image>> NoiseTexture3D::get_data() const {
} }
Image::Format NoiseTexture3D::get_format() const { Image::Format NoiseTexture3D::get_format() const {
ERR_FAIL_COND_V(!texture.is_valid(), Image::FORMAT_L8); return format;
return RS::get_singleton()->texture_3d_get(texture)[0]->get_format();
} }

View file

@ -60,6 +60,8 @@ private:
Ref<Gradient> color_ramp; Ref<Gradient> color_ramp;
Ref<Noise> noise; Ref<Noise> noise;
Image::Format format = Image::FORMAT_L8;
void _thread_done(const TypedArray<Image> &p_data); void _thread_done(const TypedArray<Image> &p_data);
static void _thread_function(void *p_ud); static void _thread_function(void *p_ud);