From f752da7d03b1e9bd1827c78eef4e9aa1f1b01024 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 31 Oct 2024 12:02:48 +0100 Subject: [PATCH] formatting stuff lul --- src/hardware/hw_batching.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 43e81210e..75b29b697 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -46,12 +46,12 @@ int unsortedVertexArrayAllocSize = 65536; // Call HWR_RenderBatches to render all the collected geometry. void HWR_StartBatching(void) { - if (currently_batching) + if (currently_batching) { - I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches"); + I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches"); } - // init arrays if that has not been done yet + // init arrays if that has not been done yet if (!finalVertexArray) { finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector)); @@ -61,7 +61,7 @@ void HWR_StartBatching(void) unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector)); } - currently_batching = true; + currently_batching = true; } // This replaces the direct calls to pfnSetTexture in cases where batching is available. @@ -69,14 +69,14 @@ void HWR_StartBatching(void) // Doing this was easier than getting a texture pointer to HWR_ProcessPolygon. void HWR_SetCurrentTexture(GLMipmap_t *texture) { - if (currently_batching) - { - current_texture = texture; - } - else - { - HWD.pfnSetTexture(texture); - } + if (currently_batching) + { + current_texture = texture; + } + else + { + HWD.pfnSetTexture(texture); + } } // If batching is enabled, this function collects the polygon data and the chosen texture @@ -84,7 +84,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture) // render the polygon immediately. void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader_target, boolean horizonSpecial) { - if (currently_batching) + if (currently_batching) { if (!pSurf) I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to @@ -220,7 +220,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2) // the rendering backend to draw them. void HWR_RenderBatches(void) { - int finalVertexWritePos = 0;// position in finalVertexArray + int finalVertexWritePos = 0;// position in finalVertexArray int finalIndexWritePos = 0;// position in finalVertexIndexArray int polygonReadPos = 0;// position in polygonArraySorted @@ -236,7 +236,7 @@ void HWR_RenderBatches(void) int i; - if (!currently_batching) + if (!currently_batching) I_Error("HWR_RenderBatches called without starting batching"); nextSurfaceInfo.LightInfo.fade_end = 0; @@ -256,6 +256,7 @@ void HWR_RenderBatches(void) ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0; ps_hw_numshaders.value.i = ps_hw_numtextures.value.i = ps_hw_numpolyflags.value.i = ps_hw_numcolors.value.i = 1; + // init polygonArraySorted for (i = 0; i < polygonArraySize; i++) { @@ -269,6 +270,7 @@ void HWR_RenderBatches(void) else qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygonsNoShaders); PS_STOP_TIMING(ps_hw_batchsorttime); + // sort order // 1. shader // 2. texture @@ -294,7 +296,7 @@ void HWR_RenderBatches(void) if (currentPolyFlags & PF_NoTexture) currentTexture = NULL; - else + else HWD.pfnSetTexture(currentTexture); while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons) @@ -457,6 +459,7 @@ void HWR_RenderBatches(void) ps_hw_numcolors.value.i++; } + // and that should be it? } } // reset the arrays (set sizes to 0) @@ -466,5 +469,4 @@ void HWR_RenderBatches(void) PS_STOP_TIMING(ps_hw_batchdrawtime); } - #endif // HWRENDER