Alternative Upload geometry data in parallel to multiple GPUs using the "Multi-Device" #107552
|
@ -888,9 +888,6 @@ typedef enum {
|
|||
typedef struct _nvrtcProgram* nvrtcProgram;
|
||||
|
||||
/* Function types. */
|
||||
typedef void CUDAAPI tnvtxRangePushA(const char *msg);
|
||||
typedef void CUDAAPI tnvtxRangePop();
|
||||
|
||||
typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pStr);
|
||||
typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pStr);
|
||||
typedef CUresult CUDAAPI tcuInit(unsigned int Flags);
|
||||
|
@ -1132,8 +1129,6 @@ typedef nvrtcResult CUDAAPI tnvrtcGetLoweredName(nvrtcProgram prog, const char*
|
|||
|
||||
|
||||
/* Function declarations. */
|
||||
extern tnvtxRangePushA *nvtxRangePushA;
|
||||
extern tnvtxRangePop *nvtxRangePop;
|
||||
extern tcuGetErrorString *cuGetErrorString;
|
||||
extern tcuGetErrorName *cuGetErrorName;
|
||||
extern tcuInit *cuInit;
|
||||
|
@ -1382,8 +1377,7 @@ enum {
|
|||
|
||||
enum {
|
||||
CUEW_INIT_CUDA = 1,
|
||||
CUEW_INIT_NVRTC = 2,
|
||||
CUEW_INIT_NVTX = 4,
|
||||
CUEW_INIT_NVRTC = 2
|
||||
};
|
||||
|
||||
int cuewInit(cuuint32_t flags);
|
||||
|
|
|
@ -66,19 +66,11 @@ typedef void* DynamicLibrary;
|
|||
_LIBRARY_FIND_CHECKED(nvrtc_lib, name)
|
||||
#define NVRTC_LIBRARY_FIND(name) _LIBRARY_FIND(nvrtc_lib, name)
|
||||
|
||||
#define NVTX_LIBRARY_FIND_CHECKED(name) \
|
||||
_LIBRARY_FIND_CHECKED(nvrtc_lib, name)
|
||||
#define NVTX_LIBRARY_FIND(name) _LIBRARY_FIND(nvtx_lib, name)
|
||||
|
||||
static DynamicLibrary cuda_lib;
|
||||
static DynamicLibrary nvrtc_lib;
|
||||
static DynamicLibrary nvtx_lib;
|
||||
|
||||
/* Function definitions. */
|
||||
|
||||
tnvtxRangePushA *nvtxRangePushA;
|
||||
tnvtxRangePop *nvtxRangePop;
|
||||
|
||||
tcuGetErrorString *cuGetErrorString;
|
||||
tcuGetErrorName *cuGetErrorName;
|
||||
tcuInit *cuInit;
|
||||
|
@ -620,14 +612,6 @@ static int cuewCudaInit(void) {
|
|||
return result;
|
||||
}
|
||||
|
||||
static void cuewExitNvtx(void) {
|
||||
if (nvrtc_lib != NULL) {
|
||||
/* Ignore errors. */
|
||||
dynamic_library_close(nvtx_lib);
|
||||
nvtx_lib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void cuewExitNvrtc(void) {
|
||||
if (nvrtc_lib != NULL) {
|
||||
/* Ignore errors. */
|
||||
|
@ -698,55 +682,6 @@ static int cuewNvrtcInit(void) {
|
|||
return result;
|
||||
}
|
||||
|
||||
static int cuewNvtxInit(void) {
|
||||
/* Library paths. */
|
||||
#ifdef _WIN32
|
||||
/* Expected in c:/windows/system or similar, no path needed. */
|
||||
const char *nvtc_paths[] = {"nvToolsExt64_101_0.dll",
|
||||
NULL};
|
||||
#elif defined(__APPLE__)
|
||||
/* Default installation path. */
|
||||
const char *nvtx_paths[] = {"/usr/local/cuda/lib/libnvToolsExt.dylib", NULL};
|
||||
#else
|
||||
const char *nvtx_paths[] = {"libnvToolsExt.so",
|
||||
# if defined(__x86_64__) || defined(_M_X64)
|
||||
"/usr/local/cuda/lib64/libnvToolsExt.so",
|
||||
#else
|
||||
"/usr/local/cuda/lib/libnvToolsExt.so",
|
||||
#endif
|
||||
NULL};
|
||||
#endif
|
||||
static int nvtx_initialized = 0;
|
||||
static int result = 0;
|
||||
int error;
|
||||
|
||||
if (nvtx_initialized) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nvtx_initialized = 1;
|
||||
|
||||
error = atexit(cuewExitNvtx);
|
||||
if (error) {
|
||||
result = CUEW_ERROR_ATEXIT_FAILED;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Load library. */
|
||||
nvtx_lib = dynamic_library_open_find(nvtx_paths);
|
||||
|
||||
if (nvtx_lib == NULL) {
|
||||
result = CUEW_ERROR_OPEN_FAILED;
|
||||
return result;
|
||||
}
|
||||
|
||||
NVTX_LIBRARY_FIND(nvtxRangePushA);
|
||||
NVTX_LIBRARY_FIND(nvtxRangePop);
|
||||
|
||||
result = CUEW_SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
int cuewInit(cuuint32_t flags) {
|
||||
int result = CUEW_SUCCESS;
|
||||
|
||||
|
@ -764,13 +699,6 @@ int cuewInit(cuuint32_t flags) {
|
|||
}
|
||||
}
|
||||
|
||||
if(flags & CUEW_INIT_NVTX) {
|
||||
result = cuewNvtxInit();
|
||||
if(result != CUEW_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,7 @@ bool device_cuda_init()
|
|||
initialized = true;
|
||||
|
||||
int flags = CUEW_INIT_CUDA;
|
||||
#ifdef USE_SCOPED_MARKER
|
||||
flags |= CUEW_INIT_NVTX;
|
||||
#endif
|
||||
|
||||
int cuew_result = cuewInit(flags);
|
||||
|
||||
if (cuew_result == CUEW_SUCCESS) {
|
||||
|
|
|
@ -1034,14 +1034,6 @@ int CUDADevice::get_device_default_attribute(CUdevice_attribute attribute, int d
|
|||
return value;
|
||||
}
|
||||
|
||||
void CUDADevice::push_marker(const string name) {
|
||||
nvtxRangePushA(name.c_str());
|
||||
}
|
||||
|
||||
void CUDADevice::pop_marker() {
|
||||
nvtxRangePop();
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
|
|
@ -104,8 +104,6 @@ class CUDADevice : public GPUDevice {
|
|||
int get_num_multiprocessors();
|
||||
int get_max_num_threads_per_multiprocessor();
|
||||
|
||||
virtual void push_marker(const string name) override;
|
||||
virtual void pop_marker() override;
|
||||
protected:
|
||||
bool get_device_attribute(CUdevice_attribute attribute, int *value);
|
||||
int get_device_default_attribute(CUdevice_attribute attribute, int default_value);
|
||||
|
|
|
@ -221,13 +221,7 @@ class Device {
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void push_marker(const string) {
|
||||
}
|
||||
|
||||
virtual void pop_marker() {
|
||||
}
|
||||
|
||||
|
||||
virtual device_ptr find_matching_mem(device_ptr key, Device * /*sub*/)
|
||||
{
|
||||
return key;
|
||||
|
@ -328,29 +322,6 @@ class Device {
|
|||
static uint devices_initialized_mask;
|
||||
};
|
||||
|
||||
class ScopedMarker {
|
||||
private:
|
||||
Device *_device;
|
||||
public:
|
||||
ScopedMarker(Device *p_device, const string name) {
|
||||
_device = p_device;
|
||||
_device->push_marker(name.c_str() + std::to_string(p_device->info.num));
|
||||
}
|
||||
|
||||
~ScopedMarker() {
|
||||
_device->pop_marker();
|
||||
}
|
||||
};
|
||||
|
||||
#define USE_SCOPED_MARKER
|
||||
#ifndef SCOPED_MARKER
|
||||
# ifdef USE_SCOPED_MARKER
|
||||
# define SCOPED_MARKER(device, msg) ScopedMarker scoped_marker(device, msg)
|
||||
# else
|
||||
# define SCOPED_MARKER(device, msg)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Device, which is GPU, with some common functionality for GPU backends */
|
||||
class GPUDevice : public Device {
|
||||
protected:
|
||||
|
|
|
@ -189,7 +189,6 @@ void Geometry::compute_bvh(Device *device,
|
|||
size_t n,
|
||||
size_t total)
|
||||
{
|
||||
SCOPED_MARKER(device,"Geometry::compute_bvh");
|
||||
if (progress->get_cancel())
|
||||
return;
|
||||
|
||||
|
@ -636,39 +635,13 @@ void GeometryManager::device_update_attributes(Device *device,
|
|||
{
|
||||
progress.set_status("Updating Mesh", "Copying Attributes to device");
|
||||
/* copy svm attributes to device */
|
||||
{
|
||||
SCOPED_MARKER(device, "copy attribute_map");
|
||||
dscene->attributes_map.copy_to_device_if_modified();
|
||||
}
|
||||
|
||||
{
|
||||
SCOPED_MARKER(device, "copy attributes_float");
|
||||
dscene->attributes_float.copy_to_device_if_modified(sizes->attr_float_size, 0);
|
||||
}
|
||||
{
|
||||
SCOPED_MARKER(device, "copy attributes_float2");
|
||||
dscene->attributes_float2.copy_to_device_if_modified(sizes->attr_float2_size, 0);
|
||||
}
|
||||
{
|
||||
SCOPED_MARKER(device, "copy attributes_float3");
|
||||
dscene->attributes_float3.copy_to_device_if_modified(sizes->attr_float3_size, 0);
|
||||
}
|
||||
|
||||
{
|
||||
SCOPED_MARKER(device, "copy attributes_float4");
|
||||
dscene->attributes_float4.copy_to_device_if_modified(sizes->attr_float4_size, 0);
|
||||
}
|
||||
{
|
||||
SCOPED_MARKER(device, "copy attributes_uchar4");
|
||||
dscene->attributes_uchar4.copy_to_device_if_modified(sizes->attr_uchar4_size, 0);
|
||||
}
|
||||
|
||||
/* After mesh attributes and patch tables have been copied to device memory,
|
||||
* we need to update offsets in the objects. */
|
||||
{
|
||||
SCOPED_MARKER(device, "copy objects");
|
||||
dscene->objects.copy_to_device_if_modified();
|
||||
}
|
||||
dscene->attributes_map.copy_to_device_if_modified();
|
||||
dscene->attributes_float.copy_to_device_if_modified(sizes->attr_float_size, 0);
|
||||
dscene->attributes_float2.copy_to_device_if_modified(sizes->attr_float2_size, 0);
|
||||
dscene->attributes_float3.copy_to_device_if_modified(sizes->attr_float3_size, 0);
|
||||
dscene->attributes_float4.copy_to_device_if_modified(sizes->attr_float4_size, 0);
|
||||
dscene->attributes_uchar4.copy_to_device_if_modified(sizes->attr_uchar4_size, 0);
|
||||
dscene->objects.copy_to_device_if_modified();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -679,55 +652,29 @@ void GeometryManager::device_update_mesh(Device *device,
|
|||
const GeometrySizes *p_sizes,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "GeometryManager::device_update_mesh");
|
||||
progress.set_status("Updating Mesh", "Copying Mesh to device");
|
||||
{
|
||||
SCOPED_MARKER(device, "copy packed data to device");
|
||||
if (p_sizes->tri_size != 0) {
|
||||
SCOPED_MARKER(device, "copy mesh data");
|
||||
{
|
||||
SCOPED_MARKER(device, "copy tri_verts");
|
||||
dscene->tri_verts.copy_to_device_if_modified(p_sizes->vert_size, 0);
|
||||
}
|
||||
{
|
||||
SCOPED_MARKER(device, "copy tri_shader");
|
||||
dscene->tri_shader.copy_to_device_if_modified(p_sizes->tri_size, 0);
|
||||
}
|
||||
{
|
||||
SCOPED_MARKER(device, "copy tri_vnormal");
|
||||
dscene->tri_vnormal.copy_to_device_if_modified(p_sizes->vert_size, 0);
|
||||
}
|
||||
{
|
||||
SCOPED_MARKER(device, "copy tri_vindex");
|
||||
dscene->tri_vindex.copy_to_device_if_modified(p_sizes->tri_size, 0);
|
||||
}
|
||||
{
|
||||
SCOPED_MARKER(device, "copy tri_patch");
|
||||
dscene->tri_patch.copy_to_device_if_modified(p_sizes->tri_size, 0);
|
||||
}
|
||||
{
|
||||
SCOPED_MARKER(device, "copy tri_patch_uv");
|
||||
dscene->tri_patch_uv.copy_to_device_if_modified(p_sizes->vert_size, 0);
|
||||
}
|
||||
}
|
||||
if (p_sizes->tri_size != 0) {
|
||||
dscene->tri_verts.copy_to_device_if_modified(p_sizes->vert_size, 0);
|
||||
dscene->tri_shader.copy_to_device_if_modified(p_sizes->tri_size, 0);
|
||||
dscene->tri_vnormal.copy_to_device_if_modified(p_sizes->vert_size, 0);
|
||||
dscene->tri_vindex.copy_to_device_if_modified(p_sizes->tri_size, 0);
|
||||
dscene->tri_patch.copy_to_device_if_modified(p_sizes->tri_size, 0);
|
||||
dscene->tri_patch_uv.copy_to_device_if_modified(p_sizes->vert_size, 0);
|
||||
}
|
||||
|
||||
if (p_sizes->curve_segment_size != 0) {
|
||||
SCOPED_MARKER(device, "copy hair");
|
||||
dscene->curve_keys.copy_to_device_if_modified(p_sizes->curve_key_size, 0);
|
||||
dscene->curves.copy_to_device_if_modified(p_sizes->curve_size, 0);
|
||||
dscene->curve_segments.copy_to_device_if_modified(p_sizes->curve_segment_size, 0);
|
||||
}
|
||||
if (p_sizes->curve_segment_size != 0) {
|
||||
dscene->curve_keys.copy_to_device_if_modified(p_sizes->curve_key_size, 0);
|
||||
dscene->curves.copy_to_device_if_modified(p_sizes->curve_size, 0);
|
||||
dscene->curve_segments.copy_to_device_if_modified(p_sizes->curve_segment_size, 0);
|
||||
}
|
||||
|
||||
if (p_sizes->point_size != 0) {
|
||||
SCOPED_MARKER(device, "copy points");
|
||||
dscene->points.copy_to_device(p_sizes->point_size, 0);
|
||||
dscene->points_shader.copy_to_device(p_sizes->point_size, 0);
|
||||
}
|
||||
if (p_sizes->point_size != 0) {
|
||||
dscene->points.copy_to_device(p_sizes->point_size, 0);
|
||||
dscene->points_shader.copy_to_device(p_sizes->point_size, 0);
|
||||
}
|
||||
|
||||
if (p_sizes->patch_size != 0 && dscene->patches.need_realloc()) {
|
||||
SCOPED_MARKER(device, "copy patches");
|
||||
dscene->patches.copy_to_device(p_sizes->patch_size, 0);
|
||||
}
|
||||
if (p_sizes->patch_size != 0 && dscene->patches.need_realloc()) {
|
||||
dscene->patches.copy_to_device(p_sizes->patch_size, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -837,7 +784,6 @@ static void update_attribute_realloc_flags(uint32_t &device_update_flags,
|
|||
|
||||
void GeometryManager::device_update_preprocess(Device *device, Scene *scene, Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "GeometryManager::device_update_preprocess");
|
||||
if (!need_update() && !need_flags_update) {
|
||||
return;
|
||||
}
|
||||
|
@ -1095,7 +1041,6 @@ void GeometryManager::device_update_displacement_images(Device *device,
|
|||
Scene *scene,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "device_update_displacement_images");
|
||||
progress.set_status("Updating Displacement Images");
|
||||
TaskPool pool;
|
||||
ImageManager *image_manager = scene->image_manager;
|
||||
|
@ -1215,15 +1160,12 @@ void GeometryManager::preTessDispNormalAndVerticesSetup(Device *device,
|
|||
// also determines if tesselation, displacement or shadow transparency is needed.
|
||||
foreach (Geometry *geom, scene->geometry) {
|
||||
if (geom->is_modified()) {
|
||||
SCOPED_MARKER(device, "add modified mesh");
|
||||
if ((geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME)) {
|
||||
Mesh *mesh = static_cast<Mesh *>(geom);
|
||||
|
||||
/* Update normals. */
|
||||
{
|
||||
SCOPED_MARKER(device, "add vertex normals");
|
||||
mesh->add_vertex_normals();
|
||||
}
|
||||
mesh->add_vertex_normals();
|
||||
|
||||
if (mesh->need_attribute(scene, ATTR_STD_POSITION_UNDISPLACED)) {
|
||||
mesh->add_undisplaced();
|
||||
}
|
||||
|
@ -1276,14 +1218,12 @@ void GeometryManager::deviceDataXferAndBVHUpdate(int idx,
|
|||
sub_dscene->data.bvh.bvh_layout = BVH_LAYOUT_NONE;
|
||||
// Get the device to use for this DeviceScene from one of the buffers
|
||||
Device *sub_device = sub_dscene->tri_verts.device;
|
||||
SCOPED_MARKER(sub_device, "parallel update device");
|
||||
// Assign the host_pointers to the sub_dscene so that they access
|
||||
// the correct data
|
||||
device_update_host_pointers(sub_device, dscene, sub_dscene, &sizes);
|
||||
|
||||
// Upload geometry and attribute buffers to the device
|
||||
{
|
||||
SCOPED_MARKER(sub_device, "copy mesh to device");
|
||||
scoped_callback_timer timer([scene, idx](double time) {
|
||||
if (scene->update_stats) {
|
||||
// Save copy mesh to device duration for later logging
|
||||
|
@ -1294,7 +1234,6 @@ void GeometryManager::deviceDataXferAndBVHUpdate(int idx,
|
|||
}
|
||||
|
||||
{
|
||||
SCOPED_MARKER(sub_device, "copy attributes to device");
|
||||
scoped_callback_timer timer([scene, idx](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->attrib_times[idx] = time;
|
||||
|
@ -1305,7 +1244,6 @@ void GeometryManager::deviceDataXferAndBVHUpdate(int idx,
|
|||
|
||||
device_scene_clear_modified(sub_dscene);
|
||||
{
|
||||
SCOPED_MARKER(sub_device, "Parallel BVH building");
|
||||
scoped_callback_timer timer([scene, idx](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->object_bvh_times[idx] = time;
|
||||
|
@ -1323,7 +1261,6 @@ void GeometryManager::deviceDataXferAndBVHUpdate(int idx,
|
|||
}
|
||||
|
||||
if(need_update_scene_bvh) {
|
||||
SCOPED_MARKER(sub_device, "Build Scene BVH");
|
||||
scoped_callback_timer timer([scene, idx](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->scene_bvh_times[idx] = time;
|
||||
|
@ -1340,8 +1277,6 @@ void GeometryManager::deviceDataXferAndBVHUpdate(int idx,
|
|||
*/
|
||||
void GeometryManager::updateObjectBounds(Scene *scene)
|
||||
{
|
||||
SCOPED_MARKER(scene->device, "update objects");
|
||||
|
||||
Scene::MotionType need_motion = scene->need_motion();
|
||||
bool motion_blur = need_motion == Scene::MOTION_BLUR;
|
||||
|
||||
|
@ -1371,7 +1306,6 @@ size_t GeometryManager::createObjectBVHs(Device *device,
|
|||
const BVHLayout bvh_layout,
|
||||
bool &need_update_scene_bvh)
|
||||
{
|
||||
SCOPED_MARKER(device, "update object BVH preprocess");
|
||||
scoped_callback_timer timer([scene](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->update_stats->geometry.times.add_entry(
|
||||
|
@ -1385,20 +1319,17 @@ size_t GeometryManager::createObjectBVHs(Device *device,
|
|||
}
|
||||
|
||||
// Create BVH structures where needed
|
||||
{
|
||||
SCOPED_MARKER(device, "create BVH structures");
|
||||
int id = 0;
|
||||
foreach (Geometry *geom, scene->geometry) {
|
||||
if (geom->is_modified() || geom->need_update_bvh_for_offset) {
|
||||
need_update_scene_bvh = true;
|
||||
Object *object = &object_pool[id];
|
||||
geom->create_new_bvh_if_needed(object, device, dscene, &scene->params);
|
||||
if (geom->need_build_bvh(bvh_layout)) {
|
||||
num_bvh++;
|
||||
}
|
||||
int id = 0;
|
||||
foreach (Geometry *geom, scene->geometry) {
|
||||
if (geom->is_modified() || geom->need_update_bvh_for_offset) {
|
||||
need_update_scene_bvh = true;
|
||||
Object *object = &object_pool[id];
|
||||
geom->create_new_bvh_if_needed(object, device, dscene, &scene->params);
|
||||
if (geom->need_build_bvh(bvh_layout)) {
|
||||
num_bvh++;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
|
||||
return num_bvh;
|
||||
|
@ -1413,7 +1344,6 @@ void GeometryManager::updateSceneBVHs(Device *device,
|
|||
Scene *scene,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "update scene BVH");
|
||||
scoped_callback_timer timer([scene](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->update_stats->geometry.times.add_entry({"device_update (build scene BVH)", time});
|
||||
|
@ -1423,7 +1353,6 @@ void GeometryManager::updateSceneBVHs(Device *device,
|
|||
bool can_refit = device_update_bvh_preprocess(device, dscene, scene, progress);
|
||||
foreach (DeviceScene *sub_dscene, scene->dscenes) {
|
||||
Device *sub_device = sub_dscene->tri_verts.device;
|
||||
SCOPED_MARKER(sub_device, "Build Scene BVH");
|
||||
device_update_bvh(sub_device, sub_dscene, scene, can_refit, 1, 1, progress);
|
||||
}
|
||||
device_update_bvh_postprocess(device, dscene, scene, progress);
|
||||
|
@ -1436,7 +1365,6 @@ void GeometryManager::tesselate(Scene *scene, size_t total_tess_needed, Progress
|
|||
{
|
||||
/* Tessellate meshes that are using subdivision */
|
||||
if (total_tess_needed) {
|
||||
SCOPED_MARKER(scene->device, "Tesselate");
|
||||
scoped_callback_timer timer([scene](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->update_stats->geometry.times.add_entry(
|
||||
|
@ -1454,7 +1382,6 @@ void GeometryManager::tesselate(Scene *scene, size_t total_tess_needed, Progress
|
|||
if (!(geom->is_modified() && geom->is_mesh())) {
|
||||
continue;
|
||||
}
|
||||
SCOPED_MARKER(scene->device, "tesselate mesh");
|
||||
Mesh *mesh = static_cast<Mesh *>(geom);
|
||||
if (mesh->need_tesselation()) {
|
||||
string msg = "Tessellating ";
|
||||
|
@ -1484,7 +1411,6 @@ void GeometryManager::device_update(Device *device,
|
|||
Scene *scene,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "GeometryManager::device_update");
|
||||
if (!need_update())
|
||||
return;
|
||||
|
||||
|
@ -1555,12 +1481,10 @@ void GeometryManager::device_update(Device *device,
|
|||
size_t num_bvh = createObjectBVHs(device, dscene, scene, bvh_layout, need_update_scene_bvh);
|
||||
bool can_refit_scene_bvh = true;
|
||||
if(need_update_scene_bvh) {
|
||||
SCOPED_MARKER(device, "update scene BVH");
|
||||
can_refit_scene_bvh = device_update_bvh_preprocess(device, dscene, scene, progress);
|
||||
}
|
||||
{
|
||||
size_t n_scenes = scene->dscenes.size();
|
||||
SCOPED_MARKER(device, "device update");
|
||||
// Parallel upload the geometry data to the devices and
|
||||
// calculate or refit the BVHs
|
||||
tbb::parallel_for(size_t(0),
|
||||
|
@ -1621,7 +1545,6 @@ void GeometryManager::device_update(Device *device,
|
|||
|
||||
void GeometryManager::device_free(Device *device, DeviceScene *dscene, bool force_free)
|
||||
{
|
||||
SCOPED_MARKER(device, "GeometryManager::device_free");
|
||||
dscene->bvh_nodes.free_if_need_realloc(force_free);
|
||||
dscene->bvh_leaf_nodes.free_if_need_realloc(force_free);
|
||||
dscene->object_node.free_if_need_realloc(force_free);
|
||||
|
|
|
@ -51,7 +51,6 @@ void GeometryManager::clearShaderUpdateTags(Scene *scene)
|
|||
void GeometryManager::clearGeometryUpdateAndModifiedTags(Scene *scene)
|
||||
{
|
||||
// Clear update tags
|
||||
SCOPED_MARKER(scene->device, "clear BVH update tags");
|
||||
foreach (Geometry *geom, scene->geometry) {
|
||||
// Clear update indicators
|
||||
if (geom->is_modified() || geom->need_update_bvh_for_offset) {
|
||||
|
@ -118,7 +117,6 @@ bool GeometryManager::device_update_attributes_preprocess(
|
|||
AttributeSizes *sizes,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "GeometryManager::device_update_attributes");
|
||||
bool update_obj_offsets = false;
|
||||
|
||||
progress.set_status("Updating Mesh", "Computing attributes");
|
||||
|
@ -259,7 +257,6 @@ bool GeometryManager::device_update_attributes_preprocess(
|
|||
void GeometryManager::device_update_mesh_preprocess(
|
||||
Device *device, DeviceScene *dscene, Scene *scene, GeometrySizes *p_sizes, Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "GeometryManager::device_update_mesh_preprocess");
|
||||
/* Fill in all the arrays. */
|
||||
if (p_sizes->tri_size != 0) {
|
||||
/* normals */
|
||||
|
@ -284,18 +281,15 @@ void GeometryManager::device_update_mesh_preprocess(
|
|||
|
||||
if (mesh->shader_is_modified() || mesh->smooth_is_modified() ||
|
||||
mesh->triangles_is_modified() || copy_all_data) {
|
||||
SCOPED_MARKER(scene->device, "Mesh:pack_shaders");
|
||||
mesh->pack_shaders(scene, &tri_shader[mesh->prim_offset]);
|
||||
}
|
||||
|
||||
if (mesh->verts_is_modified() || copy_all_data) {
|
||||
SCOPED_MARKER(scene->device, "Mesh:pack_normals");
|
||||
mesh->pack_normals(&vnormal[mesh->vert_offset]);
|
||||
}
|
||||
|
||||
if (mesh->verts_is_modified() || mesh->triangles_is_modified() ||
|
||||
mesh->vert_patch_uv_is_modified() || copy_all_data) {
|
||||
SCOPED_MARKER(scene->device, "Mesh:pack_vertices");
|
||||
mesh->pack_verts(&tri_verts[mesh->vert_offset],
|
||||
&tri_vindex[mesh->prim_offset],
|
||||
&tri_patch[mesh->prim_offset],
|
||||
|
@ -388,7 +382,6 @@ void GeometryManager::device_update_host_pointers(Device *device,
|
|||
DeviceScene *sub_dscene,
|
||||
GeometrySizes *p_sizes)
|
||||
{
|
||||
SCOPED_MARKER(device, "update host_pointers");
|
||||
if (p_sizes->tri_size != 0) {
|
||||
if (dscene->tri_verts.is_modified()) {
|
||||
sub_dscene->tri_verts.assign_mem(dscene->tri_verts);
|
||||
|
@ -443,7 +436,6 @@ void GeometryManager::device_update_host_pointers(Device *device,
|
|||
}
|
||||
|
||||
if (p_sizes->point_size != 0) {
|
||||
SCOPED_MARKER(device, "copy points");
|
||||
// TODO: Why does this not check the modified tag?
|
||||
sub_dscene->points.assign_mem(dscene->points);
|
||||
// sub_dscene->points.tag_modified();
|
||||
|
@ -746,7 +738,6 @@ void GeometryManager::device_update_bvh2(Device *device,
|
|||
Scene *scene,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "GeometryManager::device_update_bvh2");
|
||||
BVH *bvh = scene->bvh;
|
||||
if (bvh->params.bvh_layout == BVH_LAYOUT_BVH2) {
|
||||
BVH2 *bvh2 = static_cast<BVH2 *>(bvh);
|
||||
|
@ -794,7 +785,6 @@ void GeometryManager::device_update_bvh_postprocess(Device *device,
|
|||
Scene *scene,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "GeometryManager::device_update_bvh_postprocess");
|
||||
BVH *bvh = scene->bvh;
|
||||
|
||||
const bool has_bvh2_layout = (bvh->params.bvh_layout == BVH_LAYOUT_BVH2);
|
||||
|
@ -958,7 +948,6 @@ bool GeometryManager::displacement_and_curve_shadow_transparency(
|
|||
vector<AttributeSet> &object_attribute_values,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "Displacement & Hair transparency");
|
||||
scoped_callback_timer timer([scene](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->update_stats->geometry.times.add_entry({"device_update (displacement)", time});
|
||||
|
@ -980,7 +969,6 @@ bool GeometryManager::displacement_and_curve_shadow_transparency(
|
|||
DeviceScene *sub_dscene = scene->dscenes.front();
|
||||
Device *sub_device = sub_dscene->tri_verts.device;
|
||||
{
|
||||
SCOPED_MARKER(device, "copy mesh to device for displacement");
|
||||
scoped_callback_timer timer([scene](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->update_stats->geometry.times.add_entry(
|
||||
|
@ -991,16 +979,12 @@ bool GeometryManager::displacement_and_curve_shadow_transparency(
|
|||
device_update_attributes(sub_device, sub_dscene, attrib_sizes, progress);
|
||||
device_update_mesh(sub_device, sub_dscene, sizes, progress);
|
||||
}
|
||||
{
|
||||
/* Copy constant data needed by shader evaluation. */
|
||||
SCOPED_MARKER(device, "copy constant data for hair and displacement");
|
||||
sub_device->const_copy_to("data", &dscene->data, sizeof(dscene->data));
|
||||
}
|
||||
|
||||
foreach (Geometry *geom, scene->geometry) {
|
||||
/* Update images needed for true displacement. */
|
||||
{
|
||||
SCOPED_MARKER(device, "upload images for displacement");
|
||||
scoped_callback_timer timer([scene](double time) {
|
||||
if (scene->update_stats) {
|
||||
scene->update_stats->geometry.times.add_entry(
|
||||
|
|
|
@ -262,8 +262,6 @@ void Scene::device_update(Device *device_, Progress &progress)
|
|||
if (!device)
|
||||
device = device_;
|
||||
|
||||
SCOPED_MARKER(device,"Scene::device_update");
|
||||
|
||||
bool print_stats = need_data_update();
|
||||
|
||||
if (update_stats) {
|
||||
|
@ -598,7 +596,6 @@ void Scene::update_kernel_features()
|
|||
|
||||
bool Scene::update(Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device, "Scene::update");
|
||||
if (!need_update()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -461,7 +461,6 @@ void ShaderManager::device_update(Device *device,
|
|||
Scene *scene,
|
||||
Progress &progress)
|
||||
{
|
||||
SCOPED_MARKER(device,"ShaderManager::device_update");
|
||||
if (!need_update()) {
|
||||
return;
|
||||
}
|
||||
|
@ -486,7 +485,6 @@ void ShaderManager::device_update_common(Device *device,
|
|||
Scene *scene,
|
||||
Progress & /*progress*/)
|
||||
{
|
||||
SCOPED_MARKER(device, "ShaderManager::device_update_common");
|
||||
dscene->shaders.free();
|
||||
|
||||
if (scene->shaders.size() == 0)
|
||||
|
|
|
@ -128,20 +128,16 @@ void SVMShaderManager::device_update_specific(Device *device,
|
|||
}
|
||||
|
||||
/* Copy the nodes of each shader into the correct location. */
|
||||
{
|
||||
SCOPED_MARKER(device, "copy shader node");
|
||||
svm_nodes += num_shaders;
|
||||
for (int i = 0; i < num_shaders; i++) {
|
||||
int shader_size = shader_svm_nodes[i].size() - 1;
|
||||
|
||||
svm_nodes += num_shaders;
|
||||
for (int i = 0; i < num_shaders; i++) {
|
||||
int shader_size = shader_svm_nodes[i].size() - 1;
|
||||
memcpy(svm_nodes, &shader_svm_nodes[i][1], sizeof(int4) * shader_size);
|
||||
svm_nodes += shader_size;
|
||||
}
|
||||
|
||||
memcpy(svm_nodes, &shader_svm_nodes[i][1], sizeof(int4) * shader_size);
|
||||
svm_nodes += shader_size;
|
||||
}
|
||||
|
||||
if (progress.get_cancel()) {
|
||||
return;
|
||||
}
|
||||
if (progress.get_cancel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
dscene->svm_nodes.copy_to_device();
|
||||
|
|
Loading…
Reference in New Issue