Merge branch 'blender-v2.92-release'

This commit is contained in:
Sebastian Parborg 2021-01-20 18:18:38 +01:00
commit c07c110467
12 changed files with 48 additions and 10 deletions

View File

@ -853,7 +853,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
preview_samples = preview_samples * preview_samples;
}
if (get_enum(cscene, "progressive") == 0 && (params.device.type != DEVICE_OPTIX)) {
if (get_enum(cscene, "progressive") == 0 && params.device.has_branched_path) {
if (background) {
params.samples = aa_samples;
}

View File

@ -620,6 +620,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.has_half_images = true;
info.has_volume_decoupled = true;
info.has_branched_path = true;
info.has_adaptive_stop_per_sample = true;
info.has_osl = true;
info.has_profiling = true;
@ -665,6 +666,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
/* Accumulate device info. */
info.has_half_images &= device.has_half_images;
info.has_volume_decoupled &= device.has_volume_decoupled;
info.has_branched_path &= device.has_branched_path;
info.has_adaptive_stop_per_sample &= device.has_adaptive_stop_per_sample;
info.has_osl &= device.has_osl;
info.has_profiling &= device.has_profiling;

View File

@ -79,6 +79,7 @@ class DeviceInfo {
bool display_device; /* GPU is used as a display device. */
bool has_half_images; /* Support half-float textures. */
bool has_volume_decoupled; /* Decoupled volume shading. */
bool has_branched_path; /* Supports branched path tracing. */
bool has_adaptive_stop_per_sample; /* Per-sample adaptive sampling stopping. */
bool has_osl; /* Support Open Shading Language. */
bool use_split_kernel; /* Use split or mega kernel. */
@ -99,6 +100,7 @@ class DeviceInfo {
display_device = false;
has_half_images = false;
has_volume_decoupled = false;
has_branched_path = true;
has_adaptive_stop_per_sample = false;
has_osl = false;
use_split_kernel = false;

View File

@ -1857,6 +1857,7 @@ void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo
info.type = DEVICE_OPTIX;
info.id += "_OptiX";
info.denoisers |= DENOISER_OPTIX;
info.has_branched_path = false;
devices.push_back(info);
}

View File

@ -168,7 +168,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
FLT_MAX :
sample_clamp_indirect * 3.0f;
kintegrator->branched = (method == BRANCHED_PATH);
kintegrator->branched = (method == BRANCHED_PATH) && device->info.has_branched_path;
kintegrator->volume_decoupled = device->info.has_volume_decoupled;
kintegrator->diffuse_samples = diffuse_samples;
kintegrator->glossy_samples = glossy_samples;
@ -179,7 +179,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
kintegrator->volume_samples = volume_samples;
kintegrator->start_sample = start_sample;
if (method == BRANCHED_PATH) {
if (kintegrator->branched) {
kintegrator->sample_all_lights_direct = sample_all_lights_direct;
kintegrator->sample_all_lights_indirect = sample_all_lights_indirect;
}
@ -224,7 +224,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
/* sobol directions table */
int max_samples = 1;
if (method == BRANCHED_PATH) {
if (kintegrator->branched) {
foreach (Light *light, scene->lights)
max_samples = max(max_samples, light->get_samples());

View File

@ -103,10 +103,10 @@ class SessionParams {
bool modified(const SessionParams &params)
{
/* Modified means we have to recreate the session, any parameter changes
* that can be handled by an existing Session are omitted. */
return !(device == params.device && background == params.background &&
progressive_refine == params.progressive_refine &&
/* samples == params.samples && denoising_start_sample ==
params.denoising_start_sample && */
progressive == params.progressive && experimental == params.experimental &&
tile_size == params.tile_size && start_resolution == params.start_resolution &&
pixel_size == params.pixel_size && threads == params.threads &&
@ -117,7 +117,8 @@ class SessionParams {
text_timeout == params.text_timeout &&
progressive_update_timeout == params.progressive_update_timeout &&
tile_order == params.tile_order && shadingsystem == params.shadingsystem &&
denoising.type == params.denoising.type);
denoising.type == params.denoising.type &&
(denoising.use == params.denoising.use || (device.denoisers & denoising.type)));
}
};

View File

@ -456,6 +456,8 @@ class InstancesComponent : public GeometryComponent {
blender::Span<blender::float3> scales() const;
blender::Span<int> ids() const;
blender::MutableSpan<blender::float3> positions();
blender::MutableSpan<blender::float3> rotations();
blender::MutableSpan<blender::float3> scales();
int instances_amount() const;
bool is_empty() const final;

View File

@ -540,6 +540,16 @@ MutableSpan<float3> InstancesComponent::positions()
return positions_;
}
MutableSpan<float3> InstancesComponent::rotations()
{
return rotations_;
}
MutableSpan<float3> InstancesComponent::scales()
{
return scales_;
}
int InstancesComponent::instances_amount() const
{
const int size = instanced_data_.size();

View File

@ -1022,7 +1022,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
tpt->uv_fac = 0.0f;
}
tpt->uv_rot = p2d->uv_rot;
tpt->uv_rot = 0.0f;
gpd->runtime.sbuffer_used++;
@ -1044,6 +1044,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
pt->time = 0.0f;
pt->flag = 0;
pt->uv_fac = tpt->uv_fac;
pt->uv_rot = 0.0f;
ED_gpencil_point_vertex_color_set(ts, brush, pt, tpt);
if (gps->dvert != NULL) {

View File

@ -441,6 +441,12 @@ static bool bake_object_check(ViewLayer *view_layer,
}
Mesh *me = (Mesh *)ob->data;
if (me->totpoly == 0) {
BKE_reportf(reports, RPT_ERROR, "No faces found in the object \"%s\"", ob->id.name + 2);
return false;
}
if (target == R_BAKE_TARGET_VERTEX_COLORS) {
MPropCol *mcol = CustomData_get_layer(&me->vdata, CD_PROP_COLOR);
MLoopCol *mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL);

View File

@ -92,6 +92,8 @@ static void transform_instances(InstancesComponent &instances,
const float3 scale)
{
MutableSpan<float3> positions = instances.positions();
MutableSpan<float3> rotations = instances.rotations();
MutableSpan<float3> scales = instances.scales();
/* Use only translation if rotation and scale don't apply. */
if (use_translate(rotation, scale)) {
@ -101,9 +103,15 @@ static void transform_instances(InstancesComponent &instances,
}
else {
float mat[4][4];
float instance_mat[4][4];
float quaternion[4];
loc_eul_size_to_mat4(mat, translation, rotation, scale);
for (float3 &position : positions) {
mul_m4_v3(mat, position);
for (int i = 0; i < positions.size(); i++) {
loc_eul_size_to_mat4(instance_mat, positions[i], rotations[i], scales[i]);
mul_m4_m4_post(instance_mat, mat);
mat4_decompose(positions[i], quaternion, scales[i], instance_mat);
quat_to_eul(rotations[i], quaternion);
}
}
}

View File

@ -1229,6 +1229,10 @@ void render_result_exr_file_begin(Render *re, RenderEngine *engine)
/* end write of exr tile file, read back first sample */
void render_result_exr_file_end(Render *re, RenderEngine *engine)
{
/* Preserve stamp data. */
struct StampData *stamp_data = re->result->stamp_data;
re->result->stamp_data = NULL;
/* Close EXR files. */
for (RenderResult *rr = re->result; rr; rr = rr->next) {
LISTBASE_FOREACH (RenderLayer *, rl, &rr->layers) {
@ -1243,6 +1247,7 @@ void render_result_exr_file_end(Render *re, RenderEngine *engine)
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
render_result_free_list(&re->fullresult, re->result);
re->result = render_result_new(re, &re->disprect, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
re->result->stamp_data = stamp_data;
BLI_rw_mutex_unlock(&re->resultmutex);
LISTBASE_FOREACH (RenderLayer *, rl, &re->result->layers) {