Fixed crash in FixRenderCommandList() We can skip whole CGEN_LIGHTING_DIFFUSE

Fixed crash in FixRenderCommandList()
We can skip whole CGEN_LIGHTING_DIFFUSE

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e388e78..6c3a0b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -148,6 +148,7 @@ set( GPURENDERER_HEADERS
 	${MOUNT_DIR}/GPURenderer/r_splash.hpp
 	${MOUNT_DIR}/API/renderer_api.hpp
 	${MOUNT_DIR}/GPURenderer/r_types.hpp
+	${MOUNT_DIR}/GPURenderer/r_cmdsTemplate.hpp
 )
 
 set( GPURENDERER_SOURCES
diff --git a/src/engine/GPURenderer/r_shader.cpp b/src/engine/GPURenderer/r_shader.cpp
index 02463d5..73f92d8 100644
--- a/src/engine/GPURenderer/r_shader.cpp
+++ b/src/engine/GPURenderer/r_shader.cpp
@@ -1528,8 +1528,7 @@ static bool ParseStage( shaderStage_t* stage, valueType** text )
     // decide which agens we can skip
     if( stage->alphaGen == AGEN_IDENTITY )
     {
-        if( stage->rgbGen == CGEN_IDENTITY
-                || stage->rgbGen == CGEN_LIGHTING_DIFFUSE )
+        if( stage->rgbGen == CGEN_IDENTITY /* || stage->rgbGen == CGEN_LIGHTING_DIFFUSE*/ )
         {
             stage->alphaGen = AGEN_SKIP;
         }
@@ -3303,7 +3302,7 @@ static void FixRenderCommandList( sint newShader )
                         sortedIndex = ( ( drawSurf->sort >> QSORT_SHADERNUM_SHIFT ) & ( MAX_SHADERS - 1 ) );
                         if( sortedIndex >= newShader )
                         {
-                            sortedIndex++;
+                            sortedIndex = shader->sortedIndex;
                             drawSurf->sort = ( sortedIndex << QSORT_SHADERNUM_SHIFT ) | entityNum | ( fogNum << QSORT_FOGNUM_SHIFT ) | ( ( sint )pshadowMap << QSORT_PSHADOW_SHIFT ) | ( sint )dlightMap;
                         }
                     }

GitHub
sha: b3425325