mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 13:41:05 +00:00
- fixed register allocation for vector arguments to script functions.
- handle 2D and 3D vectors in SetReturn.
This commit is contained in:
parent
7209f9edd6
commit
4dc97a6ed0
3 changed files with 12 additions and 2 deletions
|
@ -296,6 +296,12 @@ struct VMReturn
|
|||
((double *)Location)[1] = val[1];
|
||||
((double *)Location)[2] = val[2];
|
||||
}
|
||||
void SetVector2(const double val[2])
|
||||
{
|
||||
//assert(RegType == REGT_FLOAT);
|
||||
((double *)Location)[0] = val[0];
|
||||
((double *)Location)[1] = val[1];
|
||||
}
|
||||
void SetString(const FString &val)
|
||||
{
|
||||
assert(RegType == REGT_STRING);
|
||||
|
|
|
@ -702,7 +702,7 @@ void FFunctionBuildList::Build()
|
|||
auto flags = item.Func->Variants[0].ArgFlags[i];
|
||||
// this won't get resolved and won't get emitted. It is only needed so that the code generator can retrieve the necessary info about this argument to do its work.
|
||||
auto local = new FxLocalVariableDeclaration(type, name, nullptr, flags, FScriptPosition());
|
||||
local->RegNum = buildit.Registers[type->GetRegType()].Get(1);
|
||||
local->RegNum = buildit.Registers[type->GetRegType()].Get(type->GetRegCount());
|
||||
ctx.FunctionArgs.Push(local);
|
||||
}
|
||||
|
||||
|
|
|
@ -1808,10 +1808,14 @@ static void SetReturn(const VMRegisters ®, VMFrame *frame, VMReturn *ret, VM_
|
|||
assert(regnum + ((regtype & REGT_KONST) ? 2u : 0u) < frame->NumRegF);
|
||||
src = ®.f[regnum];
|
||||
}
|
||||
if (regtype & REGT_MULTIREG)
|
||||
if (regtype & REGT_MULTIREG3)
|
||||
{
|
||||
ret->SetVector((double *)src);
|
||||
}
|
||||
else if (regtype & REGT_MULTIREG2)
|
||||
{
|
||||
ret->SetVector2((double *)src);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret->SetFloat(*(double *)src);
|
||||
|
|
Loading…
Reference in a new issue