4 changes: 2 additions & 2 deletions src/tmap.nas → src/asm_ia32/tmap.asm
Expand Up @@ -51,7 +51,7 @@ FUZZTABLE equ 50
%define fuzzpos _fuzzpos
%define fuzzoffset _fuzzoffset
%define NormalLight _NormalLight
%define realviewheight _realviewheight
%define viewheight _viewheight
%define fuzzviewheight _fuzzviewheight
%define CPU _CPU

Expand Down Expand Up @@ -103,7 +103,7 @@ EXTERN centery
EXTERN fuzzpos
EXTERN fuzzoffset
EXTERN NormalLight
EXTERN realviewheight
EXTERN viewheight
EXTERN fuzzviewheight
EXTERN CPU

Expand Down
File renamed without changes.
File renamed without changes.
182 changes: 182 additions & 0 deletions src/asm_x86_64/tmap3.asm
@@ -0,0 +1,182 @@
%include "valgrind.inc"

BITS 64
DEFAULT REL

%ifnidn __OUTPUT_FORMAT__,win64

%macro PROC_FRAME 1
%1:
%endmacro

%macro rex_push_reg 1
push %1
%endmacro

%macro push_reg 1
push %1
%endmacro

%macro alloc_stack 1
sub rsp,%1
%endmacro

%define parm1lo dil

%else

%define parm1lo cl

%endif

SECTION .data

EXTERN vplce
EXTERN vince
EXTERN palookupoffse
EXTERN bufplce

EXTERN dc_count
EXTERN dc_dest
EXTERN dc_pitch

SECTION .text

ALIGN 16
GLOBAL ASM_PatchPitch
ASM_PatchPitch:
mov ecx, [dc_pitch]
mov [pm+3], ecx
mov [vltpitch+3], ecx
selfmod pm, vltpitch+6
ret

ALIGN 16
GLOBAL setupvlinetallasm
setupvlinetallasm:
mov [shifter1+2], parm1lo
mov [shifter2+2], parm1lo
mov [shifter3+2], parm1lo
mov [shifter4+2], parm1lo
selfmod shifter1, shifter4+3
ret

%ifidn __OUTPUT_FORMAT__,win64
; Yasm can't do progbits alloc exec for win64?
; Hmm, looks like it's automatic. No worries, then.
SECTION .rtext write ;progbits alloc exec
%else
SECTION .rtext progbits alloc exec write
%endif

ALIGN 16

GLOBAL vlinetallasm4
PROC_FRAME vlinetallasm4
rex_push_reg rbx
push_reg rdi
push_reg r15
push_reg r14
push_reg r13
push_reg r12
push_reg rbp
push_reg rsi
alloc_stack 8 ; Stack must be 16-byte aligned
END_PROLOGUE
; rax = bufplce base address
; rbx =
; rcx = offset from rdi/count (negative)
; edx/rdx = scratch
; rdi = bottom of columns to write to
; r8d-r11d = column offsets
; r12-r15 = palookupoffse[0] - palookupoffse[4]

mov ecx, [dc_count]
mov rdi, [dc_dest]
test ecx, ecx
jle vltepilog ; count must be positive

mov rax, [bufplce]
mov r8, [bufplce+8]
sub r8, rax
mov r9, [bufplce+16]
sub r9, rax
mov r10, [bufplce+24]
sub r10, rax
mov [source2+4], r8d
mov [source3+4], r9d
mov [source4+4], r10d

pm: imul rcx, 320

mov r12, [palookupoffse]
mov r13, [palookupoffse+8]
mov r14, [palookupoffse+16]
mov r15, [palookupoffse+24]

mov r8d, [vince]
mov r9d, [vince+4]
mov r10d, [vince+8]
mov r11d, [vince+12]
mov [step1+3], r8d
mov [step2+3], r9d
mov [step3+3], r10d
mov [step4+3], r11d

add rdi, rcx
neg rcx

mov r8d, [vplce]
mov r9d, [vplce+4]
mov r10d, [vplce+8]
mov r11d, [vplce+12]
selfmod loopit, vltepilog
jmp loopit

ALIGN 16
loopit:
mov edx, r8d
shifter1: shr edx, 24
step1: add r8d, 0x88888888
movzx rdx, BYTE [rax+rdx]
mov ebx, r9d
mov dl, [r12+rdx]
shifter2: shr ebx, 24
step2: add r9d, 0x88888888
source2: movzx ebx, BYTE [rax+rbx+0x88888888]
mov ebp, r10d
mov bl, [r13+rbx]
shifter3: shr ebp, 24
step3: add r10d, 0x88888888
source3: movzx ebp, BYTE [rax+rbp+0x88888888]
mov esi, r11d
mov bpl, BYTE [r14+rbp]
shifter4: shr esi, 24
step4: add r11d, 0x88888888
source4: movzx esi, BYTE [rax+rsi+0x88888888]
mov [rdi+rcx], dl
mov [rdi+rcx+1], bl
mov sil, BYTE [r15+rsi]
mov [rdi+rcx+2], bpl
mov [rdi+rcx+3], sil

vltpitch: add rcx, 320
jl loopit

mov [vplce], r8d
mov [vplce+4], r9d
mov [vplce+8], r10d
mov [vplce+12], r11d

vltepilog:
add rsp, 8
pop rsi
pop rbp
pop r12
pop r13
pop r14
pop r15
pop rdi
pop rbx
ret
ENDPROC_FRAME
2 changes: 1 addition & 1 deletion src/ct_chat.cpp
Expand Up @@ -207,7 +207,7 @@ void CT_Drawer (void)
int screen_height = con_scaletext > 1? SCREENHEIGHT/2 : SCREENHEIGHT;
int st_y = con_scaletext > 1? ST_Y/2 : ST_Y;

y += ((SCREENHEIGHT == realviewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;
y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;

promptwidth = SmallFont->StringWidth (prompt) * scalex;
x = screen->Font->GetCharWidth ('_') * scalex * 2 + promptwidth;
Expand Down
18 changes: 12 additions & 6 deletions src/d_main.cpp
Expand Up @@ -582,7 +582,7 @@ void D_Display ()
StatusBar->BlendView (blend);
}
screen->SetBlendingRect(viewwindowx, viewwindowy,
viewwindowx + realviewwidth, viewwindowy + realviewheight);
viewwindowx + viewwidth, viewwindowy + viewheight);
P_CheckPlayerSprites();
screen->RenderView(&players[consoleplayer]);
if ((hw2d = screen->Begin2D(viewactive)))
Expand All @@ -593,8 +593,11 @@ void D_Display ()
}
if (automapactive)
{
int saved_ST_Y=ST_Y;
if (hud_althud && realviewheight == SCREENHEIGHT) ST_Y=realviewheight;
int saved_ST_Y = ST_Y;
if (hud_althud && viewheight == SCREENHEIGHT)
{
ST_Y = viewheight;
}
AM_Drawer ();
ST_Y = saved_ST_Y;
}
Expand All @@ -603,13 +606,13 @@ void D_Display ()
R_RefreshViewBorder ();
}

if (hud_althud && realviewheight == SCREENHEIGHT)
if (hud_althud && viewheight == SCREENHEIGHT)
{
if (DrawFSHUD || automapactive) DrawHUD();
StatusBar->DrawTopStuff (HUD_None);
}
else
if (realviewheight == SCREENHEIGHT && viewactive)
if (viewheight == SCREENHEIGHT && viewactive)
{
StatusBar->Draw (DrawFSHUD ? HUD_Fullscreen : HUD_None);
StatusBar->DrawTopStuff (DrawFSHUD ? HUD_Fullscreen : HUD_None);
Expand Down Expand Up @@ -2085,7 +2088,10 @@ void D_DoomMain (void)
_FPU_SETCW(cw);
}
#elif defined(_PC_53)
_control87(_PC_53, _MCW_PC);
// On the x64 architecture, changing the floating point precision is not supported.
#ifndef _WIN64
int cfp = _control87(_PC_53, _MCW_PC);
#endif
#endif

PClass::StaticInit ();
Expand Down
4 changes: 0 additions & 4 deletions src/doomstat.h
Expand Up @@ -132,10 +132,6 @@ extern int viewwindowy;
extern "C" int viewheight;
extern "C" int viewwidth;
extern "C" int halfviewwidth; // [RH] Half view width, for plane drawing
extern "C" int realviewwidth; // [RH] Physical width of view window
extern "C" int realviewheight; // [RH] Physical height of view window
extern "C" int detailxshift; // [RH] X shift for horizontal detail level
extern "C" int detailyshift; // [RH] Y shift for vertical detail level



Expand Down
52 changes: 45 additions & 7 deletions src/doomtype.h
Expand Up @@ -43,24 +43,62 @@

// Since this file is included by everything, it seems an appropriate place
// to check the NOASM/USEASM macros.
#if (!defined(_M_IX86) && !defined(__i386__)) || defined(__APPLE__)
// The assembly code requires an x86 processor.
// And needs to be tweaked for Mach-O before enabled on Macs.
#if defined(__APPLE__)
// The assembly code needs to be tweaked for Mach-O before enabled on Macs.
#ifndef NOASM
#define NOASM
#endif
#endif

// There are three assembly-related macros:
//
// NOASM - Assembly code is disabled
// X86_ASM - Using ia32 assembly code
// X64_ASM - Using amd64 assembly code
//
// Note that these relate only to using the pure assembly code. Inline
// assembly may still be used without respect to these macros, as
// deemed appropriate.

#ifndef NOASM
#ifndef USEASM
#define USEASM 1
// Select the appropriate type of assembly code to use.

#if defined(_M_IX86) || defined(__i386__)

#define X86_ASM
#ifdef X64_ASM
#undef X64_ASM
#endif

#elif defined(_M_X64) || defined(__amd64__)

#define X64_ASM
#ifdef X86_ASM
#undef X86_ASM
#endif

#else
#ifdef USEASM
#undef USEASM

#define NOASM

#endif

#endif

#ifdef NOASM
// Ensure no assembly macros are defined if NOASM is defined.

#ifdef X86_ASM
#undef X86_ASM
#endif

#ifdef X64_ASM
#undef X64_ASM
#endif

#endif


#if defined(_MSC_VER) || defined(__WATCOMC__)
#define STACK_ARGS __cdecl
#else
Expand Down
4 changes: 2 additions & 2 deletions src/g_hexen/hexen_sbar.cpp
Expand Up @@ -842,7 +842,7 @@ class DHexenStatusBar : public DBaseStatusBar
{
AWeaponHolder *hold = static_cast<AWeaponHolder*>(inv);

if (hold->PieceWeapon->TypeName == FourthWeaponNames[FourthWeaponClass])
if (hold->PieceWeapon->TypeName == FourthWeaponNames[(int)FourthWeaponClass])
{
// Weapon Pieces
if (oldpieces != hold->PieceMask)
Expand Down Expand Up @@ -883,7 +883,7 @@ class DHexenStatusBar : public DBaseStatusBar
}
if (oldpieces != 0)
{
DrawImage (ClassImages[FourthWeaponClass][imgWEAPONSLOT], 190, 0);
DrawImage (ClassImages[(int)FourthWeaponClass][imgWEAPONSLOT], 190, 0);
oldpieces = 0;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/g_shared/sbarinfo_display.cpp
Expand Up @@ -203,9 +203,9 @@ void DSBarInfo::Draw (EHudState state)
if(SBarInfoScript->completeBorder) //Fill the statusbar with the border before we draw.
{
FTexture *b = TexMan[gameinfo.border->b];
R_DrawBorder(viewwindowx, viewwindowy + realviewheight + b->GetHeight(), viewwindowx + realviewwidth, SCREENHEIGHT);
R_DrawBorder(viewwindowx, viewwindowy + viewheight + b->GetHeight(), viewwindowx + viewwidth, SCREENHEIGHT);
if(screenblocks == 10)
screen->FlatFill(viewwindowx, viewwindowy + realviewheight, viewwindowx + realviewwidth, viewwindowy + realviewheight + b->GetHeight(), b, true);
screen->FlatFill(viewwindowx, viewwindowy + viewheight, viewwindowx + viewwidth, viewwindowy + viewheight + b->GetHeight(), b, true);
}
if(SBarInfoScript->automapbar && automapactive)
{
Expand Down
4 changes: 2 additions & 2 deletions src/g_shared/shared_sbar.cpp
Expand Up @@ -1067,8 +1067,8 @@ void DBaseStatusBar::DrawCrosshair ()
}

screen->DrawTexture (CrosshairImage,
realviewwidth / 2 + viewwindowx,
realviewheight / 2 + viewwindowy,
viewwidth / 2 + viewwindowx,
viewheight / 2 + viewwindowy,
DTA_DestWidth, w,
DTA_DestHeight, h,
DTA_AlphaChannel, true,
Expand Down
10 changes: 0 additions & 10 deletions src/m_options.cpp
Expand Up @@ -450,7 +450,6 @@ static void StartScoreboardMenu (void);
static void InitCrosshairsList();

EXTERN_CVAR (Bool, st_scale)
EXTERN_CVAR (Int, r_detail)
EXTERN_CVAR (Bool, r_stretchsky)
EXTERN_CVAR (Int, r_columnmethod)
EXTERN_CVAR (Bool, r_drawfuzz)
Expand All @@ -464,14 +463,6 @@ EXTERN_CVAR (Int, screenblocks)

static TArray<valuestring_t> Crosshairs;

static value_t DetailModes[] =
{
{ 0.0, "Normal" },
{ 1.0, "Double Horizontally" },
{ 2.0, "Double Vertically" },
{ 3.0, "Double Horiz and Vert" }
};

static value_t ColumnMethods[] = {
{ 0.0, "Original" },
{ 1.0, "Optimized" }
Expand Down Expand Up @@ -517,7 +508,6 @@ static menuitem_t VideoItems[] = {
{ slider, "Brightness", {&Gamma}, {1.0}, {3.0}, {0.1}, {NULL} },
{ discretes,"Crosshair", {&crosshair}, {8.0}, {0.0}, {0.0}, {NULL} },
{ discrete, "Column render mode", {&r_columnmethod}, {2.0}, {0.0}, {0.0}, {ColumnMethods} },
{ discrete, "Detail mode", {&r_detail}, {4.0}, {0.0}, {0.0}, {DetailModes} },
{ discrete, "Stretch short skies", {&r_stretchsky}, {2.0}, {0.0}, {0.0}, {OnOff} },
{ discrete, "Stretch status bar", {&st_scale}, {2.0}, {0.0}, {0.0}, {OnOff} },
{ discrete, "Alternative HUD", {&hud_althud}, {2.0}, {0.0}, {0.0}, {OnOff} },
Expand Down
2 changes: 1 addition & 1 deletion src/m_swap.h
Expand Up @@ -120,7 +120,7 @@ inline int BigLong (int x)
| ((((unsigned int)x)<<8) & 0xff0000)
| (((unsigned int)x)<<24));
}
#endif // USEASM
#endif

#endif // WORDS_BIGENDIAN

Expand Down
537 changes: 0 additions & 537 deletions src/misc.nas

This file was deleted.

2 changes: 1 addition & 1 deletion src/p_mobj.cpp
Expand Up @@ -794,7 +794,7 @@ AInventory *AActor::FindInventory (FName type)

AInventory *AActor::GiveInventoryType (const PClass *type)
{
AInventory *item;
AInventory *item = NULL;

if (type != NULL)
{
Expand Down
178 changes: 36 additions & 142 deletions src/r_draw.cpp
Expand Up @@ -69,19 +69,6 @@ int scaledviewwidth;
int viewwindowx;
int viewwindowy;

extern "C" {
int realviewwidth; // [RH] Physical width of view window
int realviewheight; // [RH] Physical height of view window
int detailxshift; // [RH] X shift for horizontal detail level
int detailyshift; // [RH] Y shift for vertical detail level
}

#ifdef USEASM
extern "C" void STACK_ARGS DoubleHoriz_MMX (int height, int width, BYTE *dest, int pitch);
extern "C" void STACK_ARGS DoubleHorizVert_MMX (int height, int width, BYTE *dest, int pitch);
extern "C" void STACK_ARGS DoubleVert_ASM (int height, int width, BYTE *dest, int pitch);
#endif

// [RH] Pointers to the different column drawers.
// These get changed depending on the current
// screen depth and asm/no asm.
Expand Down Expand Up @@ -130,8 +117,6 @@ const BYTE* bufplce[4];
int dccount;
}

cycle_t DetailDoubleCycles;

int dc_fillcolor;
BYTE *dc_translation;
BYTE shadetables[NUMCOLORMAPS*16*256];
Expand Down Expand Up @@ -161,7 +146,7 @@ EXTERN_CVAR (Int, r_columnmethod)
/* */
/************************************/

#ifndef USEASM
#ifndef X86_ASM
//
// A column is a vertical slice/span from a wall texture that,
// given the DOOM style restrictions on the view orientation,
Expand Down Expand Up @@ -212,7 +197,7 @@ void R_DrawColumnP_C (void)
} while (--count);
}
}
#endif // USEASM
#endif

// [RH] Just fills a column with a color
void R_FillColumnP (void)
Expand Down Expand Up @@ -404,7 +389,7 @@ void R_InitFuzzTable (int fuzzoff)
}
}

#ifndef USEASM
#ifndef X86_ASM
//
// Creates a fuzzy image by copying pixels from adjacent ones above and below.
// Used with an all black colormap, this could create the SHADOW effect,
Expand Down Expand Up @@ -480,7 +465,7 @@ void R_DrawFuzzColumnP_C (void)
fuzzpos = fuzz;
}
}
#endif // USEASM
#endif

//
// R_DrawTranlucentColumn
Expand Down Expand Up @@ -976,7 +961,7 @@ int dscount;

//
// Draws the actual span.
#if !defined(USEASM)
#ifndef X86_ASM
void R_DrawSpanP_C (void)
{
dsfixed_t xfrac;
Expand Down Expand Up @@ -1256,14 +1241,21 @@ void R_FillSpan (void)

// wallscan stuff, in C

#ifndef USEASM
#ifndef X86_ASM
static DWORD STACK_ARGS vlinec1 ();
static void STACK_ARGS vlinec4 ();
static int vlinebits;

DWORD (STACK_ARGS *dovline1)() = vlinec1;
DWORD (STACK_ARGS *doprevline1)() = vlinec1;

#ifdef X64_ASM
extern "C" static void vlinetallasm4();
#define dovline4 vlinetallasm4
extern "C" void setupvlinetallasm (int);
#else
static void STACK_ARGS vlinec4 ();
void (STACK_ARGS *dovline4)() = vlinec4;
#endif

static DWORD STACK_ARGS mvlinec1();
static void STACK_ARGS mvlinec4();
Expand All @@ -1281,8 +1273,8 @@ DWORD STACK_ARGS prevlineasm1 ();
DWORD STACK_ARGS vlinetallasm1 ();
DWORD STACK_ARGS prevlinetallasm1 ();
void STACK_ARGS vlineasm4 ();
void STACK_ARGS vlinetallasm4 ();
void STACK_ARGS vlinetallasmathlon4 ();
void STACK_ARGS vlinetallasm4 ();
void STACK_ARGS setupvlineasm (int);
void STACK_ARGS setupvlinetallasm (int);

Expand All @@ -1301,7 +1293,7 @@ void (STACK_ARGS *domvline4)() = mvlineasm4;

void setupvline (int fracbits)
{
#ifdef USEASM
#ifdef X86_ASM
if (CPU.Family <= 5)
{
if (fracbits >= 24)
Expand Down Expand Up @@ -1329,10 +1321,13 @@ void setupvline (int fracbits)
}
#else
vlinebits = fracbits;
#ifdef X64_ASM
setupvlinetallasm(fracbits);
#endif
#endif
}

#ifndef USEASM
#if !defined(X86_ASM)
DWORD STACK_ARGS vlinec1 ()
{
DWORD fracstep = dc_iscale;
Expand Down Expand Up @@ -1374,7 +1369,7 @@ void STACK_ARGS vlinec4 ()

void setupmvline (int fracbits)
{
#if defined(USEASM)
#if defined(X86_ASM)
setupmvlineasm (fracbits);
domvline1 = mvlineasm1;
domvline4 = mvlineasm4;
Expand All @@ -1383,7 +1378,7 @@ void setupmvline (int fracbits)
#endif
}

#ifndef USEASM
#if !defined(X86_ASM)
DWORD STACK_ARGS mvlinec1 ()
{
DWORD fracstep = dc_iscale;
Expand Down Expand Up @@ -1863,17 +1858,17 @@ void R_DrawViewBorder (void)
SB_state = screen->GetPageCount ();
}

if (realviewwidth == SCREENWIDTH)
if (viewwidth == SCREENWIDTH)
{
return;
}

R_DrawBorder (0, 0, SCREENWIDTH, viewwindowy);
R_DrawBorder (0, viewwindowy, viewwindowx, realviewheight + viewwindowy);
R_DrawBorder (viewwindowx + realviewwidth, viewwindowy, SCREENWIDTH, realviewheight + viewwindowy);
R_DrawBorder (0, viewwindowy + realviewheight, SCREENWIDTH, ST_Y);
R_DrawBorder (0, viewwindowy, viewwindowx, viewheight + viewwindowy);
R_DrawBorder (viewwindowx + viewwidth, viewwindowy, SCREENWIDTH, viewheight + viewwindowy);
R_DrawBorder (0, viewwindowy + viewheight, SCREENWIDTH, ST_Y);

M_DrawFrame (viewwindowx, viewwindowy, realviewwidth, realviewheight);
M_DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
V_MarkRect (0, 0, SCREENWIDTH, ST_Y);
}

Expand All @@ -1893,143 +1888,42 @@ void R_DrawTopBorder ()
FTexture *p;
int offset;

if (realviewwidth == SCREENWIDTH)
if (viewwidth == SCREENWIDTH)
return;

offset = gameinfo.border->offset;

if (viewwindowy < 34)
{
R_DrawBorder (0, 0, viewwindowx, 34);
R_DrawBorder (viewwindowx, 0, viewwindowx+realviewwidth, viewwindowy);
R_DrawBorder (viewwindowx+realviewwidth, 0, SCREENWIDTH, 34);
R_DrawBorder (viewwindowx, 0, viewwindowx + viewwidth, viewwindowy);
R_DrawBorder (viewwindowx + viewwidth, 0, SCREENWIDTH, 34);
p = TexMan(gameinfo.border->t);
screen->FlatFill(viewwindowx, viewwindowy - p->GetHeight(),
viewwindowx + realviewwidth, viewwindowy, p, true);
viewwindowx + viewwidth, viewwindowy, p, true);

p = TexMan(gameinfo.border->l);
screen->FlatFill(viewwindowx - p->GetWidth(), viewwindowy,
viewwindowx, 35, p, true);
p = TexMan(gameinfo.border->r);
screen->FlatFill(viewwindowx + realviewwidth, viewwindowy,
viewwindowx + realviewwidth + p->GetWidth(), 35, p, true);
screen->FlatFill(viewwindowx + viewwidth, viewwindowy,
viewwindowx + viewwidth + p->GetWidth(), 35, p, true);

p = TexMan(gameinfo.border->tl);
screen->DrawTexture (p, viewwindowx-offset, viewwindowy - offset, TAG_DONE);
screen->DrawTexture (p, viewwindowx - offset, viewwindowy - offset, TAG_DONE);

p = TexMan(gameinfo.border->tr);
screen->DrawTexture (p, viewwindowx+realviewwidth, viewwindowy - offset, TAG_DONE);
screen->DrawTexture (p, viewwindowx + viewwidth, viewwindowy - offset, TAG_DONE);
}
else
{
R_DrawBorder (0, 0, SCREENWIDTH, 34);
}
}


// [RH] Double pixels in the view window horizontally
// and/or vertically (or not at all).
void R_DetailDouble ()
{
if (!viewactive) return;
DetailDoubleCycles = 0;
clock (DetailDoubleCycles);

switch ((detailxshift << 1) | detailyshift)
{
case 1: // y-double
#ifdef USEASM
DoubleVert_ASM (viewheight, viewwidth, dc_destorg, RenderTarget->GetPitch());
#else
{
int rowsize = realviewwidth;
int pitch = RenderTarget->GetPitch();
int y;
BYTE *line;

line = dc_destorg;
for (y = viewheight; y != 0; --y, line += pitch<<1)
{
memcpy (line+pitch, line, rowsize);
}
}
#endif
break;

case 2: // x-double
#ifdef USEASM
if (CPU.bMMX && (viewwidth&15)==0)
{
DoubleHoriz_MMX (viewheight, viewwidth, dc_destorg+viewwidth, RenderTarget->GetPitch());
}
else
#endif
{
int rowsize = viewwidth;
int pitch = RenderTarget->GetPitch();
int y,x;
BYTE *linefrom, *lineto;

linefrom = dc_destorg;
for (y = viewheight; y != 0; --y, linefrom += pitch)
{
lineto = linefrom - viewwidth;
for (x = 0; x < rowsize; ++x)
{
BYTE c = linefrom[x];
lineto[x*2] = c;
lineto[x*2+1] = c;
}
}
}
break;

case 3: // x- and y-double
#ifdef USEASM
if (CPU.bMMX && (viewwidth&15)==0 && 0)
{
DoubleHorizVert_MMX (viewheight, viewwidth, dc_destorg+viewwidth, RenderTarget->GetPitch());
}
else
#endif
{
int rowsize = viewwidth;
int realpitch = RenderTarget->GetPitch();
int pitch = realpitch << 1;
int y,x;
BYTE *linefrom, *lineto;

linefrom = dc_destorg;
for (y = viewheight; y != 0; --y, linefrom += pitch)
{
lineto = linefrom - viewwidth;
for (x = 0; x < rowsize; ++x)
{
BYTE c = linefrom[x];
lineto[x*2] = c;
lineto[x*2+1] = c;
lineto[x*2+realpitch] = c;
lineto[x*2+realpitch+1] = c;
}
}
}
break;
}

unclock (DetailDoubleCycles);
}

ADD_STAT(detail)
{
FString out;
out.Format ("doubling = %04.1f ms", (double)DetailDoubleCycles * 1000 * SecondsPerCycle);
return out;
}

// [RH] Initialize the column drawer pointers
void R_InitColumnDrawers ()
{
#ifdef USEASM
#ifdef X86_ASM
R_DrawColumn = R_DrawColumnP_ASM;
R_DrawColumnHoriz = R_DrawColumnHorizP_ASM;
R_DrawFuzzColumn = R_DrawFuzzColumnP_ASM;
Expand Down
37 changes: 19 additions & 18 deletions src/r_draw.h
Expand Up @@ -67,7 +67,12 @@ extern void (*R_DrawColumn)(void);

extern DWORD (STACK_ARGS *dovline1) ();
extern DWORD (STACK_ARGS *doprevline1) ();
#ifdef X64_ASM
#define dovline4 vlinetallasm4
extern "C" void vlinetallasm4();
#else
extern void (STACK_ARGS *dovline4) ();
#endif
extern void setupvline (int);

extern DWORD (STACK_ARGS *domvline1) ();
Expand Down Expand Up @@ -151,7 +156,7 @@ void STACK_ARGS rt_addclamp4cols_asm (int sx, int yl, int yh);

extern void (STACK_ARGS *rt_map4cols)(int sx, int yl, int yh);

#ifdef USEASM
#ifdef X86_ASM
#define rt_copy1col rt_copy1col_asm
#define rt_copy4cols rt_copy4cols_asm
#define rt_map1col rt_map1col_asm
Expand All @@ -175,27 +180,27 @@ void rt_initcols (void);
void R_DrawFogBoundary (int x1, int x2, short *uclip, short *dclip);


#ifndef USEASM
void R_DrawColumnHorizP_C (void);
void R_DrawColumnP_C (void);
void R_DrawFuzzColumnP_C (void);
void R_DrawTranslatedColumnP_C (void);
void R_DrawShadedColumnP_C (void);
void R_DrawSpanP_C (void);
void R_DrawSpanMaskedP_C (void);

#else /* USEASM */
#ifdef X86_ASM

extern "C" void R_DrawColumnP_Unrolled (void);

extern "C" void R_DrawColumnHorizP_ASM (void);
extern "C" void R_DrawColumnP_ASM (void);
extern "C" void R_DrawFuzzColumnP_ASM (void);
void R_DrawTranslatedColumnP_C (void);
void R_DrawShadedColumnP_C (void);
void R_DrawTranslatedColumnP_C (void);
void R_DrawShadedColumnP_C (void);
extern "C" void R_DrawSpanP_ASM (void);
extern "C" void R_DrawSpanMaskedP_ASM (void);

#else

void R_DrawColumnHorizP_C (void);
void R_DrawColumnP_C (void);
void R_DrawFuzzColumnP_C (void);
void R_DrawTranslatedColumnP_C (void);
void R_DrawShadedColumnP_C (void);
void R_DrawSpanP_C (void);
void R_DrawSpanMaskedP_C (void);

#endif

void R_DrawSpanTranslucentP_C (void);
Expand Down Expand Up @@ -232,10 +237,6 @@ extern FDynamicColormap ShadeFakeColormap[16];
extern BYTE identitymap[256];
extern BYTE *dc_translation;

// [RH] Double view pixels by detail mode
void R_DetailDouble (void);



// If the view size is not full screen, draws a border around it.
void R_DrawViewBorder (void);
Expand Down
8 changes: 4 additions & 4 deletions src/r_drawt.cpp
Expand Up @@ -59,13 +59,13 @@ unsigned int dc_tspans[4][MAXHEIGHT];
unsigned int *dc_ctspan[4];
unsigned int *horizspan[4];

#ifdef USEASM
#ifdef X86_ASM
extern "C" void R_SetupShadedCol();
extern "C" void R_SetupAddCol();
extern "C" void R_SetupAddClampCol();
#endif

#ifndef USEASM
#ifndef X86_ASM
// Copies one span at hx to the screen at sx.
void rt_copy1col_c (int hx, int sx, int yl, int yh)
{
Expand Down Expand Up @@ -218,7 +218,7 @@ void STACK_ARGS rt_map4cols_c (int sx, int yl, int yh)
dest += pitch*2;
} while (--count);
}
#endif /* !USEASM */
#endif

void rt_Translate1col(const BYTE *translation, int hx, int yl, int yh)
{
Expand Down Expand Up @@ -850,7 +850,7 @@ void rt_draw4cols (int sx)
dc_ctspan[x][1] = screen->GetHeight();
}

#ifdef USEASM
#ifdef X86_ASM
// Setup assembly routines for changed colormaps or other parameters.
if (hcolfunc_post4 == rt_shaded4cols)
{
Expand Down
119 changes: 22 additions & 97 deletions src/r_main.cpp
Expand Up @@ -191,7 +191,7 @@ bool foggy; // [RH] ignore extralight and fullbright?
int r_actualextralight;

bool setsizeneeded;
int setblocks, setdetail = -1;
int setblocks;

fixed_t freelookviewheight;

Expand Down Expand Up @@ -516,8 +516,8 @@ void R_SetVisibility (float vis)
else
r_WallVisibility = r_BaseVisibility;

r_WallVisibility = FixedMul (Scale (InvZtoScale, SCREENWIDTH*(BaseRatioSizes[WidescreenRatio][1]<<detailyshift),
(viewwidth<<detailxshift)*SCREENHEIGHT*3), FixedMul (r_WallVisibility, FocalTangent));
r_WallVisibility = FixedMul (Scale (InvZtoScale, SCREENWIDTH*BaseRatioSizes[WidescreenRatio][1],
viewwidth*SCREENHEIGHT*3), FixedMul (r_WallVisibility, FocalTangent));

// Prevent overflow on floors/ceilings. Note that the calculation of
// MaxVisForFloor means that planes less than two units from the player's
Expand Down Expand Up @@ -562,48 +562,6 @@ void R_SetViewSize (int blocks)
setblocks = blocks;
}

//==========================================================================
//
// CVAR r_detail
//
// Selects a pixel doubling mode
//
//==========================================================================

CUSTOM_CVAR (Int, r_detail, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
static bool badrecovery = false;

if (badrecovery)
{
badrecovery = false;
return;
}

if (self < 0 || self > 3)
{
Printf ("Bad detail mode. (Use 0-3)\n");
badrecovery = true;
self = (detailyshift << 1) | detailxshift;
return;
}

setdetail = self;
setsizeneeded = true;
}

//==========================================================================
//
// R_SetDetail
//
//==========================================================================

void R_SetDetail (int detail)
{
detailxshift = detail & 1;
detailyshift = (detail >> 1) & 1;
}

//==========================================================================
//
// R_SetWindow
Expand All @@ -616,19 +574,19 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)

if (windowSize >= 11)
{
realviewwidth = fullWidth;
freelookviewheight = realviewheight = fullHeight;
viewwidth = fullWidth;
freelookviewheight = viewheight = fullHeight;
}
else if (windowSize == 10)
{
realviewwidth = fullWidth;
realviewheight = stHeight;
viewwidth = fullWidth;
viewheight = stHeight;
freelookviewheight = fullHeight;
}
else
{
realviewwidth = ((setblocks*fullWidth)/10) & (~15);
realviewheight = ((setblocks*stHeight)/10)&~7;
viewwidth = ((setblocks*fullWidth)/10) & (~15);
viewheight = ((setblocks*stHeight)/10)&~7;
freelookviewheight = ((setblocks*fullHeight)/10)&~7;
}

Expand All @@ -637,10 +595,7 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)

DrawFSHUD = (windowSize == 11);

viewwidth = realviewwidth >> detailxshift;
viewheight = realviewheight >> detailyshift;
fuzzviewheight = viewheight - 2; // Maximum row the fuzzer can draw to
freelookviewheight >>= detailyshift;
halfviewwidth = (viewwidth >> 1) - 1;

if (!bRenderingToCanvas)
Expand All @@ -659,8 +614,8 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
centerxfrac = centerx<<FRACBITS;
centeryfrac = centery<<FRACBITS;

virtwidth = fullWidth >> detailxshift;
virtheight = fullHeight >> detailyshift;
virtwidth = fullWidth;
virtheight = fullHeight;
if (WidescreenRatio & 4)
{
virtheight = virtheight * BaseRatioSizes[WidescreenRatio][3] / 48;
Expand Down Expand Up @@ -692,8 +647,8 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)

R_InitTextureMapping ();

MaxVisForWall = FixedMul (Scale (InvZtoScale, SCREENWIDTH*(r_Yaspect<<detailyshift),
(viewwidth<<detailxshift)*SCREENHEIGHT), FocalTangent);
MaxVisForWall = FixedMul (Scale (InvZtoScale, SCREENWIDTH*r_Yaspect,
viewwidth*SCREENHEIGHT), FocalTangent);
MaxVisForWall = FixedDiv (0x7fff0000, MaxVisForWall);
MaxVisForFloor = Scale (FixedDiv (0x7fff0000, viewheight<<(FRACBITS-2)), FocalLengthY, 160*FRACUNIT);

Expand All @@ -712,20 +667,13 @@ void R_ExecuteSetViewSize ()
setsizeneeded = false;
BorderNeedRefresh = screen->GetPageCount ();

if (setdetail >= 0)
{
R_SetDetail (setdetail);
setdetail = -1;
}

R_SetWindow (setblocks, SCREENWIDTH, SCREENHEIGHT, ST_Y);

// Handle resize, e.g. smaller view windows with border and/or status bar.
viewwindowx = (screen->GetWidth() - (viewwidth<<detailxshift))>>1;
viewwindowx = (screen->GetWidth() - viewwidth) >> 1;

// Same with base row offset.
viewwindowy = ((viewwidth<<detailxshift) == screen->GetWidth()) ?
0 : (ST_Y-(viewheight<<detailyshift)) >> 1;
viewwindowy = (viewwidth == screen->GetWidth()) ? 0 : (ST_Y - viewheight) >> 1;
}

//==========================================================================
Expand Down Expand Up @@ -762,7 +710,7 @@ CUSTOM_CVAR (Int, r_columnmethod, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
}
else
{ // Trigger the change
r_detail.Callback ();
setsizeneeded = true;
}
}

Expand Down Expand Up @@ -1434,29 +1382,20 @@ void R_EnterMirror (drawseg_t *ds, int depth)
//
//==========================================================================

void R_SetupBuffer (bool inview)
void R_SetupBuffer ()
{
static BYTE *lastbuff = NULL;

int pitch = RenderTarget->GetPitch();
BYTE *lineptr = RenderTarget->GetBuffer() + viewwindowy*pitch + viewwindowx;

if (inview)
{
pitch <<= detailyshift;
}
if (detailxshift)
{
lineptr += viewwidth;
}

if (dc_pitch != pitch || lineptr != lastbuff)
{
if (dc_pitch != pitch)
{
dc_pitch = pitch;
R_InitFuzzTable (pitch);
#ifdef USEASM
#if defined(X86_ASM) || defined(X64_ASM)
ASM_PatchPitch ();
#endif
}
Expand All @@ -1478,7 +1417,7 @@ void R_RenderActorView (AActor *actor, bool dontmaplines)
{
WallCycles = PlaneCycles = MaskedCycles = WallScanCycles = 0;

R_SetupBuffer (true);
R_SetupBuffer ();
R_SetupFrame (actor);

// Clear buffers.
Expand Down Expand Up @@ -1569,17 +1508,8 @@ void R_RenderActorView (AActor *actor, bool dontmaplines)
}
}
WallMirrors.Clear ();

interpolator.RestoreInterpolations ();

// If there is vertical doubling, and the view window is not an even height,
// draw a black line at the bottom of the view window.
if (detailyshift && viewwindowy == 0 && (realviewheight & 1))
{
screen->Clear (0, realviewheight-1, realviewwidth, realviewheight, 0, 0);
}

R_SetupBuffer (false);
R_SetupBuffer ();
}

//==========================================================================
Expand All @@ -1593,16 +1523,12 @@ void R_RenderActorView (AActor *actor, bool dontmaplines)
void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,
int x, int y, int width, int height, bool dontmaplines)
{
const int saveddetail = detailxshift | (detailyshift << 1);
const bool savedviewactive = viewactive;

detailxshift = detailyshift = 0;
realviewwidth = viewwidth = width;

viewwidth = width;
RenderTarget = canvas;
bRenderingToCanvas = true;

R_SetDetail (0);
R_SetWindow (12, width, height, height);
viewwindowx = x;
viewwindowy = y;
Expand All @@ -1612,10 +1538,9 @@ void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas,

RenderTarget = screen;
bRenderingToCanvas = false;
R_SetDetail (saveddetail);
R_ExecuteSetViewSize ();
screen->Lock (true);
R_SetupBuffer (false);
R_SetupBuffer ();
screen->Unlock ();
viewactive = savedviewactive;
}
Expand Down
6 changes: 1 addition & 5 deletions src/r_main.h
Expand Up @@ -128,10 +128,6 @@ extern int fixedlightlev;
extern lighttable_t* fixedcolormap;


// [RH] New detail modes
extern "C" int detailxshift;
extern "C" int detailyshift;

//
// Function pointers to switch refresh/drawing functions.
// Used to select shadow mode etc.
Expand Down Expand Up @@ -190,7 +186,7 @@ void R_SetViewAngle ();
// Called by G_Drawer.
void R_RenderActorView (AActor *actor, bool dontmaplines = false);
void R_RefreshViewBorder ();
void R_SetupBuffer (bool inview);
void R_SetupBuffer ();

void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false);

Expand Down
12 changes: 6 additions & 6 deletions src/r_plane.cpp
Expand Up @@ -134,7 +134,7 @@ static fixed_t xscale, yscale;
static DWORD xstepscale, ystepscale;
static DWORD basexfrac, baseyfrac;

#ifdef USEASM
#ifdef X86_ASM
extern "C" void R_SetSpanSource_ASM (const BYTE *flat);
extern "C" void STACK_ARGS R_SetSpanSize_ASM (int xbits, int ybits);
extern "C" void R_SetSpanColormap_ASM (BYTE *colormap);
Expand Down Expand Up @@ -210,7 +210,7 @@ void R_MapPlane (int y, int x1)
FixedMul (GlobVis, abs (centeryfrac - (y << FRACBITS))), planeshade) << COLORMAPSHIFT);
}

#ifdef USEASM
#ifdef X86_ASM
if (ds_colormap != ds_curcolormap)
R_SetSpanColormap_ASM (ds_colormap);
#endif
Expand Down Expand Up @@ -469,7 +469,7 @@ void R_ClearPlanes (bool fullclear)
// [RH] clip ceiling to console bottom
clearbufshort (ceilingclip, viewwidth,
!screen->Accel2D && ConBottom > viewwindowy && !bRenderingToCanvas
? ((ConBottom - viewwindowy) >> detailyshift) : 0);
? (ConBottom - viewwindowy) : 0);

lastopening = 0;
}
Expand Down Expand Up @@ -988,7 +988,7 @@ void R_DrawSinglePlane (visplane_t *pl, fixed_t alpha, bool masked)
}
pl->xscale = MulScale16 (pl->xscale, tex->xScale);
pl->yscale = MulScale16 (pl->yscale, tex->yScale);
#ifdef USEASM
#ifdef X86_ASM
R_SetSpanSize_ASM (ds_xbits, ds_ybits);
#endif
ds_source = tex->GetPixels ();
Expand Down Expand Up @@ -1344,7 +1344,7 @@ void R_DrawSkyPlane (visplane_t *pl)

void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool masked)
{
#ifdef USEASM
#ifdef X86_ASM
if (ds_source != ds_cursource)
{
R_SetSpanSource_ASM (ds_source);
Expand Down Expand Up @@ -1550,7 +1550,7 @@ void R_DrawTiltedPlane (visplane_t *pl, fixed_t alpha, bool masked)
}
}

#if defined(USEASM)
#if defined(X86_ASM)
if (ds_source != ds_curtiltedsource)
R_SetTiltedSpanSource_ASM (ds_source);
R_MapVisPlane (pl, R_DrawTiltedPlane_ASM);
Expand Down
5 changes: 2 additions & 3 deletions src/r_sky.cpp
Expand Up @@ -57,7 +57,6 @@ CUSTOM_CVAR (Bool, r_stretchsky, true, CVAR_ARCHIVE)
R_InitSkyMap ();
}

extern "C" int detailxshift, detailyshift;
extern fixed_t freelookviewheight;

//==========================================================================
Expand Down Expand Up @@ -107,8 +106,8 @@ void R_InitSkyMap ()

if (viewwidth && viewheight)
{
skyiscale = (r_Yaspect*FRACUNIT) / (((freelookviewheight<<detailxshift) * viewwidth) / (viewwidth<<detailxshift));
skyscale = ((((freelookviewheight<<detailxshift) * viewwidth) / (viewwidth<<detailxshift)) << FRACBITS) /
skyiscale = (r_Yaspect*FRACUNIT) / ((freelookviewheight * viewwidth) / viewwidth);
skyscale = (((freelookviewheight * viewwidth) / viewwidth) << FRACBITS) /
(r_Yaspect);

skyiscale = Scale (skyiscale, FieldOfView, 2048);
Expand Down
2 changes: 0 additions & 2 deletions src/r_state.h
Expand Up @@ -33,9 +33,7 @@
//

extern "C" int viewwidth;
extern "C" int realviewwidth;
extern "C" int viewheight;
extern "C" int realviewheight;

// Sprite....
extern int firstspritelump;
Expand Down
6 changes: 3 additions & 3 deletions src/r_things.cpp
Expand Up @@ -1583,7 +1583,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_


if (camera->player && (RenderTarget != screen ||
realviewheight == RenderTarget->GetHeight() ||
viewheight == RenderTarget->GetHeight() ||
(RenderTarget->GetWidth() > 320 && !st_scale)))
{ // Adjust PSprite for fullscreen views
AWeapon *weapon = NULL;
Expand All @@ -1593,7 +1593,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
}
if (pspnum <= ps_flash && weapon != NULL && weapon->YAdjust != 0)
{
if (RenderTarget != screen || realviewheight == RenderTarget->GetHeight())
if (RenderTarget != screen || viewheight == RenderTarget->GetHeight())
{
vis->texturemid -= weapon->YAdjust;
}
Expand Down Expand Up @@ -2502,7 +2502,7 @@ void R_DrawParticle (vissprite_t *vis)
fg = fg2rgb[color];
}

spacing = (RenderTarget->GetPitch()<<detailyshift) - countbase;
spacing = RenderTarget->GetPitch() - countbase;
dest = ylookup[yl] + x1 + dc_destorg;

do
Expand Down
4 changes: 2 additions & 2 deletions src/sdl/i_system.cpp
Expand Up @@ -63,7 +63,7 @@

EXTERN_CVAR (String, language)

#ifdef USEASM
#if defined(X86_ASM) || defined(X64_ASM)
extern "C" void STACK_ARGS CheckMMX (CPUInfo *cpu);
#endif

Expand Down Expand Up @@ -182,7 +182,7 @@ void SetLanguageIDs ()
//
void I_Init (void)
{
#ifndef USEASM
#if !defined(X86_ASM) && !defined(X64_ASM)
memset (&CPU, 0, sizeof(CPU));
#else
CheckMMX (&CPU);
Expand Down
74 changes: 46 additions & 28 deletions src/v_palette.cpp
Expand Up @@ -100,14 +100,11 @@ CUSTOM_CVAR (Float, Gamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
/* Palette management stuff */
/****************************/

extern "C"
{
BYTE BestColor_MMX (DWORD rgb, const DWORD *pal);
}
extern "C" BYTE BestColor_MMX (DWORD rgb, const DWORD *pal);

int BestColor (const uint32 *pal_in, int r, int g, int b, int first, int num)
{
#ifdef USEASM
#ifdef X86_ASM
if (CPU.bMMX)
{
int pre = 256 - num - first;
Expand All @@ -120,9 +117,10 @@ int BestColor (const uint32 *pal_in, int r, int g, int b, int first, int num)

for (int color = first; color < num; color++)
{
int dist = (r-pal[color].r)*(r-pal[color].r)+
(g-pal[color].g)*(g-pal[color].g)+
(b-pal[color].b)*(b-pal[color].b);
int x = r - pal[color].r;
int y = g - pal[color].g;
int z = b - pal[color].b;
int dist = x*x + y*y + z*z;
if (dist < bestdist)
{
if (dist == 0)
Expand Down Expand Up @@ -454,10 +452,8 @@ void InitPalette ()

}

extern "C"
{
void STACK_ARGS DoBlending_MMX (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a);
}
extern "C" void STACK_ARGS DoBlending_MMX (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a);
extern void DoBlending_SSE2 (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a);

void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a)
{
Expand All @@ -478,29 +474,51 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in
to[i] = t;
}
}
#ifdef USEASM
else if (CPU.bMMX && !(count & 1))
else if (CPU.bSSE2)
{
DoBlending_MMX (from, to, count, r, g, b, a);
if (count >= 4)
{
int not3count = count & ~3;
DoBlending_SSE2 (from, to, not3count, r, g, b, a);
count &= 3;
if (count <= 0)
{
return;
}
from += not3count;
to += not3count;
}
}
#endif
else
#ifdef X86_ASM
else if (CPU.bMMX)
{
int i, ia;

ia = 256 - a;
r *= a;
g *= a;
b *= a;

for (i = count; i > 0; i--, to++, from++)
if (count >= 4)
{
to->r = (r + from->r*ia) >> 8;
to->g = (g + from->g*ia) >> 8;
to->b = (b + from->b*ia) >> 8;
int not3count = count & ~3;
DoBlending_MMX (from, to, not3count, r, g, b, a);
count &= 3;
if (count <= 0)
{
return;
}
from += not3count;
to += not3count;
}
}
#endif
int i, ia;

ia = 256 - a;
r *= a;
g *= a;
b *= a;

for (i = count; i > 0; i--, to++, from++)
{
to->r = (r + from->r * ia) >> 8;
to->g = (g + from->g * ia) >> 8;
to->b = (b + from->b * ia) >> 8;
}
}

void V_SetBlend (int blendr, int blendg, int blendb, int blenda)
Expand Down
3 changes: 1 addition & 2 deletions src/v_video.cpp
Expand Up @@ -1192,7 +1192,6 @@ void DFrameBuffer::PrecacheTexture(FTexture *tex, int cache)
void DFrameBuffer::RenderView(player_t *player)
{
R_RenderActorView (player->mo);
R_DetailDouble (); // [RH] Apply detail mode expansion
// [RH] Let cameras draw onto textures that were visible this frame.
FCanvasTextureInfo::UpdateAll ();
}
Expand Down Expand Up @@ -1317,7 +1316,7 @@ bool V_DoModeSetup (int width, int height, int bits)

RenderTarget = screen;
screen->Lock (true);
R_SetupBuffer (false);
R_SetupBuffer ();
screen->Unlock ();

M_RefreshModesList ();
Expand Down
2 changes: 1 addition & 1 deletion src/v_video.h
Expand Up @@ -458,7 +458,7 @@ FString V_GetColorStringByName (const char *name);
// Tries to get color by name, then by string
int V_GetColor (const DWORD *palette, const char *str);

#ifdef USEASM
#if defined(X86_ASM) || defined(X64_ASM)
extern "C" void ASM_PatchPitch (void);
#endif

Expand Down
14 changes: 4 additions & 10 deletions src/win32/i_system.cpp
Expand Up @@ -67,9 +67,7 @@

EXTERN_CVAR (String, language)

#ifdef USEASM
extern "C" void STACK_ARGS CheckMMX (CPUInfo *cpu);
#endif
extern void CheckCPUID(CPUInfo *cpu);

extern "C"
{
Expand Down Expand Up @@ -344,12 +342,10 @@ void SetLanguageIDs ()
//
// I_Init
//

void I_Init (void)
{
#ifndef USEASM
memset (&CPU, 0, sizeof(CPU));
#else
CheckMMX (&CPU);
CheckCPUID(&CPU);
CalculateCPUSpeed ();

// Why does Intel right-justify this string?
Expand All @@ -367,7 +363,6 @@ void I_Init (void)
}
}

#endif
if (CPU.VendorID[0])
{
Printf ("CPU Vendor ID: %s\n", CPU.VendorID);
Expand Down Expand Up @@ -396,7 +391,6 @@ void I_Init (void)
Printf ("\n");
}


// Use a timer event if possible
NewTicArrived = CreateEvent (NULL, FALSE, FALSE, NULL);
if (NewTicArrived)
Expand Down Expand Up @@ -484,7 +478,7 @@ void CalculateCPUSpeed ()
Printf ("Can't determine CPU speed, so pretending.\n");
}

Printf ("CPU Speed: %f MHz\n", CyclesPerSecond / 1e6);
Printf ("CPU Speed: %.0f MHz\n", CyclesPerSecond / 1e6);
}

//
Expand Down
48 changes: 24 additions & 24 deletions src/win32/i_system.h
Expand Up @@ -52,47 +52,47 @@ extern os_t OSPlatform;

struct CPUInfo // 92 bytes
{
char VendorID[16];
char CPUString[48];
char VendorID[16]; // 0
char CPUString[48]; // 16

BYTE Stepping;
BYTE Model;
BYTE Family;
BYTE Type;
BYTE Stepping; // 64
BYTE Model; // 65
BYTE Family; // 66
BYTE Type; // 67

BYTE BrandIndex;
BYTE CLFlush;
BYTE CPUCount;
BYTE APICID;
BYTE BrandIndex; // 68
BYTE CLFlush; // 69
BYTE CPUCount; // 70
BYTE APICID; // 71

DWORD bSSE3:1;
DWORD bSSE3:1; // 72
DWORD DontCare1:31;

DWORD bFPU:1;
DWORD bFPU:1; // 76
DWORD bVME:1;
DWORD bDE:1;
DWORD bPSE:1;
DWORD bRDTSC:1;
DWORD bMSR:1;
DWORD bPAE:1;
DWORD bMCE:1;
DWORD bCX8:1;
DWORD bCX8:1; // 77
DWORD bAPIC:1;
DWORD bReserved1:1;
DWORD bSEP:1;
DWORD bMTRR:1;
DWORD bPGE:1;
DWORD bMCA:1;
DWORD bCMOV:1;
DWORD bPAT:1;
DWORD bPAT:1; // 78
DWORD bPSE36:1;
DWORD bPSN:1;
DWORD bCFLUSH:1;
DWORD bReserved2:1;
DWORD bDS:1;
DWORD bACPI:1;
DWORD bMMX:1;
DWORD bFXSR:1;
DWORD bFXSR:1; // 79
DWORD bSSE:1;
DWORD bSSE2:1;
DWORD bSS:1;
Expand All @@ -101,22 +101,22 @@ struct CPUInfo // 92 bytes
DWORD bReserved3:1;
DWORD bPBE:1;

DWORD DontCare2:22;
DWORD DontCare2:22; // 80
DWORD bMMXPlus:1; // AMD's MMX extensions
DWORD bMMXAgain:1; // Just a copy of bMMX above
DWORD DontCare3:6;
DWORD b3DNowPlus:1;
DWORD b3DNow:1;

BYTE AMDStepping;
BYTE AMDModel;
BYTE AMDFamily;
BYTE bIsAMD;
BYTE AMDStepping; // 84
BYTE AMDModel; // 85
BYTE AMDFamily; // 86
BYTE bIsAMD; // 87

BYTE DataL1LineSize;
BYTE DataL1LinesPerTag;
BYTE DataL1Associativity;
BYTE DataL1SizeKB;
BYTE DataL1LineSize; // 88
BYTE DataL1LinesPerTag; // 89
BYTE DataL1Associativity;//90
BYTE DataL1SizeKB; // 91
};


Expand Down
File renamed without changes.
722 changes: 387 additions & 335 deletions zdoom.vcproj

Large diffs are not rendered by default.