diff --git a/intern/cycles/device/oneapi/device_impl.cpp b/intern/cycles/device/oneapi/device_impl.cpp index 270dfa91025..dfa46924975 100644 --- a/intern/cycles/device/oneapi/device_impl.cpp +++ b/intern/cycles/device/oneapi/device_impl.cpp @@ -764,6 +764,41 @@ void OneapiDevice::tex_alloc(device_texture &mem) sycl::ext::oneapi::experimental::image_descriptor desc{}; if (mem.data_height > 0) { + const sycl::device &device = reinterpret_cast(queue)->get_device(); + if (mem.data_depth > 1) { + const size_t max_width = device.get_info(); + const size_t max_height = device.get_info(); + const size_t max_depth = device.get_info(); + + if (mem.data_width > max_width || mem.data_height > max_height || + mem.data_depth > max_depth) + { + set_error(string_printf( + "Maximum GPU 3D texture size exceeded (max %zux%zux%zu, found %zux%zux%zu)", + max_width, + max_height, + max_depth, + mem.data_width, + mem.data_height, + mem.data_depth)); + return; + } + } + else { + const size_t max_width = device.get_info(); + const size_t max_height = device.get_info(); + + if (mem.data_width > max_width || mem.data_height > max_height) { + set_error( + string_printf("Maximum GPU 2D texture size exceeded (max %zux%zu, found %zux%zu)", + max_width, + max_height, + mem.data_width, + mem.data_height)); + return; + } + } + /* 2D/3D texture -- Tile optimized */ size_t depth = mem.data_depth == 1 ? 0 : mem.data_depth; desc = sycl::ext::oneapi::experimental::image_descriptor( @@ -775,6 +810,10 @@ void OneapiDevice::tex_alloc(device_texture &mem) sycl::ext::oneapi::experimental::image_mem_handle memHandle = sycl::ext::oneapi::experimental::alloc_image_mem(desc, *queue); + if (!memHandle.raw_handle) { + set_error("GPU texture allocation failed: Raw handle is null"); + return; + } /* Copy data from host to the texture properly based on the texture description */ queue->ext_oneapi_copy(mem.host_pointer, memHandle, desc); @@ -848,8 +887,7 @@ void OneapiDevice::tex_alloc(device_texture &mem) } } catch (sycl::exception const &e) { - set_error("oneAPI texture allocation error: got runtime exception \"" + string(e.what()) + - "\""); + set_error("GPU texture allocation failed: runtime exception \"" + string(e.what()) + "\""); } } diff --git a/source/blender/asset_system/intern/asset_catalog_collection.hh b/source/blender/asset_system/intern/asset_catalog_collection.hh index 50c12dfe279..546d7e33d6f 100644 --- a/source/blender/asset_system/intern/asset_catalog_collection.hh +++ b/source/blender/asset_system/intern/asset_catalog_collection.hh @@ -12,6 +12,8 @@ namespace blender::asset_system { +class AssetLibraryService; + /** * All catalogs that are owned by a single asset library, and managed by a single instance of * #AssetCatalogService. The undo system for asset catalog edits contains historical copies of this @@ -35,6 +37,7 @@ class AssetCatalogCollection { bool has_unsaved_changes_ = false; friend AssetCatalogService; + friend AssetLibraryService; public: AssetCatalogCollection() = default; diff --git a/source/blender/asset_system/intern/asset_library_service.cc b/source/blender/asset_system/intern/asset_library_service.cc index 420095605a0..cc722b4b15d 100644 --- a/source/blender/asset_system/intern/asset_library_service.cc +++ b/source/blender/asset_system/intern/asset_library_service.cc @@ -9,6 +9,7 @@ #include "BKE_blender.hh" #include "BKE_preferences.h" +#include "BLI_fileops.h" // IWYU pragma: keep #include "BLI_path_utils.hh" #include "BLI_string_ref.hh" @@ -20,6 +21,8 @@ #include "AS_asset_library.hh" #include "AS_essentials_library.hh" #include "all_library.hh" +#include "asset_catalog_collection.hh" +#include "asset_catalog_definition_file.hh" // IWYU pragma: keep #include "asset_library_service.hh" #include "essentials_library.hh" #include "on_disk_library.hh" @@ -251,13 +254,24 @@ AssetLibrary *AssetLibraryService::move_runtime_current_file_into_on_disk_librar library_service.current_file_library_->catalog_service_); } - on_disk_library->catalog_service().asset_library_root_ = on_disk_library->root_path(); + AssetCatalogService &catalog_service = on_disk_library->catalog_service(); + catalog_service.asset_library_root_ = on_disk_library->root_path(); /* The catalogs are not stored on disk, so there should not be any CDF. Otherwise, we'd have to * remap their stored file-path too (#AssetCatalogDefinitionFile.file_path). */ - BLI_assert_msg(on_disk_library->catalog_service().get_catalog_definition_file() == nullptr, + BLI_assert_msg(catalog_service.get_catalog_definition_file() == nullptr, "new on-disk library shouldn't have catalog definition files - root path " "changed, so they would have to be relocated"); + { + char asset_lib_cdf_path[PATH_MAX]; + BLI_path_join(asset_lib_cdf_path, + sizeof(asset_lib_cdf_path), + on_disk_library->root_path().c_str(), + AssetCatalogService::DEFAULT_CATALOG_FILENAME.c_str()); + catalog_service.catalog_collection_->catalog_definition_file_ = + catalog_service.construct_cdf_in_memory(asset_lib_cdf_path); + } + library_service.current_file_library_ = nullptr; return on_disk_library; diff --git a/source/blender/editors/transform/transform_convert_mesh.cc b/source/blender/editors/transform/transform_convert_mesh.cc index 3821cc71395..0fa53e599c7 100644 --- a/source/blender/editors/transform/transform_convert_mesh.cc +++ b/source/blender/editors/transform/transform_convert_mesh.cc @@ -1095,14 +1095,22 @@ void transform_convert_mesh_connectivity_distance(BMesh *bm, } if (bmesh_test_dist_add(v2, v1, nullptr, dists, index, mtx)) { - /* Add adjacent loose edges to the queue, or all edges if this is a loose edge. - * Other edges are handled by propagation across edges below. */ + /* Add adjacent edges to the queue if: + * - Adjacent edge is loose + * - Edge itself is loose + * - Edge has vertex that was originally selected + * In all these cases a direct distance along the edge is accurate and + * required to make sure we visit all edges. Other edges are handled by + * propagation across edges below. */ + const bool need_direct_distance = BM_elem_flag_test(e, tag_loose) || + BM_elem_flag_test(v1, BM_ELEM_SELECT) || + BM_elem_flag_test(v2, BM_ELEM_SELECT); BMEdge *e_other; BMIter eiter; BM_ITER_ELEM (e_other, &eiter, v2, BM_EDGES_OF_VERT) { if (e_other != e && BM_elem_flag_test(e_other, tag_queued) == 0 && !BM_elem_flag_test(e_other, BM_ELEM_HIDDEN) && - (BM_elem_flag_test(e, tag_loose) || BM_elem_flag_test(e_other, tag_loose))) + (need_direct_distance || BM_elem_flag_test(e_other, tag_loose))) { BM_elem_flag_enable(e_other, tag_queued); BLI_LINKSTACK_PUSH(queue_next, e_other);