Page Menu
Home
Search
Configure Global Search
Log In
Paste
P306
Snippet for D1377
Active
Public
Actions
Authored by
Sergey Sharybin (sergey)
on Dec 30 2015, 9:32 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Tags
None
Subscribers
None
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 590fcf8..af54d3e 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -37,7 +37,7 @@ static void shade_background_pixels(Device *device, DeviceScene *dscene, int res
int height = res;
device_vector<uint4> d_input;
- device_vector<float4> d_output;
+ device_vector<float> d_output_luma;
uint4 *d_input_data = d_input.resize(width*height);
@@ -52,18 +52,18 @@ static void shade_background_pixels(Device *device, DeviceScene *dscene, int res
}
/* compute on device */
- d_output.resize((width*height + 3)/4);
- memset((void*)d_output.data_pointer, 0, d_output.memory_size());
+ d_output_luma.resize(width*height);
+ memset((void*)d_output_luma.data_pointer, 0, d_output_luma.memory_size());
device->const_copy_to("__data", &dscene->data, sizeof(dscene->data));
device->mem_alloc(d_input, MEM_READ_ONLY);
device->mem_copy_to(d_input);
- device->mem_alloc(d_output, MEM_WRITE_ONLY);
+ device->mem_alloc(d_output_luma, MEM_WRITE_ONLY);
DeviceTask main_task(DeviceTask::SHADER);
main_task.shader_input = d_input.device_pointer;
- main_task.shader_output = d_output.device_pointer;
+ main_task.shader_output_luma = d_output_luma.device_pointer;
main_task.shader_eval_type = SHADER_EVAL_BACKGROUND;
main_task.shader_x = 0;
main_task.shader_w = width*height;
@@ -77,15 +77,15 @@ static void shade_background_pixels(Device *device, DeviceScene *dscene, int res
foreach(DeviceTask& task, split_tasks) {
device->task_add(task);
device->task_wait();
- device->mem_copy_from(d_output, task.shader_x, 1, task.shader_w, sizeof(float4));
+ device->mem_copy_from(d_output_luma, task.shader_x, 1, task.shader_w, sizeof(float));
}
device->mem_free(d_input);
- device->mem_free(d_output);
+ device->mem_free(d_output_luma);
d_input.clear();
- float *d_output_data = reinterpret_cast<float*>(d_output.data_pointer);
+ float *d_output_data = reinterpret_cast<float*>(d_output_luma.data_pointer);
pixels.resize(width*height);
Event Timeline
Sergey Sharybin (sergey)
edited the content of this paste.
(Show Details)
Dec 30 2015, 9:32 AM
Sergey Sharybin (sergey)
changed the title of this paste from untitled to
Snippet for D1377
.
Sergey Sharybin (sergey)
updated the paste's language from
autodetect
to
autodetect
.
Sergey Sharybin (sergey)
changed the edit policy from "All Users" to "Administrators".
Sergey Sharybin (sergey)
mentioned this in
D1377: Cycles: Moved the background map averaging into the kernel, saving some memory
.
Log In to Comment