Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-09-12 17:13:56 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-09-12 17:13:56 +0400
commitebc653463ddfd9f8b893b6acbcc6465972e6abc6 (patch)
tree6b3cc2ba3f04994cf9f8d8f5bca6d63cfe2c9d1f /intern/cycles/device
parentc40492205b4369de3babe63b43d127ca622773ec (diff)
Cycles:
* Fix missing update when editing objects with emission materials. * Fix preview pass rendering set to 1 not showing full resolution. * Fix CUDA runtime compiling failing due to missing cache directory. * Use settings from first render layer for visibility and material override. And a bunch of incomplete and still disabled code mostly related to closure sampling.
Diffstat (limited to 'intern/cycles/device')
-rw-r--r--intern/cycles/device/device.cpp10
-rw-r--r--intern/cycles/device/device_cuda.cpp19
-rw-r--r--intern/cycles/device/device_multi.cpp34
3 files changed, 50 insertions, 13 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index e21dce45d80..ab57d7cfe86 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -84,7 +84,7 @@ void Device::pixels_alloc(device_memory& mem)
void Device::pixels_copy_from(device_memory& mem, int y, int w, int h)
{
- mem_copy_from(mem, sizeof(uchar)*4*y*w, sizeof(uchar)*4*w*h);
+ mem_copy_from(mem, sizeof(uint8_t)*4*y*w, sizeof(uint8_t)*4*w*h);
}
void Device::pixels_free(device_memory& mem)
@@ -104,7 +104,13 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int width, in
glPixelZoom((float)width/(float)w, (float)height/(float)h);
glRasterPos2f(0, y);
- glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, (void*)rgba.data_pointer);
+ uint8_t *pixels = (uint8_t*)rgba.data_pointer;
+
+ /* for multi devices, this assumes the ineffecient method that we allocate
+ all pixels on the device even though we only render to a subset */
+ pixels += sizeof(uint8_t)*4*y*w;
+
+ glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glRasterPos2f(0.0f, 0.0f);
glPixelZoom(1.0f, 1.0f);
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 49ffd3d0834..7fc0afce1ac 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -232,11 +232,16 @@ public:
double starttime = time_dt();
printf("Compiling CUDA kernel ...\n");
+ path_create_directories(cubin);
+
string command = string_printf("%s -arch=sm_%d%d -m%d --cubin \"%s\" --use_fast_math "
"-o \"%s\" --ptxas-options=\"-v\" --maxrregcount=%d --opencc-options -OPT:Olimit=0 -I\"%s\" -DNVCC",
nvcc.c_str(), major, minor, machine, kernel.c_str(), cubin.c_str(), maxreg, include.c_str());
- system(command.c_str());
+ if(system(command.c_str()) == -1) {
+ fprintf(stderr, "Failed to execute compilation command.\n");
+ return "";
+ }
/* verify if compilation succeeded */
if(!path_exists(cubin)) {
@@ -708,9 +713,13 @@ public:
cuda_push_context();
+ /* for multi devices, this assumes the ineffecient method that we allocate
+ all pixels on the device even though we only render to a subset */
+ size_t offset = sizeof(uint8_t)*4*y*w;
+
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pmem.cuPBO);
glBindTexture(GL_TEXTURE_2D, pmem.cuTexId);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, (void*)offset);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
glEnable(GL_TEXTURE_2D);
@@ -729,11 +738,11 @@ public:
glTexCoord2f(0.0f, 0.0f);
glVertex2f(0.0f, 0.0f);
- glTexCoord2f((float)w/(float)width, 0);
+ glTexCoord2f((float)w/(float)pmem.w, 0.0f);
glVertex2f((float)width, 0.0f);
- glTexCoord2f((float)w/(float)width, (float)h/(float)height);
+ glTexCoord2f((float)w/(float)pmem.w, (float)h/(float)pmem.h);
glVertex2f((float)width, (float)height);
- glTexCoord2f(0.0f, (float)h/(float)height);
+ glTexCoord2f(0.0f, (float)h/(float)pmem.h);
glVertex2f(0.0f, (float)height);
glEnd();
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index cae63596d3b..f2f6251685e 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -47,9 +47,6 @@ public:
MultiDevice(bool background_)
: unique_ptr(1)
{
- /* enforce background for now */
- background = true;
-
Device *device;
/* add CPU device */
@@ -125,6 +122,15 @@ public:
return desc.str();
}
+ bool load_kernels()
+ {
+ foreach(SubDevice& sub, devices)
+ if(!sub.device->load_kernels())
+ return false;
+
+ return true;
+ }
+
void mem_alloc(device_memory& mem, MemoryType type)
{
foreach(SubDevice& sub, devices) {
@@ -219,12 +225,26 @@ public:
void pixels_alloc(device_memory& mem)
{
- Device::pixels_alloc(mem);
+ foreach(SubDevice& sub, devices) {
+ mem.device_pointer = 0;
+ sub.device->pixels_alloc(mem);
+ sub.ptr_map[unique_ptr] = mem.device_pointer;
+ }
+
+ mem.device_pointer = unique_ptr++;
}
void pixels_free(device_memory& mem)
{
- Device::pixels_free(mem);
+ device_ptr tmp = mem.device_pointer;
+
+ foreach(SubDevice& sub, devices) {
+ mem.device_pointer = sub.ptr_map[tmp];
+ sub.device->pixels_free(mem);
+ sub.ptr_map.erase(sub.ptr_map.find(tmp));
+ }
+
+ mem.device_pointer = 0;
}
void pixels_copy_from(device_memory& mem, int y, int w, int h)
@@ -248,14 +268,16 @@ public:
{
device_ptr tmp = rgba.device_pointer;
int i = 0, sub_h = h/devices.size();
+ int sub_height = height/devices.size();
foreach(SubDevice& sub, devices) {
int sy = y + i*sub_h;
int sh = (i == (int)devices.size() - 1)? h - sub_h*i: sub_h;
+ int sheight = (i == (int)devices.size() - 1)? height - sub_height*i: sub_height;
/* adjust math for w/width */
rgba.device_pointer = sub.ptr_map[tmp];
- sub.device->draw_pixels(rgba, sy, w, sh, width, height, transparent);
+ sub.device->draw_pixels(rgba, sy, w, sh, width, sheight, transparent);
i++;
}