Merge branch 'master' into cycles_path_guiding
This commit is contained in:
@@ -854,12 +854,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]));
|
||||
optix_assert(optixProgramGroupGetStackSize(groups[i], &stack_size[i]));
|
||||
}
|
||||
for (size_t i = 0; i < osl_groups.size(); ++i) {
|
||||
if (osl_groups[i] != NULL) {
|
||||
@@ -907,13 +909,15 @@ bool OptiXDevice::load_osl_kernels()
|
||||
0,
|
||||
&pipelines[PIP_SHADE]));
|
||||
|
||||
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;
|
||||
for (unsigned int i = 0; i < osl_stack_size.size(); ++i) {
|
||||
dss = std::max(dss, osl_stack_size[i].dssDC);
|
||||
}
|
||||
|
||||
optix_assert(optixPipelineSetStackSize(
|
||||
pipelines[PIP_SHADE], 0, dss, 0, pipeline_options.usesMotionBlur ? 3 : 2));
|
||||
pipelines[PIP_SHADE], 0, dss, css, pipeline_options.usesMotionBlur ? 3 : 2));
|
||||
}
|
||||
|
||||
return !have_error();
|
||||
|
@@ -431,6 +431,7 @@ ccl_gpu_kernel_threads(GPU_PARALLEL_SORT_BLOCK_SIZE)
|
||||
metal_grid_id);
|
||||
#endif
|
||||
}
|
||||
ccl_gpu_kernel_postfix
|
||||
|
||||
ccl_gpu_kernel_threads(GPU_PARALLEL_SORT_BLOCK_SIZE)
|
||||
ccl_gpu_kernel_signature(integrator_sort_write_pass,
|
||||
|
@@ -19,11 +19,10 @@ CCL_NAMESPACE_BEGIN
|
||||
# define GPU_PARALLEL_SORTED_INDEX_DEFAULT_BLOCK_SIZE 512
|
||||
#endif
|
||||
#define GPU_PARALLEL_SORTED_INDEX_INACTIVE_KEY (~0)
|
||||
#define GPU_PARALLEL_SORT_BLOCK_SIZE 1024
|
||||
|
||||
#if defined(__KERNEL_LOCAL_ATOMIC_SORT__)
|
||||
|
||||
# define GPU_PARALLEL_SORT_BLOCK_SIZE 1024
|
||||
|
||||
# define atomic_store_local(p, x) \
|
||||
atomic_store_explicit((threadgroup atomic_int *)p, x, memory_order_relaxed)
|
||||
# define atomic_load_local(p) \
|
||||
|
@@ -372,6 +372,16 @@ bool oneapi_enqueue_kernel(KernelContext *kernel_context,
|
||||
kg, cgh, global_size, local_size, args, oneapi_kernel_integrator_sorted_paths_array);
|
||||
break;
|
||||
}
|
||||
case DEVICE_KERNEL_INTEGRATOR_SORT_BUCKET_PASS: {
|
||||
oneapi_call(
|
||||
kg, cgh, global_size, local_size, args, oneapi_kernel_integrator_sort_bucket_pass);
|
||||
break;
|
||||
}
|
||||
case DEVICE_KERNEL_INTEGRATOR_SORT_WRITE_PASS: {
|
||||
oneapi_call(
|
||||
kg, cgh, global_size, local_size, args, oneapi_kernel_integrator_sort_write_pass);
|
||||
break;
|
||||
}
|
||||
case DEVICE_KERNEL_INTEGRATOR_COMPACT_PATHS_ARRAY: {
|
||||
oneapi_call(kg,
|
||||
cgh,
|
||||
|
@@ -612,3 +612,25 @@ void BKE_modifier_blend_read_lib(struct BlendLibReader *reader, struct Object *o
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
/**
|
||||
* A convenience class that can be used to set `ModifierData::execution_time` based on the lifetime
|
||||
* of this class.
|
||||
*/
|
||||
class ScopedModifierTimer {
|
||||
private:
|
||||
ModifierData &md_;
|
||||
double start_time_;
|
||||
|
||||
public:
|
||||
ScopedModifierTimer(ModifierData &md);
|
||||
~ScopedModifierTimer();
|
||||
};
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
#endif
|
||||
|
@@ -760,6 +760,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
||||
}
|
||||
|
||||
if (mti->type == eModifierTypeType_OnlyDeform && !sculpt_dyntopo) {
|
||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||
if (!deformed_verts) {
|
||||
deformed_verts = BKE_mesh_vert_coords_alloc(mesh_input, &num_deformed_verts);
|
||||
}
|
||||
@@ -846,6 +847,8 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
||||
continue;
|
||||
}
|
||||
|
||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||
|
||||
/* Add orco mesh as layer if needed by this modifier. */
|
||||
if (mesh_final && mesh_orco && mti->requiredDataMask) {
|
||||
CustomData_MeshMasks mask = {0};
|
||||
@@ -1323,6 +1326,8 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph,
|
||||
continue;
|
||||
}
|
||||
|
||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||
|
||||
/* Add an orco mesh as layer if needed by this modifier. */
|
||||
if (mesh_final && mesh_orco && mti->requiredDataMask) {
|
||||
CustomData_MeshMasks mask = {0};
|
||||
|
@@ -314,6 +314,8 @@ static void curves_evaluate_modifiers(struct Depsgraph *depsgraph,
|
||||
continue;
|
||||
}
|
||||
|
||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||
|
||||
if (mti->modifyGeometrySet != nullptr) {
|
||||
mti->modifyGeometrySet(md, &mectx, &geometry_set);
|
||||
}
|
||||
|
@@ -613,6 +613,8 @@ void BKE_curve_calc_modifiers_pre(Depsgraph *depsgraph,
|
||||
continue;
|
||||
}
|
||||
|
||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||
|
||||
if (!deformedVerts) {
|
||||
deformedVerts = BKE_curve_nurbs_vert_coords_alloc(source_nurb, &numVerts);
|
||||
}
|
||||
@@ -733,6 +735,8 @@ static GeometrySet curve_calc_modifiers_post(Depsgraph *depsgraph,
|
||||
continue;
|
||||
}
|
||||
|
||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||
|
||||
if (!geometry_set.has_mesh()) {
|
||||
geometry_set.replace_mesh(BKE_mesh_new_nomain(0, 0, 0, 0, 0));
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#define DNA_DEPRECATED_ALLOW
|
||||
|
||||
#include <cfloat>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
@@ -1514,3 +1515,28 @@ void BKE_modifier_blend_read_lib(BlendLibReader *reader, Object *ob)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
using Clock = std::chrono::high_resolution_clock;
|
||||
|
||||
static double get_current_time_in_seconds()
|
||||
{
|
||||
return std::chrono::duration<double, std::chrono::seconds::period>(
|
||||
Clock::now().time_since_epoch())
|
||||
.count();
|
||||
}
|
||||
|
||||
ScopedModifierTimer::ScopedModifierTimer(ModifierData &md) : md_(md)
|
||||
{
|
||||
start_time_ = get_current_time_in_seconds();
|
||||
}
|
||||
|
||||
ScopedModifierTimer::~ScopedModifierTimer()
|
||||
{
|
||||
const double end_time = get_current_time_in_seconds();
|
||||
const double duration = end_time - start_time_;
|
||||
md_.execution_time = duration;
|
||||
}
|
||||
|
||||
} // namespace blender::bke
|
||||
|
@@ -380,6 +380,8 @@ static void pointcloud_evaluate_modifiers(struct Depsgraph *depsgraph,
|
||||
continue;
|
||||
}
|
||||
|
||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||
|
||||
if (mti->modifyGeometrySet) {
|
||||
mti->modifyGeometrySet(md, &mectx, &geometry_set);
|
||||
}
|
||||
|
@@ -1108,6 +1108,8 @@ static void volume_evaluate_modifiers(struct Depsgraph *depsgraph,
|
||||
continue;
|
||||
}
|
||||
|
||||
blender::bke::ScopedModifierTimer modifier_timer{*md};
|
||||
|
||||
if (mti->modifyGeometrySet) {
|
||||
mti->modifyGeometrySet(md, &mectx, &geometry_set);
|
||||
}
|
||||
|
@@ -1484,6 +1484,12 @@ static void drawTransformPixel(const struct bContext *C, ARegion *region, void *
|
||||
|
||||
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
||||
{
|
||||
if (t->state == TRANS_CANCEL) {
|
||||
/* No need to edit operator properties or tool settings if we are canceling the operation.
|
||||
* These properties must match the original ones. */
|
||||
return;
|
||||
}
|
||||
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
PropertyRNA *prop;
|
||||
|
||||
@@ -1589,7 +1595,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
||||
/* Update `ToolSettings` for properties that change during modal. */
|
||||
if (t->flag & T_MODAL) {
|
||||
/* Do we check for parameter? */
|
||||
if (transformModeUseSnap(t) && !(t->tsnap.status & SNAP_FORCED)) {
|
||||
if (transformModeUseSnap(t) && !(t->modifiers & MOD_SNAP_FORCED)) {
|
||||
if (!(t->modifiers & MOD_SNAP) != !(t->tsnap.flag & SCE_SNAP)) {
|
||||
/* Type is #eSnapFlag, but type must match various snap attributes in #ToolSettings. */
|
||||
short *snap_flag_ptr;
|
||||
|
@@ -155,18 +155,18 @@ typedef enum {
|
||||
MOD_SNAP_INVERT = 1 << 3,
|
||||
MOD_CONSTRAINT_SELECT_PLANE = 1 << 4,
|
||||
MOD_NODE_ATTACH = 1 << 5,
|
||||
MOD_SNAP_FORCED = 1 << 6,
|
||||
} eTModifier;
|
||||
ENUM_OPERATORS(eTModifier, MOD_NODE_ATTACH)
|
||||
|
||||
/** #TransSnap.status */
|
||||
typedef enum eTSnap {
|
||||
SNAP_RESETTED = 0,
|
||||
SNAP_FORCED = 1 << 0,
|
||||
SNAP_SOURCE_FOUND = 1 << 1,
|
||||
SNAP_SOURCE_FOUND = 1 << 0,
|
||||
/* Special flag for snap to grid. */
|
||||
SNAP_TARGET_GRID_FOUND = 1 << 2,
|
||||
SNAP_TARGET_FOUND = 1 << 3,
|
||||
SNAP_MULTI_POINTS = 1 << 4,
|
||||
SNAP_TARGET_GRID_FOUND = 1 << 1,
|
||||
SNAP_TARGET_FOUND = 1 << 2,
|
||||
SNAP_MULTI_POINTS = 1 << 3,
|
||||
} eTSnap;
|
||||
ENUM_OPERATORS(eTSnap, SNAP_MULTI_POINTS)
|
||||
|
||||
|
@@ -2688,7 +2688,7 @@ static wmGizmoGroup *gizmogroup_xform_find(TransInfo *t)
|
||||
|
||||
void transform_gizmo_3d_model_from_constraint_and_mode_init(TransInfo *t)
|
||||
{
|
||||
wmGizmo *gizmo_modal_current = WM_gizmomap_get_modal(t->region->gizmo_map);
|
||||
wmGizmo *gizmo_modal_current = t->region ? WM_gizmomap_get_modal(t->region->gizmo_map) : NULL;
|
||||
if (!gizmo_modal_current || !ELEM(gizmo_modal_current->parent_gzgroup->type,
|
||||
g_GGT_xform_gizmo,
|
||||
g_GGT_xform_gizmo_context)) {
|
||||
|
@@ -147,7 +147,7 @@ bool transformModeUseSnap(const TransInfo *t)
|
||||
|
||||
static bool doForceIncrementSnap(const TransInfo *t)
|
||||
{
|
||||
if (t->tsnap.status & SNAP_FORCED) {
|
||||
if (t->modifiers & MOD_SNAP_FORCED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -808,7 +808,8 @@ void initSnapping(TransInfo *t, wmOperator *op)
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "snap_point")) &&
|
||||
RNA_property_is_set(op->ptr, prop)) {
|
||||
RNA_property_float_get_array(op->ptr, prop, t->tsnap.snap_target);
|
||||
t->tsnap.status |= SNAP_FORCED | SNAP_TARGET_FOUND;
|
||||
t->modifiers |= MOD_SNAP_FORCED;
|
||||
t->tsnap.status |= SNAP_TARGET_FOUND;
|
||||
}
|
||||
|
||||
/* snap align only defined in specific cases */
|
||||
|
@@ -105,7 +105,8 @@ typedef struct ModifierData {
|
||||
struct ModifierData *next, *prev;
|
||||
|
||||
int type, mode;
|
||||
char _pad0[4];
|
||||
/** Time in seconds that the modifier took to evaluate. This is only set on evaluated objects. */
|
||||
float execution_time;
|
||||
short flag;
|
||||
/** An "expand" bit for each of the modifier's (sub)panels (#uiPanelDataExpansion). */
|
||||
short ui_expand_flag;
|
||||
|
@@ -7355,6 +7355,14 @@ void RNA_def_modifier(BlenderRNA *brna)
|
||||
RNA_def_property_ui_icon(prop, ICON_SURFACE_DATA, 0);
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "execution_time", PROP_FLOAT, PROP_TIME_ABSOLUTE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Execution Time",
|
||||
"Time in seconds that the modifier took to evaluate. This is only set on evaluated objects. "
|
||||
"If multiple modifiers run in parallel, execution time is not a reliable metric");
|
||||
|
||||
/* types */
|
||||
rna_def_modifier_subsurf(brna);
|
||||
rna_def_modifier_lattice(brna);
|
||||
|
@@ -40,6 +40,12 @@ static CLG_LogRef LOG = {"bgl"};
|
||||
|
||||
static void report_deprecated_call(const char *function_name)
|
||||
{
|
||||
/* Only report first 100 deprecated calls. BGL is typically used inside an handler that is
|
||||
* triggered at refresh. */
|
||||
static int times = 0;
|
||||
while (times >= 100) {
|
||||
return;
|
||||
}
|
||||
char message[256];
|
||||
SNPRINTF(message,
|
||||
"'bgl.gl%s' is deprecated and will be removed in Blender 3.7. Report or update your "
|
||||
@@ -47,6 +53,7 @@ static void report_deprecated_call(const char *function_name)
|
||||
function_name);
|
||||
CLOG_WARN(&LOG, "%s", message);
|
||||
PyErr_WarnEx(PyExc_DeprecationWarning, message, 1);
|
||||
times++;
|
||||
}
|
||||
|
||||
static void report_deprecated_call_to_user(void)
|
||||
|
Reference in New Issue
Block a user