a-c.c: Compile vlineasm4nlogy() only if CLASSIC_NONPOW2_YSIZE_WALLS is #defined.

Also make three file-scope variables static.

git-svn-id: https://svn.eduke32.com/eduke32@4758 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-11-22 18:37:23 +00:00
parent e919dee00f
commit b65ae1b741
3 changed files with 27 additions and 20 deletions

View file

@ -11,6 +11,11 @@
#define CLASSIC_SLICE_BY_4 #define CLASSIC_SLICE_BY_4
#define A_C_RESTRICT __restrict #define A_C_RESTRICT __restrict
#define CLASSIC_NONPOW2_YSIZE_SPRITES
#ifdef LUNATIC
# define CLASSIC_NONPOW2_YSIZE_WALLS
#endif
/** Definitions of high-precision integer types. **/ /** Definitions of high-precision integer types. **/
// Should be used for values that represent coordinates with which calculations // Should be used for values that represent coordinates with which calculations
// like dot product are carried out. Substituting 32-bit ints for these will // like dot product are carried out. Substituting 32-bit ints for these will

View file

@ -37,9 +37,10 @@ char *a64_gtrans;
#endif #endif
static int32_t bpl, transmode = 0; static int32_t bpl, transmode = 0;
int32_t glogx, glogy, gpinc; static char *gbuf;
static int32_t glogx, glogy;
int32_t gpinc;
static int32_t gbxinc, gbyinc; static int32_t gbxinc, gbyinc;
char *gbuf;
static char *gpal, *ghlinepal, *gtrans; static char *gpal, *ghlinepal, *gtrans;
static char *gpal2; static char *gpal2;
@ -219,13 +220,14 @@ typedef uint32_t uint32_vec4 __attribute__ ((vector_size (16)));
# define saturate_vplc_trans(vplc, vinc) # define saturate_vplc_trans(vplc, vinc)
#endif #endif
#ifdef CLASSIC_NONPOW2_YSIZE_WALLS
// cnt >= 1 // cnt >= 1
void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, char *const A_C_RESTRICT * buf, static void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, char *const A_C_RESTRICT * buf,
#ifdef USE_VECTOR_EXT # ifdef USE_VECTOR_EXT
uint32_vec4 vplc, const uint32_vec4 vinc) uint32_vec4 vplc, const uint32_vec4 vinc)
#else # else
uint32_t * vplc, const int32_t *vinc) uint32_t * vplc, const int32_t *vinc)
#endif # endif
{ {
const int32_t ourbpl = bpl; const int32_t ourbpl = bpl;
@ -236,19 +238,20 @@ void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, char *
p[2] = pal[2][buf[2][ourmulscale32(vplc[2], globaltilesizy)]]; p[2] = pal[2][buf[2][ourmulscale32(vplc[2], globaltilesizy)]];
p[3] = pal[3][buf[3][ourmulscale32(vplc[3], globaltilesizy)]]; p[3] = pal[3][buf[3][ourmulscale32(vplc[3], globaltilesizy)]];
#if defined USE_VECTOR_EXT # if defined USE_VECTOR_EXT
vplc += vinc; vplc += vinc;
#else # else
vplc[0] += vinc[0]; vplc[0] += vinc[0];
vplc[1] += vinc[1]; vplc[1] += vinc[1];
vplc[2] += vinc[2]; vplc[2] += vinc[2];
vplc[3] += vinc[3]; vplc[3] += vinc[3];
#endif # endif
p += ourbpl; p += ourbpl;
} while (--cnt); } while (--cnt);
Bmemcpy(&vplce[0], &vplc[0], sizeof(uint32_t) * 4); Bmemcpy(&vplce[0], &vplc[0], sizeof(uint32_t) * 4);
} }
#endif
// cnt >= 1 // cnt >= 1
void vlineasm4(int32_t cnt, char *p) void vlineasm4(int32_t cnt, char *p)
@ -264,12 +267,17 @@ void vlineasm4(int32_t cnt, char *p)
#endif #endif
const int32_t logy = glogy, ourbpl = bpl; const int32_t logy = glogy, ourbpl = bpl;
if (EDUKE32_PREDICT_FALSE(!logy)) // I had an assert on logy for quite a while that NEVER triggered... #ifdef CLASSIC_NONPOW2_YSIZE_WALLS
if (EDUKE32_PREDICT_FALSE(!logy))
{ {
// This should only happen when 'globalshiftval = 0' has been set in engine.c.
vlineasm4nlogy(cnt, p, pal, buf, vplc, vinc); vlineasm4nlogy(cnt, p, pal, buf, vplc, vinc);
return; return;
} }
#else
assert(logy);
#endif
// just fucking shoot me // just fucking shoot me
#ifdef CLASSIC_SLICE_BY_4 #ifdef CLASSIC_SLICE_BY_4
for (; cnt>=4;cnt-=4) for (; cnt>=4;cnt-=4)

View file

@ -53,11 +53,6 @@ L_State g_engState;
#endif #endif
#define CACHEAGETIME 16 #define CACHEAGETIME 16
#define CLASSIC_NONPOW2_YSIZE_SPRITES
#ifdef LUNATIC
# define CLASSIC_NONPOW2_YSIZE_WALLS
#endif
#if !defined(__arm__) && !defined(GEKKO) #if !defined(__arm__) && !defined(GEKKO)
#define HIGH_PRECISION_SPRITE #define HIGH_PRECISION_SPRITE
@ -4208,15 +4203,14 @@ static int32_t gglogx, gglogy, ggpinc;
static char *ggbuf, *ggpal; static char *ggbuf, *ggpal;
#ifdef ENGINE_USING_A_C #ifdef ENGINE_USING_A_C
extern int32_t glogx, glogy, gpinc; extern int32_t gpinc;
extern char *gbuf;
#endif #endif
static inline void setupslopevlin_alsotrans(int32_t logylogx, intptr_t bufplc, int32_t pinc) static inline void setupslopevlin_alsotrans(int32_t logylogx, intptr_t bufplc, int32_t pinc)
{ {
#ifdef ENGINE_USING_A_C #ifdef ENGINE_USING_A_C
glogx = (logylogx&255); glogy = (logylogx>>8); sethlinesizes(logylogx&255, logylogx>>8, bufplc);
gbuf = (char *) bufplc; gpinc = pinc; gpinc = pinc;
#else #else
setupslopevlin(logylogx, bufplc, pinc); setupslopevlin(logylogx, bufplc, pinc);
#endif #endif