summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;