[Bf-blender-cvs] [5588a51] master: Cycles OpenGL: Don't use full matrix transform when we can just use simple addition.

Antony Riakiotakis noreply at git.blender.org
Mon May 11 13:10:24 CEST 2015


Commit: 5588a51c9cb89878588c8130a02d76e04a53aae2
Author: Antony Riakiotakis
Date:   Mon May 11 13:10:19 2015 +0200
Branches: master
https://developer.blender.org/rB5588a51c9cb89878588c8130a02d76e04a53aae2

Cycles OpenGL: Don't use full matrix transform when we can just use
simple addition.

===================================================================

M	intern/cycles/device/device.cpp
M	intern/cycles/device/device_cuda.cpp

===================================================================

diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 3a33b8f..839f351 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -83,24 +83,19 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int w
 			draw_params.bind_display_space_shader_cb();
 		}
 
-		glPushMatrix();
-		glTranslatef(0.0f, (float)dy, 0.0f);
-
 		glBegin(GL_QUADS);
 		
 		glTexCoord2f(0.0f, 0.0f);
-		glVertex2f(0.0f, 0.0f);
+		glVertex2f(0.0f, dy);
 		glTexCoord2f(1.0f, 0.0f);
-		glVertex2f((float)width, 0.0f);
+		glVertex2f((float)width, dy);
 		glTexCoord2f(1.0f, 1.0f);
-		glVertex2f((float)width, (float)height);
+		glVertex2f((float)width, (float)height + dy);
 		glTexCoord2f(0.0f, 1.0f);
-		glVertex2f(0.0f, (float)height);
+		glVertex2f(0.0f, (float)height + dy);
 
 		glEnd();
 
-		glPopMatrix();
-
 		if(draw_params.unbind_display_space_shader_cb) {
 			draw_params.unbind_display_space_shader_cb();
 		}
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 04319ba..42d4f8e 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -918,24 +918,19 @@ public:
 				draw_params.bind_display_space_shader_cb();
 			}
 
-			glPushMatrix();
-			glTranslatef(0.0f, (float)dy, 0.0f);
-				
 			glBegin(GL_QUADS);
 			
 			glTexCoord2f(0.0f, 0.0f);
-			glVertex2f(0.0f, 0.0f);
+			glVertex2f(0.0f, dy);
 			glTexCoord2f((float)w/(float)pmem.w, 0.0f);
-			glVertex2f((float)width, 0.0f);
+			glVertex2f((float)width, dy);
 			glTexCoord2f((float)w/(float)pmem.w, (float)h/(float)pmem.h);
-			glVertex2f((float)width, (float)height);
+			glVertex2f((float)width, (float)height + dy);
 			glTexCoord2f(0.0f, (float)h/(float)pmem.h);
-			glVertex2f(0.0f, (float)height);
+			glVertex2f(0.0f, (float)height + dy);
 
 			glEnd();
 
-			glPopMatrix();
-
 			if(draw_params.unbind_display_space_shader_cb) {
 				draw_params.unbind_display_space_shader_cb();
 			}




More information about the Bf-blender-cvs mailing list