Merge remote-tracking branch 'origin/master' into clientserver

This commit is contained in:
Magnus Norddahl 2018-12-11 20:58:10 +01:00
commit dd5f5dc5d8
30 changed files with 343 additions and 204 deletions

View file

@ -271,6 +271,22 @@ Error X86RAPass::emitSwapGp(VirtReg* dstReg, VirtReg* srcReg, uint32_t dstPhysId
return kErrorOk; return kErrorOk;
} }
Error X86RAPass::emitSwapVec(VirtReg* dstReg, VirtReg* srcReg, uint32_t dstPhysId, uint32_t srcPhysId, const char* reason) noexcept {
ASMJIT_ASSERT(dstPhysId != Globals::kInvalidRegId);
ASMJIT_ASSERT(srcPhysId != Globals::kInvalidRegId);
ASMJIT_ASSERT(dstPhysId != srcPhysId);
X86Reg a = X86Reg::fromSignature(dstReg->getSignature(), dstPhysId);
X86Reg b = X86Reg::fromSignature(srcReg->getSignature(), srcPhysId);
ASMJIT_PROPAGATE(cc()->emit(X86Inst::kIdXorps, a, b));
if (_emitComments)
cc()->getCursor()->setInlineComment(cc()->_cbDataZone.sformat("[%s] %s, %s", reason, dstReg->getName(), srcReg->getName()));
ASMJIT_PROPAGATE(cc()->emit(X86Inst::kIdXorps, b, a));
ASMJIT_PROPAGATE(cc()->emit(X86Inst::kIdXorps, a, b));
return kErrorOk;
}
Error X86RAPass::emitImmToReg(uint32_t dstTypeId, uint32_t dstPhysId, const Imm* src) noexcept { Error X86RAPass::emitImmToReg(uint32_t dstTypeId, uint32_t dstPhysId, const Imm* src) noexcept {
ASMJIT_ASSERT(dstPhysId != Globals::kInvalidRegId); ASMJIT_ASSERT(dstPhysId != Globals::kInvalidRegId);
@ -778,6 +794,9 @@ _MoveOrLoad:
if (C == X86Reg::kKindGp) { if (C == X86Reg::kKindGp) {
self->swapGp(dVReg, sVd); self->swapGp(dVReg, sVd);
} }
else if (C == X86Reg::kKindVec) {
self->swapVec(dVReg, sVd);
}
else { else {
self->spill<C>(dVReg); self->spill<C>(dVReg);
self->move<C>(sVd, physId); self->move<C>(sVd, physId);
@ -932,10 +951,13 @@ static ASMJIT_INLINE void X86RAPass_intersectStateVars(X86RAPass* self, X86RASta
didWork = true; didWork = true;
continue; continue;
} }
else if (C == X86Reg::kKindGp) { else if (C == X86Reg::kKindGp || C == X86Reg::kKindVec) {
if (aCell.getState() == VirtReg::kStateReg) { if (aCell.getState() == VirtReg::kStateReg) {
if (dVReg->getPhysId() != Globals::kInvalidRegId && aVReg->getPhysId() != Globals::kInvalidRegId) { if (dVReg->getPhysId() != Globals::kInvalidRegId && aVReg->getPhysId() != Globals::kInvalidRegId) {
if (C == X86Reg::kKindGp)
self->swapGp(dVReg, aVReg); self->swapGp(dVReg, aVReg);
else
self->swapVec(dVReg, aVReg);
didWork = true; didWork = true;
continue; continue;
@ -2787,9 +2809,13 @@ ASMJIT_INLINE void X86VarAlloc::alloc() {
// allocation tasks by a single 'xchg' instruction, swapping // allocation tasks by a single 'xchg' instruction, swapping
// two registers required by the instruction/node or one register // two registers required by the instruction/node or one register
// required with another non-required. // required with another non-required.
if (C == X86Reg::kKindGp && aPhysId != Globals::kInvalidRegId) { // Uses xor swap for Vec registers.
if ((C == X86Reg::kKindGp || C == X86Reg::kKindVec) && aPhysId != Globals::kInvalidRegId) {
TiedReg* bTied = bVReg->_tied; TiedReg* bTied = bVReg->_tied;
if (C == X86Reg::kKindGp)
_context->swapGp(aVReg, bVReg); _context->swapGp(aVReg, bVReg);
else
_context->swapVec(aVReg, bVReg);
aTied->flags |= TiedReg::kRDone; aTied->flags |= TiedReg::kRDone;
addTiedDone(C); addTiedDone(C);
@ -3341,8 +3367,11 @@ ASMJIT_INLINE void X86CallAlloc::alloc() {
// allocation tasks by a single 'xchg' instruction, swapping // allocation tasks by a single 'xchg' instruction, swapping
// two registers required by the instruction/node or one register // two registers required by the instruction/node or one register
// required with another non-required. // required with another non-required.
if (C == X86Reg::kKindGp && sPhysId != Globals::kInvalidRegId) { if ((C == X86Reg::kKindGp || C == X86Reg::kKindVec) && sPhysId != Globals::kInvalidRegId) {
if (C == X86Reg::kKindGp)
_context->swapGp(aVReg, bVReg); _context->swapGp(aVReg, bVReg);
else
_context->swapVec(aVReg, bVReg);
aTied->flags |= TiedReg::kRDone; aTied->flags |= TiedReg::kRDone;
addTiedDone(C); addTiedDone(C);

View file

@ -327,6 +327,7 @@ public:
Error emitLoad(VirtReg* vreg, uint32_t id, const char* reason); Error emitLoad(VirtReg* vreg, uint32_t id, const char* reason);
Error emitSave(VirtReg* vreg, uint32_t id, const char* reason); Error emitSave(VirtReg* vreg, uint32_t id, const char* reason);
Error emitSwapGp(VirtReg* aVReg, VirtReg* bVReg, uint32_t aId, uint32_t bId, const char* reason) noexcept; Error emitSwapGp(VirtReg* aVReg, VirtReg* bVReg, uint32_t aId, uint32_t bId, const char* reason) noexcept;
Error emitSwapVec(VirtReg* aVReg, VirtReg* bVReg, uint32_t aId, uint32_t bId, const char* reason) noexcept;
Error emitImmToReg(uint32_t dstTypeId, uint32_t dstPhysId, const Imm* src) noexcept; Error emitImmToReg(uint32_t dstTypeId, uint32_t dstPhysId, const Imm* src) noexcept;
Error emitImmToStack(uint32_t dstTypeId, const X86Mem* dst, const Imm* src) noexcept; Error emitImmToStack(uint32_t dstTypeId, const X86Mem* dst, const Imm* src) noexcept;
@ -515,6 +516,37 @@ public:
ASMJIT_X86_CHECK_STATE ASMJIT_X86_CHECK_STATE
} }
//! Swap two registers
//!
//! Xor swap on Vec registers.
ASMJIT_INLINE void swapVec(VirtReg* aVReg, VirtReg* bVReg) {
ASMJIT_ASSERT(aVReg != bVReg);
ASMJIT_ASSERT(aVReg->getKind() == X86Reg::kKindVec);
ASMJIT_ASSERT(aVReg->getState() == VirtReg::kStateReg);
ASMJIT_ASSERT(aVReg->getPhysId() != Globals::kInvalidRegId);
ASMJIT_ASSERT(bVReg->getKind() == X86Reg::kKindVec);
ASMJIT_ASSERT(bVReg->getState() == VirtReg::kStateReg);
ASMJIT_ASSERT(bVReg->getPhysId() != Globals::kInvalidRegId);
uint32_t aIndex = aVReg->getPhysId();
uint32_t bIndex = bVReg->getPhysId();
emitSwapVec(aVReg, bVReg, aIndex, bIndex, "Swap");
aVReg->setPhysId(bIndex);
bVReg->setPhysId(aIndex);
_x86State.getListByKind(X86Reg::kKindVec)[aIndex] = bVReg;
_x86State.getListByKind(X86Reg::kKindVec)[bIndex] = aVReg;
uint32_t m = aVReg->isModified() ^ bVReg->isModified();
_x86State._modified.xor_(X86Reg::kKindVec, (m << aIndex) | (m << bIndex));
ASMJIT_X86_CHECK_STATE
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Alloc / Spill] // [Alloc / Spill]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View file

@ -453,7 +453,7 @@ public:
TObjPtr<AActor*> MUSINFOactor = nullptr; // For MUSINFO purposes TObjPtr<AActor*> MUSINFOactor = nullptr; // For MUSINFO purposes
int8_t MUSINFOtics = 0; int8_t MUSINFOtics = 0;
bool settings_controller = true; // Player can control game settings. bool settings_controller = false; // Player can control game settings.
int8_t crouching = 0; int8_t crouching = 0;
int8_t crouchdir = 0; int8_t crouchdir = 0;

View file

@ -148,7 +148,7 @@ AActor* actorvalue(const svalue_t &svalue)
return NULL; return NULL;
} }
// Inventory items in the player's inventory have to be considered non-present. // Inventory items in the player's inventory have to be considered non-present.
if (svalue.value.mobj == NULL || !svalue.value.mobj->IsMapActor()) if (SpawnedThings[intval] == nullptr || !SpawnedThings[intval]->IsMapActor())
{ {
return NULL; return NULL;
} }

View file

@ -1278,6 +1278,7 @@ void G_PlayerReborn (int player)
log = p->LogText; log = p->LogText;
chasecam = p->cheats & CF_CHASECAM; chasecam = p->cheats & CF_CHASECAM;
Bot = p->Bot; //Added by MC: Bot = p->Bot; //Added by MC:
const bool settings_controller = p->settings_controller;
// Reset player structure to its defaults // Reset player structure to its defaults
p->~player_t(); p->~player_t();
@ -1296,6 +1297,7 @@ void G_PlayerReborn (int player)
p->LogText = log; p->LogText = log;
p->cheats |= chasecam; p->cheats |= chasecam;
p->Bot = Bot; //Added by MC: p->Bot = Bot; //Added by MC:
p->settings_controller = settings_controller;
p->oldbuttons = ~0, p->attackdown = true; p->usedown = true; // don't do anything immediately p->oldbuttons = ~0, p->attackdown = true; p->usedown = true; // don't do anything immediately
p->original_oldbuttons = ~0; p->original_oldbuttons = ~0;

View file

@ -60,6 +60,8 @@ EXTERN_CVAR (Color, am_fdwallcolor)
EXTERN_CVAR (Color, am_cdwallcolor) EXTERN_CVAR (Color, am_cdwallcolor)
EXTERN_CVAR (Float, spc_amp) EXTERN_CVAR (Float, spc_amp)
EXTERN_CVAR (Bool, wi_percents) EXTERN_CVAR (Bool, wi_percents)
EXTERN_CVAR (Int, gl_texture_hqresizemode)
EXTERN_CVAR (Int, gl_texture_hqresizemult)
FGameConfigFile::FGameConfigFile () FGameConfigFile::FGameConfigFile ()
{ {
@ -395,6 +397,93 @@ void FGameConfigFile::DoGlobalSetup ()
FBaseCVar *var = FindCVar("snd_hrtf", NULL); FBaseCVar *var = FindCVar("snd_hrtf", NULL);
if (var != NULL) var->ResetToDefault(); if (var != NULL) var->ResetToDefault();
} }
if (last < 216)
{
FBaseCVar *var = FindCVar("gl_texture_hqresize", NULL);
if (var != NULL)
{
auto v = var->GetGenericRep(CVAR_Int);
switch (v.Int)
{
case 1:
gl_texture_hqresizemode = 1; gl_texture_hqresizemult = 2;
break;
case 2:
gl_texture_hqresizemode = 1; gl_texture_hqresizemult = 3;
break;
case 3:
gl_texture_hqresizemode = 1; gl_texture_hqresizemult = 4;
break;
case 4:
gl_texture_hqresizemode = 2; gl_texture_hqresizemult = 2;
break;
case 5:
gl_texture_hqresizemode = 2; gl_texture_hqresizemult = 3;
break;
case 6:
gl_texture_hqresizemode = 2; gl_texture_hqresizemult = 4;
break;
case 7:
gl_texture_hqresizemode = 3; gl_texture_hqresizemult = 2;
break;
case 8:
gl_texture_hqresizemode = 3; gl_texture_hqresizemult = 3;
break;
case 9:
gl_texture_hqresizemode = 3; gl_texture_hqresizemult = 4;
break;
case 10:
gl_texture_hqresizemode = 4; gl_texture_hqresizemult = 2;
break;
case 11:
gl_texture_hqresizemode = 4; gl_texture_hqresizemult = 3;
break;
case 12:
gl_texture_hqresizemode = 4; gl_texture_hqresizemult = 4;
break;
case 18:
gl_texture_hqresizemode = 4; gl_texture_hqresizemult = 5;
break;
case 19:
gl_texture_hqresizemode = 4; gl_texture_hqresizemult = 6;
break;
case 13:
gl_texture_hqresizemode = 5; gl_texture_hqresizemult = 2;
break;
case 14:
gl_texture_hqresizemode = 5; gl_texture_hqresizemult = 3;
break;
case 15:
gl_texture_hqresizemode = 5; gl_texture_hqresizemult = 4;
break;
case 16:
gl_texture_hqresizemode = 5; gl_texture_hqresizemult = 5;
break;
case 17:
gl_texture_hqresizemode = 5; gl_texture_hqresizemult = 6;
break;
case 20:
gl_texture_hqresizemode = 6; gl_texture_hqresizemult = 2;
break;
case 21:
gl_texture_hqresizemode = 6; gl_texture_hqresizemult = 3;
break;
case 22:
gl_texture_hqresizemode = 6; gl_texture_hqresizemult = 4;
break;
case 23:
gl_texture_hqresizemode = 6; gl_texture_hqresizemult = 5;
break;
case 24:
gl_texture_hqresizemode = 6; gl_texture_hqresizemult = 6;
break;
case 0:
default:
gl_texture_hqresizemode = 0; gl_texture_hqresizemult = 1;
break;
}
}
}
} }
} }
} }

View file

@ -74,6 +74,7 @@ void PolyRenderThread::FlushDrawQueue()
} }
} }
static std::mutex loadmutex;
void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style) void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
{ {
if (texture == nullptr) if (texture == nullptr)
@ -87,8 +88,6 @@ void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
// It is critical that this function is called before any direct // It is critical that this function is called before any direct
// calls to GetPixels for this to work. // calls to GetPixels for this to work.
static std::mutex loadmutex;
std::unique_lock<std::mutex> lock(loadmutex); std::unique_lock<std::mutex> lock(loadmutex);
texture->GetPixels(style); texture->GetPixels(style);
@ -101,10 +100,9 @@ void PolyRenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
} }
} }
static std::mutex polyobjmutex;
void PolyRenderThread::PreparePolyObject(subsector_t *sub) void PolyRenderThread::PreparePolyObject(subsector_t *sub)
{ {
static std::mutex polyobjmutex;
std::unique_lock<std::mutex> lock(polyobjmutex); std::unique_lock<std::mutex> lock(polyobjmutex);
if (sub->BSP == nullptr || sub->BSP->bDirty) if (sub->BSP == nullptr || sub->BSP->bDirty)

View file

@ -32,9 +32,11 @@
*/ */
// Workaround for GCC Objective-C++ with C++ exceptions bug. // Workaround for GCC Objective-C++ with C++ exceptions bug.
#include "doomerrors.h"
#include <stdlib.h> #include <stdlib.h>
#include "doomerrors.h"
#include "vm.h"
// Import some functions from i_main.mm // Import some functions from i_main.mm
void call_terms(); void call_terms();
void Mac_I_FatalError(const char* const message); void Mac_I_FatalError(const char* const message);
@ -50,11 +52,22 @@ void OriginalMainExcept(int argc, char** argv)
{ {
const char* const message = error.what(); const char* const message = error.what();
if (NULL != message) if (strcmp(message, "NoRunExit"))
{
if (CVMAbortException::stacktrace.IsNotEmpty())
{
Printf("%s", CVMAbortException::stacktrace.GetChars());
}
if (batchrun)
{
Printf("%s\n", message);
}
else
{ {
if (strcmp(message, "NoRunExit")) fprintf(stderr, "%s\n", message);
Mac_I_FatalError(message); Mac_I_FatalError(message);
} }
}
exit(-1); exit(-1);
} }

View file

@ -52,6 +52,7 @@
#include "cmdlib.h" #include "cmdlib.h"
#include "r_utility.h" #include "r_utility.h"
#include "doomstat.h" #include "doomstat.h"
#include "vm.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -261,16 +262,31 @@ int main (int argc, char **argv)
catch (std::exception &error) catch (std::exception &error)
{ {
I_ShutdownJoysticks(); I_ShutdownJoysticks();
if (error.what () && strcmp(error.what(), "NoRunExit"))
fprintf (stderr, "%s\n", error.what ());
const char *const message = error.what();
if (strcmp(message, "NoRunExit"))
{
if (CVMAbortException::stacktrace.IsNotEmpty())
{
Printf("%s", CVMAbortException::stacktrace.GetChars());
}
if (batchrun)
{
Printf("%s\n", message);
}
else
{
#ifdef __APPLE__ #ifdef __APPLE__
Mac_I_FatalError(error.what()); Mac_I_FatalError(message);
#endif // __APPLE__ #endif // __APPLE__
#ifdef __linux__ #ifdef __linux__
Linux_I_FatalError(error.what()); Linux_I_FatalError(message);
#endif // __linux__ #endif // __linux__
}
}
exit (-1); exit (-1);
} }

View file

@ -78,7 +78,7 @@ namespace
} }
void R_ShowCurrentScaling(); void R_ShowCurrentScaling();
CUSTOM_CVAR(Float, vid_scalefactor, 1.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(Float, vid_scalefactor, 1.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{ {
setsizeneeded = true; setsizeneeded = true;
if (self < 0.05 || self > 2.0) if (self < 0.05 || self > 2.0)

View file

@ -7600,7 +7600,7 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
if (ctx.Class != nullptr) if (ctx.Class != nullptr)
{ {
PFunction *afd = FindClassMemberFunction(ctx.Class, ctx.Class, MethodName, ScriptPosition, &error); PFunction *afd = FindClassMemberFunction(ctx.Class, ctx.Class, MethodName, ScriptPosition, &error, ctx.Version);
if (afd != nullptr) if (afd != nullptr)
{ {
@ -8002,7 +8002,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
if (novirtual) if (novirtual)
{ {
bool error; bool error;
PFunction *afd = FindClassMemberFunction(ccls, ctx.Class, MethodName, ScriptPosition, &error); PFunction *afd = FindClassMemberFunction(ccls, ctx.Class, MethodName, ScriptPosition, &error, ctx.Version);
if ((nullptr != afd) && (afd->Variants[0].Flags & VARF_Method) && (afd->Variants[0].Flags & VARF_Virtual)) if ((nullptr != afd) && (afd->Variants[0].Flags & VARF_Method) && (afd->Variants[0].Flags & VARF_Virtual))
{ {
staticonly = false; staticonly = false;
@ -8309,7 +8309,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
isresolved: isresolved:
bool error = false; bool error = false;
PFunction *afd = FindClassMemberFunction(cls, ctx.Class, MethodName, ScriptPosition, &error); PFunction *afd = FindClassMemberFunction(cls, ctx.Class, MethodName, ScriptPosition, &error, ctx.Version);
if (error) if (error)
{ {
delete this; delete this;

View file

@ -121,9 +121,9 @@ template<class T, int fill = 1> void ArrayResize(T *self, int amount)
} }
} }
template<class T> void ArrayReserve(T *self, int amount) template<class T> unsigned int ArrayReserve(T *self, int amount)
{ {
self->Reserve(amount); return self->Reserve(amount);
} }
template<class T> int ArrayMax(T *self) template<class T> int ArrayMax(T *self)

View file

@ -236,7 +236,7 @@ PFunction *CreateAnonymousFunction(PContainerType *containingclass, PType *retur
// //
//========================================================================== //==========================================================================
PFunction *FindClassMemberFunction(PContainerType *selfcls, PContainerType *funccls, FName name, FScriptPosition &sc, bool *error) PFunction *FindClassMemberFunction(PContainerType *selfcls, PContainerType *funccls, FName name, FScriptPosition &sc, bool *error, const VersionInfo &version)
{ {
// Skip ACS_NamedExecuteWithResult. Anything calling this should use the builtin instead. // Skip ACS_NamedExecuteWithResult. Anything calling this should use the builtin instead.
if (name == NAME_ACS_NamedExecuteWithResult) return nullptr; if (name == NAME_ACS_NamedExecuteWithResult) return nullptr;
@ -263,7 +263,7 @@ PFunction *FindClassMemberFunction(PContainerType *selfcls, PContainerType *func
{ {
sc.Message(MSG_ERROR, "%s is declared protected and not accessible", symbol->SymbolName.GetChars()); sc.Message(MSG_ERROR, "%s is declared protected and not accessible", symbol->SymbolName.GetChars());
} }
else if (funcsym->Variants[0].Flags & VARF_Deprecated) else if ((funcsym->Variants[0].Flags & VARF_Deprecated) && funcsym->mVersion <= version)
{ {
sc.Message(MSG_WARNING, "Call to deprecated function %s", symbol->SymbolName.GetChars()); sc.Message(MSG_WARNING, "Call to deprecated function %s", symbol->SymbolName.GetChars());
} }

View file

@ -204,7 +204,7 @@ class FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestr
FName CheckCastKludges(FName in); FName CheckCastKludges(FName in);
void SetImplicitArgs(TArray<PType *> *args, TArray<uint32_t> *argflags, TArray<FName> *argnames, PContainerType *cls, uint32_t funcflags, int useflags); void SetImplicitArgs(TArray<PType *> *args, TArray<uint32_t> *argflags, TArray<FName> *argnames, PContainerType *cls, uint32_t funcflags, int useflags);
PFunction *CreateAnonymousFunction(PContainerType *containingclass, PType *returntype, int flags); PFunction *CreateAnonymousFunction(PContainerType *containingclass, PType *returntype, int flags);
PFunction *FindClassMemberFunction(PContainerType *cls, PContainerType *funccls, FName name, FScriptPosition &sc, bool *error); PFunction *FindClassMemberFunction(PContainerType *cls, PContainerType *funccls, FName name, FScriptPosition &sc, bool *error, const VersionInfo &version);
void CreateDamageFunction(PNamespace *ns, const VersionInfo &ver, PClassActor *info, AActor *defaults, FxExpression *id, bool fromDecorate, int lumpnum); void CreateDamageFunction(PNamespace *ns, const VersionInfo &ver, PClassActor *info, AActor *defaults, FxExpression *id, bool fromDecorate, int lumpnum);
//========================================================================== //==========================================================================

View file

@ -268,7 +268,7 @@ void JitCompiler::SetupSimpleFrame()
for (unsigned int i = 0; i < sfunc->Proto->ArgumentTypes.Size(); i++) for (unsigned int i = 0; i < sfunc->Proto->ArgumentTypes.Size(); i++)
{ {
const PType *type = sfunc->Proto->ArgumentTypes[i]; const PType *type = sfunc->Proto->ArgumentTypes[i];
if (sfunc->ArgFlags[i] & (VARF_Out | VARF_Ref)) if (sfunc->ArgFlags.Size() && sfunc->ArgFlags[i] & (VARF_Out | VARF_Ref))
{ {
cc.mov(regA[rega++], x86::ptr(args, argsPos++ * sizeof(VMValue) + offsetof(VMValue, a))); cc.mov(regA[rega++], x86::ptr(args, argsPos++ * sizeof(VMValue) + offsetof(VMValue, a)));
} }

View file

@ -543,6 +543,8 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target)
ParamOpcodes.Clear(); ParamOpcodes.Clear();
} }
static std::map<FString, std::unique_ptr<TArray<uint8_t>>> argsCache;
asmjit::FuncSignature JitCompiler::CreateFuncSignature() asmjit::FuncSignature JitCompiler::CreateFuncSignature()
{ {
using namespace asmjit; using namespace asmjit;
@ -657,7 +659,6 @@ asmjit::FuncSignature JitCompiler::CreateFuncSignature()
} }
// FuncSignature only keeps a pointer to its args array. Store a copy of each args array variant. // FuncSignature only keeps a pointer to its args array. Store a copy of each args array variant.
static std::map<FString, std::unique_ptr<TArray<uint8_t>>> argsCache;
std::unique_ptr<TArray<uint8_t>> &cachedArgs = argsCache[key]; std::unique_ptr<TArray<uint8_t>> &cachedArgs = argsCache[key];
if (!cachedArgs) cachedArgs.reset(new TArray<uint8_t>(args)); if (!cachedArgs) cachedArgs.reset(new TArray<uint8_t>(args));

View file

@ -169,17 +169,29 @@ void JitCompiler::EmitRET()
if (cc.is64Bit()) if (cc.is64Bit())
{ {
if (regtype & REGT_KONST) if (regtype & REGT_KONST)
cc.mov(x86::qword_ptr(location), asmjit::imm_ptr(konsta[regnum].v)); {
auto ptr = newTempIntPtr();
cc.mov(ptr, asmjit::imm_ptr(konsta[regnum].v));
cc.mov(x86::qword_ptr(location), ptr);
}
else else
{
cc.mov(x86::qword_ptr(location), regA[regnum]); cc.mov(x86::qword_ptr(location), regA[regnum]);
} }
}
else else
{ {
if (regtype & REGT_KONST) if (regtype & REGT_KONST)
cc.mov(x86::dword_ptr(location), asmjit::imm_ptr(konsta[regnum].v)); {
auto ptr = newTempIntPtr();
cc.mov(ptr, asmjit::imm_ptr(konsta[regnum].v));
cc.mov(x86::dword_ptr(location), ptr);
}
else else
{
cc.mov(x86::dword_ptr(location), regA[regnum]); cc.mov(x86::dword_ptr(location), regA[regnum]);
} }
}
break; break;
} }

View file

@ -128,7 +128,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, GetPointer, COPY_AAPTR)
// //
//========================================================================== //==========================================================================
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_StopSound, S_StopSound) static void NativeStopSound(AActor *actor, int slot)
{
S_StopSound(actor, slot);
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_StopSound, NativeStopSound)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
PARAM_INT(slot); PARAM_INT(slot);
@ -475,7 +480,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, Vec2To, Vec2To)
ACTION_RETURN_VEC2(self->Vec2To(t)); ACTION_RETURN_VEC2(self->Vec2To(t));
} }
static void Vec3Angle(AActor *self, double length, double angle, double z, bool absolute, DVector2 *result) static void Vec3Angle(AActor *self, double length, double angle, double z, bool absolute, DVector3 *result)
{ {
*result = self->Vec3Angle(length, angle, z, absolute); *result = self->Vec3Angle(length, angle, z, absolute);
} }

View file

@ -89,6 +89,7 @@ namespace swrenderer
return pal_drawers.get(); return pal_drawers.get();
} }
static std::mutex loadmutex;
void RenderThread::PrepareTexture(FTexture *texture, FRenderStyle style) void RenderThread::PrepareTexture(FTexture *texture, FRenderStyle style)
{ {
if (texture == nullptr) if (texture == nullptr)
@ -102,8 +103,6 @@ namespace swrenderer
// It is critical that this function is called before any direct // It is critical that this function is called before any direct
// calls to GetPixels for this to work. // calls to GetPixels for this to work.
static std::mutex loadmutex;
std::unique_lock<std::mutex> lock(loadmutex); std::unique_lock<std::mutex> lock(loadmutex);
texture->GetPixels(style); texture->GetPixels(style);
@ -116,10 +115,9 @@ namespace swrenderer
} }
} }
static std::mutex polyobjmutex;
void RenderThread::PreparePolyObject(subsector_t *sub) void RenderThread::PreparePolyObject(subsector_t *sub)
{ {
static std::mutex polyobjmutex;
std::unique_lock<std::mutex> lock(polyobjmutex); std::unique_lock<std::mutex> lock(polyobjmutex);
if (sub->BSP == nullptr || sub->BSP->bDirty) if (sub->BSP == nullptr || sub->BSP->bDirty)

View file

@ -70,12 +70,12 @@ TArray<FSWColormap> SpecialSWColormaps;
// Colored Lighting Stuffs // Colored Lighting Stuffs
// //
//========================================================================== //==========================================================================
static std::mutex buildmapmutex;
static FDynamicColormap *CreateSpecialLights (PalEntry color, PalEntry fade, int desaturate) static FDynamicColormap *CreateSpecialLights (PalEntry color, PalEntry fade, int desaturate)
{ {
// GetSpecialLights is called by the scene worker threads. // GetSpecialLights is called by the scene worker threads.
// If we didn't find the colormap, search again, but this time one thread at a time // If we didn't find the colormap, search again, but this time one thread at a time
static std::mutex buildmapmutex;
std::unique_lock<std::mutex> lock(buildmapmutex); std::unique_lock<std::mutex> lock(buildmapmutex);
// If this colormap has already been created, just return it // If this colormap has already been created, just return it

View file

@ -45,18 +45,22 @@
#include "parallel_for.h" #include "parallel_for.h"
#include "hwrenderer/textures/hw_material.h" #include "hwrenderer/textures/hw_material.h"
CUSTOM_CVAR(Int, gl_texture_hqresize, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) EXTERN_CVAR(Int, gl_texture_hqresizemult)
{ CUSTOM_CVAR(Int, gl_texture_hqresizemode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
if (self < 0 || self > 24)
{ {
if (self < 0 || self > 6)
self = 0; self = 0;
if ((gl_texture_hqresizemult > 4) && (self < 4) && (self > 0))
gl_texture_hqresizemult = 4;
FMaterial::FlushAll();
} }
#ifndef HAVE_MMX
// This is to allow the menu option to work properly so that these filters can be skipped while cycling through them. CUSTOM_CVAR(Int, gl_texture_hqresizemult, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
if (self == 7) self = 10; {
if (self == 8) self = 10; if (self < 1 || self > 6)
if (self == 9) self = 6; self = 1;
#endif if ((self > 4) && (gl_texture_hqresizemode < 4) && (gl_texture_hqresizemode > 0))
self = 4;
FMaterial::FlushAll(); FMaterial::FlushAll();
} }
@ -385,64 +389,60 @@ unsigned char *FTexture::CreateUpsampledTextureBuffer (unsigned char *inputBuffe
if (inputBuffer) if (inputBuffer)
{ {
int type = gl_texture_hqresize; int type = gl_texture_hqresizemode;
int mult = gl_texture_hqresizemult;
outWidth = inWidth; outWidth = inWidth;
outHeight = inHeight; outHeight = inHeight;
#ifdef HAVE_MMX #ifdef HAVE_MMX
// hqNx MMX does not preserve the alpha channel so fall back to C-version for such textures // hqNx MMX does not preserve the alpha channel so fall back to C-version for such textures
if (hasAlpha && type > 6 && type <= 9) if (hasAlpha && type == 3)
{ {
type -= 3; type = 2;
} }
#endif #endif
if (mult < 2)
type = 0;
switch (type) switch (type)
{ {
case 1: case 1:
return scaleNxHelper( &scale2x, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight ); switch(mult)
{
case 2: case 2:
return scaleNxHelper( &scale3x, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return scaleNxHelper( &scale2x, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 3: case 3:
return scaleNxHelper( &scale3x, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight );
default:
return scaleNxHelper( &scale4x, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return scaleNxHelper( &scale4x, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 4: }
case 2:
switch(mult)
{
case 2:
return hqNxHelper( &hq2x_32, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return hqNxHelper( &hq2x_32, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 5: case 3:
return hqNxHelper( &hq3x_32, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return hqNxHelper( &hq3x_32, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 6: default:
return hqNxHelper( &hq4x_32, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return hqNxHelper( &hq4x_32, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
}
#ifdef HAVE_MMX #ifdef HAVE_MMX
case 7: case 3:
switch(mult)
{
case 2:
return hqNxAsmHelper( &HQnX_asm::hq2x_32, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return hqNxAsmHelper( &HQnX_asm::hq2x_32, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 8: case 3:
return hqNxAsmHelper( &HQnX_asm::hq3x_32, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return hqNxAsmHelper( &HQnX_asm::hq3x_32, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 9: default:
return hqNxAsmHelper( &HQnX_asm::hq4x_32, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return hqNxAsmHelper( &HQnX_asm::hq4x_32, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
}
#endif #endif
case 10: case 4:
case 11: return xbrzHelper(xbrz::scale, mult, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 12: case 5:
return xbrzHelper(xbrz::scale, type - 8, inputBuffer, inWidth, inHeight, outWidth, outHeight ); return xbrzHelper(xbrzOldScale, mult, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 6:
case 13: return normalNxHelper( &normalNx, mult, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 14:
case 15:
case 16:
case 17:
return xbrzHelper(xbrzOldScale, type - 11, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 18:
case 19:
return xbrzHelper(xbrz::scale, type - 13, inputBuffer, inWidth, inHeight, outWidth, outHeight);
case 20:
return normalNxHelper( &normalNx, 2, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 21:
return normalNxHelper( &normalNx, 3, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 22:
return normalNxHelper( &normalNx, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 23:
return normalNxHelper( &normalNx, 5, inputBuffer, inWidth, inHeight, outWidth, outHeight );
case 24:
return normalNxHelper( &normalNx, 6, inputBuffer, inWidth, inHeight, outWidth, outHeight );
} }
} }
return inputBuffer; return inputBuffer;

View file

@ -219,8 +219,6 @@ void DFrameBuffer::DrawTextCommon(FFont *font, int normalcolor, double x, double
int kerning; int kerning;
FTexture *pic; FTexture *pic;
assert(string[0] != '$');
if (parms.celly == 0) parms.celly = font->GetHeight() + 1; if (parms.celly == 0) parms.celly = font->GetHeight() + 1;
parms.celly *= parms.scaley; parms.celly *= parms.scaley;

View file

@ -93,6 +93,11 @@ CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Int, vid_rendermode, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) CUSTOM_CVAR(Int, vid_rendermode, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{ {
if (self < 0 || self > 4)
{
self = 4;
}
if (usergame) if (usergame)
{ {
// [SP] Update pitch limits to the netgame/gamesim. // [SP] Update pitch limits to the netgame/gamesim.

View file

@ -68,7 +68,7 @@ const char *GetVersionString();
// Version stored in the ini's [LastRun] section. // Version stored in the ini's [LastRun] section.
// Bump it if you made some configuration change that you want to // Bump it if you made some configuration change that you want to
// be able to migrate in FGameConfigFile::DoGlobalSetup(). // be able to migrate in FGameConfigFile::DoGlobalSetup().
#define LASTRUNVERSION "215" #define LASTRUNVERSION "216"
// Protocol version used in demos. // Protocol version used in demos.
// Bump it if you change existing DEM_ commands or add new ones. // Bump it if you change existing DEM_ commands or add new ones.

View file

@ -71,6 +71,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "g_levellocals.h" #include "g_levellocals.h"
#include "s_sound.h" #include "s_sound.h"
#include "vm.h"
#include "stats.h" #include "stats.h"
#include "st_start.h" #include "st_start.h"
@ -1057,6 +1058,11 @@ void DoMain (HINSTANCE hInstance)
auto msg = error.what(); auto msg = error.what();
if (strcmp(msg, "NoRunExit")) if (strcmp(msg, "NoRunExit"))
{ {
if (CVMAbortException::stacktrace.IsNotEmpty())
{
Printf("%s", CVMAbortException::stacktrace.GetChars());
}
if (!batchrun) if (!batchrun)
{ {
ShowErrorPane(msg); ShowErrorPane(msg);

View file

@ -173,6 +173,9 @@ AF40D0E49BD1B76D4B1AADD8212ADC46 // MAP01 (the wad that shall not be named =P)
5FAA25F5A6AAB3409CAE0AF87F910341 // DOOM.wad e1m6 5FAA25F5A6AAB3409CAE0AF87F910341 // DOOM.wad e1m6
94893A0DC429A22ADC4B3A73DA537E16 // DOOM2.WAD map25 94893A0DC429A22ADC4B3A73DA537E16 // DOOM2.WAD map25
D5F64E02679A81B82006AF34A6A8EAC3 // plutonia.wad map32 D5F64E02679A81B82006AF34A6A8EAC3 // plutonia.wad map32
BA4860C7A2F5D705DB32A1A38DB77EC4 // pl2.wad map10
EDA5CE7C462BD171BF8110AC56B67857 // pl2.wad map11
A9A9A728E689266939C1B71655F320CA // pl2.wad map25
{ {
rebuildnodes rebuildnodes
} }

View file

@ -2783,6 +2783,7 @@ GLTEXMNU_ANISOTROPIC = "Anisotropic filter";
GLTEXMNU_TEXFORMAT = "Texture Format"; GLTEXMNU_TEXFORMAT = "Texture Format";
GLTEXMNU_ENABLEHIRES = "Enable hires textures"; GLTEXMNU_ENABLEHIRES = "Enable hires textures";
GLTEXMNU_HQRESIZE = "High Quality Resize mode"; GLTEXMNU_HQRESIZE = "High Quality Resize mode";
GLTEXMNU_HQRESIZEMULT = "High Quality Resize multiplier";
GLTEXMNU_HQRESIZEWARN = "This mode requires %d times more video memory"; GLTEXMNU_HQRESIZEWARN = "This mode requires %d times more video memory";
GLTEXMNU_RESIZETEX = "Resize textures"; GLTEXMNU_RESIZETEX = "Resize textures";
GLTEXMNU_RESIZESPR = "Resize sprites"; GLTEXMNU_RESIZESPR = "Resize sprites";
@ -2881,30 +2882,12 @@ OPTVAL_YAXIS = "Y Axis";
OPTVAL_XYAXIS = "X/Y Axis"; OPTVAL_XYAXIS = "X/Y Axis";
OPTVAL_SQUARE = "Square"; OPTVAL_SQUARE = "Square";
OPTVAL_ROUND = "Round"; OPTVAL_ROUND = "Round";
OPTVAL_SCALE2X = "Scale2x"; OPTVAL_SCALENX = "ScaleNx";
OPTVAL_SCALE3X = "Scale3x"; OPTVAL_NORMALNX = "NormalNx";
OPTVAL_SCALE4X = "Scale4x"; OPTVAL_HQNX = "hqNx";
OPTVAL_NORMAL2X = "Normal2x"; OPTVAL_HQNXMMX = "hqNx MMX";
OPTVAL_NORMAL3X = "Normal3x"; OPTVAL_NXBRZ = "xBRZ";
OPTVAL_NORMAL4X = "Normal4x"; OPTVAL_OLD_NXBRZ = "Old xBRZ";
OPTVAL_NORMAL5X = "Normal5x";
OPTVAL_NORMAL6X = "Normal6x";
OPTVAL_HQ2X = "hq2x";
OPTVAL_HQ3X = "hq3x";
OPTVAL_HQ4X = "hq4x";
OPTVAL_HQ2XMMX = "hq2x MMX";
OPTVAL_HQ3XMMX = "hq3x MMX";
OPTVAL_HQ4XMMX = "hq4x MMX";
OPTVAL_2XBRZ = "2xBRZ";
OPTVAL_3XBRZ = "3xBRZ";
OPTVAL_4XBRZ = "4xBRZ";
OPTVAL_5XBRZ = "5xBRZ";
OPTVAL_6XBRZ = "6xBRZ";
OPTVAL_OLD_2XBRZ = "Old 2xBRZ";
OPTVAL_OLD_3XBRZ = "Old 3xBRZ";
OPTVAL_OLD_4XBRZ = "Old 4xBRZ";
OPTVAL_OLD_5XBRZ = "Old 5xBRZ";
OPTVAL_OLD_6XBRZ = "Old 6xBRZ";
OPTVAL_RADIAL = "Radial"; OPTVAL_RADIAL = "Radial";
OPTVAL_PIXELFUZZ = "Pixel fuzz"; OPTVAL_PIXELFUZZ = "Pixel fuzz";
OPTVAL_SMOOTHFUZZ = "Smooth fuzz"; OPTVAL_SMOOTHFUZZ = "Smooth fuzz";

View file

@ -2151,51 +2151,32 @@ OptionValue "Particles"
OptionValue "HqResizeModes" OptionValue "HqResizeModes"
{ {
0, "$OPTVAL_OFF" 0, "$OPTVAL_OFF"
1, "$OPTVAL_SCALE2X" 1, "$OPTVAL_SCALENX"
2, "$OPTVAL_SCALE3X" 2, "$OPTVAL_HQNX"
3, "$OPTVAL_SCALE4X" 3, "$OPTVAL_HQNXMMX"
4, "$OPTVAL_HQ2X" 4, "$OPTVAL_NXBRZ"
5, "$OPTVAL_HQ3X" 5, "$OPTVAL_OLD_NXBRZ"
6, "$OPTVAL_HQ4X" 6, "$OPTVAL_NORMALNX"
7, "$OPTVAL_HQ2XMMX" }
8, "$OPTVAL_HQ3XMMX"
9, "$OPTVAL_HQ4XMMX" OptionValue "HqResizeMultipliers"
10, "$OPTVAL_2XBRZ" {
11, "$OPTVAL_3XBRZ" 1, "$OPTVAL_OFF"
12, "$OPTVAL_4XBRZ" 2, "2x"
18, "$OPTVAL_5XBRZ" 3, "3x"
19, "$OPTVAL_6XBRZ" 4, "4x"
13, "$OPTVAL_OLD_2XBRZ" 5, "5x"
14, "$OPTVAL_OLD_3XBRZ" 6, "6x"
15, "$OPTVAL_OLD_4XBRZ"
16, "$OPTVAL_OLD_5XBRZ"
17, "$OPTVAL_OLD_6XBRZ"
20, "$OPTVAL_NORMAL2X"
21, "$OPTVAL_NORMAL3X"
22, "$OPTVAL_NORMAL4X"
23, "$OPTVAL_NORMAL5X"
24, "$OPTVAL_NORMAL6X"
} }
OptionValue "HqResizeModesNoMMX" OptionValue "HqResizeModesNoMMX"
{ {
0, "$OPTVAL_OFF" 0, "$OPTVAL_OFF"
1, "$OPTVAL_SCALE2X" 1, "$OPTVAL_SCALENX"
2, "$OPTVAL_SCALE3X" 2, "$OPTVAL_HQNX"
3, "$OPTVAL_SCALE4X" 4, "$OPTVAL_NXBRZ"
4, "$OPTVAL_HQ2X" 5, "$OPTVAL_OLD_NXBRZ"
5, "$OPTVAL_HQ3X" 6, "$OPTVAL_NORMALNX"
6, "$OPTVAL_HQ4X"
10, "$OPTVAL_2XBRZ"
11, "$OPTVAL_3XBRZ"
12, "$OPTVAL_4XBRZ"
18, "$OPTVAL_5XBRZ"
19, "$OPTVAL_6XBRZ"
13, "$OPTVAL_OLD_2XBRZ"
14, "$OPTVAL_OLD_3XBRZ"
15, "$OPTVAL_OLD_4XBRZ"
16, "$OPTVAL_OLD_5XBRZ"
17, "$OPTVAL_OLD_6XBRZ"
} }
OptionValue "FogMode" OptionValue "FogMode"
@ -2262,12 +2243,13 @@ OptionMenu "GLTextureGLOptions" protected
ifOption(MMX) ifOption(MMX)
{ {
Option "$GLTEXMNU_HQRESIZE", gl_texture_hqresize, "HqResizeModes" Option "$GLTEXMNU_HQRESIZE", gl_texture_hqresizemode, "HqResizeModes"
} }
else else
{ {
Option "$GLTEXMNU_HQRESIZE", gl_texture_hqresize, "HqResizeModesNoMMX" Option "$GLTEXMNU_HQRESIZE", gl_texture_hqresizemode, "HqResizeModesNoMMX"
} }
Option "$GLTEXMNU_HQRESIZEMULT", gl_texture_hqresizemult, "HqResizeMultipliers"
StaticText "!HQRESIZE_WARNING!" StaticText "!HQRESIZE_WARNING!"
Option "$GLTEXMNU_RESIZETEX", gl_texture_hqresize_textures, "OnOff" Option "$GLTEXMNU_RESIZETEX", gl_texture_hqresize_textures, "OnOff"

View file

@ -579,47 +579,9 @@ class GLTextureGLOptions : OptionMenu
{ {
string message; string message;
if (gl_texture_hqresize > 0) if (gl_texture_hqresizemult > 1 && gl_texture_hqresizemode > 0)
{ {
int multiplier; int multiplier = gl_texture_hqresizemult * gl_texture_hqresizemult;
switch (gl_texture_hqresize)
{
case 1:
case 4:
case 7:
case 10:
case 13:
case 20:
multiplier = 4;
break;
case 2:
case 5:
case 8:
case 11:
case 14:
case 21:
multiplier = 9;
break;
case 3:
case 6:
case 9:
case 12:
case 15:
case 22:
multiplier = 16;
break;
case 16:
case 18:
case 23:
multiplier = 25;
break;
case 17:
case 19:
case 24:
multiplier = 36;
break;
}
string localized = StringTable.Localize("$GLTEXMNU_HQRESIZEWARN"); string localized = StringTable.Localize("$GLTEXMNU_HQRESIZEWARN");
message = String.Format(localized, multiplier); message = String.Format(localized, multiplier);

View file

@ -2432,6 +2432,11 @@ struct PlayerInfo native play // self is what internally is known as player_t
} }
} }
deprecated("3.7") void BringUpWeapon()
{
if (mo) mo.BringUpWeapon();
}
bool IsTotallyFrozen() bool IsTotallyFrozen()
{ {
return return