Merge branch 'master' into blender2.8

This commit is contained in:
Brecht Van Lommel 2018-11-29 23:54:30 +01:00
commit 63c0653170
Notes: blender-bot 2023-02-14 05:09:28 +01:00
Referenced by issue #60933, can't run blender 2.8 on my 32 bit windows 7 . It crashes
Referenced by issue #60933, can't run blender 2.8 on my 32 bit windows 7 . It crashes
Referenced by issue #60933, can't run blender 2.8 on my 32 bit windows 7 . It crashes
Referenced by issue #60933, can't run blender 2.8 on my 32 bit windows 7 . It crashes
Referenced by issue #59343, Grease Pencil lagging with wacom
Referenced by issue #58764, solid mode error
Referenced by issue #58403, Object Rendered incorrectly in Vertex Select Edit Mode
Referenced by issue #58258, 2.80 Beta: Select Objects in Collection not working
Referenced by issue #58259, Defocus Depth of Field bug
Referenced by issue #57364, Environment Textures cause strange glitches on reflective surfaces - Blender 2.8 - Eevee - Mac OSX
18 changed files with 65 additions and 65 deletions

View File

@ -349,36 +349,36 @@ void Device::draw_pixels(
}
}
Device *Device::create(DeviceInfo& info, Stats &stats, bool background)
Device *Device::create(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background)
{
Device *device;
switch(info.type) {
case DEVICE_CPU:
device = device_cpu_create(info, stats, background);
device = device_cpu_create(info, stats, profiler, background);
break;
#ifdef WITH_CUDA
case DEVICE_CUDA:
if(device_cuda_init())
device = device_cuda_create(info, stats, background);
device = device_cuda_create(info, stats, profiler, background);
else
device = NULL;
break;
#endif
#ifdef WITH_MULTI
case DEVICE_MULTI:
device = device_multi_create(info, stats, background);
device = device_multi_create(info, stats, profiler, background);
break;
#endif
#ifdef WITH_NETWORK
case DEVICE_NETWORK:
device = device_network_create(info, stats, "127.0.0.1");
device = device_network_create(info, stats, profiler, "127.0.0.1");
break;
#endif
#ifdef WITH_OPENCL
case DEVICE_OPENCL:
if(device_opencl_init())
device = device_opencl_create(info, stats, background);
device = device_opencl_create(info, stats, profiler, background);
else
device = NULL;
break;

View File

@ -255,10 +255,10 @@ protected:
FALLBACK_SHADER_STATUS_SUCCESS,
};
Device(DeviceInfo& info_, Stats &stats_, bool background) : background(background),
Device(DeviceInfo& info_, Stats &stats_, Profiler &profiler_, bool background) : background(background),
vertex_buffer(0),
fallback_status(FALLBACK_SHADER_STATUS_NONE), fallback_shader_program(0),
info(info_), stats(stats_) {}
info(info_), stats(stats_), profiler(profiler_) {}
bool background;
string error_msg;
@ -298,6 +298,7 @@ public:
/* statistics */
Stats &stats;
Profiler &profiler;
/* memory alignment */
virtual int mem_sub_ptr_alignment() { return MIN_ALIGNMENT_CPU_DATA_TYPES; }
@ -337,7 +338,7 @@ public:
virtual void unmap_neighbor_tiles(Device * /*sub_device*/, RenderTile * /*tiles*/) {}
/* static */
static Device *create(DeviceInfo& info, Stats &stats, bool background = true);
static Device *create(DeviceInfo& info, Stats &stats, Profiler& profiler, bool background = true);
static DeviceType type_from_string(const char *name);
static string string_from_type(DeviceType type);

View File

@ -208,8 +208,8 @@ public:
KERNEL_NAME_EVAL(cpu_avx, name), \
KERNEL_NAME_EVAL(cpu_avx2, name)
CPUDevice(DeviceInfo& info_, Stats &stats_, bool background_)
: Device(info_, stats_, background_),
CPUDevice(DeviceInfo& info_, Stats &stats_, Profiler &profiler_, bool background_)
: Device(info_, stats_, profiler_, background_),
texture_info(this, "__texture_info", MEM_TEXTURE),
#define REGISTER_KERNEL(name) name ## _kernel(KERNEL_FUNCTIONS(name))
REGISTER_KERNEL(path_trace),
@ -781,7 +781,7 @@ public:
KernelGlobals *kg = new ((void*) kgbuffer.device_pointer) KernelGlobals(thread_kernel_globals_init());
stats.profiler.add_state(&kg->profiler);
profiler.add_state(&kg->profiler);
CPUSplitKernel *split_kernel = NULL;
if(use_split_kernel) {
@ -821,7 +821,7 @@ public:
}
}
stats.profiler.remove_state(&kg->profiler);
profiler.remove_state(&kg->profiler);
thread_kernel_globals_free((KernelGlobals*)kgbuffer.device_pointer);
kg->~KernelGlobals();
@ -1065,9 +1065,9 @@ uint64_t CPUSplitKernel::state_buffer_size(device_memory& kernel_globals, device
return split_data_buffer_size(kg, num_threads);
}
Device *device_cpu_create(DeviceInfo& info, Stats &stats, bool background)
Device *device_cpu_create(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background)
{
return new CPUDevice(info, stats, background);
return new CPUDevice(info, stats, profiler, background);
}
void device_cpu_info(vector<DeviceInfo>& devices)

View File

@ -236,8 +236,8 @@ public:
cuda_error_documentation();
}
CUDADevice(DeviceInfo& info, Stats &stats, bool background_)
: Device(info, stats, background_),
CUDADevice(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_)
: Device(info, stats, profiler, background_),
texture_info(this, "__texture_info", MEM_TEXTURE)
{
first_error = true;
@ -2414,9 +2414,9 @@ bool device_cuda_init()
#endif /* WITH_CUDA_DYNLOAD */
}
Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background)
Device *device_cuda_create(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background)
{
return new CUDADevice(info, stats, background);
return new CUDADevice(info, stats, profiler, background);
}
static CUresult device_cuda_safe_init()

View File

@ -21,13 +21,13 @@ CCL_NAMESPACE_BEGIN
class Device;
Device *device_cpu_create(DeviceInfo& info, Stats &stats, bool background);
Device *device_cpu_create(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background);
bool device_opencl_init();
Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background);
Device *device_opencl_create(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background);
bool device_cuda_init();
Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background);
Device *device_network_create(DeviceInfo& info, Stats &stats, const char *address);
Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background);
Device *device_cuda_create(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background);
Device *device_network_create(DeviceInfo& info, Stats &stats, Profiler &profiler, const char *address);
Device *device_multi_create(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background);
void device_cpu_info(vector<DeviceInfo>& devices);
void device_opencl_info(vector<DeviceInfo>& devices);

View File

@ -45,11 +45,11 @@ public:
list<SubDevice> devices;
device_ptr unique_key;
MultiDevice(DeviceInfo& info, Stats &stats, bool background_)
: Device(info, stats, background_), unique_key(1)
MultiDevice(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_)
: Device(info, stats, profiler, background_), unique_key(1)
{
foreach(DeviceInfo& subinfo, info.multi_devices) {
Device *device = Device::create(subinfo, sub_stats_, background);
Device *device = Device::create(subinfo, sub_stats_, profiler, background);
/* Always add CPU devices at the back since GPU devices can change
* host memory pointers, which CPU uses as device pointer. */
@ -69,7 +69,7 @@ public:
vector<string> servers = discovery.get_server_list();
foreach(string& server, servers) {
Device *device = device_network_create(info, stats, server.c_str());
Device *device = device_network_create(info, stats, profiler, server.c_str());
if(device)
devices.push_back(SubDevice(device));
}
@ -381,9 +381,9 @@ protected:
Stats sub_stats_;
};
Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background)
Device *device_multi_create(DeviceInfo& info, Stats &stats, Profiler& profiler, bool background)
{
return new MultiDevice(info, stats, background);
return new MultiDevice(info, stats, profiler, background);
}
CCL_NAMESPACE_END

View File

@ -56,8 +56,8 @@ public:
return false;
}
NetworkDevice(DeviceInfo& info, Stats &stats, const char *address)
: Device(info, stats, true), socket(io_service)
NetworkDevice(DeviceInfo& info, Stats &stats, Profiler &profiler, const char *address)
: Device(info, stats, profiler, true), socket(io_service)
{
error_func = NetworkError();
stringstream portstr;
@ -293,9 +293,9 @@ private:
NetworkError error_func;
};
Device *device_network_create(DeviceInfo& info, Stats &stats, const char *address)
Device *device_network_create(DeviceInfo& info, Stats &stats, Profiler &profiler, const char *address)
{
return new NetworkDevice(info, stats, address);
return new NetworkDevice(info, stats, profiler, address);
}
void device_network_info(vector<DeviceInfo>& devices)

View File

@ -27,7 +27,7 @@
CCL_NAMESPACE_BEGIN
Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
Device *device_opencl_create(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background)
{
vector<OpenCLPlatformDevice> usable_devices;
OpenCLInfo::get_usable_devices(&usable_devices);
@ -37,10 +37,10 @@ Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background)
const cl_device_type device_type = platform_device.device_type;
if(OpenCLInfo::kernel_use_split(platform_name, device_type)) {
VLOG(1) << "Using split kernel.";
return opencl_create_split_device(info, stats, background);
return opencl_create_split_device(info, stats, profiler, background);
} else {
VLOG(1) << "Using mega kernel.";
return opencl_create_mega_device(info, stats, background);
return opencl_create_mega_device(info, stats, profiler, background);
}
}

View File

@ -333,7 +333,7 @@ public:
void opencl_error(const string& message);
void opencl_assert_err(cl_int err, const char* where);
OpenCLDeviceBase(DeviceInfo& info, Stats &stats, bool background_);
OpenCLDeviceBase(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_);
~OpenCLDeviceBase();
static void CL_CALLBACK context_notify_callback(const char *err_info,
@ -568,8 +568,8 @@ protected:
void flush_texture_buffers();
};
Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, bool background);
Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, bool background);
Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, Profiler &profiler, bool background);
Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, Profiler &profiler, bool background);
CCL_NAMESPACE_END

View File

@ -72,8 +72,8 @@ void OpenCLDeviceBase::opencl_assert_err(cl_int err, const char* where)
}
}
OpenCLDeviceBase::OpenCLDeviceBase(DeviceInfo& info, Stats &stats, bool background_)
: Device(info, stats, background_),
OpenCLDeviceBase::OpenCLDeviceBase(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_)
: Device(info, stats, profiler, background_),
memory_manager(this),
texture_info(this, "__texture_info", MEM_TEXTURE)
{

View File

@ -33,8 +33,8 @@ class OpenCLDeviceMegaKernel : public OpenCLDeviceBase
public:
OpenCLProgram path_trace_program;
OpenCLDeviceMegaKernel(DeviceInfo& info, Stats &stats, bool background_)
: OpenCLDeviceBase(info, stats, background_),
OpenCLDeviceMegaKernel(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_)
: OpenCLDeviceBase(info, stats, profiler, background_),
path_trace_program(this, "megakernel", "kernel.cl", "-D__COMPILE_ONLY_MEGAKERNEL__ ")
{
}
@ -160,9 +160,9 @@ public:
}
};
Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, bool background)
Device *opencl_create_mega_device(DeviceInfo& info, Stats& stats, Profiler &profiler, bool background)
{
return new OpenCLDeviceMegaKernel(info, stats, background);
return new OpenCLDeviceMegaKernel(info, stats, profiler, background);
}
CCL_NAMESPACE_END

View File

@ -79,7 +79,7 @@ public:
OpenCLProgram program_data_init;
OpenCLProgram program_state_buffer_size;
OpenCLDeviceSplitKernel(DeviceInfo& info, Stats &stats, bool background_);
OpenCLDeviceSplitKernel(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_);
~OpenCLDeviceSplitKernel()
{
@ -448,17 +448,17 @@ public:
}
};
OpenCLDeviceSplitKernel::OpenCLDeviceSplitKernel(DeviceInfo& info, Stats &stats, bool background_)
: OpenCLDeviceBase(info, stats, background_)
OpenCLDeviceSplitKernel::OpenCLDeviceSplitKernel(DeviceInfo& info, Stats &stats, Profiler &profiler, bool background_)
: OpenCLDeviceBase(info, stats, profiler, background_)
{
split_kernel = new OpenCLSplitKernel(this);
background = background_;
}
Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, bool background)
Device *opencl_create_split_device(DeviceInfo& info, Stats& stats, Profiler &profiler, bool background)
{
return new OpenCLDeviceSplitKernel(info, stats, background);
return new OpenCLDeviceSplitKernel(info, stats, profiler, background);
}
CCL_NAMESPACE_END

View File

@ -47,13 +47,14 @@ Session::Session(const SessionParams& params_)
tile_manager(params.progressive, params.samples, params.tile_size, params.start_resolution,
params.background == false || params.progressive_refine, params.background, params.tile_order,
max(params.device.multi_devices.size(), 1), params.pixel_size),
stats()
stats(),
profiler()
{
device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background);
TaskScheduler::init(params.threads);
device = Device::create(params.device, stats, params.background);
device = Device::create(params.device, stats, profiler, params.background);
if(params.background && !params.write_render_cb) {
buffers = NULL;
@ -251,7 +252,7 @@ void Session::run_gpu()
/* update scene */
scoped_timer update_timer;
if(update_scene()) {
stats.profiler.reset(scene->shaders.size(), scene->objects.size());
profiler.reset(scene->shaders.size(), scene->objects.size());
}
progress.add_skip_time(update_timer, params.background);
@ -588,7 +589,7 @@ void Session::run_cpu()
/* update scene */
scoped_timer update_timer;
if(update_scene()) {
stats.profiler.reset(scene->shaders.size(), scene->objects.size());
profiler.reset(scene->shaders.size(), scene->objects.size());
}
progress.add_skip_time(update_timer, params.background);
@ -734,7 +735,7 @@ void Session::run()
load_kernels();
if(params.use_profiling && (params.device.type == DEVICE_CPU)) {
stats.profiler.start();
profiler.start();
}
/* session thread loop */
@ -751,7 +752,7 @@ void Session::run()
run_cpu();
}
stats.profiler.stop();
profiler.stop();
/* progress update */
if(progress.get_cancel())
@ -1069,7 +1070,7 @@ void Session::collect_statistics(RenderStats *render_stats)
{
scene->collect_statistics(render_stats);
if(params.use_profiling && (params.device.type == DEVICE_CPU)) {
render_stats->collect_profiling(scene, &stats);
render_stats->collect_profiling(scene, profiler);
}
}

View File

@ -149,6 +149,7 @@ public:
SessionParams params;
TileManager tile_manager;
Stats stats;
Profiler profiler;
function<void(RenderTile&)> write_render_tile_cb;
function<void(RenderTile&, bool)> update_render_tile_cb;

View File

@ -227,12 +227,10 @@ RenderStats::RenderStats() {
has_profiling = false;
}
void RenderStats::collect_profiling(Scene *scene, Stats *stats)
void RenderStats::collect_profiling(Scene *scene, Profiler& prof)
{
has_profiling = true;
Profiler &prof = stats->profiler;
kernel = NamedNestedSampleStats("Total render time", prof.get_event(PROFILING_UNKNOWN));
kernel.add_entry("Ray setup", prof.get_event(PROFILING_RAY_SETUP));

View File

@ -144,7 +144,7 @@ public:
string full_report();
/* Collect kernel sampling information from Stats. */
void collect_profiling(Scene *scene, Stats *stats);
void collect_profiling(Scene *scene, Profiler& prof);
bool has_profiling;

View File

@ -161,6 +161,7 @@ class RenderGraph : public testing::Test
protected:
ScopedMockLog log;
Stats stats;
Profiler profiler;
DeviceInfo device_info;
Device *device_cpu;
SceneParams scene_params;
@ -179,7 +180,7 @@ protected:
util_logging_start();
util_logging_verbosity_set(1);
device_cpu = Device::create(device_info, stats, true);
device_cpu = Device::create(device_info, stats, profiler, true);
scene = new Scene(scene_params, device_cpu);
}

View File

@ -41,8 +41,6 @@ public:
size_t mem_used;
size_t mem_peak;
Profiler profiler;
};
CCL_NAMESPACE_END