From ea021e0a360af85f094705c6d887368f9b1bb682 Mon Sep 17 00:00:00 2001 From: XProger Date: Sat, 2 Jul 2022 05:15:10 +0300 Subject: [PATCH] #368 asm optimizations --- src/fixed/common.h | 233 ++++++++++---------- src/platform/gba/asm/common_asm.inc | 1 + src/platform/gba/asm/faceAddMeshQuads.s | 43 ++-- src/platform/gba/asm/faceAddMeshTriangles.s | 35 ++- src/platform/gba/asm/faceAddRoomQuads.s | 2 +- src/platform/gba/asm/faceAddRoomTriangles.s | 2 +- src/platform/gba/asm/transformMesh.s | 29 ++- src/platform/gba/asm/transformRoom.s | 31 +-- src/platform/gba/asm/transformRoomUW.s | 31 +-- src/platform/gba/main.cpp | 2 +- src/platform/gba/rasterizer.h | 8 +- 11 files changed, 213 insertions(+), 204 deletions(-) diff --git a/src/fixed/common.h b/src/fixed/common.h index 537a5913..656ec1dc 100644 --- a/src/fixed/common.h +++ b/src/fixed/common.h @@ -1,7 +1,7 @@ #ifndef H_COMMON #define H_COMMON //#define STATIC_ITEMS -//#define PROFILING +#define PROFILING #ifdef PROFILING #define STATIC_ITEMS #define PROFILE_FRAMETIME @@ -29,6 +29,8 @@ #define SND_FMT_OGG (1 << 14) #define SND_FMT_MP3 (1 << 15) +#define FIXED_SHIFT 14 + #if defined(__WIN32__) #define USE_DIV_TABLE #define MODEHW @@ -348,133 +350,22 @@ X_INLINE int32 abs(int32 x) { extern uint16 fb[VRAM_WIDTH * FRAME_HEIGHT]; #endif -#ifdef PROFILING - #define PROFILE_FRAME\ - CNT_UPDATE,\ - CNT_RENDER - - #define PROFILE_STAGES\ - CNT_TRANSFORM,\ - CNT_ADD,\ - CNT_FLUSH,\ - CNT_VERT,\ - CNT_POLY - - #define PROFILE_SOUND\ - CNT_SOUND - - #if defined(PROFILE_FRAMETIME) - enum ProfileCounterId { - PROFILE_FRAME, - CNT_MAX, - PROFILE_STAGES, - PROFILE_SOUND - }; - #elif defined(PROFILE_SOUNDTIME) - enum ProfileCounterId { - PROFILE_SOUND, - CNT_MAX, - PROFILE_FRAME, - PROFILE_STAGES - }; - #else - enum ProfileCounterId { - PROFILE_STAGES, - CNT_MAX, - PROFILE_FRAME, - PROFILE_SOUND - }; - #endif - - extern uint32 gCounters[CNT_MAX]; - - #if defined(__3DO__) || defined(__32X__) // should be first, armcpp bug (#elif) - extern int32 g_timer; - - #define PROFILE_START() {\ - g_timer = osGetSystemTimeMS();\ - } - - #define PROFILE_STOP(value) {\ - value += (osGetSystemTimeMS() - g_timer);\ - } - #elif defined(__WIN32__) || defined(__GBA_WIN__) - extern LARGE_INTEGER g_timer; - extern LARGE_INTEGER g_current; - - #define PROFILE_START() {\ - QueryPerformanceCounter(&g_timer);\ - } - - #define PROFILE_STOP(value) {\ - QueryPerformanceCounter(&g_current);\ - value += uint32(g_current.QuadPart - g_timer.QuadPart);\ - } - #elif defined(__GBA__) - #ifdef PROFILE_SOUNDTIME - #define TIMER_FREQ_DIV 1 - #else - #define TIMER_FREQ_DIV 3 - #endif - - #define PROFILE_START() {\ - REG_TM2CNT_L = 0;\ - REG_TM2CNT_H = (1 << 7) | TIMER_FREQ_DIV;\ - } - - #define PROFILE_STOP(value) {\ - value += REG_TM2CNT_L;\ - REG_TM2CNT_H = 0;\ - } - #else - #define PROFILE_START() aaa - #define PROFILE_STOP(value) bbb - #endif - - struct ProfileCounter - { - ProfileCounterId cnt; - - ProfileCounter(ProfileCounterId cnt) : cnt(cnt) { - if (cnt < CNT_MAX) { - PROFILE_START() - } - } - - ~ProfileCounter() { - if (cnt < CNT_MAX) { - PROFILE_STOP(gCounters[cnt]); - } - } - }; - - #define PROFILE(cnt) ProfileCounter profileCounter(cnt) - #define PROFILE_CLEAR() memset(gCounters, 0, sizeof(gCounters)); -#else - #define PROFILE(cnt) - #define PROFILE_CLEAR() -#endif - -#ifdef __TNS__ - void osSetPalette(uint16* palette); -#endif - #define STATIC_MESH_FLAG_NO_COLLISION 1 #define STATIC_MESH_FLAG_VISIBLE 2 #define MAX_STATIC_MESH_RADIUS (5 * 1024) extern int32 fps; -#define FIXED_SHIFT 14 - #ifndef F16_SHIFT #define F16_SHIFT 0 #endif #ifdef USE_MATRIX_INT16 - #define MATRIX_FIXED_SHIFT FIXED_SHIFT -#else - #define MATRIX_FIXED_SHIFT 0 + #define MATRIX_FIXED_SHIFT FIXED_SHIFT +#endif + +#ifndef MATRIX_FIXED_SHIFT + #define MATRIX_FIXED_SHIFT 0 #endif #define SND_MAX_DIST (8 * 1024) @@ -2966,4 +2857,112 @@ void osSetPalette(const uint16* palette); const void* osLoadScreen(LevelID id); const void* osLoadLevel(LevelID id); +#ifdef PROFILING + #define PROFILE_FRAME\ + CNT_UPDATE,\ + CNT_RENDER + + #define PROFILE_STAGES\ + CNT_TRANSFORM,\ + CNT_ADD,\ + CNT_FLUSH,\ + CNT_VERT,\ + CNT_POLY + + #define PROFILE_SOUND\ + CNT_SOUND + + #if defined(PROFILE_FRAMETIME) + enum ProfileCounterId { + PROFILE_FRAME, + CNT_MAX, + PROFILE_STAGES, + PROFILE_SOUND + }; + #elif defined(PROFILE_SOUNDTIME) + enum ProfileCounterId { + PROFILE_SOUND, + CNT_MAX, + PROFILE_FRAME, + PROFILE_STAGES + }; + #else + enum ProfileCounterId { + PROFILE_STAGES, + CNT_MAX, + PROFILE_FRAME, + PROFILE_SOUND + }; + #endif + + extern uint32 gCounters[CNT_MAX]; + + #if defined(__3DO__) || defined(__32X__) // should be first, armcpp bug (#elif) + extern int32 g_timer; + + #define PROFILE_START() {\ + g_timer = osGetSystemTimeMS();\ + } + + #define PROFILE_STOP(value) {\ + value += (osGetSystemTimeMS() - g_timer);\ + } + #elif defined(__WIN32__) || defined(__GBA_WIN__) + extern LARGE_INTEGER g_timer; + extern LARGE_INTEGER g_current; + + #define PROFILE_START() {\ + QueryPerformanceCounter(&g_timer);\ + } + + #define PROFILE_STOP(value) {\ + QueryPerformanceCounter(&g_current);\ + value += uint32(g_current.QuadPart - g_timer.QuadPart);\ + } + #elif defined(__GBA__) + #ifdef PROFILE_SOUNDTIME + #define TIMER_FREQ_DIV 1 + #else + #define TIMER_FREQ_DIV 3 + #endif + + #define PROFILE_START() {\ + REG_TM2CNT_L = 0;\ + REG_TM2CNT_H = (1 << 7) | TIMER_FREQ_DIV;\ + } + + #define PROFILE_STOP(value) {\ + value += REG_TM2CNT_L;\ + REG_TM2CNT_H = 0;\ + } + #else + #define PROFILE_START() aaa + #define PROFILE_STOP(value) bbb + #endif + + struct ProfileCounter + { + ProfileCounterId cnt; + + ProfileCounter(ProfileCounterId cnt) : cnt(cnt) { + if (cnt < CNT_MAX) { + PROFILE_START() + } + } + + ~ProfileCounter() { + if (cnt < CNT_MAX) { + PROFILE_STOP(gCounters[cnt]); + } + } + }; + + #define PROFILE(cnt) ProfileCounter profileCounter(cnt) + #define PROFILE_CLEAR() memset(gCounters, 0, sizeof(gCounters)); +#else + #define PROFILE(cnt) + #define PROFILE_CLEAR() +#endif + + #endif diff --git a/src/platform/gba/asm/common_asm.inc b/src/platform/gba/asm/common_asm.inc index edb29bf9..984f8ce5 100644 --- a/src/platform/gba/asm/common_asm.inc +++ b/src/platform/gba/asm/common_asm.inc @@ -94,6 +94,7 @@ .equ MIN_INT32, 0x80000000 .equ MAX_INT32, 0x7FFFFFFF +// res = divTable[x] (uint16) .macro divLUT res, x add \res, \x, #DIVLUT_ADDR ldrh \res, [\res, \x] diff --git a/src/platform/gba/asm/faceAddMeshQuads.s b/src/platform/gba/asm/faceAddMeshQuads.s index c5e2311a..54111411 100644 --- a/src/platform/gba/asm/faceAddMeshQuads.s +++ b/src/platform/gba/asm/faceAddMeshQuads.s @@ -24,10 +24,6 @@ vy1 .req vg3 vx2 .req vg2 vy2 .req vg2 -vz0 .req vg0 -vz1 .req vg1 -vz2 .req vg2 -vz3 .req vg3 depth .req vg0 tmp .req flags @@ -52,10 +48,12 @@ faceAddMeshQuads_asm: add polys, #2 // skip flags .loop: - ldrb vp0, [polys], #1 - ldrb vp1, [polys], #1 - ldrb vp2, [polys], #1 - ldrb vp3, [polys], #3 // + flags + ldrh vp0, [polys], #2 + lsr vp1, vp0, #8 + and vp0, #0xFF + ldrh vp2, [polys], #4 // + flags + lsr vp3, vp2, #8 + and vp2, #0xFF add vp0, vp, vp0, lsl #3 add vp1, vp, vp1, lsl #3 @@ -64,36 +62,33 @@ faceAddMeshQuads_asm: CCW .skip - // fetch clip flags - ldrb vg0, [vp0, #VERTEX_CLIP] - ldrb vg1, [vp1, #VERTEX_CLIP] - ldrb vg2, [vp2, #VERTEX_CLIP] - ldrb vg3, [vp3, #VERTEX_CLIP] + // fetch [c, g, zz] + ldr vg0, [vp0, #VERTEX_Z] + ldr vg1, [vp1, #VERTEX_Z] + ldr vg2, [vp2, #VERTEX_Z] + ldr vg3, [vp3, #VERTEX_Z] // check clipping and tmp, vg0, vg1 and tmp, vg2 and tmp, vg3 - tst tmp, #(CLIP_DISCARD >> 8) + tst tmp, #(CLIP_DISCARD << 16) bne .skip // mark if should be clipped by viewport orr tmp, vg0, vg1 orr tmp, vg2 orr tmp, vg3 - tst tmp, #(CLIP_FRAME >> 8) + tst tmp, #(CLIP_FRAME << 16) ldrh flags, [polys, #-8] orrne flags, #FACE_CLIPPED - // vz0 = AVG_Z4 (depth) - ldrh vz0, [vp0, #VERTEX_Z] - ldrh vz1, [vp1, #VERTEX_Z] - ldrh vz2, [vp2, #VERTEX_Z] - ldrh vz3, [vp3, #VERTEX_Z] - add depth, vz0, vz1 - add depth, vz2 - add depth, vz3 - lsr depth, #(2 + OT_SHIFT) + // depth = AVG_Z4 + lsl vg0, #16 + add depth, vg0, vg1, lsl #16 + add depth, vg2, lsl #16 + add depth, vg3, lsl #16 + lsr depth, #(16 + 2 + OT_SHIFT) // faceAdd rsb vp0, vertices, vp0, lsr #3 diff --git a/src/platform/gba/asm/faceAddMeshTriangles.s b/src/platform/gba/asm/faceAddMeshTriangles.s index d4f4a85a..9ed98f92 100644 --- a/src/platform/gba/asm/faceAddMeshTriangles.s +++ b/src/platform/gba/asm/faceAddMeshTriangles.s @@ -23,9 +23,6 @@ vy1 .req vg3 vx2 .req vg2 vy2 .req vg2 -vz0 .req vg0 -vz1 .req vg1 -vz2 .req vg2 depth .req vg0 tmp .req flags @@ -49,9 +46,11 @@ faceAddMeshTriangles_asm: add polys, #2 // skip flags .loop: - ldrb vp0, [polys], #1 - ldrb vp1, [polys], #1 - ldrb vp2, [polys], #4 // + padding + flags + ldrh vp0, [polys], #2 + lsr vp1, vp0, #8 + and vp0, #0xFF + ldrh vp2, [polys], #4 // + flags + and vp2, #0xFF add vp0, vp, vp0, lsl #3 add vp1, vp, vp1, lsl #3 @@ -59,31 +58,29 @@ faceAddMeshTriangles_asm: CCW .skip - // fetch clip flags - ldrb vg0, [vp0, #VERTEX_CLIP] - ldrb vg1, [vp1, #VERTEX_CLIP] - ldrb vg2, [vp2, #VERTEX_CLIP] + // fetch [c, g, zz] + ldr vg0, [vp0, #VERTEX_Z] + ldr vg1, [vp1, #VERTEX_Z] + ldr vg2, [vp2, #VERTEX_Z] // check clipping and tmp, vg0, vg1 and tmp, vg2 - tst tmp, #(CLIP_DISCARD >> 8) + tst tmp, #(CLIP_DISCARD << 16) bne .skip // mark if should be clipped by viewport orr tmp, vg0, vg1 orr tmp, vg2 - tst tmp, #(CLIP_FRAME >> 8) + tst tmp, #(CLIP_FRAME << 16) ldrh flags, [polys, #-8] orrne flags, #FACE_CLIPPED - // vz0 = AVG_Z3 (depth) - ldrh vz0, [vp0, #VERTEX_Z] - ldrh vz1, [vp1, #VERTEX_Z] - ldrh vz2, [vp2, #VERTEX_Z] - add depth, vz0, vz1 - add depth, vz2, lsl #1 - lsr depth, #(2 + OT_SHIFT) + // depth = AVG_Z3 + lsl vg0, #16 + add depth, vg0, vg1, lsl #16 + add depth, vg2, lsl #17 + lsr depth, #(16 + 2 + OT_SHIFT) // faceAdd rsb vp0, vertices, vp0, lsr #3 diff --git a/src/platform/gba/asm/faceAddRoomQuads.s b/src/platform/gba/asm/faceAddRoomQuads.s index e27aad75..bc880ab4 100644 --- a/src/platform/gba/asm/faceAddRoomQuads.s +++ b/src/platform/gba/asm/faceAddRoomQuads.s @@ -92,7 +92,7 @@ faceAddRoomQuads_asm: CCW .skip - // vz0 = MAX_Z4 (depth) + // depth = MAX_Z4 ldrh vz0, [vp0, #VERTEX_Z] ldrh vz1, [vp1, #VERTEX_Z] ldrh vz2, [vp2, #VERTEX_Z] diff --git a/src/platform/gba/asm/faceAddRoomTriangles.s b/src/platform/gba/asm/faceAddRoomTriangles.s index d9f278f0..80c92e14 100644 --- a/src/platform/gba/asm/faceAddRoomTriangles.s +++ b/src/platform/gba/asm/faceAddRoomTriangles.s @@ -83,7 +83,7 @@ faceAddRoomTriangles_asm: CCW .skip - // vz0 = MAX_Z3 (depth) + // depth = MAX_Z3 ldrh vz0, [vp0, #VERTEX_Z] ldrh vz1, [vp1, #VERTEX_Z] ldrh vz2, [vp2, #VERTEX_Z] diff --git a/src/platform/gba/asm/transformMesh.s b/src/platform/gba/asm/transformMesh.s index 2df1083d..be80ce4d 100644 --- a/src/platform/gba/asm/transformMesh.s +++ b/src/platform/gba/asm/transformMesh.s @@ -29,6 +29,8 @@ mw1 .req r14 ambient .req vz tmp .req vy +dx .req vz +dy .req tmp dz .req vz m .req vz @@ -52,7 +54,12 @@ transformMesh_asm: ldr m, [m] fiq_on ldmia m!, {mx0, my0, mz0, mw0, mx1, my1, mz1, mw1} - ldmia m, {mx2, my2, mz2, mw2}^ + asr mw0, #FIXED_SHIFT + asr mw1, #FIXED_SHIFT + fiq_off + ldmia m, {mx2, my2, mz2, mw2} + asr mw2, #FIXED_SHIFT + fiq_on .loop: // unpack vertex @@ -61,23 +68,23 @@ transformMesh_asm: ldrsh vz, [vertices], #2 // transform x - mla x, mx0, vx, mw0 + mul x, mx0, vx mla x, my0, vy, x mla x, mz0, vz, x - asr x, #FIXED_SHIFT + add x, mw0, x, asr #FIXED_SHIFT // transform y - mla y, mx1, vx, mw1 + mul y, mx1, vx mla y, my1, vy, y mla y, mz1, vz, y - asr y, #FIXED_SHIFT + add y, mw1, y, asr #FIXED_SHIFT fiq_off // transform z - mla z, mx2, vx, mw2 + mul z, mx2, vx mla z, my2, vy, z mla z, mz2, vz, z - asr z, #FIXED_SHIFT + add z, mw2, z, asr #FIXED_SHIFT bic vg, #CLIP_MASK // clear clipping flags @@ -93,10 +100,10 @@ transformMesh_asm: mov dz, z, lsr #4 add dz, z, lsr #6 divLUT tmp, dz - mul x, tmp, x - mul y, tmp, y - asr x, #(16 - PROJ_SHIFT) - asr y, #(16 - PROJ_SHIFT) + mul dx, x, tmp + mul dy, y, tmp + asr x, dx, #(16 - PROJ_SHIFT) + asr y, dy, #(16 - PROJ_SHIFT) add x, #(FRAME_WIDTH >> 1) add y, #(FRAME_HEIGHT >> 1) diff --git a/src/platform/gba/asm/transformRoom.s b/src/platform/gba/asm/transformRoom.s index 2e8d9a5a..6b3b534f 100644 --- a/src/platform/gba/asm/transformRoom.s +++ b/src/platform/gba/asm/transformRoom.s @@ -34,6 +34,8 @@ minXY .req vy maxXY .req vz tmp .req vy +dx .req vz +dy .req tmp dz .req vz fog .req vz @@ -59,8 +61,11 @@ transformRoom_asm: ldr m, [m] fiq_on ldmia m!, {mx0, my0, mz0, mw0, mx1, my1, mz1, mw1} - ldmia m, {mx2, my2, mz2, mw2}^ + asr mw0, #FIXED_SHIFT + asr mw1, #FIXED_SHIFT fiq_off + ldmia m, {mx2, my2, mz2, mw2} + asr mw2, #FIXED_SHIFT .loop: // unpack vertex @@ -71,10 +76,10 @@ transformRoom_asm: and vx, mask, v, lsl #10 // transform z - mla z, mx2, vx, mw2 + mul z, mx2, vx mla z, my2, vy, z mla z, mz2, vz, z - asr z, #FIXED_SHIFT + add z, mw2, z, asr #FIXED_SHIFT // skip if vertex is out of z-range add z, #VIEW_OFF @@ -87,16 +92,16 @@ transformRoom_asm: fiq_on // transform y - mla y, mx1, vx, mw1 + mul y, mx1, vx mla y, my1, vy, y mla y, mz1, vz, y - asr y, #FIXED_SHIFT + add y, mw1, y, asr #FIXED_SHIFT // transform x - mla x, mx0, vx, mw0 + mul x, mx0, vx mla x, my0, vy, x mla x, mz0, vz, x - asr x, #FIXED_SHIFT + add x, mw0, x, asr #FIXED_SHIFT fiq_off // fog @@ -116,13 +121,13 @@ transformRoom_asm: orrge vg, #CLIP_FAR // project - mov dz, z, lsr #6 - add dz, z, lsr #4 + mov dz, z, lsr #4 + add dz, z, lsr #6 divLUT tmp, dz - mul x, tmp, x - mul y, tmp, y - asr x, #(16 - PROJ_SHIFT) - asr y, #(16 - PROJ_SHIFT) + mul dx, x, tmp + mul dy, y, tmp + asr x, dx, #(16 - PROJ_SHIFT) + asr y, dy, #(16 - PROJ_SHIFT) // portal rect clipping ldmia sp, {minXY, maxXY} diff --git a/src/platform/gba/asm/transformRoomUW.s b/src/platform/gba/asm/transformRoomUW.s index 4ec8c313..de6654b7 100644 --- a/src/platform/gba/asm/transformRoomUW.s +++ b/src/platform/gba/asm/transformRoomUW.s @@ -34,6 +34,8 @@ minXY .req vy maxXY .req vz tmp .req vy +dx .req vz +dy .req tmp dz .req vz fog .req vz @@ -79,8 +81,11 @@ transformRoomUW_asm: ldr m, [m] fiq_on ldmia m!, {mx0, my0, mz0, mw0, mx1, my1, mz1, mw1} - ldmia m, {mx2, my2, mz2, mw2}^ + asr mw0, #FIXED_SHIFT + asr mw1, #FIXED_SHIFT fiq_off + ldmia m, {mx2, my2, mz2, mw2} + asr mw2, #FIXED_SHIFT .loop: // unpack vertex @@ -91,10 +96,10 @@ transformRoomUW_asm: and vx, mask, v, lsl #10 // transform z - mla z, mx2, vx, mw2 + mul z, mx2, vx mla z, my2, vy, z mla z, mz2, vz, z - asr z, #FIXED_SHIFT + add z, mw2, z, asr #FIXED_SHIFT // skip if vertex is out of z-range add z, #VIEW_OFF @@ -107,16 +112,16 @@ transformRoomUW_asm: fiq_on // transform y - mla y, mx1, vx, mw1 + mul y, mx1, vx mla y, my1, vy, y mla y, mz1, vz, y - asr y, #FIXED_SHIFT + add y, mw1, y, asr #FIXED_SHIFT // transform x - mla x, mx0, vx, mw0 + mul x, mx0, vx mla x, my0, vy, x mla x, mz0, vz, x - asr x, #FIXED_SHIFT + add x, mw0, x, asr #FIXED_SHIFT fiq_off // caustics @@ -147,13 +152,13 @@ transformRoomUW_asm: orrge vg, #CLIP_FAR // project - mov dz, z, lsr #6 - add dz, z, lsr #4 + mov dz, z, lsr #4 + add dz, z, lsr #6 divLUT tmp, dz - mul x, tmp, x - mul y, tmp, y - asr x, #(16 - PROJ_SHIFT) - asr y, #(16 - PROJ_SHIFT) + mul dx, x, tmp + mul dy, y, tmp + asr x, dx, #(16 - PROJ_SHIFT) + asr y, dy, #(16 - PROJ_SHIFT) // portal rect clipping ldmia sp, {minXY, maxXY} diff --git a/src/platform/gba/main.cpp b/src/platform/gba/main.cpp index f5323650..48417998 100644 --- a/src/platform/gba/main.cpp +++ b/src/platform/gba/main.cpp @@ -214,7 +214,7 @@ const void* osLoadLevel(LevelID id) delete[] levelData; - sprintf(buf, "data/%s.PKD", gLevelInfo[id].data); + sprintf(buf, "data/%s.PKD", (const char*)gLevelInfo[id].data); FILE *f = fopen(buf, "rb"); diff --git a/src/platform/gba/rasterizer.h b/src/platform/gba/rasterizer.h index 53ab6ac9..bc4500eb 100644 --- a/src/platform/gba/rasterizer.h +++ b/src/platform/gba/rasterizer.h @@ -514,7 +514,7 @@ void rasterizeFT_c(uint16* pixel, const VertexLink* L, const VertexLink* R) void rasterizeGT_c(uint16* pixel, const VertexLink* L, const VertexLink* R) { #ifdef ALIGNED_LIGHTMAP - ASSERT((intptr_t(lightmap) & 0xFFFF) == 0); // lightmap should be 64k aligned + ASSERT((intptr_t(gLightmap) & 0xFFFF) == 0); // lightmap should be 64k aligned #endif int32 Lh = 0, Rh = 0; @@ -629,7 +629,7 @@ void rasterizeGT_c(uint16* pixel, const VertexLink* L, const VertexLink* R) } #ifdef ALIGNED_LIGHTMAP - g += intptr_t(lightmap); + g += intptr_t(gLightmap); #endif width >>= 1; @@ -809,7 +809,7 @@ void rasterizeFTA_c(uint16* pixel, const VertexLink* L, const VertexLink* R) void rasterizeGTA_c(uint16* pixel, const VertexLink* L, const VertexLink* R) { #ifdef ALIGNED_LIGHTMAP - ASSERT((intptr_t(lightmap) & 0xFFFF) == 0); // lightmap should be 64k aligned + ASSERT((intptr_t(gLightmap) & 0xFFFF) == 0); // lightmap should be 64k aligned #endif int32 Lh = 0, Rh = 0; @@ -935,7 +935,7 @@ void rasterizeGTA_c(uint16* pixel, const VertexLink* L, const VertexLink* R) } #ifdef ALIGNED_LIGHTMAP - g += intptr_t(lightmap); + g += intptr_t(gLightmap); #endif width >>= 1;