Merge branch 'blender-v4.3-release'
This commit is contained in:
@@ -60,7 +60,12 @@ std::optional<std::string> asset_edit_id_save_as(Main &global_main,
|
||||
ReportList &reports);
|
||||
|
||||
bool asset_edit_id_save(Main &global_main, const ID &id, ReportList &reports);
|
||||
bool asset_edit_id_revert(Main &global_main, ID &id, ReportList &reports);
|
||||
/**
|
||||
* Relink the asset from the library. This causes the ID to be re-allocated, so its address
|
||||
* changes. Even in case of failure to reload the asset, \a id will be deleted.
|
||||
* \return the new address of the reloaded \a id.
|
||||
*/
|
||||
ID *asset_edit_id_revert(Main &global_main, ID &id, ReportList &reports);
|
||||
bool asset_edit_id_delete(Main &global_main, ID &id, ReportList &reports);
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace blender::bke {
|
||||
static ID *asset_link_id(Main &global_main,
|
||||
const ID_Type id_type,
|
||||
const char *filepath,
|
||||
const char *asset_name)
|
||||
const char *asset_name,
|
||||
ReportList *reports = nullptr)
|
||||
{
|
||||
/* Load asset from asset library. */
|
||||
LibraryLink_Params lapp_params{};
|
||||
@@ -63,7 +64,7 @@ static ID *asset_link_id(Main &global_main,
|
||||
|
||||
BKE_blendfile_link_append_context_init_done(lapp_context);
|
||||
|
||||
BKE_blendfile_link(lapp_context, nullptr);
|
||||
BKE_blendfile_link(lapp_context, reports);
|
||||
|
||||
BKE_blendfile_link_append_context_finalize(lapp_context);
|
||||
|
||||
@@ -248,24 +249,23 @@ static bool asset_write_in_library(Main &bmain,
|
||||
return success;
|
||||
}
|
||||
|
||||
static void asset_reload(Main &global_main, Library *lib, ReportList &reports)
|
||||
static ID *asset_reload(Main &global_main, ID &id, ReportList *reports)
|
||||
{
|
||||
/* Fill fresh main database with same datablock as before. */
|
||||
LibraryLink_Params lapp_params{};
|
||||
lapp_params.bmain = &global_main;
|
||||
BlendfileLinkAppendContext *lapp_context = BKE_blendfile_link_append_context_new(&lapp_params);
|
||||
BKE_blendfile_link_append_context_flag_set(
|
||||
lapp_context, BLO_LIBLINK_FORCE_INDIRECT | BLO_LIBLINK_USE_PLACEHOLDERS, true);
|
||||
BLI_assert(ID_IS_LINKED(&id));
|
||||
|
||||
BKE_blendfile_link_append_context_library_add(lapp_context, lib->runtime.filepath_abs, nullptr);
|
||||
BKE_blendfile_library_relocate(lapp_context, &reports, lib, true);
|
||||
BKE_blendfile_link_append_context_free(lapp_context);
|
||||
const std::string name = BKE_id_name(id);
|
||||
const std::string filepath = id.lib->runtime.filepath_abs;
|
||||
const ID_Type id_type = GS(id.name);
|
||||
|
||||
/* Clear temporary tag from relocation. */
|
||||
BKE_main_id_tag_all(&global_main, ID_TAG_PRE_EXISTING, false);
|
||||
/* TODO: There's no API to reload a single data block (and its dependencies) yet. For now
|
||||
* deleting the brush and re-linking it is the best way to get reloading to work. */
|
||||
BKE_id_delete(&global_main, &id);
|
||||
ID *new_id = asset_link_id(global_main, id_type, filepath.c_str(), name.c_str(), reports);
|
||||
|
||||
/* Recreate dependency graph to include new IDs. */
|
||||
DEG_relations_tag_update(&global_main);
|
||||
|
||||
return new_id;
|
||||
}
|
||||
|
||||
static AssetWeakReference asset_weak_reference_for_user_library(
|
||||
@@ -357,17 +357,13 @@ bool asset_edit_id_save(Main &global_main, const ID &id, ReportList &reports)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asset_edit_id_revert(Main &global_main, ID &id, ReportList &reports)
|
||||
ID *asset_edit_id_revert(Main &global_main, ID &id, ReportList &reports)
|
||||
{
|
||||
if (!asset_edit_id_is_editable(id)) {
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Reload entire main, including texture dependencies. This relies on there
|
||||
* being only a single asset per blend file. */
|
||||
asset_reload(global_main, id.lib, reports);
|
||||
|
||||
return true;
|
||||
return asset_reload(global_main, id, &reports);
|
||||
}
|
||||
|
||||
bool asset_edit_id_delete(Main &global_main, ID &id, ReportList &reports)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "BLI_bounds.hh"
|
||||
#include "GPU_capabilities.hh"
|
||||
|
||||
#include "eevee_instance.hh"
|
||||
#include "eevee_pipeline.hh"
|
||||
@@ -594,6 +595,10 @@ void DeferredLayer::end_sync(bool is_first_pass,
|
||||
GPU_ATTACHMENT_IGNORE,
|
||||
GPU_ATTACHMENT_IGNORE});
|
||||
sub.shader_set(sh);
|
||||
if (GPU_stencil_clasify_buffer_workaround()) {
|
||||
/* Binding any buffer to satify the binding. The buffer is not actually used. */
|
||||
sub.bind_ssbo("dummy_workaround_buf", &inst_.film.aovs_info);
|
||||
}
|
||||
sub.state_set(DRW_STATE_WRITE_STENCIL | DRW_STATE_STENCIL_ALWAYS);
|
||||
if (GPU_stencil_export_support()) {
|
||||
/* The shader sets the stencil directly in one full-screen pass. */
|
||||
|
||||
@@ -29,20 +29,32 @@ void VolumeModule::init()
|
||||
const Scene *scene_eval = inst_.scene;
|
||||
|
||||
const int2 extent = inst_.film.render_extent_get();
|
||||
const int tile_size = scene_eval->eevee.volumetric_tile_size;
|
||||
int tile_size = clamp_i(scene_eval->eevee.volumetric_tile_size, 1, 16);
|
||||
|
||||
int3 tex_size;
|
||||
/* Try to match resolution setting but fallback to lower resolution
|
||||
* if it doesn't fit the hardware limits. */
|
||||
for (; tile_size <= 16; tile_size *= 2) {
|
||||
/* Find Froxel Texture resolution. */
|
||||
tex_size = int3(math::divide_ceil(extent, int2(tile_size)), 0);
|
||||
tex_size.z = std::max(1, scene_eval->eevee.volumetric_samples);
|
||||
|
||||
if (math::reduce_max(tex_size) < GPU_max_texture_3d_size()) {
|
||||
/* Fits hardware limits. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tile_size != scene_eval->eevee.volumetric_tile_size) {
|
||||
inst_.info_append_i18n(
|
||||
"Warning: Volume rendering data could not be allocated. Now using a resolution of 1:{} "
|
||||
"instead of 1:{}.",
|
||||
tile_size,
|
||||
scene_eval->eevee.volumetric_tile_size);
|
||||
}
|
||||
|
||||
data_.tile_size = tile_size;
|
||||
data_.tile_size_lod = int(log2(tile_size));
|
||||
|
||||
/* Find Froxel Texture resolution. */
|
||||
int3 tex_size = int3(math::divide_ceil(extent, int2(tile_size)), 0);
|
||||
tex_size.z = std::max(1, scene_eval->eevee.volumetric_samples);
|
||||
|
||||
/* Clamp 3D texture size based on device maximum. */
|
||||
int3 max_size = int3(GPU_max_texture_3d_size());
|
||||
BLI_assert(tex_size == math::min(tex_size, max_size));
|
||||
tex_size = math::min(tex_size, max_size);
|
||||
|
||||
data_.coord_scale = float2(extent) / float2(tile_size * tex_size);
|
||||
data_.main_view_extent = float2(extent);
|
||||
data_.main_view_extent_inv = 1.0f / float2(extent);
|
||||
|
||||
@@ -788,7 +788,15 @@ static int brush_asset_revert_exec(bContext *C, wmOperator *op)
|
||||
Paint *paint = BKE_paint_get_active_from_context(C);
|
||||
Brush *brush = BKE_paint_brush(paint);
|
||||
|
||||
bke::asset_edit_id_revert(*bmain, brush->id, *op->reports);
|
||||
if (ID *reverted_id = bke::asset_edit_id_revert(*bmain, brush->id, *op->reports)) {
|
||||
BLI_assert(GS(reverted_id->name) == ID_BR);
|
||||
BKE_paint_brush_set(paint, reinterpret_cast<Brush *>(reverted_id));
|
||||
}
|
||||
else {
|
||||
/* bke::asset_edit_id_revert() deleted the brush for sure, even on failure. Fallback to the
|
||||
* default. */
|
||||
BKE_paint_brush_set_default(bmain, paint);
|
||||
}
|
||||
|
||||
WM_main_add_notifier(NC_BRUSH | NA_EDITED, nullptr);
|
||||
WM_main_add_notifier(NC_TEXTURE | ND_NODES, nullptr);
|
||||
|
||||
@@ -42,6 +42,7 @@ int GPU_texture_size_with_limit(int res);
|
||||
|
||||
bool GPU_use_parallel_compilation();
|
||||
|
||||
bool GPU_stencil_clasify_buffer_workaround();
|
||||
bool GPU_mip_render_workaround();
|
||||
bool GPU_depth_blitting_workaround();
|
||||
bool GPU_use_main_context_workaround();
|
||||
|
||||
@@ -167,6 +167,11 @@ bool GPU_clear_viewport_workaround()
|
||||
return GCaps.clear_viewport_workaround;
|
||||
}
|
||||
|
||||
bool GPU_stencil_clasify_buffer_workaround()
|
||||
{
|
||||
return GCaps.stencil_clasify_buffer_workaround;
|
||||
}
|
||||
|
||||
bool GPU_geometry_shader_support()
|
||||
{
|
||||
return GCaps.geometry_shader_support;
|
||||
|
||||
@@ -60,6 +60,7 @@ struct GPUCapabilities {
|
||||
bool broken_amd_driver = false;
|
||||
bool use_hq_normals_workaround = false;
|
||||
bool clear_viewport_workaround = false;
|
||||
bool stencil_clasify_buffer_workaround = false;
|
||||
/* Vulkan related workarounds. */
|
||||
|
||||
/* Metal related workarounds. */
|
||||
|
||||
@@ -485,6 +485,12 @@ void gpu_shader_create_info_init()
|
||||
draw_resource_with_custom_id_new = draw_resource_with_custom_id_fallback;
|
||||
}
|
||||
|
||||
if (GPU_stencil_clasify_buffer_workaround()) {
|
||||
/* WORKAROUND: Adding a dummy buffer that isn't used fixes a bug inside the Qualcom driver. */
|
||||
eevee_deferred_tile_classify.storage_buf(
|
||||
12, Qualifier::READ_WRITE, "uint", "dummy_workaround_buf[]");
|
||||
}
|
||||
|
||||
#ifdef WITH_METAL_BACKEND
|
||||
/* Metal-specific alternatives for Geometry shaders. */
|
||||
if (GPU_type_matches_ex(GPU_DEVICE_ANY, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_METAL)) {
|
||||
|
||||
@@ -2040,7 +2040,8 @@ bool gpu::MTLTexture::init_internal()
|
||||
this->prepare_internal();
|
||||
/* TODO(jbakker): Other limit checks should be added as well. When a texture violates a limit it
|
||||
* is not backed by a texture and will crash when used. */
|
||||
if (type_ == GPU_TEXTURE_3D && d_ > GPU_max_texture_3d_size()) {
|
||||
const int limit = GPU_max_texture_3d_size();
|
||||
if ((type_ == GPU_TEXTURE_3D) && (w_ > limit || h_ > limit || d_ > limit)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -304,6 +304,7 @@ static void detect_workarounds()
|
||||
printf(" version: %s\n\n", version);
|
||||
GCaps.depth_blitting_workaround = true;
|
||||
GCaps.mip_render_workaround = true;
|
||||
GCaps.stencil_clasify_buffer_workaround = true;
|
||||
GLContext::debug_layer_workaround = true;
|
||||
/* Turn off Blender features. */
|
||||
GCaps.hdr_viewport_support = false;
|
||||
@@ -451,10 +452,9 @@ static void detect_workarounds()
|
||||
|
||||
/* X Elite devices have GPU driver version 31, and currently no known release version of the
|
||||
* GPU driver renders the cube correctly. This will be changed when a working driver version
|
||||
* is released to commercial devices to only enable these flags on older drivers. */
|
||||
* is released to commercial devices to only enable this flags on older drivers. */
|
||||
if (ver0 == 31) {
|
||||
GCaps.shader_draw_parameters_support = false;
|
||||
GLContext::shader_draw_parameters_support = false;
|
||||
GCaps.stencil_clasify_buffer_workaround = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user