mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Port tvlineasm2 to C and enable transmaskvline2 code also for all-C builds.
With the same setup as before, a screen-filling translucent wall (with nothing drawn behind it) renders at about 7 fps faster (from 60-something fps initially) git-svn-id: https://svn.eduke32.com/eduke32@2498 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e191a915f7
commit
020c60feec
3 changed files with 71 additions and 4 deletions
|
@ -135,6 +135,9 @@ void mvlineasm4(int32_t cnt, char *p);
|
||||||
void setuptvlineasm(int32_t neglogy);
|
void setuptvlineasm(int32_t neglogy);
|
||||||
int32_t tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p);
|
int32_t tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p);
|
||||||
|
|
||||||
|
void setuptvlineasm2(int32_t neglogy, intptr_t paloffs1, intptr_t paloffs2);
|
||||||
|
void tvlineasm2(uint32_t vplc2, int32_t vinc1, intptr_t bufplc1, intptr_t bufplc2, uint32_t vplc1, intptr_t p);
|
||||||
|
|
||||||
void msethlineshift(int32_t logx, int32_t logy);
|
void msethlineshift(int32_t logx, int32_t logy);
|
||||||
void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p);
|
void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p);
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ extern void *reciptable;
|
||||||
static int32_t bpl, transmode = 0;
|
static int32_t bpl, transmode = 0;
|
||||||
static int32_t glogx, glogy, gbxinc, gbyinc, gpinc;
|
static int32_t glogx, glogy, gbxinc, gbyinc, gpinc;
|
||||||
static char *gbuf, *gpal, *ghlinepal, *gtrans;
|
static char *gbuf, *gpal, *ghlinepal, *gtrans;
|
||||||
|
static char *gpal2;
|
||||||
|
|
||||||
//Global variable functions
|
//Global variable functions
|
||||||
void setvlinebpl(int32_t dabpl) { bpl = dabpl; }
|
void setvlinebpl(int32_t dabpl) { bpl = dabpl; }
|
||||||
|
@ -208,7 +209,7 @@ void mvlineasm4(int32_t cnt, char *p)
|
||||||
|
|
||||||
void setuptvlineasm(int32_t neglogy) { glogy = neglogy; }
|
void setuptvlineasm(int32_t neglogy) { glogy = neglogy; }
|
||||||
// cnt+1 loop iterations!
|
// cnt+1 loop iterations!
|
||||||
void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
|
int32_t tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
|
@ -242,8 +243,71 @@ void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intp
|
||||||
}
|
}
|
||||||
while (--cnt);
|
while (--cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return vplc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setuptvlineasm2(int32_t neglogy, intptr_t paloffs1, intptr_t paloffs2)
|
||||||
|
{
|
||||||
|
glogy = neglogy;
|
||||||
|
gpal = (char *)paloffs1;
|
||||||
|
gpal2 = (char *)paloffs2;
|
||||||
|
}
|
||||||
|
// Pass: asm1=vinc2, asm2=pend
|
||||||
|
// Return: asm1=vplc1, asm2=vplc2
|
||||||
|
void tvlineasm2(uint32_t vplc2, int32_t vinc1, intptr_t bufplc1, intptr_t bufplc2, uint32_t vplc1, intptr_t p)
|
||||||
|
{
|
||||||
|
char ch;
|
||||||
|
|
||||||
|
int32_t cnt = (asm2-p-1)/bpl; // >= 1
|
||||||
|
const int32_t vinc2 = asm1;
|
||||||
|
|
||||||
|
const char *const buf1 = (char *)bufplc1;
|
||||||
|
const char *const buf2 = (char *)bufplc2;
|
||||||
|
const int32_t logy = glogy, ourbpl = bpl, transm = transmode;
|
||||||
|
|
||||||
|
char *pp = (char *)p;
|
||||||
|
|
||||||
|
cnt++;
|
||||||
|
|
||||||
|
if (transm)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ch = buf1[vplc1>>logy];
|
||||||
|
if (ch != 255) pp[0] = gtrans[pp[0]|(gpal[ch]<<8)];
|
||||||
|
vplc1 += vinc1;
|
||||||
|
|
||||||
|
ch = buf2[vplc2>>logy];
|
||||||
|
if (ch != 255) pp[1] = gtrans[pp[1]|(gpal2[ch]<<8)];
|
||||||
|
vplc2 += vinc2;
|
||||||
|
|
||||||
|
pp += ourbpl;
|
||||||
|
}
|
||||||
|
while (--cnt > 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ch = buf1[vplc1>>logy];
|
||||||
|
if (ch != 255) pp[0] = gtrans[(pp[0]<<8)|gpal[ch]];
|
||||||
|
vplc1 += vinc1;
|
||||||
|
|
||||||
|
ch = buf2[vplc2>>logy];
|
||||||
|
if (ch != 255) pp[1] = gtrans[(pp[1]<<8)|gpal2[ch]];
|
||||||
|
vplc2 += vinc2;
|
||||||
|
|
||||||
|
pp += ourbpl;
|
||||||
|
}
|
||||||
|
while (--cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
asm1 = vplc1;
|
||||||
|
asm2 = vplc2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Floor sprite horizontal line functions
|
//Floor sprite horizontal line functions
|
||||||
void msethlineshift(int32_t logx, int32_t logy) { glogx = logx; glogy = logy; }
|
void msethlineshift(int32_t logx, int32_t logy) { glogx = logx; glogy = logy; }
|
||||||
// cntup16>>16 + 1 iterations
|
// cntup16>>16 + 1 iterations
|
||||||
|
|
|
@ -3875,7 +3875,7 @@ static void transmaskvline(int32_t x)
|
||||||
//
|
//
|
||||||
// transmaskvline2 (internal)
|
// transmaskvline2 (internal)
|
||||||
//
|
//
|
||||||
#ifndef ENGINE_USING_A_C
|
#if 1 //ndef ENGINE_USING_A_C
|
||||||
static void transmaskvline2(int32_t x)
|
static void transmaskvline2(int32_t x)
|
||||||
{
|
{
|
||||||
int32_t i, y1, y2, x2;
|
int32_t i, y1, y2, x2;
|
||||||
|
@ -3950,7 +3950,7 @@ static void transmaskvline2(int32_t x)
|
||||||
//
|
//
|
||||||
// transmaskwallscan (internal)
|
// transmaskwallscan (internal)
|
||||||
//
|
//
|
||||||
static inline void transmaskwallscan(int32_t x1, int32_t x2)
|
static void transmaskwallscan(int32_t x1, int32_t x2)
|
||||||
{
|
{
|
||||||
int32_t x;
|
int32_t x;
|
||||||
|
|
||||||
|
@ -3963,7 +3963,7 @@ static inline void transmaskwallscan(int32_t x1, int32_t x2)
|
||||||
|
|
||||||
x = x1;
|
x = x1;
|
||||||
while ((startumost[x+windowx1] > startdmost[x+windowx1]) && (x <= x2)) x++;
|
while ((startumost[x+windowx1] > startdmost[x+windowx1]) && (x <= x2)) x++;
|
||||||
#ifndef ENGINE_USING_A_C
|
#if 1 //ndef ENGINE_USING_A_C
|
||||||
if ((x <= x2) && (x&1)) transmaskvline(x), x++;
|
if ((x <= x2) && (x&1)) transmaskvline(x), x++;
|
||||||
while (x < x2) transmaskvline2(x), x += 2;
|
while (x < x2) transmaskvline2(x), x += 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue