From a7dc8e4721c87848c809c24eb788512e8a4654d6 Mon Sep 17 00:00:00 2001 From: myT <> Date: Sat, 11 Nov 2023 03:38:32 +0100 Subject: [PATCH] re-enabled the r_ignoreShaderSortKey 0 debug validation code --- code/renderer/tr_main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/renderer/tr_main.cpp b/code/renderer/tr_main.cpp index 555645a..5c2a126 100644 --- a/code/renderer/tr_main.cpp +++ b/code/renderer/tr_main.cpp @@ -1519,12 +1519,14 @@ static void R_SortDrawSurfs( int firstDrawSurf, int firstLitSurf ) const sortFunc_t transpSort = r_ignoreShaderSortKey->integer ? &R_CompareDrawSurfNoKey : &R_CompareDrawSurf; qsort( drawSurfs + numDrawSurfs - numTranspSurfs, numTranspSurfs, sizeof(drawSurf_t), transpSort ); -#if 0 +#if defined(_DEBUG) if ( r_ignoreShaderSortKey->integer == 0 ) { + // all surfaces must be in sort order except the sky + // because we draw it after all the other opaque surfaces float prevSort = -1.0f; for ( int i = 0; i < numDrawSurfs; ++i ) { - R_DecomposeSort( (drawSurfs + i)->sort, &entityNum, &shader, &fogNum ); - assert( shader->sort >= prevSort ); + R_DecomposeSort( (drawSurfs + i)->sort, &entityNum, &shader ); + Q_assert( shader->isSky || shader->sort >= prevSort ); prevSort = shader->sort; } }