diff options
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/bake.cpp | 7 | ||||
-rw-r--r-- | intern/cycles/render/buffers.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/render/image.cpp | 14 | ||||
-rw-r--r-- | intern/cycles/render/image.h | 1 | ||||
-rw-r--r-- | intern/cycles/render/object.cpp | 2 |
5 files changed, 21 insertions, 11 deletions
diff --git a/intern/cycles/render/bake.cpp b/intern/cycles/render/bake.cpp index aeb5d1c1316..1fef7a0188f 100644 --- a/intern/cycles/render/bake.cpp +++ b/intern/cycles/render/bake.cpp @@ -151,6 +151,10 @@ bool BakeManager::bake(Device *device, DeviceScene *dscene, Scene *scene, Progre progress.reset_sample(); progress.set_total_pixel_samples(total_pixel_samples); + /* needs to be up to date for baking specific AA samples */ + dscene->data.integrator.aa_samples = num_samples; + device->const_copy_to("__data", &dscene->data, sizeof(dscene->data)); + for(size_t shader_offset = 0; shader_offset < num_pixels; shader_offset += m_shader_limit) { size_t shader_size = (size_t)fminf(num_pixels - shader_offset, m_shader_limit); @@ -175,9 +179,6 @@ bool BakeManager::bake(Device *device, DeviceScene *dscene, Scene *scene, Progre d_output.zero_to_device(); d_input.copy_to_device(); - /* needs to be up to data for attribute access */ - device->const_copy_to("__data", &dscene->data, sizeof(dscene->data)); - DeviceTask task(DeviceTask::SHADER); task.shader_input = d_input.device_pointer; task.shader_output = d_output.device_pointer; diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index c6502df7252..89a44c7ce3c 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -151,6 +151,10 @@ bool RenderBuffers::copy_from_device() bool RenderBuffers::get_denoising_pass_rect(int offset, float exposure, int sample, int components, float *pixels) { + if(buffer.data() == NULL) { + return false; + } + float invsample = 1.0f/sample; float scale = invsample; bool variance = (offset == DENOISING_PASS_NORMAL_VAR) || @@ -218,6 +222,10 @@ bool RenderBuffers::get_denoising_pass_rect(int offset, float exposure, int samp bool RenderBuffers::get_pass_rect(PassType type, float exposure, int sample, int components, float *pixels) { + if(buffer.data() == NULL) { + return false; + } + int pass_offset = 0; for(size_t j = 0; j < params.passes.size(); j++) { diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 482442cce29..feaa17148ee 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -703,7 +703,7 @@ void ImageManager::device_load_image(Device *device, /* Slot assignment */ int flat_slot = type_index_to_flattened_slot(slot, type); - string name = string_printf("__tex_image_%s_%03d", name_from_type(type).c_str(), flat_slot); + img->mem_name = string_printf("__tex_image_%s_%03d", name_from_type(type).c_str(), flat_slot); /* Free previous texture in slot. */ if(img->mem) { @@ -715,7 +715,7 @@ void ImageManager::device_load_image(Device *device, /* Create new texture. */ if(type == IMAGE_DATA_TYPE_FLOAT4) { device_vector<float4> *tex_img - = new device_vector<float4>(device, name.c_str(), MEM_TEXTURE); + = new device_vector<float4>(device, img->mem_name.c_str(), MEM_TEXTURE); if(!file_load_image<TypeDesc::FLOAT, float>(img, type, @@ -741,7 +741,7 @@ void ImageManager::device_load_image(Device *device, } else if(type == IMAGE_DATA_TYPE_FLOAT) { device_vector<float> *tex_img - = new device_vector<float>(device, name.c_str(), MEM_TEXTURE); + = new device_vector<float>(device, img->mem_name.c_str(), MEM_TEXTURE); if(!file_load_image<TypeDesc::FLOAT, float>(img, type, @@ -764,7 +764,7 @@ void ImageManager::device_load_image(Device *device, } else if(type == IMAGE_DATA_TYPE_BYTE4) { device_vector<uchar4> *tex_img - = new device_vector<uchar4>(device, name.c_str(), MEM_TEXTURE); + = new device_vector<uchar4>(device, img->mem_name.c_str(), MEM_TEXTURE); if(!file_load_image<TypeDesc::UINT8, uchar>(img, type, @@ -790,7 +790,7 @@ void ImageManager::device_load_image(Device *device, } else if(type == IMAGE_DATA_TYPE_BYTE) { device_vector<uchar> *tex_img - = new device_vector<uchar>(device, name.c_str(), MEM_TEXTURE); + = new device_vector<uchar>(device, img->mem_name.c_str(), MEM_TEXTURE); if(!file_load_image<TypeDesc::UINT8, uchar>(img, type, @@ -812,7 +812,7 @@ void ImageManager::device_load_image(Device *device, } else if(type == IMAGE_DATA_TYPE_HALF4) { device_vector<half4> *tex_img - = new device_vector<half4>(device, name.c_str(), MEM_TEXTURE); + = new device_vector<half4>(device, img->mem_name.c_str(), MEM_TEXTURE); if(!file_load_image<TypeDesc::HALF, half>(img, type, @@ -837,7 +837,7 @@ void ImageManager::device_load_image(Device *device, } else if(type == IMAGE_DATA_TYPE_HALF) { device_vector<half> *tex_img - = new device_vector<half>(device, name.c_str(), MEM_TEXTURE); + = new device_vector<half>(device, img->mem_name.c_str(), MEM_TEXTURE); if(!file_load_image<TypeDesc::HALF, half>(img, type, diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index cc7c8544bed..3519a67bc05 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -111,6 +111,7 @@ public: InterpolationType interpolation; ExtensionType extension; + string mem_name; device_memory *mem; int users; diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index aef7fc29573..d7143f24850 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -644,7 +644,7 @@ void ObjectManager::device_update_flags(Device *, void ObjectManager::device_update_mesh_offsets(Device *, DeviceScene *dscene, Scene *scene) { - if(scene->objects.size() == 0) { + if(dscene->objects.size() == 0) { return; } |