summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThilo Schulz <arny@ats.s.bawue.de>2011-06-16 22:28:13 +0000
committerTim Angus <tim@ngus.net>2013-01-10 21:31:12 +0000
commit4a71993ec6ef433bc44dc91c8cc776c7b402fe9f (patch)
tree358f42b106343cb83f2a93f73d988169954a3a11
parentd18bb965e36652ce4fa80ff6657173f2ed91ccbd (diff)
patch by Zack Middleton (#5044) - Fix a few comments in tr_local.h - A bit of refactoring of the cpp macros
-rw-r--r--src/renderer/tr_local.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/renderer/tr_local.h b/src/renderer/tr_local.h
index 1dea4bb3..fe7a4ba5 100644
--- a/src/renderer/tr_local.h
+++ b/src/renderer/tr_local.h
@@ -40,15 +40,16 @@ typedef unsigned int glIndex_t;
// 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 {
@@ -822,21 +823,24 @@ compared quickly during the qsorting process
the bits are allocated as follows:
-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
+//2 : used to be clipped flag REMOVED - 03.21.00 rad
+2 - 6 : fog index
+11 - 20 : entity index
+21 - 31 : sorted shader index
TTimo - 1.32
-17-31 : sorted shader index
-7-16 : entity index
-2-6 : fog index
0-1 : dlightmap index
+2-6 : fog index
+7-16 : entity 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;