mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
- copybyte is not the same as memcpy.
It should be inlined to use it, though, because homegrown loops for this stuff may have been ok in 1995, but not in 2019.
This commit is contained in:
parent
c9198729b0
commit
9b9c009de9
5 changed files with 51 additions and 14 deletions
|
@ -189,6 +189,9 @@ void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t
|
|||
#ifndef pragmas_have_clearbuf
|
||||
void clearbuf(void *d, int32_t c, int32_t a);
|
||||
#endif
|
||||
#ifndef pragmas_have_copybuf
|
||||
void copybuf(const void *s, void *d, int32_t c);
|
||||
#endif
|
||||
#ifndef pragmas_have_swaps
|
||||
void swapbuf4(void *a, void *b, int32_t c);
|
||||
#endif
|
||||
|
@ -196,6 +199,9 @@ void swapbuf4(void *a, void *b, int32_t c);
|
|||
#ifndef pragmas_have_clearbufbyte
|
||||
void clearbufbyte(void *D, int32_t c, int32_t a);
|
||||
#endif
|
||||
#ifndef pragmas_have_copybufbyte
|
||||
void copybufbyte(const void *S, void *D, int32_t c);
|
||||
#endif
|
||||
#ifndef pragmas_have_copybufreverse
|
||||
void copybufreverse(const void *S, void *D, int32_t c);
|
||||
#endif
|
||||
|
|
|
@ -4478,7 +4478,7 @@ static void classicDrawBunches(int32_t bunch)
|
|||
smostwall[smostwallcnt] = z;
|
||||
smostwalltype[smostwallcnt] = 1; //1 for umost
|
||||
smostwallcnt++;
|
||||
memcpy(&umost[x1],&smost[smostcnt],i*sizeof(smost[0]));
|
||||
copybufbyte(&umost[x1],&smost[smostcnt],i*sizeof(smost[0]));
|
||||
smostcnt += i;
|
||||
}
|
||||
}
|
||||
|
@ -4564,7 +4564,7 @@ static void classicDrawBunches(int32_t bunch)
|
|||
smostwall[smostwallcnt] = z;
|
||||
smostwalltype[smostwallcnt] = 2; //2 for dmost
|
||||
smostwallcnt++;
|
||||
memcpy(&dmost[x1],&smost[smostcnt],i*sizeof(smost[0]));
|
||||
copybufbyte(&dmost[x1],&smost[smostcnt],i*sizeof(smost[0]));
|
||||
smostcnt += i;
|
||||
}
|
||||
}
|
||||
|
@ -5033,6 +5033,16 @@ static void classicDrawVoxel(int32_t dasprx, int32_t daspry, int32_t dasprz, int
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
for (x=0; x<xdimen; x++)
|
||||
{
|
||||
if (daumost[x]>=0 && daumost[x]<ydimen)
|
||||
*(char *)(frameplace + x + bytesperline*daumost[x]) = editorcolors[13];
|
||||
if (dadmost[x]>=0 && dadmost[x]<ydimen)
|
||||
*(char *)(frameplace + x + bytesperline*dadmost[x]) = editorcolors[14];
|
||||
}
|
||||
#endif
|
||||
|
||||
videoEndDrawing(); //}}}
|
||||
}
|
||||
|
||||
|
@ -11638,8 +11648,8 @@ void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz)
|
|||
rendmode = REND_CLASSIC;
|
||||
#endif
|
||||
|
||||
memcpy(&startumost[windowxy1.x],&bakumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(bakumost[0]));
|
||||
memcpy(&startdmost[windowxy1.x],&bakdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(bakdmost[0]));
|
||||
copybufbyte(&startumost[windowxy1.x],&bakumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(bakumost[0]));
|
||||
copybufbyte(&startdmost[windowxy1.x],&bakdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(bakdmost[0]));
|
||||
setviewcnt++;
|
||||
|
||||
offscreenrendering = 1;
|
||||
|
@ -11673,8 +11683,8 @@ void renderRestoreTarget(void)
|
|||
ydim = bakysiz[setviewcnt];
|
||||
videoSetViewableArea(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y,
|
||||
bakwindowxy2[setviewcnt].x,bakwindowxy2[setviewcnt].y);
|
||||
memcpy(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0]));
|
||||
memcpy(&bakdmost[windowxy1.x],&startdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startdmost[0]));
|
||||
copybufbyte(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0]));
|
||||
copybufbyte(&bakdmost[windowxy1.x],&startdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startdmost[0]));
|
||||
frameplace = bakframeplace[setviewcnt];
|
||||
|
||||
calc_ylookup((setviewcnt == 0) ? bytesperline : bakxsiz[setviewcnt],
|
||||
|
|
|
@ -71,6 +71,17 @@ void clearbuf(void *d, int32_t c, int32_t a)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_copybuf
|
||||
void copybuf(const void *s, void *d, int32_t c)
|
||||
{
|
||||
auto p = (const int32_t *) s;
|
||||
auto q = (int32_t *) d;
|
||||
|
||||
while (c--)
|
||||
*q++ = *p++;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_swaps
|
||||
void swapbuf4(void *a, void *b, int32_t c)
|
||||
{
|
||||
|
@ -102,6 +113,16 @@ void clearbufbyte(void *D, int32_t c, int32_t a)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef pragmas_have_copybufbyte
|
||||
void copybufbyte(const void *s, void *d, int32_t c)
|
||||
{
|
||||
auto src = (const char *)s;
|
||||
auto dst = (char *)d;
|
||||
|
||||
while (c--)
|
||||
*dst++ = *src++;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// copybufreverse() is a special case: use the assembly version for GCC on x86
|
||||
|
|
|
@ -1802,7 +1802,7 @@ void Net_GetInput(void)
|
|||
|
||||
if (g_player[myconnectindex].movefifoend&(g_movesPerPacket-1))
|
||||
{
|
||||
memcpy(&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex],
|
||||
copybufbyte(&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex],
|
||||
&inputfifo[g_player[myconnectindex].movefifoend&(MOVEFIFOSIZ-1)][myconnectindex],sizeof(input_t));
|
||||
g_player[myconnectindex].movefifoend++;
|
||||
return;
|
||||
|
@ -2180,7 +2180,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
|
|||
continue;
|
||||
}
|
||||
|
||||
memcpy(&osyn[i],&nsyn[i],sizeof(input_t));
|
||||
copybufbyte(&osyn[i],&nsyn[i],sizeof(input_t));
|
||||
if (l&1) nsyn[i].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
|
||||
if (l&2) nsyn[i].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
|
||||
if (l&4)
|
||||
|
@ -2219,7 +2219,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
|
|||
if (i != myconnectindex)
|
||||
for (j=g_movesPerPacket-1;j>=1;j--)
|
||||
{
|
||||
memcpy(&nsyn[i],&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t));
|
||||
copybufbyte(&nsyn[i],&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t));
|
||||
g_player[i].movefifoend++;
|
||||
}
|
||||
|
||||
|
@ -2233,7 +2233,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
|
|||
osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0];
|
||||
nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0];
|
||||
|
||||
memcpy(&osyn[other],&nsyn[other],sizeof(input_t));
|
||||
copybufbyte(&osyn[other],&nsyn[other],sizeof(input_t));
|
||||
if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
|
||||
if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2;
|
||||
if (k&4)
|
||||
|
@ -2272,7 +2272,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
|
|||
|
||||
for (i=g_movesPerPacket-1;i>=1;i--)
|
||||
{
|
||||
memcpy(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t));
|
||||
copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t));
|
||||
g_player[other].movefifoend++;
|
||||
}
|
||||
|
||||
|
@ -2296,7 +2296,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
|
|||
osyn = (input_t *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0];
|
||||
nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0];
|
||||
|
||||
memcpy(&osyn[other],&nsyn[other],sizeof(input_t));
|
||||
copybufbyte(&osyn[other],&nsyn[other],sizeof(input_t));
|
||||
k = packbuf[j] + (int)(packbuf[j+1]<<8);
|
||||
j += 2;
|
||||
|
||||
|
@ -2332,7 +2332,7 @@ void Net_ParsePacket(uint8_t *packbuf, int packbufleng)
|
|||
|
||||
for (i=g_movesPerPacket-1;i>=1;i--)
|
||||
{
|
||||
memcpy(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t));
|
||||
copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t));
|
||||
g_player[other].movefifoend++;
|
||||
}
|
||||
|
||||
|
|
|
@ -3178,7 +3178,7 @@ void movelava(char *dapic)
|
|||
offs2 = (LAVASIZ + 2) + 1 + ((intptr_t) lavabakpic);
|
||||
for (x = 0; x < LAVASIZ; x++)
|
||||
{
|
||||
memcpy(offs, offs2, LAVASIZ);
|
||||
copybuf(offs, offs2, LAVASIZ >> 2);
|
||||
offs += LAVASIZ;
|
||||
offs2 += LAVASIZ + 2;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue