Browse Source

ref_soft: Add OpenMP for blit and 2d draw

pull/2/head
mittorn 6 years ago
parent
commit
932ad73441
  1. 10
      r_draw.c
  2. 1
      r_glblit.c

10
r_draw.c

@ -65,7 +65,7 @@ Draw_StretchPicImplementation
*/ */
void R_DrawStretchPicImplementation (int x, int y, int w, int h, int s1, int t1, int s2, int t2, image_t *pic) void R_DrawStretchPicImplementation (int x, int y, int w, int h, int s1, int t1, int s2, int t2, image_t *pic)
{ {
pixel_t *dest, *source; pixel_t *source, *dest;
unsigned int v, u, sv; unsigned int v, u, sv;
unsigned int height; unsigned int height;
unsigned int f, fstep; unsigned int f, fstep;
@ -104,8 +104,13 @@ void R_DrawStretchPicImplementation (int x, int y, int w, int h, int s1, int t1,
dest = vid.buffer + y * vid.rowbytes + x; dest = vid.buffer + y * vid.rowbytes + x;
for (v=0 ; v<height ; v++, dest += vid.rowbytes)
#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
sv = (skip + v)*(t2-t1)/h + t1; sv = (skip + v)*(t2-t1)/h + t1;
source = pic->pixels[0] + sv*pic->width + s1; source = pic->pixels[0] + sv*pic->width + s1;
{ {
@ -161,6 +166,7 @@ void R_DrawStretchPicImplementation (int x, int y, int w, int h, int s1, int t1,
} }
#endif #endif
} }
dest += vid.rowbytes;
} }
} }

1
r_glblit.c

@ -179,6 +179,7 @@ void R_BlitScreen()
int i; int i;
byte *buf = vid.buffer; byte *buf = vid.buffer;
#pragma omp parallel for schedule(static)
for( i = 0; i < vid.width * vid.height;i++) for( i = 0; i < vid.width * vid.height;i++)
{ {
#ifdef SEPARATE_BLIT #ifdef SEPARATE_BLIT

Loading…
Cancel
Save