Merge branch 'blender-v4.2-release'
This commit is contained in:
@@ -916,27 +916,14 @@ bool OptiXDevice::load_osl_kernels()
|
||||
context, group_descs, 2, &group_options, nullptr, 0, &osl_groups[i * 2]));
|
||||
}
|
||||
|
||||
OptixStackSizes stack_size[NUM_PROGRAM_GROUPS] = {};
|
||||
vector<OptixStackSizes> osl_stack_size(osl_groups.size());
|
||||
|
||||
/* Update SBT with new entries. */
|
||||
sbt_data.alloc(NUM_PROGRAM_GROUPS + osl_groups.size());
|
||||
for (int i = 0; i < NUM_PROGRAM_GROUPS; ++i) {
|
||||
optix_assert(optixSbtRecordPackHeader(groups[i], &sbt_data[i]));
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i], nullptr));
|
||||
# else
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i]));
|
||||
# endif
|
||||
}
|
||||
for (size_t i = 0; i < osl_groups.size(); ++i) {
|
||||
if (osl_groups[i] != NULL) {
|
||||
optix_assert(optixSbtRecordPackHeader(osl_groups[i], &sbt_data[NUM_PROGRAM_GROUPS + i]));
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
optix_assert(optixProgramGroupGetStackSize(osl_groups[i], &osl_stack_size[i], nullptr));
|
||||
# else
|
||||
optix_assert(optixProgramGroupGetStackSize(osl_groups[i], &osl_stack_size[i]));
|
||||
# endif
|
||||
}
|
||||
else {
|
||||
/* Default to "__direct_callable__dummy_services", so that OSL evaluation for empty
|
||||
@@ -982,6 +969,28 @@ bool OptiXDevice::load_osl_kernels()
|
||||
0,
|
||||
&pipelines[PIP_SHADE]));
|
||||
|
||||
/* Get program stack sizes. */
|
||||
OptixStackSizes stack_size[NUM_PROGRAM_GROUPS] = {};
|
||||
vector<OptixStackSizes> osl_stack_size(osl_groups.size());
|
||||
|
||||
for (int i = 0; i < NUM_PROGRAM_GROUPS; ++i) {
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i], nullptr));
|
||||
# else
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i]));
|
||||
# endif
|
||||
}
|
||||
for (size_t i = 0; i < osl_groups.size(); ++i) {
|
||||
if (osl_groups[i] != NULL) {
|
||||
# if OPTIX_ABI_VERSION >= 84
|
||||
optix_assert(optixProgramGroupGetStackSize(
|
||||
osl_groups[i], &osl_stack_size[i], pipelines[PIP_SHADE]));
|
||||
# else
|
||||
optix_assert(optixProgramGroupGetStackSize(osl_groups[i], &osl_stack_size[i]));
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
const unsigned int css = std::max(stack_size[PG_RGEN_SHADE_SURFACE_RAYTRACE].cssRG,
|
||||
stack_size[PG_RGEN_SHADE_SURFACE_MNEE].cssRG);
|
||||
unsigned int dss = 0;
|
||||
|
||||
@@ -1395,6 +1395,12 @@ BLI_STATIC_ASSERT_ALIGN(ShadowPagesInfoData, 16)
|
||||
|
||||
struct ShadowStatistics {
|
||||
/** Statistics that are read back to CPU after a few frame (to avoid stall). */
|
||||
/**
|
||||
* WARNING: Excepting `view_needed_count` it is uncertain if these are accurate.
|
||||
* This is because `eevee_shadow_page_allocate_comp` runs on all pages even for
|
||||
* directional. There might be some lingering states somewhere as relying on
|
||||
* `page_update_count` was causing non-deterministic infinite loop. Needs further investigation.
|
||||
*/
|
||||
int page_used_count;
|
||||
int page_update_count;
|
||||
int page_allocated_count;
|
||||
|
||||
@@ -1134,8 +1134,14 @@ float ShadowModule::screen_pixel_radius(const float4x4 &wininv,
|
||||
return math::distance(p0, p1) / min_dim;
|
||||
}
|
||||
|
||||
bool ShadowModule::shadow_update_finished()
|
||||
bool ShadowModule::shadow_update_finished(int loop_count)
|
||||
{
|
||||
if (loop_count >= (SHADOW_MAX_TILEMAP * SHADOW_TILEMAP_LOD) / SHADOW_VIEW_MAX) {
|
||||
/* We have reach the maximum theoretical number of updates.
|
||||
* This can indicate a problem in the statistic buffer readback or update tagging. */
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!inst_.is_image_render()) {
|
||||
/* For viewport, only run the shadow update once per redraw.
|
||||
* This avoids the stall from the read-back and freezes from long shadow update. */
|
||||
@@ -1154,7 +1160,7 @@ bool ShadowModule::shadow_update_finished()
|
||||
statistics_buf_.current().read();
|
||||
ShadowStatistics stats = statistics_buf_.current();
|
||||
/* Rendering is finished if we rendered all the remaining pages. */
|
||||
return stats.page_rendered_count == stats.page_update_count;
|
||||
return stats.view_needed_count <= SHADOW_VIEW_MAX;
|
||||
}
|
||||
|
||||
int ShadowModule::max_view_per_tilemap()
|
||||
@@ -1231,8 +1237,8 @@ void ShadowModule::set_view(View &view, int2 extent)
|
||||
}
|
||||
|
||||
inst_.hiz_buffer.update();
|
||||
bool first_loop = true;
|
||||
|
||||
int loop_count = 0;
|
||||
do {
|
||||
DRW_stats_group_start("Shadow");
|
||||
{
|
||||
@@ -1245,7 +1251,7 @@ void ShadowModule::set_view(View &view, int2 extent)
|
||||
* test casters only against the static tilemaps instead of all of them. */
|
||||
inst_.manager->submit(caster_update_ps_, view);
|
||||
}
|
||||
if (assign_if_different(first_loop, false)) {
|
||||
if (loop_count == 0) {
|
||||
inst_.manager->submit(jittered_transparent_caster_update_ps_, view);
|
||||
}
|
||||
inst_.manager->submit(tilemap_usage_ps_, view);
|
||||
@@ -1259,6 +1265,8 @@ void ShadowModule::set_view(View &view, int2 extent)
|
||||
* If parameter buffer exceeds limits, then other work will not be impacted. */
|
||||
bool use_flush = (shadow_technique == ShadowTechnique::TILE_COPY) &&
|
||||
(GPU_backend_get_type() == GPU_BACKEND_METAL);
|
||||
/* Flush every loop as these passes are very heavy. */
|
||||
use_flush |= loop_count != 0;
|
||||
|
||||
if (use_flush) {
|
||||
GPU_flush();
|
||||
@@ -1300,7 +1308,10 @@ void ShadowModule::set_view(View &view, int2 extent)
|
||||
GPU_memory_barrier(GPU_BARRIER_SHADER_IMAGE_ACCESS | GPU_BARRIER_TEXTURE_FETCH);
|
||||
}
|
||||
DRW_stats_group_end();
|
||||
} while (!shadow_update_finished());
|
||||
|
||||
loop_count++;
|
||||
|
||||
} while (!shadow_update_finished(loop_count));
|
||||
|
||||
if (prev_fb) {
|
||||
GPU_framebuffer_bind(prev_fb);
|
||||
|
||||
@@ -371,7 +371,7 @@ class ShadowModule {
|
||||
private:
|
||||
void remove_unused();
|
||||
void debug_page_map_call(DRWPass *pass);
|
||||
bool shadow_update_finished();
|
||||
bool shadow_update_finished(int loop_count);
|
||||
|
||||
/** Compute approximate punctual shadow pixel world space radius, 1 unit away of the light. */
|
||||
float tilemap_pixel_radius();
|
||||
|
||||
@@ -55,6 +55,8 @@ void main()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
barrier();
|
||||
}
|
||||
|
||||
if (valid_thread) {
|
||||
|
||||
@@ -1148,8 +1148,6 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
|
||||
|
||||
postEditBoneDuplicate(arm->edbo, ob);
|
||||
|
||||
ED_armature_edit_validate_active(arm);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_SELECT);
|
||||
}
|
||||
@@ -1424,8 +1422,6 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op)
|
||||
|
||||
postEditBoneDuplicate(arm->edbo, obedit);
|
||||
|
||||
ED_armature_edit_validate_active(arm);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
|
||||
DEG_id_tag_update(&obedit->id, ID_RECALC_SELECT);
|
||||
}
|
||||
|
||||
@@ -1523,7 +1523,6 @@ static int armature_hide_exec(bContext *C, wmOperator *op)
|
||||
if (!changed) {
|
||||
continue;
|
||||
}
|
||||
ED_armature_edit_validate_active(arm);
|
||||
ED_armature_edit_sync_selection(arm->edbo);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
|
||||
@@ -1581,7 +1580,6 @@ static int armature_reveal_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
ED_armature_edit_validate_active(arm);
|
||||
ED_armature_edit_sync_selection(arm->edbo);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
|
||||
|
||||
@@ -1291,7 +1291,6 @@ bool ED_armature_edit_select_op_from_tagged(bArmature *arm, const int sel_op)
|
||||
}
|
||||
|
||||
ED_armature_edit_sync_selection(arm->edbo);
|
||||
ED_armature_edit_validate_active(arm);
|
||||
}
|
||||
|
||||
return changed;
|
||||
|
||||
@@ -60,17 +60,6 @@ void ED_armature_edit_sync_selection(ListBase *edbo)
|
||||
}
|
||||
}
|
||||
|
||||
void ED_armature_edit_validate_active(bArmature *arm)
|
||||
{
|
||||
EditBone *ebone = arm->act_edbone;
|
||||
|
||||
if (ebone) {
|
||||
if (ebone->flag & BONE_HIDDEN_A) {
|
||||
arm->act_edbone = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -672,9 +672,6 @@ static int hide_pose_bone_fn(Object *ob, Bone *bone, void *ptr)
|
||||
bone->flag |= BONE_HIDDEN_P;
|
||||
/* only needed when 'hide_select' is true, but harmless. */
|
||||
bone->flag &= ~BONE_SELECTED;
|
||||
if (arm->act_bone == bone) {
|
||||
arm->act_bone = nullptr;
|
||||
}
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,6 @@ void ED_armature_undosys_type(UndoType *ut);
|
||||
|
||||
/** Sync selection to parent for connected children. */
|
||||
void ED_armature_edit_sync_selection(ListBase *edbo);
|
||||
void ED_armature_edit_validate_active(bArmature *arm);
|
||||
/**
|
||||
* \param clear_connected: When false caller is responsible for keeping the flag in a valid state.
|
||||
*/
|
||||
|
||||
@@ -526,47 +526,45 @@ static void tree_element_posechannel_activate(bContext *C,
|
||||
bArmature *arm = static_cast<bArmature *>(ob->data);
|
||||
bPoseChannel *pchan = static_cast<bPoseChannel *>(te->directdata);
|
||||
|
||||
if (!(pchan->bone->flag & BONE_HIDDEN_P)) {
|
||||
if (set != OL_SETSEL_EXTEND) {
|
||||
/* Single select forces all other bones to get unselected. */
|
||||
const Vector<Object *> objects = BKE_object_pose_array_get_unique(
|
||||
scene, view_layer, nullptr);
|
||||
if (set != OL_SETSEL_EXTEND) {
|
||||
/* Single select forces all other bones to get unselected. */
|
||||
const Vector<Object *> objects = BKE_object_pose_array_get_unique(scene, view_layer, nullptr);
|
||||
|
||||
for (Object *ob : objects) {
|
||||
Object *ob_iter = BKE_object_pose_armature_get(ob);
|
||||
for (Object *ob : objects) {
|
||||
Object *ob_iter = BKE_object_pose_armature_get(ob);
|
||||
|
||||
/* Sanity checks. */
|
||||
if (ELEM(nullptr, ob_iter, ob_iter->pose, ob_iter->data)) {
|
||||
continue;
|
||||
}
|
||||
/* Sanity checks. */
|
||||
if (ELEM(nullptr, ob_iter, ob_iter->pose, ob_iter->data)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchannel, &ob_iter->pose->chanbase) {
|
||||
pchannel->bone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
|
||||
}
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchannel, &ob_iter->pose->chanbase) {
|
||||
pchannel->bone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
|
||||
}
|
||||
|
||||
if (ob != ob_iter) {
|
||||
DEG_id_tag_update(static_cast<ID *>(ob_iter->data), ID_RECALC_SELECT);
|
||||
}
|
||||
if (ob != ob_iter) {
|
||||
DEG_id_tag_update(static_cast<ID *>(ob_iter->data), ID_RECALC_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
if ((set == OL_SETSEL_EXTEND) && (pchan->bone->flag & BONE_SELECTED)) {
|
||||
pchan->bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
else {
|
||||
pchan->bone->flag |= BONE_SELECTED;
|
||||
arm->act_bone = pchan->bone;
|
||||
}
|
||||
|
||||
if (recursive) {
|
||||
/* Recursive select/deselect */
|
||||
do_outliner_bone_select_recursive(
|
||||
arm, pchan->bone, (pchan->bone->flag & BONE_SELECTED) != 0);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
|
||||
DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
|
||||
}
|
||||
|
||||
if ((set == OL_SETSEL_EXTEND) && (pchan->bone->flag & BONE_SELECTED)) {
|
||||
pchan->bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
else {
|
||||
if (ANIM_bone_is_visible(arm, pchan->bone)) {
|
||||
pchan->bone->flag |= BONE_SELECTED;
|
||||
}
|
||||
arm->act_bone = pchan->bone;
|
||||
}
|
||||
|
||||
if (recursive) {
|
||||
/* Recursive select/deselect */
|
||||
do_outliner_bone_select_recursive(arm, pchan->bone, (pchan->bone->flag & BONE_SELECTED) != 0);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
|
||||
DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
|
||||
}
|
||||
|
||||
static void tree_element_bone_activate(bContext *C,
|
||||
@@ -580,36 +578,36 @@ static void tree_element_bone_activate(bContext *C,
|
||||
bArmature *arm = (bArmature *)tselem->id;
|
||||
Bone *bone = static_cast<Bone *>(te->directdata);
|
||||
|
||||
if (!(bone->flag & BONE_HIDDEN_P)) {
|
||||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
Object *ob = BKE_view_layer_active_object_get(view_layer);
|
||||
if (ob) {
|
||||
if (set != OL_SETSEL_EXTEND) {
|
||||
/* single select forces all other bones to get unselected */
|
||||
for (Bone *bone_iter = static_cast<Bone *>(arm->bonebase.first); bone_iter != nullptr;
|
||||
bone_iter = bone_iter->next)
|
||||
{
|
||||
bone_iter->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
|
||||
do_outliner_bone_select_recursive(arm, bone_iter, false);
|
||||
}
|
||||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
Object *ob = BKE_view_layer_active_object_get(view_layer);
|
||||
if (ob) {
|
||||
if (set != OL_SETSEL_EXTEND) {
|
||||
/* single select forces all other bones to get unselected */
|
||||
for (Bone *bone_iter = static_cast<Bone *>(arm->bonebase.first); bone_iter != nullptr;
|
||||
bone_iter = bone_iter->next)
|
||||
{
|
||||
bone_iter->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
|
||||
do_outliner_bone_select_recursive(arm, bone_iter, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (set == OL_SETSEL_EXTEND && (bone->flag & BONE_SELECTED)) {
|
||||
bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
else {
|
||||
bone->flag |= BONE_SELECTED;
|
||||
arm->act_bone = bone;
|
||||
}
|
||||
|
||||
if (recursive) {
|
||||
/* Recursive select/deselect */
|
||||
do_outliner_bone_select_recursive(arm, bone, (bone->flag & BONE_SELECTED) != 0);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
|
||||
}
|
||||
|
||||
if (set == OL_SETSEL_EXTEND && (bone->flag & BONE_SELECTED)) {
|
||||
bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
else {
|
||||
if (ANIM_bone_is_visible(arm, bone)) {
|
||||
bone->flag |= BONE_SELECTED;
|
||||
}
|
||||
arm->act_bone = bone;
|
||||
}
|
||||
|
||||
if (recursive) {
|
||||
/* Recursive select/deselect */
|
||||
do_outliner_bone_select_recursive(arm, bone, (bone->flag & BONE_SELECTED) != 0);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, ob);
|
||||
}
|
||||
|
||||
/** Edit-bones only draw in edit-mode armature. */
|
||||
@@ -618,9 +616,12 @@ static void tree_element_active_ebone__sel(bContext *C, bArmature *arm, EditBone
|
||||
if (sel) {
|
||||
arm->act_edbone = ebone;
|
||||
}
|
||||
ED_armature_ebone_select_set(ebone, sel);
|
||||
if (ANIM_bone_is_visible_editbone(arm, ebone)) {
|
||||
ED_armature_ebone_select_set(ebone, sel);
|
||||
}
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, CTX_data_edit_object(C));
|
||||
}
|
||||
|
||||
static void tree_element_ebone_activate(bContext *C,
|
||||
const Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
@@ -633,28 +634,23 @@ static void tree_element_ebone_activate(bContext *C,
|
||||
EditBone *ebone = static_cast<EditBone *>(te->directdata);
|
||||
|
||||
if (set == OL_SETSEL_NORMAL) {
|
||||
if (!(ebone->flag & BONE_HIDDEN_A)) {
|
||||
ObjectsInModeParams ob_params{};
|
||||
ob_params.object_mode = OB_MODE_EDIT;
|
||||
ob_params.no_dup_data = true;
|
||||
|
||||
ObjectsInModeParams ob_params{};
|
||||
ob_params.object_mode = OB_MODE_EDIT;
|
||||
ob_params.no_dup_data = true;
|
||||
Vector<Base *> bases = BKE_view_layer_array_from_bases_in_mode_params(
|
||||
scene, view_layer, nullptr, &ob_params);
|
||||
ED_armature_edit_deselect_all_multi_ex(bases);
|
||||
|
||||
Vector<Base *> bases = BKE_view_layer_array_from_bases_in_mode_params(
|
||||
scene, view_layer, nullptr, &ob_params);
|
||||
ED_armature_edit_deselect_all_multi_ex(bases);
|
||||
|
||||
tree_element_active_ebone__sel(C, arm, ebone, true);
|
||||
}
|
||||
tree_element_active_ebone__sel(C, arm, ebone, true);
|
||||
}
|
||||
else if (set == OL_SETSEL_EXTEND) {
|
||||
if (!(ebone->flag & BONE_HIDDEN_A)) {
|
||||
if (!(ebone->flag & BONE_SELECTED)) {
|
||||
tree_element_active_ebone__sel(C, arm, ebone, true);
|
||||
}
|
||||
else {
|
||||
/* entirely selected, so de-select */
|
||||
tree_element_active_ebone__sel(C, arm, ebone, false);
|
||||
}
|
||||
if (!(ebone->flag & BONE_SELECTED)) {
|
||||
tree_element_active_ebone__sel(C, arm, ebone, true);
|
||||
}
|
||||
else {
|
||||
/* entirely selected, so de-select */
|
||||
tree_element_active_ebone__sel(C, arm, ebone, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5054,7 +5054,6 @@ static bool armature_circle_select(const ViewContext *vc,
|
||||
|
||||
if (data.is_changed) {
|
||||
ED_armature_edit_sync_selection(arm->edbo);
|
||||
ED_armature_edit_validate_active(arm);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, vc->obedit);
|
||||
}
|
||||
return data.is_changed;
|
||||
|
||||
Reference in New Issue
Block a user