[quake3-commits] r2039 - trunk/code/renderer

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Jun 16 18:28:13 EDT 2011


Author: thilo
Date: 2011-06-16 18:28:13 -0400 (Thu, 16 Jun 2011)
New Revision: 2039

Modified:
   trunk/code/renderer/tr_local.h
Log:
patch by Zack Middleton (#5044)
- Fix a few comments in tr_local.h
- A bit of refactoring of the cpp macros


Modified: trunk/code/renderer/tr_local.h
===================================================================
--- trunk/code/renderer/tr_local.h	2011-06-16 22:20:03 UTC (rev 2038)
+++ trunk/code/renderer/tr_local.h	2011-06-16 22:28:13 UTC (rev 2039)
@@ -39,15 +39,16 @@
 // parallel on a dual cpu machine
 #define	SMP_FRAMES		2
 
-// 12 bits
+// 14 bits
+// can't be increased without changing bit packing for drawsurfs
 // see QSORT_SHADERNUM_SHIFT
-#define	MAX_SHADERS				16384
+#define SHADERNUM_BITS	14
+#define MAX_SHADERS		(1<<SHADERNUM_BITS)
 
 //#define MAX_SHADER_STATES 2048
 #define MAX_STATES_PER_SHADER 32
 #define MAX_STATE_NAME 32
 
-// can't be increased without changing bit packing for drawsurfs
 
 
 typedef struct dlight_s {
@@ -821,21 +822,24 @@
 
 the bits are allocated as follows:
 
+0 - 1	: dlightmap index
+//2		: used to be clipped flag REMOVED - 03.21.00 rad
+2 - 6	: fog index
+11 - 20	: entity index
 21 - 31	: sorted shader index
-11 - 20	: entity index
-2 - 6	: fog index
-//2		: used to be clipped flag REMOVED - 03.21.00 rad
-0 - 1	: dlightmap index
 
 	TTimo - 1.32
-17-31 : sorted shader index
+0-1   : dlightmap index
+2-6   : fog index
 7-16  : entity index
-2-6   : fog index
-0-1   : dlightmap index
+17-30 : sorted shader index
 */
-#define	QSORT_SHADERNUM_SHIFT	17
+#define	QSORT_FOGNUM_SHIFT	2
 #define	QSORT_ENTITYNUM_SHIFT	7
-#define	QSORT_FOGNUM_SHIFT		2
+#define	QSORT_SHADERNUM_SHIFT	(QSORT_ENTITYNUM_SHIFT+GENTITYNUM_BITS)
+#if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32
+	#error "Need to update sorting, too many bits."
+#endif
 
 extern	int			gl_filter_min, gl_filter_max;
 



More information about the quake3-commits mailing list