mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 09:31:14 +00:00
Fixed Vector2/3 out parameters in the ZScript compiler.
This commit is contained in:
parent
ef06ef5977
commit
93d111ef29
3 changed files with 23 additions and 3 deletions
|
@ -7133,7 +7133,15 @@ FxExpression *FxStructMember::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
// since this is a vector, all potential things that may get here are single float or an xy-vector.
|
||||
auto locvar = static_cast<FxLocalVariable *>(classx);
|
||||
locvar->RegOffset = int(membervar->Offset / 8);
|
||||
if (!(locvar->Variable->VarFlags & VARF_Out))
|
||||
{
|
||||
locvar->RegOffset = int(membervar->Offset / 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
locvar->RegOffset = int(membervar->Offset);
|
||||
}
|
||||
|
||||
locvar->ValueType = membervar->Type;
|
||||
classx = nullptr;
|
||||
delete this;
|
||||
|
|
|
@ -2126,6 +2126,7 @@ class FxLocalVariableDeclaration : public FxExpression
|
|||
friend class FxLocalVariable;
|
||||
friend class FxStaticArrayVariable;
|
||||
friend class FxLocalArrayDeclaration;
|
||||
friend class FxStructMember;
|
||||
|
||||
FName Name;
|
||||
FxExpression *Init;
|
||||
|
|
|
@ -887,9 +887,20 @@ void FFunctionBuildList::Build()
|
|||
sfunc->NumArgs = 0;
|
||||
// NumArgs for the VMFunction must be the amount of stack elements, which can differ from the amount of logical function arguments if vectors are in the list.
|
||||
// For the VM a vector is 2 or 3 args, depending on size.
|
||||
for (auto s : item.Func->Variants[0].Proto->ArgumentTypes)
|
||||
auto funcVariant = item.Func->Variants[0];
|
||||
for (unsigned int i = 0; i < funcVariant.Proto->ArgumentTypes.Size(); i++)
|
||||
{
|
||||
sfunc->NumArgs += s->GetRegCount();
|
||||
auto argType = funcVariant.Proto->ArgumentTypes[i];
|
||||
auto argFlags = funcVariant.ArgFlags[i];
|
||||
if (argFlags & VARF_Out)
|
||||
{
|
||||
auto argPointer = NewPointer(argType);
|
||||
sfunc->NumArgs += argPointer->GetRegCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
sfunc->NumArgs += argType->GetRegCount();
|
||||
}
|
||||
}
|
||||
|
||||
if (dump != nullptr)
|
||||
|
|
Loading…
Reference in a new issue