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:
Diffstat (limited to 'intern/cycles/device')
-rw-r--r--intern/cycles/device/device.cpp11
-rw-r--r--intern/cycles/device/device.h8
-rw-r--r--intern/cycles/device/device_cuda.cpp13
-rw-r--r--intern/cycles/device/device_multi.cpp5
4 files changed, 31 insertions, 6 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index a3264f0c516..7fd1b79f6bc 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -53,7 +53,8 @@ void Device::pixels_free(device_memory& mem)
mem_free(mem);
}
-void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int width, int height, bool transparent)
+void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int width, int height, bool transparent,
+ const DeviceDrawParams &draw_params)
{
pixels_copy_from(rgba, y, w, h);
@@ -80,6 +81,10 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int w
glEnable(GL_TEXTURE_2D);
+ if(draw_params.bind_display_space_shader_cb) {
+ draw_params.bind_display_space_shader_cb();
+ }
+
glPushMatrix();
glTranslatef(0.0f, (float)dy, 0.0f);
@@ -98,6 +103,10 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int w
glPopMatrix();
+ if(draw_params.unbind_display_space_shader_cb) {
+ draw_params.unbind_display_space_shader_cb();
+ }
+
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
glDeleteTextures(1, &texid);
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index bd309e35788..fba44485810 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -69,6 +69,11 @@ public:
/* Device */
+struct DeviceDrawParams {
+ boost::function<void(void)> bind_display_space_shader_cb;
+ boost::function<void(void)> unbind_display_space_shader_cb;
+};
+
class Device {
protected:
Device(DeviceInfo& info_, Stats &stats_, bool background) : background(background), info(info_), stats(stats_) {}
@@ -121,7 +126,8 @@ public:
/* opengl drawing */
virtual void draw_pixels(device_memory& mem, int y, int w, int h,
- int dy, int width, int height, bool transparent);
+ int dy, int width, int height, bool transparent,
+ const DeviceDrawParams &draw_params);
#ifdef WITH_NETWORK
/* networking */
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 0fbb48cf431..029293d2a04 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -892,7 +892,8 @@ public:
}
}
- void draw_pixels(device_memory& mem, int y, int w, int h, int dy, int width, int height, bool transparent)
+ void draw_pixels(device_memory& mem, int y, int w, int h, int dy, int width, int height, bool transparent,
+ const DeviceDrawParams &draw_params)
{
if(!background) {
PixelMem pmem = pixel_mem_map[mem.device_pointer];
@@ -925,6 +926,10 @@ public:
glColor3f(1.0f, 1.0f, 1.0f);
+ if(draw_params.bind_display_space_shader_cb) {
+ draw_params.bind_display_space_shader_cb();
+ }
+
glPushMatrix();
glTranslatef(0.0f, (float)dy, 0.0f);
@@ -943,6 +948,10 @@ public:
glPopMatrix();
+ if(draw_params.unbind_display_space_shader_cb) {
+ draw_params.unbind_display_space_shader_cb();
+ }
+
if(transparent)
glDisable(GL_BLEND);
@@ -954,7 +963,7 @@ public:
return;
}
- Device::draw_pixels(mem, y, w, h, dy, width, height, transparent);
+ Device::draw_pixels(mem, y, w, h, dy, width, height, transparent, draw_params);
}
void thread_run(DeviceTask *task)
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 27b9de0769e..5cb1069d244 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -233,7 +233,8 @@ public:
mem.device_pointer = tmp;
}
- void draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int width, int height, bool transparent)
+ void draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int width, int height, bool transparent,
+ const DeviceDrawParams &draw_params)
{
device_ptr tmp = rgba.device_pointer;
int i = 0, sub_h = h/devices.size();
@@ -247,7 +248,7 @@ public:
/* adjust math for w/width */
rgba.device_pointer = sub.ptr_map[tmp];
- sub.device->draw_pixels(rgba, sy, w, sh, sdy, width, sheight, transparent);
+ sub.device->draw_pixels(rgba, sy, w, sh, sdy, width, sheight, transparent, draw_params);
i++;
}