[Bf-blender-cvs] [a49708a6918] blender2.8: OpenGL: stop using GL_NORMALIZE

Mike Erwin noreply at git.blender.org
Thu Apr 27 17:29:24 CEST 2017


Commit: a49708a69181b4c15fb2bd58f6721a39a7e9b0e6
Author: Mike Erwin
Date:   Thu Apr 27 10:35:12 2017 -0400
Branches: blender2.8
https://developer.blender.org/rBa49708a69181b4c15fb2bd58f6721a39a7e9b0e6

OpenGL: stop using GL_NORMALIZE

With GLSL there is no need for GL_NORMALIZE. We explicitly normalize in the shader, or (better) send in unit vectors.

Part of T51164

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

M	source/blender/blenkernel/intern/subsurf_ccg.c
M	source/blender/gpu/GPU_draw.h
M	source/blender/gpu/intern/gpu_draw.c

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

diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 9a06fa9e848..35887c12d62 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1901,7 +1901,8 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
 	no[1] = b_dZ * a_cX - b_dX * a_cZ;
 	no[2] = b_dX * a_cY - b_dY * a_cX;
 
-	/* don't normalize, GL_NORMALIZE is enabled */
+	normalize_v3(no); /* we no longer rely on GL_NORMALIZE */
+
 	glNormal3fv(no);
 }
 
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index b9bf39118db..7afb4c2b88b 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -198,7 +198,6 @@ typedef struct GPUStateValues
 	unsigned int is_line_smooth : 1;
 	unsigned int is_color_logic_op : 1;
 	unsigned int is_multisample : 1;
-	unsigned int is_normalize : 1;
 	unsigned int is_polygon_offset_line : 1;
 	unsigned int is_polygon_offset_fill : 1;
 	unsigned int is_polygon_smooth : 1;
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 85180b74246..19fb37b47a6 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -2291,8 +2291,6 @@ void GPU_state_init(void)
 	glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
 
 	glDepthFunc(GL_LEQUAL);
-	/* scaling matrices */
-	glEnable(GL_NORMALIZE);
 
 	glDisable(GL_ALPHA_TEST);
 	glDisable(GL_BLEND);
@@ -2548,7 +2546,6 @@ void gpuSaveState(GPUStateValues *values, eGPUStateMask mask)
 		values->is_line_smooth = glIsEnabled(GL_LINE_SMOOTH);
 		values->is_color_logic_op = glIsEnabled(GL_COLOR_LOGIC_OP);
 		values->is_multisample = glIsEnabled(GL_MULTISAMPLE);
-		values->is_normalize = glIsEnabled(GL_NORMALIZE);
 		values->is_polygon_offset_line = glIsEnabled(GL_POLYGON_OFFSET_LINE);
 		values->is_polygon_offset_fill = glIsEnabled(GL_POLYGON_OFFSET_FILL);
 		values->is_polygon_smooth = glIsEnabled(GL_POLYGON_SMOOTH);
@@ -2612,7 +2609,6 @@ void gpuRestoreState(GPUStateValues *values)
 		restore_mask(GL_LINE_SMOOTH, values->is_line_smooth);
 		restore_mask(GL_COLOR_LOGIC_OP, values->is_color_logic_op);
 		restore_mask(GL_MULTISAMPLE, values->is_multisample);
-		restore_mask(GL_NORMALIZE, values->is_normalize);
 		restore_mask(GL_POLYGON_OFFSET_LINE, values->is_polygon_offset_line);
 		restore_mask(GL_POLYGON_OFFSET_FILL, values->is_polygon_offset_fill);
 		restore_mask(GL_POLYGON_SMOOTH, values->is_polygon_smooth);




More information about the Bf-blender-cvs mailing list