ref: soft: fix R_DrawStretchPic and Draw_Fill with OpenMP enabled
This commit is contained in:
parent
9577a6af21
commit
d57d8e0d5d
2 changed files with 54 additions and 105 deletions
|
@ -320,7 +320,7 @@ static void GAME_EXPORT R_SetupSky( int *skyboxTextures )
|
|||
return;
|
||||
|
||||
for( i = 0; i < SKYBOX_MAX_SIDES; i++ )
|
||||
tr.skyboxTextures[i] = skyboxTextures;
|
||||
tr.skyboxTextures[i] = skyboxTextures[i];
|
||||
}
|
||||
|
||||
qboolean GAME_EXPORT VID_CubemapShot(const char *base, uint size, const float *vieworg, qboolean skyshot)
|
||||
|
|
|
@ -65,10 +65,7 @@ Draw_StretchPicImplementation
|
|||
*/
|
||||
static void R_DrawStretchPicImplementation( int x, int y, int w, int h, int s1, int t1, int s2, int t2, image_t *pic )
|
||||
{
|
||||
pixel_t *source, *dest;
|
||||
unsigned int u, sv;
|
||||
unsigned int height;
|
||||
unsigned int f, fstep;
|
||||
int skip, v;
|
||||
qboolean transparent = false;
|
||||
pixel_t *buffer;
|
||||
|
@ -108,8 +105,6 @@ static void R_DrawStretchPicImplementation( int x, int y, int w, int h, int s1,
|
|||
else
|
||||
skip = 0;
|
||||
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
|
||||
if( pic->alpha_pixels )
|
||||
{
|
||||
buffer = pic->alpha_pixels;
|
||||
|
@ -123,29 +118,14 @@ static void R_DrawStretchPicImplementation( int x, int y, int w, int h, int s1,
|
|||
for (v=0 ; v<height ; v++)
|
||||
{
|
||||
int alpha1 = vid.alpha;
|
||||
#ifdef _OPENMP
|
||||
pixel_t *dest = vid.buffer + (y + v) * vid.rowbytes + x;
|
||||
#endif
|
||||
sv = (skip + v)*(t2-t1)/h + t1;
|
||||
source = buffer + sv*pic->width + s1;
|
||||
uint sv = (skip + v)*(t2-t1)/h + t1;
|
||||
uint u, f, fstep;
|
||||
pixel_t *source = buffer + sv*pic->width + s1;
|
||||
|
||||
{
|
||||
f = 0;
|
||||
fstep = ((s2-s1) << 16)/w;
|
||||
|
||||
#if 0
|
||||
for (u=0 ; u<w ; u+=4)
|
||||
{
|
||||
dest[u] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+1] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+2] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+3] = source[f>>16];
|
||||
f += fstep;
|
||||
}
|
||||
#else
|
||||
for (u=0 ; u<w ; u++)
|
||||
{
|
||||
pixel_t src = source[f>>16];
|
||||
|
@ -183,9 +163,6 @@ static void R_DrawStretchPicImplementation( int x, int y, int w, int h, int s1,
|
|||
dest[u] = src;
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
dest += vid.rowbytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,10 +188,8 @@ void GAME_EXPORT R_DrawStretchPic( float x, float y, float w, float h, float s1,
|
|||
|
||||
void Draw_Fill (int x, int y, int w, int h)
|
||||
{
|
||||
pixel_t *dest;
|
||||
unsigned int u;
|
||||
unsigned int height;
|
||||
int skip, v;
|
||||
int v;
|
||||
pixel_t src = vid.color;
|
||||
int alpha = vid.alpha;
|
||||
|
||||
|
@ -238,37 +213,16 @@ void Draw_Fill (int x, int y, int w, int h)
|
|||
{
|
||||
if( h <= -y )
|
||||
return;
|
||||
skip = -y;
|
||||
height += y;
|
||||
y = 0;
|
||||
}
|
||||
else
|
||||
skip = 0;
|
||||
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
|
||||
#pragma omp parallel for schedule(static)
|
||||
for (v=0 ; v<height ; v++)
|
||||
{
|
||||
#ifdef _OPENMP
|
||||
pixel_t *dest = vid.buffer + (y + v) * vid.rowbytes + x;
|
||||
#endif
|
||||
uint u;
|
||||
|
||||
{
|
||||
|
||||
#if 0
|
||||
for (u=0 ; u<w ; u+=4)
|
||||
{
|
||||
dest[u] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+1] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+2] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+3] = source[f>>16];
|
||||
f += fstep;
|
||||
}
|
||||
#else
|
||||
for (u=0 ; u<w ; u++)
|
||||
{
|
||||
if( alpha == 0 )
|
||||
|
@ -283,15 +237,10 @@ void Draw_Fill (int x, int y, int w, int h)
|
|||
{
|
||||
pixel_t screen = dest[u]; // | 0xff & screen & src ;
|
||||
dest[u] = BLEND_ALPHA( alpha, src, screen);//vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff) >> 3 | ((src & 0xff) >> 3);
|
||||
|
||||
}
|
||||
else
|
||||
dest[u] = src;
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
dest += vid.rowbytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue