mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- fixed setup for PString which was missing the load/store/move instructions which caused me to overlook its register type.
- properly set up the vector types. - fixed: a struct must start with a size of 0, not 1. This caused the layout of the vectors to be broken.
This commit is contained in:
parent
ed5a94d187
commit
f2f365bfef
2 changed files with 19 additions and 18 deletions
|
@ -205,6 +205,7 @@ PType::PType(unsigned int size, unsigned int align)
|
|||
storeOp = OP_NOP;
|
||||
moveOp = OP_NOP;
|
||||
RegType = REGT_NIL;
|
||||
RegCount = 1;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -570,7 +571,8 @@ void PType::StaticInit()
|
|||
TypeVector2->loadOp = OP_LV2;
|
||||
TypeVector2->storeOp = OP_SV2;
|
||||
TypeVector2->moveOp = OP_MOVEV2;
|
||||
TypeVector2->RegType = REGT_FLOAT|REGT_MULTIREG;
|
||||
TypeVector2->RegType = REGT_FLOAT;
|
||||
TypeVector2->RegCount = 2;
|
||||
|
||||
TypeVector3 = new PStruct(NAME_Vector3, nullptr);
|
||||
TypeVector3->AddField(NAME_X, TypeFloat64);
|
||||
|
@ -579,10 +581,11 @@ void PType::StaticInit()
|
|||
// allow accessing xy as a vector2. This is marked native because it's not supposed to be serialized.
|
||||
TypeVector3->Symbols.AddSymbol(new PField(NAME_XY, TypeVector2, VARF_Native, 0));
|
||||
TypeTable.AddType(TypeVector3);
|
||||
TypeVector2->loadOp = OP_LV3;
|
||||
TypeVector2->storeOp = OP_SV3;
|
||||
TypeVector2->moveOp = OP_MOVEV3;
|
||||
TypeVector2->RegType = REGT_FLOAT | REGT_MULTIREG;
|
||||
TypeVector3->loadOp = OP_LV3;
|
||||
TypeVector3->storeOp = OP_SV3;
|
||||
TypeVector3->moveOp = OP_MOVEV3;
|
||||
TypeVector3->RegType = REGT_FLOAT;
|
||||
TypeVector3->RegCount = 3;
|
||||
|
||||
|
||||
|
||||
|
@ -1207,17 +1210,11 @@ PString::PString()
|
|||
: PBasicType(sizeof(FString), __alignof(FString))
|
||||
{
|
||||
mDescriptiveName = "String";
|
||||
}
|
||||
storeOp = OP_SS;
|
||||
loadOp = OP_LS;
|
||||
moveOp = OP_MOVES;
|
||||
RegType = REGT_STRING;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PString :: GetRegType
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int PString::GetRegType() const
|
||||
{
|
||||
return REGT_STRING;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -2089,6 +2086,7 @@ IMPLEMENT_CLASS(PStruct)
|
|||
PStruct::PStruct()
|
||||
{
|
||||
mDescriptiveName = "Struct";
|
||||
Size = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -2101,6 +2099,7 @@ PStruct::PStruct(FName name, PTypeBase *outer)
|
|||
: PNamedType(name, outer)
|
||||
{
|
||||
mDescriptiveName.Format("Struct<%s>", name.GetChars());
|
||||
Size = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -224,7 +224,7 @@ public:
|
|||
PSymbolTable Symbols;
|
||||
bool MemberOnly = false; // type may only be used as a struct/class member but not as a local variable or function argument.
|
||||
FString mDescriptiveName;
|
||||
BYTE loadOp, storeOp, moveOp, RegType;
|
||||
BYTE loadOp, storeOp, moveOp, RegType, RegCount;
|
||||
|
||||
PType(unsigned int size = 1, unsigned int align = 1);
|
||||
virtual ~PType();
|
||||
|
@ -291,6 +291,10 @@ public:
|
|||
return RegType;
|
||||
}
|
||||
|
||||
int GetRegCount() const
|
||||
{
|
||||
return RegCount;
|
||||
}
|
||||
// Returns true if this type matches the two identifiers. Referring to the
|
||||
// above table, any type is identified by at most two characteristics. Each
|
||||
// type that implements this function will cast these to the appropriate type.
|
||||
|
@ -477,8 +481,6 @@ class PString : public PBasicType
|
|||
public:
|
||||
PString();
|
||||
|
||||
virtual int GetRegType() const;
|
||||
|
||||
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
|
||||
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
|
||||
void SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special=NULL) const override;
|
||||
|
|
Loading…
Reference in a new issue