2022-09-26 15:12:13 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
2022-10-01 02:06:09 -04:00
|
|
|
#include "MuT/ASTOpConstantString.h"
|
2022-10-02 10:56:02 -04:00
|
|
|
|
|
|
|
|
#include "HAL/PlatformMath.h"
|
|
|
|
|
#include "MuR/ModelPrivate.h"
|
|
|
|
|
#include "MuR/RefCounted.h"
|
|
|
|
|
#include "MuR/Types.h"
|
|
|
|
|
|
2022-09-26 15:12:13 -04:00
|
|
|
|
2022-10-18 04:42:25 -04:00
|
|
|
namespace mu
|
2022-09-26 15:12:13 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2022-10-18 04:42:25 -04:00
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
|
|
|
void ASTOpConstantString::ForEachChild(const TFunctionRef<void(ASTChild&)>)
|
|
|
|
|
{
|
|
|
|
|
}
|
2022-09-26 15:12:13 -04:00
|
|
|
|
|
|
|
|
|
2022-10-18 04:42:25 -04:00
|
|
|
uint64 ASTOpConstantString::Hash() const
|
|
|
|
|
{
|
2023-09-26 04:43:37 -04:00
|
|
|
uint64 res = std::hash<int32>()(value.Len());
|
2022-10-18 04:42:25 -04:00
|
|
|
return res;
|
|
|
|
|
}
|
2022-09-26 15:12:13 -04:00
|
|
|
|
|
|
|
|
|
2022-10-18 04:42:25 -04:00
|
|
|
bool ASTOpConstantString::IsEqual(const ASTOp& otherUntyped) const
|
|
|
|
|
{
|
2024-01-18 03:27:38 -05:00
|
|
|
if (otherUntyped.GetOpType() == GetOpType())
|
2022-10-18 04:42:25 -04:00
|
|
|
{
|
2024-01-18 03:27:38 -05:00
|
|
|
const ASTOpConstantString* other = static_cast<const ASTOpConstantString*>(&otherUntyped);
|
2022-10-18 04:42:25 -04:00
|
|
|
return value == other->value;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2022-09-26 15:12:13 -04:00
|
|
|
|
|
|
|
|
|
2022-10-18 04:42:25 -04:00
|
|
|
mu::Ptr<ASTOp> ASTOpConstantString::Clone(MapChildFuncRef) const
|
|
|
|
|
{
|
|
|
|
|
Ptr<ASTOpConstantString> n = new ASTOpConstantString();
|
|
|
|
|
n->value = value;
|
|
|
|
|
return n;
|
|
|
|
|
}
|
2022-09-26 15:12:13 -04:00
|
|
|
|
|
|
|
|
|
2023-07-28 04:00:17 -04:00
|
|
|
void ASTOpConstantString::Link(FProgram& program, FLinkerOptions*)
|
2022-10-18 04:42:25 -04:00
|
|
|
{
|
|
|
|
|
if (!linkedAddress)
|
|
|
|
|
{
|
|
|
|
|
OP::ResourceConstantArgs args;
|
2023-09-26 04:43:37 -04:00
|
|
|
FMemory::Memset(&args, 0, sizeof(args));
|
2022-10-18 04:42:25 -04:00
|
|
|
args.value = program.AddConstant(value);
|
|
|
|
|
|
|
|
|
|
linkedAddress = (OP::ADDRESS)program.m_opAddress.Num();
|
|
|
|
|
program.m_opAddress.Add((uint32_t)program.m_byteCode.Num());
|
|
|
|
|
AppendCode(program.m_byteCode, OP_TYPE::ST_CONSTANT);
|
|
|
|
|
AppendCode(program.m_byteCode, args);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|