Skip to content

Commit

Permalink
Merge pull request #80407 from clayjohn/NoiseTexture3D-format
Browse files Browse the repository at this point in the history
Remove GPU readback from NoiseTexture3D.get_format()
  • Loading branch information
akien-mga committed Aug 8, 2023
2 parents 0ce1ca4 + 60d5571 commit ff1f50f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/noise/noise_texture_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions modules/noise/noise_texture_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class NoiseTexture3D : public Texture3D {
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);

Expand Down

0 comments on commit ff1f50f

Please sign in to comment.