Merge remote-tracking branch 'zdoom/master' into qzdoom

# Conflicts:
#	src/r_draw.cpp
#	src/r_draw.h
This commit is contained in:
Magnus Norddahl 2016-12-05 08:22:04 +01:00
commit 8a12d040de
18 changed files with 287 additions and 1477 deletions

View file

@ -1045,9 +1045,8 @@ set( FASTMATH_PCH_SOURCES
r_poly_intersection.cpp r_poly_intersection.cpp
r_3dfloors.cpp r_3dfloors.cpp
r_bsp.cpp r_bsp.cpp
r_draw.cpp r_draw_tc.cpp
r_draw_rgba.cpp r_draw_rgba.cpp
r_drawt.cpp
r_drawt_rgba.cpp r_drawt_rgba.cpp
r_drawers.cpp r_drawers.cpp
r_thread.cpp r_thread.cpp

View file

@ -598,667 +598,6 @@ dmsdone add esp,8
;*----------------------------------------------------------------------
;*
;* R_DrawColumnP
;*
;*----------------------------------------------------------------------
GLOBAL @R_DrawColumnP_ASM@0
GLOBAL _R_DrawColumnP_ASM
GLOBAL R_DrawColumnP_ASM
align 16
R_DrawColumnP_ASM:
_R_DrawColumnP_ASM:
@R_DrawColumnP_ASM@0:
; count = dc_yh - dc_yl;
mov ecx,[dc_count]
test ecx,ecx
jle near rdcpret ; count <= 0: nothing to do, so leave
push ebp ; save registers
push ebx
push edi
push esi
; dest = ylookup[dc_yl] + dc_x + dc_destorg;
mov edi,[dc_dest]
mov ebp,ecx
mov ebx,[dc_texturefrac] ; ebx = frac
rdcp1: sub edi,SPACEFILLER4
mov ecx,ebx
shr ecx,16
mov esi,[dc_source]
mov edx,[dc_iscale]
mov eax,[dc_colormap]
cmp BYTE [CPU+66],byte 5
jg rdcploop2
align 16
; The registers should now look like this:
;
; [31 .. 16][15 .. 8][7 .. 0]
; eax [colormap ]
; ebx [yi ][yf ]
; ecx [scratch ]
; edx [dyi ][dyf ]
; esi [source texture column ]
; edi [destination screen pointer ]
; ebp [counter ]
;
; Note the partial register stalls on anything better than a Pentium
; That's why there are two versions of this loop.
rdcploop:
mov cl,[esi+ecx] ; Fetch texel
xor ch,ch
add ebx,edx ; increment frac
rdcp2: add edi,SPACEFILLER4 ; increment destination pointer
mov cl,[eax+ecx] ; colormap texel
mov [edi],cl ; Store texel
mov ecx,ebx
shr ecx,16
dec ebp
jnz rdcploop ; loop
pop esi
pop edi
pop ebx
pop ebp
rdcpret:
ret
align 16
rdcploop2:
movzx ecx,byte [esi+ecx] ; Fetch texel
add ebx,edx ; increment frac
mov cl,[eax+ecx] ; colormap texel
rdcp3: add edi,SPACEFILLER4 ; increment destination pointer
mov [edi],cl ; Store texel
mov ecx,ebx
shr ecx,16
dec ebp
jnz rdcploop2 ; loop
pop esi
pop edi
pop ebx
pop ebp
ret
;*----------------------------------------------------------------------
;*
;* R_DrawFuzzColumnP
;*
;*----------------------------------------------------------------------
GLOBAL @R_DrawFuzzColumnP_ASM@0
GLOBAL _R_DrawFuzzColumnP_ASM
GLOBAL R_DrawFuzzColumnP_ASM
align 16
R_DrawFuzzColumnP_ASM:
_R_DrawFuzzColumnP_ASM:
@R_DrawFuzzColumnP_ASM@0:
; Adjust borders. Low...
mov eax,[dc_yl]
push ebx
push esi
push edi
push ebp
cmp eax,0
jg .ylok
mov eax,1
nop
; ...and high.
.ylok mov edx,[fuzzviewheight]
mov esi,[dc_yh]
cmp esi,edx
jle .yhok
mov esi,edx
nop
.yhok mov edx,[dc_x]
sub esi,eax ; esi = count
js near .dfcdone ; Zero length (or less)
mov edi,[ylookup+eax*4]
mov ebx,edx
add edi,[dc_destorg]
mov eax,[NormalLight]
mov ecx,[fuzzpos]
add edi,ebx
add eax,256*6
inc esi
mov ebp,[dc_pitch]
mov edx,FUZZTABLE
test ecx,ecx
je .fuzz0
;
; esi = count
; edi = dest
; ecx = fuzzpos
; eax = colormap 6
;
; first loop: end with fuzzpos or count 0, whichever happens first
sub edx,ecx ; edx = # of entries left in fuzzoffset
mov ebx,esi
cmp esi,edx
jle .enuf
mov esi,edx
.enuf sub ebx,esi
mov edx,[fuzzoffset+ecx*4]
push ebx
xor ebx,ebx
.loop1 inc ecx
mov bl,[edi+edx]
dec esi
mov bl,[eax+ebx]
mov [edi],bl
lea edi,[edi+ebp]
mov edx,[fuzzoffset+ecx*4]
jnz .loop1
; second loop: Chunk it into groups of FUZZTABLE-sized spans and do those
pop esi
cmp ecx,FUZZTABLE
jl .savefuzzpos
xor ecx,ecx
nop
.fuzz0 cmp esi,FUZZTABLE
jl .chunked
.oloop lea edx,[esi-FUZZTABLE]
mov esi,FUZZTABLE
push edx
mov edx,[fuzzoffset+ecx*4]
.iloop inc ecx
mov bl,[edi+edx]
dec esi
mov bl,[eax+ebx]
mov [edi],bl
lea edi,[edi+ebp]
mov edx,[fuzzoffset+ecx*4]
jnz .iloop
pop esi
xor ecx,ecx
cmp esi,FUZZTABLE
jge .oloop
; third loop: Do whatever is left
.chunked:
test esi,esi
jle .savefuzzpos
mov edx,[fuzzoffset+ecx*4]
nop
.loop3 inc ecx
mov bl,[edi+edx]
dec esi
mov bl,[eax+ebx]
mov [edi],bl
lea edi,[edi+ebp]
mov edx,[fuzzoffset+ecx*4]
jnz .loop3
.savefuzzpos:
mov [fuzzpos],ecx
.dfcdone:
pop ebp
pop edi
pop esi
pop ebx
ret
;*----------------------------------------------------------------------
;*
;* rt_copy1col_asm
;*
;* ecx = hx
;* edx = sx
;* [esp+4] = yl
;* [esp+8] = yh
;*
;*----------------------------------------------------------------------
GLOBAL @rt_copy1col_asm@16
GLOBAL _rt_copy1col_asm
GLOBAL rt_copy1col_asm
align 16
rt_copy1col_asm:
_rt_copy1col_asm:
pop eax
mov edx,[esp+4*3]
mov ecx,[esp+4*2]
push edx
push ecx
mov ecx,[esp+4*2]
mov edx,[esp+4*3]
push eax
@rt_copy1col_asm@16:
mov eax, [esp+4]
push ebx
mov ebx, [esp+12]
push esi
sub ebx, eax
push edi
js .done
lea esi,[eax*4]
inc ebx ; ebx = count
mov eax,edx
add ecx,esi
mov edi,[ylookup+esi]
add ecx,[dc_temp] ; ecx = source
mov esi,[dc_pitch] ; esi = pitch
add eax,edi ; eax = dest
add eax,[dc_destorg]
shr ebx,1
jnc .even
mov dl,[ecx]
add ecx,4
mov [eax],dl
add eax,esi
.even and ebx,ebx
jz .done
.loop mov dl,[ecx]
mov dh,[ecx+4]
mov [eax],dl
mov [eax+esi],dh
add ecx,8
lea eax,[eax+esi*2]
dec ebx
jnz .loop
.done pop edi
pop esi
pop ebx
ret 8
;*----------------------------------------------------------------------
;*
;* rt_copy4cols_asm
;*
;* ecx = sx
;* edx = yl
;* [esp+4] = yh
;*
;*----------------------------------------------------------------------
GLOBAL @rt_copy4cols_asm@12
GLOBAL _rt_copy4cols_asm
GLOBAL rt_copy4cols_asm
align 16
rt_copy4cols_asm:
_rt_copy4cols_asm:
pop eax
mov ecx,[esp+8]
mov edx,[esp+4]
push ecx
mov ecx,[esp+4]
push eax
@rt_copy4cols_asm@12:
push ebx
mov ebx,[esp+8]
push esi
sub ebx,edx
push edi
js .done
inc ebx ; ebx = count
mov eax,ecx
mov esi,[ylookup+edx*4]
mov ecx,[dc_temp]
add eax,esi ; eax = dest
add eax,[dc_destorg]
lea ecx,[ecx+edx*4] ; ecx = source
mov edx,[dc_pitch] ; edx = pitch
shr ebx,1
jnc .even
mov esi,[ecx]
add ecx,4
mov [eax],esi
add eax,edx
.even and ebx,ebx
jz .done
.loop mov esi,[ecx]
mov edi,[ecx+4]
mov [eax],esi
mov [eax+edx],edi
add ecx,8
lea eax,[eax+edx*2]
dec ebx
jnz .loop
.done pop edi
pop esi
pop ebx
ret 4
;*----------------------------------------------------------------------
;*
;* rt_map1col_asm
;*
;* ecx = hx
;* edx = sx
;* [esp+4] = yl
;* [esp+8] = yh
;*
;*----------------------------------------------------------------------
GLOBAL @rt_map1col_asm@16
GLOBAL _rt_map1col_asm
GLOBAL rt_map1col_asm
align 16
rt_map1col_asm:
_rt_map1col_asm:
pop eax
mov edx,[esp+4*3]
mov ecx,[esp+4*2]
push edx
push ecx
mov ecx,[esp+4*2]
mov edx,[esp+4*3]
push eax
@rt_map1col_asm@16:
mov eax,[esp+4]
push ebx
mov ebx,[esp+12]
push ebp
push esi
sub ebx, eax
push edi
js .done
lea edi,[eax*4]
mov esi,[dc_colormap] ; esi = colormap
inc ebx ; ebx = count
mov eax,edx
lea ebp,[ecx+edi] ; ebp = source
add ebp,[dc_temp]
mov ecx,[ylookup+edi]
mov edi,[dc_pitch] ; edi = pitch
add eax,ecx ; eax = dest
xor ecx,ecx
xor edx,edx
add eax,[dc_destorg]
shr ebx,1
jnc .even
mov dl,[ebp]
add ebp,4
mov dl,[esi+edx]
mov [eax],dl
add eax,edi
.even and ebx,ebx
jz .done
.loop mov dl,[ebp]
mov cl,[ebp+4]
add ebp,8
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax],dl
mov [eax+edi],cl
dec ebx
lea eax,[eax+edi*2]
jnz .loop
.done pop edi
pop esi
pop ebp
pop ebx
ret 8
;*----------------------------------------------------------------------
;*
;* rt_map4cols_asm
;*
;* rt_map4cols_asm1 is for PPro and above
;* rt_map4cols_asm2 is for Pentium and below
;*
;* ecx = sx
;* edx = yl
;* [esp+4] = yh
;*
;*----------------------------------------------------------------------
GLOBAL @rt_map4cols_asm1@12
GLOBAL _rt_map4cols_asm1
GLOBAL rt_map4cols_asm1
align 16
rt_map4cols_asm1:
_rt_map4cols_asm1:
pop eax
mov ecx,[esp+8]
mov edx,[esp+4]
push ecx
mov ecx,[esp+4]
push eax
@rt_map4cols_asm1@12:
push ebx
mov ebx,[esp+8]
push ebp
push esi
sub ebx,edx
push edi
js near .done
mov esi,[dc_colormap] ; esi = colormap
shl edx,2
mov eax,ecx
inc ebx ; ebx = count
mov edi,[ylookup+edx]
mov ebp,[dc_temp]
add ebp,edx ; ebp = source
add eax,edi ; eax = dest
mov edi,[dc_pitch] ; edi = pitch
add eax,[dc_destorg]
xor ecx,ecx
xor edx,edx
shr ebx,1
jnc .even
mov dl,[ebp]
mov cl,[ebp+1]
add ebp,4
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax],dl
mov [eax+1],cl
mov dl,[ebp-2]
mov cl,[ebp-1]
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax+2],dl
mov [eax+3],cl
add eax,edi
.even and ebx,ebx
jz .done
.loop:
mov dl,[ebp]
mov cl,[ebp+1]
add ebp,8
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax],dl
mov [eax+1],cl
mov dl,[ebp-6]
mov cl,[ebp-5]
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax+2],dl
mov [eax+3],cl
mov dl,[ebp-4]
mov cl,[ebp-3]
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax+edi],dl
mov [eax+edi+1],cl
mov dl,[ebp-2]
mov cl,[ebp-1]
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax+edi+2],dl
mov [eax+edi+3],cl
lea eax,[eax+edi*2]
dec ebx
jnz .loop
.done pop edi
pop esi
pop ebp
pop ebx
ret 4
GLOBAL @rt_map4cols_asm2@12
GLOBAL _rt_map4cols_asm2
GLOBAL rt_map4cols_asm2
align 16
rt_map4cols_asm2:
_rt_map4cols_asm2:
pop eax
mov ecx,[esp+8]
mov edx,[esp+4]
push ecx
mov ecx,[esp+4]
push eax
@rt_map4cols_asm2@12:
push ebx
mov ebx,[esp+8]
push ebp
push esi
sub ebx,edx
push edi
js near .done
mov esi,[dc_colormap] ; esi = colormap
shl edx,2
mov eax,ecx
inc ebx ; ebx = count
mov edi,[ylookup+edx]
mov ebp,[dc_temp]
add ebp,edx ; ebp = source
add eax,edi ; eax = dest
mov edi,[dc_pitch] ; edi = pitch
add eax,[dc_destorg]
xor ecx,ecx
xor edx,edx
shr ebx,1
jnc .even
mov dl,[ebp]
mov cl,[ebp+1]
add ebp,4
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax],dl
mov [eax+1],cl
mov dl,[ebp-2]
mov cl,[ebp-1]
mov dl,[esi+edx]
mov cl,[esi+ecx]
mov [eax+2],dl
mov [eax+3],cl
add eax,edi
.even and ebx,ebx
jz .done
.loop:
mov dl,[ebp+3]
mov ch,[esi+edx]
mov dl,[ebp+2]
mov cl,[esi+edx]
shl ecx,16
mov dl,[ebp+1]
mov ch,[esi+edx]
mov dl,[ebp]
mov cl,[esi+edx]
mov [eax],ecx
add eax,edi
mov dl,[ebp+7]
mov ch,[esi+edx]
mov dl,[ebp+6]
mov cl,[esi+edx]
shl ecx,16
mov dl,[ebp+5]
mov ch,[esi+edx]
mov dl,[ebp+4]
mov cl,[esi+edx]
mov [eax],ecx
add eax,edi
add ebp,8
dec ebx
jnz .loop
.done pop edi
pop esi
pop ebp
pop ebx
ret 4
align 16
GLOBAL rt_shaded4cols_asm GLOBAL rt_shaded4cols_asm
GLOBAL _rt_shaded4cols_asm GLOBAL _rt_shaded4cols_asm
@ -1648,9 +987,6 @@ ASM_PatchPitch:
_ASM_PatchPitch: _ASM_PatchPitch:
@ASM_PatchPitch@0: @ASM_PatchPitch@0:
mov eax,[dc_pitch] mov eax,[dc_pitch]
mov [rdcp1+2],eax
mov [rdcp2+2],eax
mov [rdcp3+2],eax
mov [s4p+1],eax mov [s4p+1],eax
mov [a4p+1],eax mov [a4p+1],eax
mov [ac4p+1],eax mov [ac4p+1],eax

View file

@ -63,6 +63,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);
namespace swrenderer namespace swrenderer
{ {
using namespace drawerargs;
seg_t* curline; seg_t* curline;
side_t* sidedef; side_t* sidedef;

File diff suppressed because it is too large Load diff

View file

@ -19,82 +19,42 @@
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "r_draw_tc.h"
#if 0 // Do not remove this. Used to reduce merge conflicts with ZDoom
#ifndef __R_DRAW__ #ifndef __R_DRAW__
#define __R_DRAW__ #define __R_DRAW__
#include "r_defs.h" #include "r_defs.h"
struct FSWColormap;
EXTERN_CVAR(Bool, r_multithreaded);
EXTERN_CVAR(Bool, r_magfilter);
EXTERN_CVAR(Bool, r_minfilter);
EXTERN_CVAR(Bool, r_mipmap);
EXTERN_CVAR(Float, r_lod_bias);
namespace swrenderer
{
// Spectre/Invisibility.
#define FUZZTABLE 50
extern "C" int fuzzoffset[FUZZTABLE + 1]; // [RH] +1 for the assembly routine
extern "C" int fuzzpos;
extern "C" int fuzzviewheight;
struct ShadeConstants
{
uint16_t light_alpha;
uint16_t light_red;
uint16_t light_green;
uint16_t light_blue;
uint16_t fade_alpha;
uint16_t fade_red;
uint16_t fade_green;
uint16_t fade_blue;
uint16_t desaturate;
bool simple_shade;
};
extern "C" int ylookup[MAXHEIGHT]; extern "C" int ylookup[MAXHEIGHT];
extern "C" int dc_pitch; // [RH] Distance between rows extern "C" int dc_pitch; // [RH] Distance between rows
extern "C" lighttable_t*dc_colormap; extern "C" lighttable_t*dc_colormap;
extern "C" FSWColormap *dc_fcolormap;
extern "C" ShadeConstants dc_shade_constants;
extern "C" fixed_t dc_light;
extern "C" int dc_x; extern "C" int dc_x;
extern "C" int dc_yl; extern "C" int dc_yl;
extern "C" int dc_yh; extern "C" int dc_yh;
extern "C" fixed_t dc_iscale; extern "C" fixed_t dc_iscale;
extern double dc_texturemid; extern double dc_texturemid;
extern "C" fixed_t dc_texturefrac; extern "C" fixed_t dc_texturefrac;
extern "C" uint32_t dc_textureheight;
extern "C" int dc_color; // [RH] For flat colors (no texturing) extern "C" int dc_color; // [RH] For flat colors (no texturing)
extern "C" DWORD dc_srccolor; extern "C" DWORD dc_srccolor;
extern "C" uint32_t dc_srccolor_bgra;
extern "C" DWORD *dc_srcblend; extern "C" DWORD *dc_srcblend;
extern "C" DWORD *dc_destblend; extern "C" DWORD *dc_destblend;
extern "C" fixed_t dc_srcalpha;
extern "C" fixed_t dc_destalpha;
// first pixel in a column // first pixel in a column
extern "C" const BYTE* dc_source; extern "C" const BYTE* dc_source;
extern "C" const BYTE* dc_source2;
extern "C" uint32_t dc_texturefracx;
extern "C" BYTE *dc_dest, *dc_destorg; extern "C" BYTE *dc_dest, *dc_destorg;
extern "C" int dc_destheight;
extern "C" int dc_count; extern "C" int dc_count;
extern "C" DWORD vplce[4]; extern "C" DWORD vplce[4];
extern "C" DWORD vince[4]; extern "C" DWORD vince[4];
extern "C" BYTE* palookupoffse[4]; extern "C" BYTE* palookupoffse[4];
extern "C" fixed_t palookuplight[4];
extern "C" const BYTE* bufplce[4]; extern "C" const BYTE* bufplce[4];
extern "C" const BYTE* bufplce2[4]; extern "C" const BYTE* bufplce2[4];
extern "C" uint32_t buftexturefracx[4];
extern "C" uint32_t bufheight[4]; extern "C" uint32_t bufheight[4];
// [RH] Temporary buffer for column drawing // [RH] Temporary buffer for column drawing
@ -103,15 +63,20 @@ extern "C" unsigned int dc_tspans[4][MAXHEIGHT];
extern "C" unsigned int *dc_ctspan[4]; extern "C" unsigned int *dc_ctspan[4];
extern "C" unsigned int horizspans[4]; extern "C" unsigned int horizspans[4];
// [RH] Pointers to the different column and span drawers... // [RH] Pointers to the different column and span drawers...
// The span blitting interface. // The span blitting interface.
// Hook in assembler or system specific BLT here. // Hook in assembler or system specific BLT here.
extern void (*R_DrawColumn)(void);
extern DWORD (*dovline1) (); extern DWORD (*dovline1) ();
extern DWORD (*doprevline1) (); extern DWORD (*doprevline1) ();
#ifdef X64_ASM
#define dovline4 vlinetallasm4
extern "C" void vlinetallasm4();
#else
extern void (*dovline4) (); extern void (*dovline4) ();
#endif
extern void setupvline (int); extern void setupvline (int);
extern DWORD (*domvline1) (); extern DWORD (*domvline1) ();
@ -121,7 +86,7 @@ extern void setupmvline (int);
extern void setuptmvline (int); extern void setuptmvline (int);
// The Spectre/Invisibility effect. // The Spectre/Invisibility effect.
extern void (*R_DrawFuzzColumn)(void); extern void R_DrawFuzzColumn(void);
// [RH] Draw shaded column // [RH] Draw shaded column
extern void (*R_DrawShadedColumn)(void); extern void (*R_DrawShadedColumn)(void);
@ -133,23 +98,23 @@ extern void (*R_DrawTranslatedColumn)(void);
// Span drawing for rows, floor/ceiling. No Spectre effect needed. // Span drawing for rows, floor/ceiling. No Spectre effect needed.
extern void (*R_DrawSpan)(void); extern void (*R_DrawSpan)(void);
void R_SetupSpanBits(FTexture *tex); void R_SetupSpanBits(FTexture *tex);
void R_SetSpanColormap(FDynamicColormap *colormap, int shade); void R_SetSpanColormap(BYTE *colormap);
void R_SetSpanSource(FTexture *tex); void R_SetSpanSource(const BYTE *pixels);
// Span drawing for masked textures. // Span drawing for masked textures.
extern void (*R_DrawSpanMasked)(void); extern void (*R_DrawSpanMasked)(void);
// Span drawing for translucent textures. // Span drawing for translucent textures.
extern void (*R_DrawSpanTranslucent)(void); void R_DrawSpanTranslucent(void);
// Span drawing for masked, translucent textures. // Span drawing for masked, translucent textures.
extern void (*R_DrawSpanMaskedTranslucent)(void); void R_DrawSpanMaskedTranslucent(void);
// Span drawing for translucent, additive textures. // Span drawing for translucent, additive textures.
extern void (*R_DrawSpanAddClamp)(void); void R_DrawSpanAddClamp(void);
// Span drawing for masked, translucent, additive textures. // Span drawing for masked, translucent, additive textures.
extern void (*R_DrawSpanMaskedAddClamp)(void); void R_DrawSpanMaskedAddClamp(void);
// [RH] Span blit into an interleaved intermediate buffer // [RH] Span blit into an interleaved intermediate buffer
extern void (*R_DrawColumnHoriz)(void); extern void (*R_DrawColumnHoriz)(void);
@ -158,163 +123,110 @@ extern void (*R_DrawColumnHoriz)(void);
void R_InitColumnDrawers (); void R_InitColumnDrawers ();
// [RH] Moves data from the temporary buffer to the screen. // [RH] Moves data from the temporary buffer to the screen.
void rt_copy1col(int hx, int sx, int yl, int yh);
void rt_copy4cols(int sx, int yl, int yh);
void rt_map4cols(int sx, int yl, int yh);
extern "C" extern "C"
{ {
void rt_copy1col_c (int hx, int sx, int yl, int yh);
void rt_copy4cols_c (int sx, int yl, int yh);
void rt_shaded1col_c (int hx, int sx, int yl, int yh); void rt_shaded1col (int hx, int sx, int yl, int yh);
void rt_shaded4cols_c (int sx, int yl, int yh); void rt_shaded4cols_c (int sx, int yl, int yh);
void rt_shaded4cols_asm (int sx, int yl, int yh); void rt_shaded4cols_asm (int sx, int yl, int yh);
void rt_map1col_c (int hx, int sx, int yl, int yh); void rt_map1col (int hx, int sx, int yl, int yh);
void rt_add1col_c (int hx, int sx, int yl, int yh); void rt_add1col (int hx, int sx, int yl, int yh);
void rt_addclamp1col_c (int hx, int sx, int yl, int yh); void rt_addclamp1col (int hx, int sx, int yl, int yh);
void rt_subclamp1col_c (int hx, int sx, int yl, int yh); void rt_subclamp1col (int hx, int sx, int yl, int yh);
void rt_revsubclamp1col_c (int hx, int sx, int yl, int yh); void rt_revsubclamp1col (int hx, int sx, int yl, int yh);
void rt_tlate1col_c (int hx, int sx, int yl, int yh); void rt_tlate1col (int hx, int sx, int yl, int yh);
void rt_tlateadd1col_c (int hx, int sx, int yl, int yh); void rt_tlateadd1col (int hx, int sx, int yl, int yh);
void rt_tlateaddclamp1col_c (int hx, int sx, int yl, int yh); void rt_tlateaddclamp1col (int hx, int sx, int yl, int yh);
void rt_tlatesubclamp1col_c (int hx, int sx, int yl, int yh); void rt_tlatesubclamp1col (int hx, int sx, int yl, int yh);
void rt_tlaterevsubclamp1col_c (int hx, int sx, int yl, int yh); void rt_tlaterevsubclamp1col (int hx, int sx, int yl, int yh);
void rt_map4cols_c (int sx, int yl, int yh);
void rt_add4cols_c (int sx, int yl, int yh); void rt_add4cols_c (int sx, int yl, int yh);
void rt_addclamp4cols_c (int sx, int yl, int yh); void rt_addclamp4cols_c (int sx, int yl, int yh);
void rt_subclamp4cols_c (int sx, int yl, int yh); void rt_subclamp4cols (int sx, int yl, int yh);
void rt_revsubclamp4cols_c (int sx, int yl, int yh); void rt_revsubclamp4cols (int sx, int yl, int yh);
void rt_tlate4cols_c (int sx, int yl, int yh); void rt_tlate4cols (int sx, int yl, int yh);
void rt_tlateadd4cols_c (int sx, int yl, int yh); void rt_tlateadd4cols (int sx, int yl, int yh);
void rt_tlateaddclamp4cols_c (int sx, int yl, int yh); void rt_tlateaddclamp4cols (int sx, int yl, int yh);
void rt_tlatesubclamp4cols_c (int sx, int yl, int yh); void rt_tlatesubclamp4cols (int sx, int yl, int yh);
void rt_tlaterevsubclamp4cols_c (int sx, int yl, int yh); void rt_tlaterevsubclamp4cols (int sx, int yl, int yh);
void rt_copy1col_asm (int hx, int sx, int yl, int yh);
void rt_map1col_asm (int hx, int sx, int yl, int yh);
void rt_copy4cols_asm (int sx, int yl, int yh);
void rt_map4cols_asm1 (int sx, int yl, int yh);
void rt_map4cols_asm2 (int sx, int yl, int yh);
void rt_add4cols_asm (int sx, int yl, int yh); void rt_add4cols_asm (int sx, int yl, int yh);
void rt_addclamp4cols_asm (int sx, int yl, int yh); void rt_addclamp4cols_asm (int sx, int yl, int yh);
} }
extern void (*rt_copy1col)(int hx, int sx, int yl, int yh);
extern void (*rt_copy4cols)(int sx, int yl, int yh);
extern void (*rt_shaded1col)(int hx, int sx, int yl, int yh); #ifdef X86_ASM
extern void (*rt_shaded4cols)(int sx, int yl, int yh); #define rt_shaded4cols rt_shaded4cols_asm
#define rt_add4cols rt_add4cols_asm
extern void (*rt_map1col)(int hx, int sx, int yl, int yh); #define rt_addclamp4cols rt_addclamp4cols_asm
extern void (*rt_add1col)(int hx, int sx, int yl, int yh); #else
extern void (*rt_addclamp1col)(int hx, int sx, int yl, int yh); #define rt_shaded4cols rt_shaded4cols_c
extern void (*rt_subclamp1col)(int hx, int sx, int yl, int yh); #define rt_add4cols rt_add4cols_c
extern void (*rt_revsubclamp1col)(int hx, int sx, int yl, int yh); #define rt_addclamp4cols rt_addclamp4cols_c
#endif
extern void (*rt_tlate1col)(int hx, int sx, int yl, int yh);
extern void (*rt_tlateadd1col)(int hx, int sx, int yl, int yh);
extern void (*rt_tlateaddclamp1col)(int hx, int sx, int yl, int yh);
extern void (*rt_tlatesubclamp1col)(int hx, int sx, int yl, int yh);
extern void (*rt_tlaterevsubclamp1col)(int hx, int sx, int yl, int yh);
extern void (*rt_map4cols)(int sx, int yl, int yh);
extern void (*rt_add4cols)(int sx, int yl, int yh);
extern void (*rt_addclamp4cols)(int sx, int yl, int yh);
extern void (*rt_subclamp4cols)(int sx, int yl, int yh);
extern void (*rt_revsubclamp4cols)(int sx, int yl, int yh);
extern void (*rt_tlate4cols)(int sx, int yl, int yh);
extern void (*rt_tlateadd4cols)(int sx, int yl, int yh);
extern void (*rt_tlateaddclamp4cols)(int sx, int yl, int yh);
extern void (*rt_tlatesubclamp4cols)(int sx, int yl, int yh);
extern void (*rt_tlaterevsubclamp4cols)(int sx, int yl, int yh);
extern void (*rt_initcols)(BYTE *buffer);
extern void (*rt_span_coverage)(int x, int start, int stop);
void rt_flip_posts(); void rt_flip_posts();
void rt_draw4cols (int sx); void rt_draw4cols (int sx);
// [RH] Preps the temporary horizontal buffer. // [RH] Preps the temporary horizontal buffer.
void rt_initcols_pal (BYTE *buffer); void rt_initcols (BYTE *buffer=NULL);
void rt_span_coverage_pal(int x, int start, int stop); void R_DrawFogBoundary (int x1, int x2, short *uclip, short *dclip);
extern void (*R_DrawFogBoundary)(int x1, int x2, short *uclip, short *dclip);
void R_DrawFogBoundary_C (int x1, int x2, short *uclip, short *dclip);
#ifdef X86_ASM #ifdef X86_ASM
extern "C" void R_DrawColumnP_Unrolled (void);
extern "C" void R_DrawColumnP_ASM (void);
extern "C" void R_DrawFuzzColumnP_ASM (void);
void R_DrawShadedColumnP_C (void); void R_DrawShadedColumnP_C (void);
extern "C" void R_DrawSpanP_ASM (void); extern "C" void R_DrawSpanP_ASM (void);
extern "C" void R_DrawSpanMaskedP_ASM (void); extern "C" void R_DrawSpanMaskedP_ASM (void);
void R_DrawColumnHorizP_C(void);
#else #else
void R_DrawColumnP_C (void);
void R_DrawFuzzColumnP_C (void);
void R_DrawShadedColumnP_C (void); void R_DrawShadedColumnP_C (void);
void R_DrawSpanP_C (void); void R_DrawSpanP_C (void);
void R_DrawSpanMaskedP_C (void); void R_DrawSpanMaskedP_C (void);
#endif #endif
void R_DrawColumn();
void R_DrawColumnHorizP_C(void); void R_DrawColumnHorizP_C(void);
void R_DrawTranslatedColumnP_C(void); void R_DrawTranslatedColumnP_C(void);
void R_DrawSpanTranslucentP_C (void); void R_DrawSpanTranslucent (void);
void R_DrawSpanMaskedTranslucentP_C (void); void R_DrawSpanMaskedTranslucent (void);
void R_DrawTlatedLucentColumnP_C (void); void R_DrawTlatedLucentColumnP_C (void);
#define R_DrawTlatedLucentColumn R_DrawTlatedLucentColumnP_C #define R_DrawTlatedLucentColumn R_DrawTlatedLucentColumnP_C
extern void(*R_FillColumn)(void); void R_FillColumnP (void);
extern void(*R_FillAddColumn)(void); void R_FillColumnHorizP (void);
extern void(*R_FillAddClampColumn)(void); void R_FillSpan (void);
extern void(*R_FillSubClampColumn)(void);
extern void(*R_FillRevSubClampColumn)(void);
extern void(*R_DrawAddColumn)(void);
extern void(*R_DrawTlatedAddColumn)(void);
extern void(*R_DrawAddClampColumn)(void);
extern void(*R_DrawAddClampTranslatedColumn)(void);
extern void(*R_DrawSubClampColumn)(void);
extern void(*R_DrawSubClampTranslatedColumn)(void);
extern void(*R_DrawRevSubClampColumn)(void);
extern void(*R_DrawRevSubClampTranslatedColumn)(void);
extern void(*R_FillSpan)(void);
extern void(*R_FillColumnHoriz)(void);
void R_FillColumnP_C (void);
void R_FillColumnHorizP_C (void);
void R_FillSpan_C (void);
extern void(*R_SetupDrawSlab)(FSWColormap *base_colormap, float light, int shade);
extern void(*R_DrawSlab)(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p);
#ifdef X86_ASM #ifdef X86_ASM
extern "C" void R_SetupDrawSlabA(const BYTE *colormap); #define R_SetupDrawSlab R_SetupDrawSlabA
extern "C" void R_DrawSlabA(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p); #define R_DrawSlab R_DrawSlabA
#else #else
extern "C" void R_SetupDrawSlabC(const BYTE *colormap); #define R_SetupDrawSlab R_SetupDrawSlabC
extern "C" void R_DrawSlabC(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p); #define R_DrawSlab R_DrawSlabC
#endif #endif
extern "C" void R_SetupDrawSlab(const BYTE *colormap);
extern "C" void R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p);
extern "C" int ds_y; extern "C" int ds_y;
extern "C" int ds_x1; extern "C" int ds_x1;
extern "C" int ds_x2; extern "C" int ds_x2;
extern "C" FSWColormap* ds_fcolormap;
extern "C" lighttable_t* ds_colormap; extern "C" lighttable_t* ds_colormap;
extern "C" ShadeConstants ds_shade_constants;
extern "C" dsfixed_t ds_light;
extern "C" dsfixed_t ds_xfrac; extern "C" dsfixed_t ds_xfrac;
extern "C" dsfixed_t ds_yfrac; extern "C" dsfixed_t ds_yfrac;
@ -323,18 +235,15 @@ extern "C" dsfixed_t ds_ystep;
extern "C" int ds_xbits; extern "C" int ds_xbits;
extern "C" int ds_ybits; extern "C" int ds_ybits;
extern "C" fixed_t ds_alpha; extern "C" fixed_t ds_alpha;
extern "C" double ds_lod;
// start of a 64*64 tile image // start of a 64*64 tile image
extern "C" const BYTE* ds_source; extern "C" const BYTE* ds_source;
extern "C" bool ds_source_mipmapped;
extern "C" int ds_color; // [RH] For flat color (no texturing) extern "C" int ds_color; // [RH] For flat color (no texturing)
extern BYTE shadetables[/*NUMCOLORMAPS*16*256*/]; extern BYTE shadetables[/*NUMCOLORMAPS*16*256*/];
extern FDynamicColormap ShadeFakeColormap[16]; extern FDynamicColormap ShadeFakeColormap[16];
extern BYTE identitymap[256]; extern BYTE identitymap[256];
extern FDynamicColormap identitycolormap;
extern BYTE *dc_translation; extern BYTE *dc_translation;
// [RH] Added for muliresolution support // [RH] Added for muliresolution support
@ -358,15 +267,6 @@ inline ESPSResult R_SetPatchStyle(FRenderStyle style, float alpha, int translati
// style was STYLE_Shade // style was STYLE_Shade
void R_FinishSetPatchStyle (); void R_FinishSetPatchStyle ();
extern fixed_t(*tmvline1_add)();
extern void(*tmvline4_add)();
extern fixed_t(*tmvline1_addclamp)();
extern void(*tmvline4_addclamp)();
extern fixed_t(*tmvline1_subclamp)();
extern void(*tmvline4_subclamp)();
extern fixed_t(*tmvline1_revsubclamp)();
extern void(*tmvline4_revsubclamp)();
// transmaskwallscan calls this to find out what column drawers to use // transmaskwallscan calls this to find out what column drawers to use
bool R_GetTransMaskDrawers (fixed_t (**tmvline1)(), void (**tmvline4)()); bool R_GetTransMaskDrawers (fixed_t (**tmvline1)(), void (**tmvline4)());
@ -382,26 +282,11 @@ void maskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_
// transmaskwallscan is like maskwallscan, but it can also blend to the background // transmaskwallscan is like maskwallscan, but it can also blend to the background
void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int col)=R_GetColumn); void transmaskwallscan (int x1, int x2, short *uwal, short *dwal, float *swal, fixed_t *lwal, double yrepeat, const BYTE *(*getcol)(FTexture *tex, int col)=R_GetColumn);
// Sets dc_colormap and dc_light to their appropriate values depending on the output format (pal vs true color)
void R_SetColorMapLight(FSWColormap *base_colormap, float light, int shade);
// Same as R_SetColorMapLight, but for ds_colormap and ds_light
void R_SetDSColorMapLight(FSWColormap *base_colormap, float light, int shade);
void R_SetTranslationMap(lighttable_t *translation);
void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom); void R_DrawSingleSkyCol1(uint32_t solid_top, uint32_t solid_bottom);
void R_DrawSingleSkyCol4(uint32_t solid_top, uint32_t solid_bottom); void R_DrawSingleSkyCol4(uint32_t solid_top, uint32_t solid_bottom);
void R_DrawDoubleSkyCol1(uint32_t solid_top, uint32_t solid_bottom); void R_DrawDoubleSkyCol1(uint32_t solid_top, uint32_t solid_bottom);
void R_DrawDoubleSkyCol4(uint32_t solid_top, uint32_t solid_bottom); void R_DrawDoubleSkyCol4(uint32_t solid_top, uint32_t solid_bottom);
void R_DrawSingleSkyCol1_rgba(uint32_t solid_top, uint32_t solid_bottom); #endif
void R_DrawSingleSkyCol4_rgba(uint32_t solid_top, uint32_t solid_bottom);
void R_DrawDoubleSkyCol1_rgba(uint32_t solid_top, uint32_t solid_bottom);
void R_DrawDoubleSkyCol4_rgba(uint32_t solid_top, uint32_t solid_bottom);
extern bool r_swtruecolor;
}
#endif #endif

View file

@ -73,6 +73,8 @@ class DrawSpanLLVMCommand : public DrawerCommand
public: public:
DrawSpanLLVMCommand() DrawSpanLLVMCommand()
{ {
using namespace drawerargs;
args.xfrac = ds_xfrac; args.xfrac = ds_xfrac;
args.yfrac = ds_yfrac; args.yfrac = ds_yfrac;
args.xstep = ds_xstep; args.xstep = ds_xstep;
@ -122,6 +124,8 @@ protected:
private: private:
inline static bool sampler_setup(const uint32_t * &source, int &xbits, int &ybits, bool mipmapped) inline static bool sampler_setup(const uint32_t * &source, int &xbits, int &ybits, bool mipmapped)
{ {
using namespace drawerargs;
bool magnifying = ds_lod < 0.0f; bool magnifying = ds_lod < 0.0f;
if (r_mipmap && mipmapped) if (r_mipmap && mipmapped)
{ {
@ -217,6 +221,8 @@ protected:
public: public:
DrawWall4LLVMCommand() DrawWall4LLVMCommand()
{ {
using namespace drawerargs;
args.dest = (uint32_t*)dc_dest; args.dest = (uint32_t*)dc_dest;
args.dest_y = _dest_y; args.dest_y = _dest_y;
args.count = dc_count; args.count = dc_count;
@ -281,6 +287,8 @@ protected:
public: public:
DrawWall1LLVMCommand() DrawWall1LLVMCommand()
{ {
using namespace drawerargs;
args.dest = (uint32_t*)dc_dest; args.dest = (uint32_t*)dc_dest;
args.dest_y = _dest_y; args.dest_y = _dest_y;
args.pitch = dc_pitch; args.pitch = dc_pitch;
@ -347,6 +355,8 @@ protected:
public: public:
DrawColumnLLVMCommand() DrawColumnLLVMCommand()
{ {
using namespace drawerargs;
args.dest = (uint32_t*)dc_dest; args.dest = (uint32_t*)dc_dest;
args.source = dc_source; args.source = dc_source;
args.source2 = dc_source2; args.source2 = dc_source2;
@ -408,6 +418,8 @@ protected:
public: public:
DrawSkyLLVMCommand(uint32_t solid_top, uint32_t solid_bottom) DrawSkyLLVMCommand(uint32_t solid_top, uint32_t solid_bottom)
{ {
using namespace drawerargs;
args.dest = (uint32_t*)dc_dest; args.dest = (uint32_t*)dc_dest;
args.dest_y = _dest_y; args.dest_y = _dest_y;
args.count = dc_count; args.count = dc_count;
@ -492,6 +504,8 @@ class DrawFuzzColumnRGBACommand : public DrawerCommand
public: public:
DrawFuzzColumnRGBACommand() DrawFuzzColumnRGBACommand()
{ {
using namespace drawerargs;
_x = dc_x; _x = dc_x;
_yl = dc_yl; _yl = dc_yl;
_yh = dc_yh; _yh = dc_yh;
@ -609,6 +623,8 @@ class FillSpanRGBACommand : public DrawerCommand
public: public:
FillSpanRGBACommand() FillSpanRGBACommand()
{ {
using namespace drawerargs;
_x1 = ds_x1; _x1 = ds_x1;
_x2 = ds_x2; _x2 = ds_x2;
_y = ds_y; _y = ds_y;
@ -655,6 +671,8 @@ class DrawSlabRGBACommand : public DrawerCommand
public: public:
DrawSlabRGBACommand(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p, ShadeConstants shade_constants, const BYTE *colormap, fixed_t light) DrawSlabRGBACommand(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p, ShadeConstants shade_constants, const BYTE *colormap, fixed_t light)
{ {
using namespace drawerargs;
_dx = dx; _dx = dx;
_v = v; _v = v;
_dy = dy; _dy = dy;
@ -774,6 +792,8 @@ class DrawFogBoundaryLineRGBACommand : public DrawerCommand
public: public:
DrawFogBoundaryLineRGBACommand(int y, int x, int x2) DrawFogBoundaryLineRGBACommand(int y, int x, int x2)
{ {
using namespace drawerargs;
_y = y; _y = y;
_x = x; _x = x;
_x2 = x2; _x2 = x2;
@ -862,6 +882,8 @@ class DrawTiltedSpanRGBACommand : public DrawerCommand
public: public:
DrawTiltedSpanRGBACommand(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy) DrawTiltedSpanRGBACommand(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy)
{ {
using namespace drawerargs;
_x1 = x1; _x1 = x1;
_x2 = x2; _x2 = x2;
_y = y; _y = y;
@ -1005,6 +1027,8 @@ class DrawColoredSpanRGBACommand : public DrawerCommand
public: public:
DrawColoredSpanRGBACommand(int y, int x1, int x2) DrawColoredSpanRGBACommand(int y, int x1, int x2)
{ {
using namespace drawerargs;
_y = y; _y = y;
_x1 = x1; _x1 = x1;
_x2 = x2; _x2 = x2;
@ -1051,6 +1075,8 @@ class FillTransColumnRGBACommand : public DrawerCommand
public: public:
FillTransColumnRGBACommand(int x, int y1, int y2, int color, int a) FillTransColumnRGBACommand(int x, int y1, int y2, int color, int a)
{ {
using namespace drawerargs;
_x = x; _x = x;
_y1 = y1; _y1 = y1;
_y2 = y2; _y2 = y2;
@ -1315,6 +1341,8 @@ void R_FillRevSubClampColumn_rgba()
void R_DrawFuzzColumn_rgba() void R_DrawFuzzColumn_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawFuzzColumnRGBACommand>(); DrawerCommandQueue::QueueCommand<DrawFuzzColumnRGBACommand>();
dc_yl = MAX(dc_yl, 1); dc_yl = MAX(dc_yl, 1);
@ -1445,12 +1473,16 @@ void R_DrawSlab_rgba(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BY
DWORD vlinec1_rgba() DWORD vlinec1_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWall1LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWall1LLVMCommand>();
return dc_texturefrac + dc_count * dc_iscale; return dc_texturefrac + dc_count * dc_iscale;
} }
void vlinec4_rgba() void vlinec4_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWall4LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWall4LLVMCommand>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count; vplce[i] += vince[i] * dc_count;
@ -1458,12 +1490,16 @@ void vlinec4_rgba()
DWORD mvlinec1_rgba() DWORD mvlinec1_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallMasked1LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallMasked1LLVMCommand>();
return dc_texturefrac + dc_count * dc_iscale; return dc_texturefrac + dc_count * dc_iscale;
} }
void mvlinec4_rgba() void mvlinec4_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallMasked4LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallMasked4LLVMCommand>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count; vplce[i] += vince[i] * dc_count;
@ -1471,12 +1507,16 @@ void mvlinec4_rgba()
fixed_t tmvline1_add_rgba() fixed_t tmvline1_add_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAdd1LLVMCommand>();
return dc_texturefrac + dc_count * dc_iscale; return dc_texturefrac + dc_count * dc_iscale;
} }
void tmvline4_add_rgba() void tmvline4_add_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallAdd4LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAdd4LLVMCommand>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count; vplce[i] += vince[i] * dc_count;
@ -1484,12 +1524,16 @@ void tmvline4_add_rgba()
fixed_t tmvline1_addclamp_rgba() fixed_t tmvline1_addclamp_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallAddClamp1LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAddClamp1LLVMCommand>();
return dc_texturefrac + dc_count * dc_iscale; return dc_texturefrac + dc_count * dc_iscale;
} }
void tmvline4_addclamp_rgba() void tmvline4_addclamp_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallAddClamp4LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallAddClamp4LLVMCommand>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count; vplce[i] += vince[i] * dc_count;
@ -1497,12 +1541,16 @@ void tmvline4_addclamp_rgba()
fixed_t tmvline1_subclamp_rgba() fixed_t tmvline1_subclamp_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallSubClamp1LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallSubClamp1LLVMCommand>();
return dc_texturefrac + dc_count * dc_iscale; return dc_texturefrac + dc_count * dc_iscale;
} }
void tmvline4_subclamp_rgba() void tmvline4_subclamp_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallSubClamp4LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallSubClamp4LLVMCommand>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count; vplce[i] += vince[i] * dc_count;
@ -1510,12 +1558,16 @@ void tmvline4_subclamp_rgba()
fixed_t tmvline1_revsubclamp_rgba() fixed_t tmvline1_revsubclamp_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp1LLVMCommand>();
return dc_texturefrac + dc_count * dc_iscale; return dc_texturefrac + dc_count * dc_iscale;
} }
void tmvline4_revsubclamp_rgba() void tmvline4_revsubclamp_rgba()
{ {
using namespace drawerargs;
DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4LLVMCommand>(); DrawerCommandQueue::QueueCommand<DrawWallRevSubClamp4LLVMCommand>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
vplce[i] += vince[i] * dc_count; vplce[i] += vince[i] * dc_count;

View file

@ -39,89 +39,6 @@ EXTERN_CVAR(Float, r_lod_bias)
namespace swrenderer namespace swrenderer
{ {
/////////////////////////////////////////////////////////////////////////////
// Drawer functions:
void rt_initcols_rgba(BYTE *buffer);
void rt_span_coverage_rgba(int x, int start, int stop);
void rt_copy1col_rgba(int hx, int sx, int yl, int yh);
void rt_copy4cols_rgba(int sx, int yl, int yh);
void rt_shaded1col_rgba(int hx, int sx, int yl, int yh);
void rt_shaded4cols_rgba(int sx, int yl, int yh);
void rt_map1col_rgba(int hx, int sx, int yl, int yh);
void rt_add1col_rgba(int hx, int sx, int yl, int yh);
void rt_addclamp1col_rgba(int hx, int sx, int yl, int yh);
void rt_subclamp1col_rgba(int hx, int sx, int yl, int yh);
void rt_revsubclamp1col_rgba(int hx, int sx, int yl, int yh);
void rt_tlate1col_rgba(int hx, int sx, int yl, int yh);
void rt_tlateadd1col_rgba(int hx, int sx, int yl, int yh);
void rt_tlateaddclamp1col_rgba(int hx, int sx, int yl, int yh);
void rt_tlatesubclamp1col_rgba(int hx, int sx, int yl, int yh);
void rt_tlaterevsubclamp1col_rgba(int hx, int sx, int yl, int yh);
void rt_map4cols_rgba(int sx, int yl, int yh);
void rt_add4cols_rgba(int sx, int yl, int yh);
void rt_addclamp4cols_rgba(int sx, int yl, int yh);
void rt_subclamp4cols_rgba(int sx, int yl, int yh);
void rt_revsubclamp4cols_rgba(int sx, int yl, int yh);
void rt_tlate4cols_rgba(int sx, int yl, int yh);
void rt_tlateadd4cols_rgba(int sx, int yl, int yh);
void rt_tlateaddclamp4cols_rgba(int sx, int yl, int yh);
void rt_tlatesubclamp4cols_rgba(int sx, int yl, int yh);
void rt_tlaterevsubclamp4cols_rgba(int sx, int yl, int yh);
void R_DrawColumnHoriz_rgba();
void R_DrawColumn_rgba();
void R_DrawFuzzColumn_rgba();
void R_DrawTranslatedColumn_rgba();
void R_DrawShadedColumn_rgba();
void R_FillColumn_rgba();
void R_FillAddColumn_rgba();
void R_FillAddClampColumn_rgba();
void R_FillSubClampColumn_rgba();
void R_FillRevSubClampColumn_rgba();
void R_DrawAddColumn_rgba();
void R_DrawTlatedAddColumn_rgba();
void R_DrawAddClampColumn_rgba();
void R_DrawAddClampTranslatedColumn_rgba();
void R_DrawSubClampColumn_rgba();
void R_DrawSubClampTranslatedColumn_rgba();
void R_DrawRevSubClampColumn_rgba();
void R_DrawRevSubClampTranslatedColumn_rgba();
void R_DrawSpan_rgba(void);
void R_DrawSpanMasked_rgba(void);
void R_DrawSpanTranslucent_rgba();
void R_DrawSpanMaskedTranslucent_rgba();
void R_DrawSpanAddClamp_rgba();
void R_DrawSpanMaskedAddClamp_rgba();
void R_FillSpan_rgba();
void R_DrawTiltedSpan_rgba(int y, int x1, int x2, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy);
void R_DrawColoredSpan_rgba(int y, int x1, int x2);
void R_SetupDrawSlab_rgba(FSWColormap *base_colormap, float light, int shade);
void R_DrawSlab_rgba(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p);
void R_DrawFogBoundary_rgba(int x1, int x2, short *uclip, short *dclip);
DWORD vlinec1_rgba();
void vlinec4_rgba();
DWORD mvlinec1_rgba();
void mvlinec4_rgba();
fixed_t tmvline1_add_rgba();
void tmvline4_add_rgba();
fixed_t tmvline1_addclamp_rgba();
void tmvline4_addclamp_rgba();
fixed_t tmvline1_subclamp_rgba();
void tmvline4_subclamp_rgba();
fixed_t tmvline1_revsubclamp_rgba();
void tmvline4_revsubclamp_rgba();
void R_FillColumnHoriz_rgba();
void R_FillSpan_rgba();
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Drawer commands: // Drawer commands:

View file

@ -72,9 +72,8 @@ extern "C" void R_SetupAddCol();
extern "C" void R_SetupAddClampCol(); extern "C" void R_SetupAddClampCol();
#endif #endif
#ifndef X86_ASM
// Copies one span at hx to the screen at sx. // Copies one span at hx to the screen at sx.
void rt_copy1col_c (int hx, int sx, int yl, int yh) void rt_copy1col (int hx, int sx, int yl, int yh)
{ {
BYTE *source; BYTE *source;
BYTE *dest; BYTE *dest;
@ -115,7 +114,7 @@ void rt_copy1col_c (int hx, int sx, int yl, int yh)
} }
// Copies all four spans to the screen starting at sx. // Copies all four spans to the screen starting at sx.
void rt_copy4cols_c (int sx, int yl, int yh) void rt_copy4cols (int sx, int yl, int yh)
{ {
int *source; int *source;
int *dest; int *dest;
@ -148,7 +147,7 @@ void rt_copy4cols_c (int sx, int yl, int yh)
} }
// Maps one span at hx to the screen at sx. // Maps one span at hx to the screen at sx.
void rt_map1col_c (int hx, int sx, int yl, int yh) void rt_map1col (int hx, int sx, int yl, int yh)
{ {
BYTE *colormap; BYTE *colormap;
BYTE *source; BYTE *source;
@ -183,7 +182,7 @@ void rt_map1col_c (int hx, int sx, int yl, int yh)
} }
// Maps all four spans to the screen starting at sx. // Maps all four spans to the screen starting at sx.
void rt_map4cols_c (int sx, int yl, int yh) void rt_map4cols (int sx, int yl, int yh)
{ {
BYTE *colormap; BYTE *colormap;
BYTE *source; BYTE *source;
@ -225,7 +224,6 @@ void rt_map4cols_c (int sx, int yl, int yh)
dest += pitch*2; dest += pitch*2;
} while (--count); } while (--count);
} }
#endif
void rt_Translate1col(const BYTE *translation, int hx, int yl, int yh) void rt_Translate1col(const BYTE *translation, int hx, int yl, int yh)
{ {

View file

@ -48,10 +48,6 @@
namespace swrenderer namespace swrenderer
{ {
extern unsigned int dc_tspans[4][MAXHEIGHT];
extern unsigned int *dc_ctspan[4];
extern unsigned int *horizspan[4];
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
class DrawColumnRt1LLVMCommand : public DrawerCommand class DrawColumnRt1LLVMCommand : public DrawerCommand
@ -73,6 +69,8 @@ protected:
public: public:
DrawColumnRt1LLVMCommand(int hx, int sx, int yl, int yh) DrawColumnRt1LLVMCommand(int hx, int sx, int yl, int yh)
{ {
using namespace drawerargs;
args.dest = (uint32_t*)dc_destorg + ylookup[yl] + sx; args.dest = (uint32_t*)dc_destorg + ylookup[yl] + sx;
args.source = nullptr; args.source = nullptr;
args.source2 = nullptr; args.source2 = nullptr;
@ -192,6 +190,8 @@ class DrawColumnHorizRGBACommand : public DrawerCommand
public: public:
DrawColumnHorizRGBACommand() DrawColumnHorizRGBACommand()
{ {
using namespace drawerargs;
_count = dc_count; _count = dc_count;
_iscale = dc_iscale; _iscale = dc_iscale;
_texturefrac = dc_texturefrac; _texturefrac = dc_texturefrac;
@ -269,6 +269,8 @@ class FillColumnHorizRGBACommand : public DrawerCommand
public: public:
FillColumnHorizRGBACommand() FillColumnHorizRGBACommand()
{ {
using namespace drawerargs;
_x = dc_x; _x = dc_x;
_count = dc_count; _count = dc_count;
_color = GPalette.BaseColors[dc_color].d | (uint32_t)0xff000000; _color = GPalette.BaseColors[dc_color].d | (uint32_t)0xff000000;
@ -462,6 +464,8 @@ void rt_tlaterevsubclamp4cols_rgba (int sx, int yl, int yh)
// call this function to set up the span pointers. // call this function to set up the span pointers.
void rt_initcols_rgba (BYTE *buff) void rt_initcols_rgba (BYTE *buff)
{ {
using namespace drawerargs;
for (int y = 3; y >= 0; y--) for (int y = 3; y >= 0; y--)
horizspan[y] = dc_ctspan[y] = &dc_tspans[y][0]; horizspan[y] = dc_ctspan[y] = &dc_tspans[y][0];
@ -470,6 +474,8 @@ void rt_initcols_rgba (BYTE *buff)
void rt_span_coverage_rgba(int x, int start, int stop) void rt_span_coverage_rgba(int x, int start, int stop)
{ {
using namespace drawerargs;
unsigned int **tspan = &dc_ctspan[x & 3]; unsigned int **tspan = &dc_ctspan[x & 3];
(*tspan)[0] = start; (*tspan)[0] = start;
(*tspan)[1] = stop; (*tspan)[1] = stop;
@ -480,6 +486,8 @@ void rt_span_coverage_rgba(int x, int start, int stop)
// drawn to the screen along with up to three other columns. // drawn to the screen along with up to three other columns.
void R_DrawColumnHoriz_rgba (void) void R_DrawColumnHoriz_rgba (void)
{ {
using namespace drawerargs;
if (dc_count <= 0) if (dc_count <= 0)
return; return;
@ -498,6 +506,8 @@ void R_DrawColumnHoriz_rgba (void)
// [RH] Just fills a column with a given color // [RH] Just fills a column with a given color
void R_FillColumnHoriz_rgba (void) void R_FillColumnHoriz_rgba (void)
{ {
using namespace drawerargs;
if (dc_count <= 0) if (dc_count <= 0)
return; return;

View file

@ -811,6 +811,8 @@ void R_EnterPortal (PortalDrawseg* pds, int depth)
void R_SetupBuffer () void R_SetupBuffer ()
{ {
using namespace drawerargs;
static BYTE *lastbuff = NULL; static BYTE *lastbuff = NULL;
int pitch = RenderTarget->GetPitch(); int pitch = RenderTarget->GetPitch();

View file

@ -129,7 +129,6 @@ extern void (*hcolfunc_pre) (void);
extern void (*hcolfunc_post1) (int hx, int sx, int yl, int yh); extern void (*hcolfunc_post1) (int hx, int sx, int yl, int yh);
extern void (*hcolfunc_post2) (int hx, int sx, int yl, int yh); extern void (*hcolfunc_post2) (int hx, int sx, int yl, int yh);
extern void (*hcolfunc_post4) (int sx, int yl, int yh); extern void (*hcolfunc_post4) (int sx, int yl, int yh);
extern bool drawer_needs_pal_input;
void R_InitTextureMapping (); void R_InitTextureMapping ();

View file

@ -72,6 +72,7 @@ EXTERN_CVAR(Int, r_skymode)
namespace swrenderer namespace swrenderer
{ {
using namespace drawerargs;
extern subsector_t *InSubsector; extern subsector_t *InSubsector;

View file

@ -96,9 +96,6 @@ void R_DrawNormalPlane (visplane_t *pl, double xscale, double yscale, fixed_t al
void R_DrawTiltedPlane (visplane_t *pl, double xscale, double yscale, fixed_t alpha, bool additive, bool masked); void R_DrawTiltedPlane (visplane_t *pl, double xscale, double yscale, fixed_t alpha, bool additive, bool masked);
void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1)); void R_MapVisPlane (visplane_t *pl, void (*mapfunc)(int y, int x1));
extern void(*R_MapColoredPlane)(int y, int x1);
extern void(*R_MapTiltedPlane)(int y, int x1);
void R_MapTiltedPlane_C(int y, int x1); void R_MapTiltedPlane_C(int y, int x1);
void R_MapTiltedPlane_rgba(int y, int x); void R_MapTiltedPlane_rgba(int y, int x);
void R_MapColoredPlane_C(int y, int x1); void R_MapColoredPlane_C(int y, int x1);

View file

@ -64,6 +64,7 @@ EXTERN_CVAR(Bool, r_mipmap)
namespace swrenderer namespace swrenderer
{ {
using namespace drawerargs;
#define HEIGHTBITS 12 #define HEIGHTBITS 12
#define HEIGHTSHIFT (FRACBITS-HEIGHTBITS) #define HEIGHTSHIFT (FRACBITS-HEIGHTBITS)

View file

@ -78,6 +78,7 @@ CVAR(Bool, r_splitsprites, true, CVAR_ARCHIVE)
namespace swrenderer namespace swrenderer
{ {
using namespace drawerargs;
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans. // [RH] A c-buffer. Used for keeping track of offscreen voxel spans.

View file

@ -100,7 +100,6 @@ struct vissprite_t
vissprite_t() {} vissprite_t() {}
}; };
extern void(*R_DrawParticle)(vissprite_t *);
void R_DrawParticle_C (vissprite_t *); void R_DrawParticle_C (vissprite_t *);
void R_DrawParticle_rgba (vissprite_t *); void R_DrawParticle_rgba (vissprite_t *);

View file

@ -107,23 +107,23 @@ protected:
{ {
count += dest_y; count += dest_y;
dest_y = 0; dest_y = 0;
dest = (uint32_t*)swrenderer::dc_destorg; dest = (uint32_t*)swrenderer::drawerargs::dc_destorg;
} }
else if (dest_y >= swrenderer::dc_destheight) else if (dest_y >= swrenderer::drawerargs::dc_destheight)
{ {
dest_y = 0; dest_y = 0;
count = 0; count = 0;
} }
if (count < 0 || count > MAXHEIGHT) count = 0; if (count < 0 || count > MAXHEIGHT) count = 0;
if (dest_y + count >= swrenderer::dc_destheight) if (dest_y + count >= swrenderer::drawerargs::dc_destheight)
count = swrenderer::dc_destheight - dest_y; count = swrenderer::drawerargs::dc_destheight - dest_y;
} }
public: public:
DrawerCommand() DrawerCommand()
{ {
_dest_y = static_cast<int>((swrenderer::dc_dest - swrenderer::dc_destorg) / (swrenderer::dc_pitch * 4)); _dest_y = static_cast<int>((swrenderer::drawerargs::dc_dest - swrenderer::drawerargs::dc_destorg) / (swrenderer::drawerargs::dc_pitch * 4));
} }
virtual ~DrawerCommand() { } virtual ~DrawerCommand() { }

View file

@ -134,6 +134,7 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
{ {
#ifndef NO_SWRENDER #ifndef NO_SWRENDER
using namespace swrenderer; using namespace swrenderer;
using namespace drawerargs;
static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH]; static short bottomclipper[MAXWIDTH], topclipper[MAXWIDTH];
const BYTE *translation = NULL; const BYTE *translation = NULL;
@ -1362,6 +1363,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
{ {
#ifndef NO_SWRENDER #ifndef NO_SWRENDER
using namespace swrenderer; using namespace swrenderer;
using namespace drawerargs;
// Use an equation similar to player sprites to determine shade // Use an equation similar to player sprites to determine shade
fixed_t shade = LIGHT2SHADE(lightlevel) - 12*FRACUNIT; fixed_t shade = LIGHT2SHADE(lightlevel) - 12*FRACUNIT;