Cycles: more code refactoring to rename things internally as well. Also change
property name back so we keep compatibility.
This commit is contained in:
@@ -252,10 +252,14 @@ static void xml_read_film(const XMLReadState& state, pugi::xml_node node)
|
||||
static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
|
||||
{
|
||||
Integrator *integrator = state.scene->integrator;
|
||||
bool branched = false;
|
||||
|
||||
xml_read_bool(&integrator->progressive, node, "progressive");
|
||||
xml_read_bool(&branched, node, "branched");
|
||||
|
||||
if(branched)
|
||||
integrator->method == Integrator::BRANCHED_PATH;
|
||||
|
||||
if(!integrator->progressive) {
|
||||
if(integrator->method == Integrator::BRANCHED_PATH) {
|
||||
xml_read_int(&integrator->diffuse_samples, node, "diffuse_samples");
|
||||
xml_read_int(&integrator->glossy_samples, node, "glossy_samples");
|
||||
xml_read_int(&integrator->transmission_samples, node, "transmission_samples");
|
||||
|
@@ -128,7 +128,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
description="Use Open Shading Language (CPU rendering only)",
|
||||
)
|
||||
|
||||
cls.integrator = EnumProperty(
|
||||
cls.progressive = EnumProperty(
|
||||
name="Integrator",
|
||||
description="Method to sample lights and materials",
|
||||
items=enum_integrator,
|
||||
|
@@ -49,7 +49,7 @@ class CyclesButtonsPanel():
|
||||
|
||||
|
||||
def draw_samples_info(layout, cscene):
|
||||
integrator = cscene.integrator
|
||||
integrator = cscene.progressive
|
||||
|
||||
# Calculate sample values
|
||||
if integrator == 'PATH':
|
||||
@@ -108,7 +108,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True
|
||||
|
||||
row = layout.row()
|
||||
row.prop(cscene, "integrator", text="")
|
||||
row.prop(cscene, "progressive", text="")
|
||||
row.prop(cscene, "use_square_samples")
|
||||
|
||||
split = layout.split()
|
||||
@@ -119,7 +119,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
sub.prop(cscene, "seed")
|
||||
sub.prop(cscene, "sample_clamp")
|
||||
|
||||
if cscene.integrator == 'PATH':
|
||||
if cscene.progressive == 'PATH':
|
||||
col = split.column()
|
||||
sub = col.column(align=True)
|
||||
sub.label(text="Samples:")
|
||||
@@ -715,7 +715,7 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
|
||||
sub.prop(lamp, "size", text="Size X")
|
||||
sub.prop(lamp, "size_y", text="Size Y")
|
||||
|
||||
if cscene.integrator == 'BRANCHED_PATH':
|
||||
if cscene.progressive == 'BRANCHED_PATH':
|
||||
col.prop(clamp, "samples")
|
||||
|
||||
col = split.column()
|
||||
|
@@ -189,7 +189,7 @@ void BlenderSync::sync_integrator()
|
||||
}
|
||||
#endif
|
||||
|
||||
integrator->progressive = get_int(cscene, "integrator") == 1;
|
||||
integrator->method = (Integrator::Method)get_int(cscene, "progressive");
|
||||
|
||||
int diffuse_samples = get_int(cscene, "diffuse_samples");
|
||||
int glossy_samples = get_int(cscene, "glossy_samples");
|
||||
@@ -420,7 +420,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
|
||||
preview_samples = preview_samples * preview_samples;
|
||||
}
|
||||
|
||||
if(get_int(cscene, "integrator") == 0) {
|
||||
if(get_int(cscene, "progressive") == 0) {
|
||||
if(background) {
|
||||
params.samples = aa_samples;
|
||||
}
|
||||
|
@@ -556,7 +556,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void path_trace(RenderTile& rtile, int sample, bool progressive)
|
||||
void path_trace(RenderTile& rtile, int sample, bool branched)
|
||||
{
|
||||
if(have_error())
|
||||
return;
|
||||
@@ -568,14 +568,14 @@ public:
|
||||
CUdeviceptr d_rng_state = cuda_device_ptr(rtile.rng_state);
|
||||
|
||||
/* get kernel function */
|
||||
if(progressive)
|
||||
cuda_assert(cuModuleGetFunction(&cuPathTrace, cuModule, "kernel_cuda_path_trace_progressive"))
|
||||
else {
|
||||
cuda_assert(cuModuleGetFunction(&cuPathTrace, cuModule, "kernel_cuda_path_trace_non_progressive"))
|
||||
if(have_error())
|
||||
return;
|
||||
}
|
||||
|
||||
if(branched)
|
||||
cuda_assert(cuModuleGetFunction(&cuPathTrace, cuModule, "kernel_cuda_branched_path_trace"))
|
||||
else
|
||||
cuda_assert(cuModuleGetFunction(&cuPathTrace, cuModule, "kernel_cuda_path_trace"))
|
||||
|
||||
if(have_error())
|
||||
return;
|
||||
|
||||
/* pass in parameters */
|
||||
int offset = 0;
|
||||
|
||||
@@ -918,7 +918,7 @@ public:
|
||||
if(task->type == DeviceTask::PATH_TRACE) {
|
||||
RenderTile tile;
|
||||
|
||||
bool progressive = task->integrator_progressive;
|
||||
bool branched = task->integrator_branched;
|
||||
|
||||
/* keep rendering tiles until done */
|
||||
while(task->acquire_tile(this, tile)) {
|
||||
@@ -931,7 +931,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
path_trace(tile, sample, progressive);
|
||||
path_trace(tile, sample, branched);
|
||||
|
||||
tile.sample = sample + 1;
|
||||
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
boost::function<bool(void)> get_cancel;
|
||||
|
||||
bool need_finish_queue;
|
||||
bool integrator_progressive;
|
||||
bool integrator_branched;
|
||||
protected:
|
||||
double last_update_time;
|
||||
};
|
||||
|
@@ -88,12 +88,12 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t
|
||||
|
||||
void kernel_cpu_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
|
||||
{
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
if(!kernel_data.integrator.progressive)
|
||||
kernel_path_trace_non_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
#ifdef __BRANCHED_PATH__
|
||||
if(kernel_data.integrator.branched)
|
||||
kernel_branched_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
else
|
||||
#endif
|
||||
kernel_path_trace_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
}
|
||||
|
||||
/* Tonemapping */
|
||||
|
@@ -24,23 +24,23 @@
|
||||
#include "kernel_path.h"
|
||||
#include "kernel_displace.h"
|
||||
|
||||
extern "C" __global__ void kernel_cuda_path_trace_progressive(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
|
||||
extern "C" __global__ void kernel_cuda_path_trace(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
|
||||
{
|
||||
int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
|
||||
int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
|
||||
|
||||
if(x < sx + sw && y < sy + sh)
|
||||
kernel_path_trace_progressive(NULL, buffer, rng_state, sample, x, y, offset, stride);
|
||||
kernel_path_trace(NULL, buffer, rng_state, sample, x, y, offset, stride);
|
||||
}
|
||||
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
extern "C" __global__ void kernel_cuda_path_trace_non_progressive(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
|
||||
#ifdef __BRANCHED_PATH__
|
||||
extern "C" __global__ void kernel_cuda_branched_path_trace(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
|
||||
{
|
||||
int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
|
||||
int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
|
||||
|
||||
if(x < sx + sw && y < sy + sh)
|
||||
kernel_path_trace_non_progressive(NULL, buffer, rng_state, sample, x, y, offset, stride);
|
||||
kernel_branched_path_trace(NULL, buffer, rng_state, sample, x, y, offset, stride);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -76,7 +76,7 @@ __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int li
|
||||
{
|
||||
LightSample ls;
|
||||
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
#ifdef __BRANCHED_PATH__
|
||||
if(lindex != -1) {
|
||||
/* sample position on a specified light */
|
||||
light_select(kg, lindex, randu, randv, sd->P, &ls);
|
||||
|
@@ -231,7 +231,7 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra
|
||||
return result;
|
||||
}
|
||||
|
||||
__device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer)
|
||||
__device float4 kernel_path_integrator(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer)
|
||||
{
|
||||
/* initialize */
|
||||
PathRadiance L;
|
||||
@@ -543,7 +543,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
|
||||
return make_float4(L_sum.x, L_sum.y, L_sum.z, 1.0f - L_transparent);
|
||||
}
|
||||
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
#ifdef __BRANCHED_PATH__
|
||||
|
||||
__device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer,
|
||||
float3 throughput, int num_samples, int num_total_samples,
|
||||
@@ -778,7 +778,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
|
||||
}
|
||||
}
|
||||
|
||||
__device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, RNG *rng, int sample,
|
||||
__device_noinline void kernel_branched_path_integrate_lighting(KernelGlobals *kg, RNG *rng, int sample,
|
||||
ShaderData *sd, float3 throughput, float num_samples_adjust,
|
||||
float min_ray_pdf, float ray_pdf, PathState state,
|
||||
int rng_offset, PathRadiance *L, __global float *buffer)
|
||||
@@ -971,7 +971,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R
|
||||
}
|
||||
}
|
||||
|
||||
__device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer)
|
||||
__device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer)
|
||||
{
|
||||
/* initialize */
|
||||
PathRadiance L;
|
||||
@@ -1114,7 +1114,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
|
||||
old_subsurface_scatter_step(kg, &bssrdf_sd, state.flag, sc, &lcg_state, true);
|
||||
|
||||
/* compute lighting with the BSDF closure */
|
||||
kernel_path_non_progressive_lighting(kg, rng, sample*num_samples + j,
|
||||
kernel_branched_path_integrate_lighting(kg, rng, sample*num_samples + j,
|
||||
&bssrdf_sd, throughput, num_samples_inv,
|
||||
ray_pdf, ray_pdf, state, rng_offset, &L, buffer);
|
||||
}
|
||||
@@ -1126,7 +1126,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
|
||||
|
||||
/* compute lighting with the BSDF closure */
|
||||
for(int hit = 0; hit < num_hits; hit++)
|
||||
kernel_path_non_progressive_lighting(kg, rng, sample*num_samples + j,
|
||||
kernel_branched_path_integrate_lighting(kg, rng, sample*num_samples + j,
|
||||
&bssrdf_sd[hit], throughput, num_samples_inv,
|
||||
ray_pdf, ray_pdf, state, rng_offset, &L, buffer);
|
||||
}
|
||||
@@ -1136,7 +1136,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
|
||||
#endif
|
||||
|
||||
/* lighting */
|
||||
kernel_path_non_progressive_lighting(kg, rng, sample, &sd, throughput,
|
||||
kernel_branched_path_integrate_lighting(kg, rng, sample, &sd, throughput,
|
||||
1.0f, ray_pdf, ray_pdf, state, rng_offset, &L, buffer);
|
||||
|
||||
/* continue in case of transparency */
|
||||
@@ -1192,7 +1192,7 @@ __device_inline void kernel_path_trace_setup(KernelGlobals *kg, __global uint *r
|
||||
camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, time, ray);
|
||||
}
|
||||
|
||||
__device void kernel_path_trace_progressive(KernelGlobals *kg,
|
||||
__device void kernel_path_trace(KernelGlobals *kg,
|
||||
__global float *buffer, __global uint *rng_state,
|
||||
int sample, int x, int y, int offset, int stride)
|
||||
{
|
||||
@@ -1213,7 +1213,7 @@ __device void kernel_path_trace_progressive(KernelGlobals *kg,
|
||||
float4 L;
|
||||
|
||||
if (ray.t != 0.0f)
|
||||
L = kernel_path_progressive(kg, &rng, sample, ray, buffer);
|
||||
L = kernel_path_integrator(kg, &rng, sample, ray, buffer);
|
||||
else
|
||||
L = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
@@ -1223,8 +1223,8 @@ __device void kernel_path_trace_progressive(KernelGlobals *kg,
|
||||
path_rng_end(kg, rng_state, rng);
|
||||
}
|
||||
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
__device void kernel_path_trace_non_progressive(KernelGlobals *kg,
|
||||
#ifdef __BRANCHED_PATH__
|
||||
__device void kernel_branched_path_trace(KernelGlobals *kg,
|
||||
__global float *buffer, __global uint *rng_state,
|
||||
int sample, int x, int y, int offset, int stride)
|
||||
{
|
||||
@@ -1245,7 +1245,7 @@ __device void kernel_path_trace_non_progressive(KernelGlobals *kg,
|
||||
float4 L;
|
||||
|
||||
if (ray.t != 0.0f)
|
||||
L = kernel_path_non_progressive(kg, &rng, sample, ray, buffer);
|
||||
L = kernel_branched_path_integrate(kg, &rng, sample, ray, buffer);
|
||||
else
|
||||
L = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
|
@@ -959,7 +959,7 @@ __device bool shader_transparent_shadow(KernelGlobals *kg, Intersection *isect)
|
||||
|
||||
/* Merging */
|
||||
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
#ifdef __BRANCHED_PATH__
|
||||
__device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
/* merge identical closures, better when we sample a single closure at a time */
|
||||
|
@@ -37,12 +37,12 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
void kernel_cpu_sse2_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
|
||||
{
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
if(!kernel_data.integrator.progressive)
|
||||
kernel_path_trace_non_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
#ifdef __BRANCHED_PATH__
|
||||
if(kernel_data.integrator.branched)
|
||||
kernel_branched_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
else
|
||||
#endif
|
||||
kernel_path_trace_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
}
|
||||
|
||||
/* Tonemapping */
|
||||
|
@@ -39,12 +39,12 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
void kernel_cpu_sse3_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
|
||||
{
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
if(!kernel_data.integrator.progressive)
|
||||
kernel_path_trace_non_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
#ifdef __BRANCHED_PATH__
|
||||
if(kernel_data.integrator.branched)
|
||||
kernel_branched_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
else
|
||||
#endif
|
||||
kernel_path_trace_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
|
||||
}
|
||||
|
||||
/* Tonemapping */
|
||||
|
@@ -55,7 +55,7 @@ CCL_NAMESPACE_BEGIN
|
||||
#ifdef __KERNEL_CPU__
|
||||
#define __KERNEL_SHADING__
|
||||
#define __KERNEL_ADV_SHADING__
|
||||
#define __NON_PROGRESSIVE__
|
||||
#define __BRANCHED_PATH__
|
||||
#ifdef WITH_OSL
|
||||
#define __OSL__
|
||||
#endif
|
||||
@@ -67,7 +67,7 @@ CCL_NAMESPACE_BEGIN
|
||||
#define __KERNEL_SHADING__
|
||||
#if __CUDA_ARCH__ >= 200
|
||||
#define __KERNEL_ADV_SHADING__
|
||||
#define __NON_PROGRESSIVE__
|
||||
#define __BRANCHED_PATH__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -763,8 +763,8 @@ typedef struct KernelIntegrator {
|
||||
/* clamp */
|
||||
float sample_clamp;
|
||||
|
||||
/* non-progressive */
|
||||
int progressive;
|
||||
/* branched path */
|
||||
int branched;
|
||||
int aa_samples;
|
||||
int diffuse_samples;
|
||||
int glossy_samples;
|
||||
|
@@ -54,7 +54,7 @@ Integrator::Integrator()
|
||||
ao_samples = 1;
|
||||
mesh_light_samples = 1;
|
||||
subsurface_samples = 1;
|
||||
progressive = true;
|
||||
method = PATH;
|
||||
|
||||
sampling_pattern = SAMPLING_PATTERN_SOBOL;
|
||||
|
||||
@@ -104,7 +104,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
|
||||
|
||||
kintegrator->sample_clamp = (sample_clamp == 0.0f)? FLT_MAX: sample_clamp*3.0f;
|
||||
|
||||
kintegrator->progressive = progressive;
|
||||
kintegrator->branched = (method == BRANCHED_PATH);
|
||||
kintegrator->aa_samples = aa_samples;
|
||||
kintegrator->diffuse_samples = diffuse_samples;
|
||||
kintegrator->glossy_samples = glossy_samples;
|
||||
@@ -118,7 +118,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
|
||||
/* sobol directions table */
|
||||
int max_samples = 1;
|
||||
|
||||
if(!progressive) {
|
||||
if(method == BRANCHED_PATH) {
|
||||
foreach(Light *light, scene->lights)
|
||||
max_samples = max(max_samples, light->samples);
|
||||
|
||||
@@ -163,7 +163,7 @@ bool Integrator::modified(const Integrator& integrator)
|
||||
layer_flag == integrator.layer_flag &&
|
||||
seed == integrator.seed &&
|
||||
sample_clamp == integrator.sample_clamp &&
|
||||
progressive == integrator.progressive &&
|
||||
method == integrator.method &&
|
||||
aa_samples == integrator.aa_samples &&
|
||||
diffuse_samples == integrator.diffuse_samples &&
|
||||
glossy_samples == integrator.glossy_samples &&
|
||||
|
@@ -57,7 +57,12 @@ public:
|
||||
int mesh_light_samples;
|
||||
int subsurface_samples;
|
||||
|
||||
bool progressive;
|
||||
enum Method {
|
||||
BRANCHED_PATH = 0,
|
||||
PATH = 1
|
||||
};
|
||||
|
||||
Method method;
|
||||
|
||||
SamplingPattern sampling_pattern;
|
||||
|
||||
|
@@ -830,7 +830,7 @@ void Session::path_trace()
|
||||
task.update_tile_sample = function_bind(&Session::update_tile_sample, this, _1);
|
||||
task.update_progress_sample = function_bind(&Session::update_progress_sample, this);
|
||||
task.need_finish_queue = params.progressive_refine;
|
||||
task.integrator_progressive = scene->integrator->progressive;
|
||||
task.integrator_branched = scene->integrator->method == Integrator::BRANCHED_PATH;
|
||||
|
||||
device->task_add(task);
|
||||
}
|
||||
|
Reference in New Issue
Block a user