Merge pull request #80407 from clayjohn/NoiseTexture3D-format

Remove GPU readback from NoiseTexture3D.get_format()
This commit is contained in:
Rémi Verschelde 2023-08-08 17:01:10 +02:00
commit ff1f50f952
No known key found for this signature in database
GPG Key ID: C3336907360768E1
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 {
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<Ref<Image>> 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;
}

View File

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