shithub: tinygl

Download patch

ref: 9269b2aeddb72669cabd1a84a267b105cec5823d
parent: d84b421997defe3e962878949039dba0002faa34
author: MHS <gek@katherine>
date: Tue Mar 23 10:44:30 EDT 2021

Automatic commit.

--- a/include/zfeatures.h
+++ b/include/zfeatures.h
@@ -68,7 +68,7 @@
 //MULTITHREADING OPTIONS, only applicable if compiled with -fopenmp
 
 //Enable DrawPixels to offload the rendering of individual scanlines to separate threads.
-#define TGL_FEATURE_MULTITHREADED_DRAWPIXELS	0
+#define TGL_FEATURE_MULTITHREADED_DRAWPIXELS	1
 //Enable multithreading glCopyTexImage2D
 #define TGL_FEATURE_MULTITHREADED_COPY_TEXIMAGE_2D 1
 //Enable multithreading the ZB_CopyBuffer operation.
--- a/src/clip.c
+++ b/src/clip.c
@@ -20,9 +20,9 @@
 		v->zp.z = (GLint)(v->pc.Z * winv * c->viewport.scale.Z + c->viewport.trans.Z);
 	}
 	/* color */
-	v->zp.r = (GLuint)(v->color.v[0] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
-	v->zp.g = (GLuint)(v->color.v[1] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
-	v->zp.b = (GLuint)(v->color.v[2] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
+	v->zp.r = (GLint)(v->color.v[0] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
+	v->zp.g = (GLint)(v->color.v[1] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
+	v->zp.b = (GLint)(v->color.v[2] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
 
 	/* texture */
 
@@ -254,8 +254,11 @@
 		q->color.v[1] = p0->color.v[1] + (p1->color.v[1] - p0->color.v[1]) * t;
 		q->color.v[2] = p0->color.v[2] + (p1->color.v[2] - p0->color.v[2]) * t;
 	}
-	//	*/
-	if (c->texture_2d_enabled) {
+	
+#if TGL_OPTIMIZATION_HINT_BRANCH_COST < 1
+	if (c->texture_2d_enabled) 
+#endif
+	{
 		q->tex_coord.X = p0->tex_coord.X + (p1->tex_coord.X - p0->tex_coord.X) * t;
 		q->tex_coord.Y = p0->tex_coord.Y + (p1->tex_coord.Y - p0->tex_coord.Y) * t;
 	}
--- a/src/get.c
+++ b/src/get.c
@@ -96,11 +96,9 @@
 #if TGL_FEATURE_GL_POLYGON == 1
 "TGL_FEATURE_GL_POLYGON "
 #endif
-#if TGL_FEATURE_NO_COPY_COLOR == 1
-"TGL_FEATURE_NO_COPY_COLOR "
-#endif
 
 
+
 #if TGL_FEATURE_BLEND == 1
 "TGL_FEATURE_BLEND "
 #endif
@@ -111,6 +109,10 @@
 "TGL_FEATURE_NO_DRAW_COLOR "
 #endif
 
+#if TGL_FEATURE_NO_COPY_COLOR == 1
+"TGL_FEATURE_NO_COPY_COLOR "
+#endif
+
 #if TGL_FEATURE_FORCE_CLEAR_NO_COPY_COLOR == 1
 "TGL_FEATURE_FORCE_CLEAR_NO_COPY_COLOR "
 #endif
@@ -130,6 +132,7 @@
 #endif
 #if defined(_OPENMP)
 "TGL_FEATURE_MULTI_THREADED "
+"TGL_FEATURE_MULTI_THREADED_POST_PROCESS "
 
 #if TGL_FEATURE_MULTITHREADED_DRAWPIXELS == 1
 "TGL_FEATURE_MULTITHREADED_DRAWPIXELS "
@@ -151,8 +154,10 @@
 "TGL_FEATURE_ALIGNAS "
 #endif
 "TGL_BUFFER_EXT "
+#if TGL_FEATURE_ALT_RENDERMODES
 "TGL_FEEDBACK "
 "TGL_SELECT "
+#endif
 "TGL_SOFTWARE_ACCELERATED";
 const GLubyte* glGetString(GLenum name){
 	switch(name){
--- a/src/vertex.c
+++ b/src/vertex.c
@@ -137,14 +137,14 @@
 		v->zp.z = (GLint)(v->pc.Z * winv * c->viewport.scale.Z + c->viewport.trans.Z);
 	}
 	
-	v->zp.r = (GLuint)(v->color.v[0] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
-	v->zp.g = (GLuint)(v->color.v[1] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
-	v->zp.b = (GLuint)(v->color.v[2] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
+	v->zp.r = (GLint)(v->color.v[0] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
+	v->zp.g = (GLint)(v->color.v[1] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
+	v->zp.b = (GLint)(v->color.v[2] * COLOR_CORRECTED_MULT_MASK + COLOR_MIN_MULT) & COLOR_MASK;
 
 	
-//#if TGL_OPTIMIZATION_HINT_BRANCH_COST < 1
+#if TGL_OPTIMIZATION_HINT_BRANCH_COST < 1
 	if (c->texture_2d_enabled) 
-//#endif
+#endif
 	{
 		v->zp.s = (GLint)(v->tex_coord.X * (ZB_POINT_S_MAX - ZB_POINT_S_MIN) + ZB_POINT_S_MIN); //MARKED
 		v->zp.t = (GLint)(v->tex_coord.Y * (ZB_POINT_T_MAX - ZB_POINT_T_MIN) + ZB_POINT_T_MIN); //MARKED
@@ -155,9 +155,9 @@
 	GLfloat* m;
 	GLContext* c = gl_get_context();
 
-//#if TGL_OPTIMIZATION_HINT_BRANCH_COST < 2
+
 	if (c->lighting_enabled) 
-//#endif
+
 	{
 		/* eye coordinates needed for lighting */
 		V4* n;
@@ -185,7 +185,7 @@
 			gl_V3_Norm_Fast(&v->normal);
 		}
 	} 
-//#if TGL_OPTIMIZATION_HINT_BRANCH_COST < 2
+
 	else {
 		/* no eye coordinates needed, no normal */
 		/* NOTE: W = 1 is assumed */
@@ -200,7 +200,7 @@
 			v->pc.W = (v->coord.X * m[12] + v->coord.Y * m[13] + v->coord.Z * m[14] + m[15]);
 		}
 	}
-//#endif
+
 	v->clip_code = gl_clipcode(v->pc.X, v->pc.Y, v->pc.Z, v->pc.W);
 }
 
@@ -242,13 +242,10 @@
 		v->color = c->current_color;
 	}
 	/* tex coords */
-
-	if (c->texture_2d_enabled) {
-#if TGL_FEATURE_LIT_TEXTURES == 1
-//Bad!
-//		if (!(c->lighting_enabled))
-//			v->color = gl_V4_New(1, 1, 1, 0); // Fix by GEK for unlit textured models.
+#if TGL_OPTIMIZATION_HINT_BRANCH_COST < 1
+	if (c->texture_2d_enabled) 
 #endif
+	{
 		if (c->apply_texture_matrix) {
 			gl_M4_MulV4(&v->tex_coord, c->matrix_stack_ptr[2], &c->current_tex_coord);
 		} else {
@@ -256,8 +253,10 @@
 		}
 	}
 	/* precompute the mapping to the viewport */
+#if TGL_OPTIMIZATION_HINT_BRANCH_COST < 2
 	if (v->clip_code == 0)
-		gl_transform_to_viewport_vertex_c(v);
+#endif
+	{	gl_transform_to_viewport_vertex_c(v);}
 
 	/* edge flag */
 	v->edge_flag = c->current_edge_flag;