[Bf-blender-cvs] [35277390024] blender2.8: Remove reference to SUPPORT_LEGACY_MATRIX

Dalai Felinto noreply at git.blender.org
Fri May 19 14:18:18 CEST 2017


Commit: 3527739002407ac9b1698beb1cde58b0077e3b78
Author: Dalai Felinto
Date:   Fri May 19 12:04:56 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB3527739002407ac9b1698beb1cde58b0077e3b78

Remove reference to SUPPORT_LEGACY_MATRIX

Since the change to core profile this is no longer supported.

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

M	source/blender/editors/space_view3d/drawmesh.c
M	source/blender/gpu/GPU_matrix.h
M	source/blender/gpu/intern/gpu_draw.c
M	source/blender/gpu/intern/gpu_matrix.c

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

diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 701efab0bd0..8db377c3061 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -1085,22 +1085,12 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
 		int bindcode = (ima) ? GPU_verify_image(ima, iuser, GL_TEXTURE_2D, 0, 0, mipmap, false) : 0;
 
 		if (bindcode) {
-			NodeTexBase *texbase = node->storage;
-
 			/* disable existing material */
 			GPU_object_material_unbind();
 
 			/* bind texture */
 			glBindTexture(GL_TEXTURE_2D, ima->bindcode[TEXTARGET_TEXTURE_2D]);
 
-#if SUPPORT_LEGACY_MATRIX
-			glMatrixMode(GL_TEXTURE);
-			glLoadMatrixf((float*) texbase->tex_mapping.mat); /* TEXTURE */
-			glMatrixMode(GL_MODELVIEW);
-#else
-			(void)texbase;
-#endif
-
 			/* use active UV texture layer */
 			memset(gattribs, 0, sizeof(*gattribs));
 
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
index 9512587c754..b62506c154f 100644
--- a/source/blender/gpu/GPU_matrix.h
+++ b/source/blender/gpu/GPU_matrix.h
@@ -40,12 +40,6 @@
 extern "C" {
 #endif
 
-/* For now we support the legacy matrix stack in gpuGetMatrix functions.
- * Will remove this after switching to core profile, which can happen after
- * we convert all code to use the API in this file. */
-#define SUPPORT_LEGACY_MATRIX 0
-
-
 void gpuMatrixReset(void); /* to Identity transform & empty stack */
 
 /* ModelView Matrix (2D or 3D) */
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index d2a86dbcfa4..6e3c5f395dc 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -400,13 +400,6 @@ void GPU_clear_tpage(bool force)
 	GTS.lasttface = NULL;
 	GTS.curtile = 0;
 	GTS.curima = NULL;
-	if (GTS.curtilemode != 0) {
-#if SUPPORT_LEGACY_MATRIX
-		glMatrixMode(GL_TEXTURE);
-		glLoadIdentity(); /* TEXTURE */
-		glMatrixMode(GL_MODELVIEW);
-#endif
-	}
 	GTS.curtilemode = 0;
 	GTS.curtileXRep = 0;
 	GTS.curtileYRep = 0;
@@ -592,21 +585,6 @@ int GPU_verify_image(
 		return (ima != NULL);
 	}
 
-	/* if tiling mode or repeat changed, change texture matrix to fit */
-	if (GTS.tilemode != GTS.curtilemode || GTS.curtileXRep != GTS.tileXRep ||
-	    GTS.curtileYRep != GTS.tileYRep)
-	{
-#if SUPPORT_LEGACY_MATRIX
-		glMatrixMode(GL_TEXTURE);
-		glLoadIdentity(); /* TEXTURE */
-
-		if (ima && (ima->tpageflag & IMA_TILES))
-			glScalef(ima->xrep, ima->yrep, 0); /* TEXTURE */
-
-		glMatrixMode(GL_MODELVIEW);
-#endif
-	}
-
 	/* check if we have a valid image */
 	if (ima == NULL || ima->ok == 0)
 		return 0;
@@ -2104,15 +2082,6 @@ void GPU_end_object_materials(void)
 	GMS.gmatbuf = NULL;
 	GMS.alphablend = NULL;
 	GMS.two_sided_lighting = false;
-
-	/* resetting the texture matrix after the scaling needed for tiled textures */
-	if (GTS.tilemode) {
-#if SUPPORT_LEGACY_MATRIX
-		glMatrixMode(GL_TEXTURE);
-		glLoadIdentity(); /* TEXTURE */
-		glMatrixMode(GL_MODELVIEW);
-#endif
-	}
 }
 
 /* Lights */
@@ -2287,12 +2256,6 @@ void GPU_state_init(void)
 
 	glDepthRange(0.0, 1.0);
 
-#if SUPPORT_LEGACY_MATRIX
-	glMatrixMode(GL_TEXTURE);
-	glLoadIdentity(); /* TEXTURE */
-	glMatrixMode(GL_MODELVIEW);
-#endif
-
 	glFrontFace(GL_CCW);
 	glCullFace(GL_BACK);
 	glDisable(GL_CULL_FACE);
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c
index a24b735a5d3..775d1cd87b2 100644
--- a/source/blender/gpu/intern/gpu_matrix.c
+++ b/source/blender/gpu/intern/gpu_matrix.c
@@ -117,25 +117,6 @@ static void checkmat(cosnt float *m)
 
 void gpuPushMatrix(void)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		GLenum mode;
-		glGetIntegerv(GL_MATRIX_MODE, (GLint*)&mode);
-		if (mode != GL_MODELVIEW) {
-			glMatrixMode(GL_MODELVIEW);
-		}
-
-		glPushMatrix();
-
-		if (mode != GL_MODELVIEW) {
-			glMatrixMode(mode); /* restore */
-		}
-
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	BLI_assert(ModelViewStack.top < MATRIX_STACK_DEPTH);
 	ModelViewStack.top++;
 	copy_m4_m4(ModelView, ModelViewStack.stack[ModelViewStack.top - 1]);
@@ -143,25 +124,6 @@ void gpuPushMatrix(void)
 
 void gpuPopMatrix(void)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		GLenum mode;
-		glGetIntegerv(GL_MATRIX_MODE, (GLint*)&mode);
-		if (mode != GL_MODELVIEW) {
-			glMatrixMode(GL_MODELVIEW);
-		}
-
-		glPopMatrix();
-
-		if (mode != GL_MODELVIEW) {
-			glMatrixMode(mode); /* restore */
-		}
-
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	BLI_assert(ModelViewStack.top > 0);
 	ModelViewStack.top--;
 	state.dirty = true;
@@ -169,25 +131,6 @@ void gpuPopMatrix(void)
 
 void gpuPushProjectionMatrix(void)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		GLenum mode;
-		glGetIntegerv(GL_MATRIX_MODE, (GLint*)&mode);
-		if (mode != GL_PROJECTION) {
-			glMatrixMode(GL_PROJECTION);
-		}
-
-		glPushMatrix();
-
-		if (mode != GL_PROJECTION) {
-			glMatrixMode(mode); /* restore */
-		}
-
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	BLI_assert(ProjectionStack.top < MATRIX_STACK_DEPTH);
 	ProjectionStack.top++;
 	copy_m4_m4(Projection, ProjectionStack.stack[ProjectionStack.top - 1]);
@@ -195,25 +138,6 @@ void gpuPushProjectionMatrix(void)
 
 void gpuPopProjectionMatrix(void)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		GLenum mode;
-		glGetIntegerv(GL_MATRIX_MODE, (GLint*)&mode);
-		if (mode != GL_PROJECTION) {
-			glMatrixMode(GL_PROJECTION);
-		}
-
-		glPopMatrix();
-
-		if (mode != GL_PROJECTION) {
-			glMatrixMode(mode); /* restore */
-		}
-
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	BLI_assert(ProjectionStack.top > 0);
 	ProjectionStack.top--;
 	state.dirty = true;
@@ -221,14 +145,6 @@ void gpuPopProjectionMatrix(void)
 
 void gpuLoadMatrix(const float m[4][4])
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glLoadMatrixf((const float*) m);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	copy_m4_m4(ModelView, m);
 	CHECKMAT(ModelView3D);
 	state.dirty = true;
@@ -236,25 +152,6 @@ void gpuLoadMatrix(const float m[4][4])
 
 void gpuLoadIdentityProjectionMatrix(void)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		GLenum mode;
-		glGetIntegerv(GL_MATRIX_MODE, (GLint*)&mode);
-		if (mode != GL_PROJECTION) {
-			glMatrixMode(GL_PROJECTION);
-		}
-
-		glLoadIdentity();
-
-		if (mode != GL_PROJECTION_MATRIX) {
-			glMatrixMode(mode); /* restore */
-		}
-
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	unit_m4(Projection);
 	CHECKMAT(Projection3D);
 	state.dirty = true;
@@ -262,25 +159,6 @@ void gpuLoadIdentityProjectionMatrix(void)
 
 void gpuLoadProjectionMatrix(const float m[4][4])
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		GLenum mode;
-		glGetIntegerv(GL_MATRIX_MODE, (GLint*)&mode);
-		if (mode != GL_PROJECTION) {
-			glMatrixMode(GL_PROJECTION);
-		}
-
-		glLoadMatrixf((const float*) m);
-
-		if (mode != GL_PROJECTION_MATRIX) {
-			glMatrixMode(mode); /* restore */
-		}
-
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	copy_m4_m4(Projection, m);
 	CHECKMAT(Projection3D);
 	state.dirty = true;
@@ -289,22 +167,11 @@ void gpuLoadProjectionMatrix(const float m[4][4])
 void gpuLoadIdentity(void)
 {
 	unit_m4(ModelView);
-#if SUPPORT_LEGACY_MATRIX
-	glLoadIdentity();
-#endif
 	state.dirty = true;
 }
 
 void gpuTranslate2f(float x, float y)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glTranslatef(x, y, 0.0f);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	Mat4 m;
 	unit_m4(m);
 	m[3][0] = x;
@@ -319,14 +186,6 @@ void gpuTranslate2fv(const float vec[2])
 
 void gpuTranslate3f(float x, float y, float z)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glTranslatef(x, y, z);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 #if 1
 	translate_m4(ModelView, x, y, z);
 	CHECKMAT(ModelView);
@@ -348,13 +207,6 @@ void gpuTranslate3fv(const float vec[3])
 
 void gpuScaleUniform(float factor)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glScalef(factor, factor, factor); /* always scale Z since we can't distinguish 2D from 3D */
-		state.dirty = true;
-		return;
-	}
-#endif
 	Mat4 m;
 	scale_m4_fl(m, factor);
 	gpuMultMatrix(m);
@@ -362,14 +214,6 @@ void gpuScaleUniform(float factor)
 
 void gpuScale2f(float x, float y)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glScalef(x, y, 1.0f);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	Mat4 m = {{0.0f}};
 	m[0][0] = x;
 	m[1][1] = y;
@@ -385,14 +229,6 @@ void gpuScale2fv(const float vec[2])
 
 void gpuScale3f(float x, float y, float z)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glScalef(x, y, z);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	Mat4 m = {{0.0f}};
 	m[0][0] = x;
 	m[1][1] = y;
@@ -408,14 +244,6 @@ void gpuScale3fv(const float vec[3])
 
 void gpuMultMatrix(const float m[4][4])
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glMultMatrixf((const float*) m);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	mul_m4_m4_post(ModelView, m);
 	CHECKMAT(ModelView);
 	state.dirty = true;
@@ -423,14 +251,6 @@ void gpuMultMatrix(const float m[4][4])
 
 void gpuRotate2D(float deg)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glRotatef(deg, 0.0f, 0.0f, 1.0f);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	/* essentially RotateAxis('Z')
 	 * TODO: simpler math for 2D case
 	 */
@@ -445,14 +265,6 @@ void gpuRotate3f(float deg, float x, float y, float z)
 
 void gpuRotate3fv(float deg, const float axis[3])
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		glRotatef(deg, axis[0], axis[1], axis[2]);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	Mat4 m;
 	axis_angle_to_mat4(m, axis, DEG2RADF(deg));
 	gpuMultMatrix(m);
@@ -460,21 +272,6 @@ void gpuRotate3fv(float deg, const float axis[3])
 
 void gpuRotateAxis(float deg, char axis)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		float a[3] = { 0.0f };
-		switch (axis) {
-			case 'X': a[0] = 1.0f; break;
-			case 'Y': a[1] = 1.0f; break;
-			case 'Z': a[2] = 1.0f; break;
-			default: BLI_assert(false); /* bad axis */
-		}
-		glRotatef(deg, a[0], a[1], a[2]);
-		state.dirty = true;
-		return;
-	}
-#endif
-
 	/* rotate_m4 works in place */
 	rotate_m4(ModelView, axis, DEG2RADF(deg));
 	CHECKMAT(ModelView);
@@ -599,26 +396,6 @@ static void mat4_look_from_origin(float m[4][4], float lookdir[3], float camup[3
 
 void gpuOrtho(float left, float right, float bottom, float top, float near, float far)
 {
-#if SUPPORT_LEGACY_MATRIX
-	{
-		GLenum mode;
-		glGetIntegerv(GL_MATRI

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list