Rename function

master
Marc Gilleron 2022-08-25 00:11:54 +01:00
parent ca29cde90d
commit 8ed72225a3
5 changed files with 13 additions and 14 deletions

View File

@ -69,7 +69,7 @@ void GenerateDistanceNormalmapTask::run(ThreadedTaskContext ctx) {
// mesh_block_position.z, lod_index)));
// }
if (VoxelEngine::get_singleton().is_threaded_mesh_resource_building_enabled()) {
if (VoxelEngine::get_singleton().is_threaded_graphics_resource_building_enabled()) {
NormalMapTextures textures = store_normalmap_data_to_textures(images);
virtual_textures->normalmap_textures = textures;
} else {

View File

@ -350,7 +350,7 @@ void MeshBlockTask::run(zylann::ThreadedTaskContext ctx) {
VoxelEngine::get_singleton().push_async_task(nm_task);
}
if (VoxelEngine::get_singleton().is_threaded_mesh_resource_building_enabled()) {
if (VoxelEngine::get_singleton().is_threaded_graphics_resource_building_enabled()) {
// This shall only run if Godot supports building meshes from multiple threads
_mesh = build_mesh(to_span(_surfaces_output.surfaces), _surfaces_output.primitive_type,
_surfaces_output.mesh_flags, _mesh_material_indices);

View File

@ -197,12 +197,12 @@ void VoxelEngine::set_main_thread_time_budget_usec(unsigned int usec) {
_main_thread_time_budget_usec = usec;
}
void VoxelEngine::set_threaded_mesh_resource_building_enabled(bool enable) {
_threaded_mesh_resource_building_enabled = enable;
void VoxelEngine::set_threaded_graphics_resource_building_enabled(bool enable) {
_threaded_graphics_resource_building_enabled = enable;
}
bool VoxelEngine::is_threaded_mesh_resource_building_enabled() const {
return _threaded_mesh_resource_building_enabled;
bool VoxelEngine::is_threaded_graphics_resource_building_enabled() const {
return _threaded_graphics_resource_building_enabled;
}
void VoxelEngine::push_async_task(zylann::IThreadedTask *task) {

View File

@ -148,13 +148,12 @@ public:
int get_main_thread_time_budget_usec() const;
void set_main_thread_time_budget_usec(unsigned int usec);
// Allows/disallows building Mesh resources from inside threads. Depends on Godot's efficiency at doing so, and
// which renderer is used. For example, the OpenGL renderer does not support this well, but the Vulkan one should.
// TODO Rename `set_threaded_gpu_resource_building_enabled`, it applies to textures too
void set_threaded_mesh_resource_building_enabled(bool enable);
// Allows/disallows building Mesh and Texture resources from inside threads.
// Depends on Godot's efficiency at doing so, and which renderer is used.
// For example, the OpenGL renderer does not support this well, but the Vulkan one should.
void set_threaded_graphics_resource_building_enabled(bool enable);
// This should be fast and safe to access from multiple threads.
// TODO Rename `is_threaded_gpu_resource_building_enabled`, it applies to textures too
bool is_threaded_mesh_resource_building_enabled() const;
bool is_threaded_graphics_resource_building_enabled() const;
void push_main_thread_progressive_task(IProgressiveTask *task);
@ -238,7 +237,7 @@ private:
FileLocker _file_locker;
bool _threaded_mesh_resource_building_enabled = false;
bool _threaded_graphics_resource_building_enabled = false;
};
struct VoxelFileLockerRead {

View File

@ -134,7 +134,7 @@ void initialize_voxel_module(ModuleInitializationLevel p_level) {
// Could use `can_create_resources_async` but this is internal.
// AFAIK `is_low_end` will be `true` only for OpenGL backends, which are the only ones not supporting async
// resource creation.
VoxelEngine::get_singleton().set_threaded_mesh_resource_building_enabled(
VoxelEngine::get_singleton().set_threaded_graphics_resource_building_enabled(
RenderingServer::get_singleton()->is_low_end() == false);
gd::VoxelEngine::create_singleton();