mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-08-06 20:55:34 +00:00
Major scoped-enum refactor
This commit is contained in:
parent
daa446588b
commit
0a457d854a
@ -15,7 +15,6 @@ endif()
|
||||
|
||||
configure_file(DataSpecRegistry.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/DataSpecRegistry.hpp @ONLY)
|
||||
|
||||
set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/blender CACHE PATH "HECL include path" FORCE)
|
||||
set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/Athena/include)
|
||||
set(ATHENA_INCLUDE_DIR ${ATHENA_INCLUDE_DIR} PARENT_SCOPE)
|
||||
set(SQUISH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/libSquish)
|
||||
|
@ -341,7 +341,7 @@ BlenderConnection::BlenderConnection(int verbosityLevel)
|
||||
InstallAddon(blenderAddonPath.c_str());
|
||||
++installAttempt;
|
||||
if (installAttempt >= 2)
|
||||
BlenderLog.report(LogVisor::FatalError, "unable to install blender addon using '%s'", blenderAddonPath.c_str());
|
||||
BlenderLog.report(LogVisor::FatalError, _S("unable to install blender addon using '%s'"), blenderAddonPath.c_str());
|
||||
continue;
|
||||
}
|
||||
else if (!strcmp(lineBuf, "ADDONINSTALLED"))
|
||||
@ -386,7 +386,7 @@ bool BlenderConnection::createBlend(const ProjectPath& path, BlendType type)
|
||||
"BlenderConnection::createBlend() musn't be called with stream active");
|
||||
return false;
|
||||
}
|
||||
_writeLine(("CREATE \"" + path.getAbsolutePathUTF8() + "\" " + BlendTypeStrs[type] + " \"" + m_startupBlend + "\"").c_str());
|
||||
_writeLine(("CREATE \"" + path.getAbsolutePathUTF8() + "\" " + BlendTypeStrs[int(type)] + " \"" + m_startupBlend + "\"").c_str());
|
||||
char lineBuf[256];
|
||||
_readLine(lineBuf, sizeof(lineBuf));
|
||||
if (!strcmp(lineBuf, "FINISHED"))
|
||||
@ -416,7 +416,7 @@ bool BlenderConnection::openBlend(const ProjectPath& path, bool force)
|
||||
m_loadedBlend = path;
|
||||
_writeLine("GETTYPE");
|
||||
_readLine(lineBuf, sizeof(lineBuf));
|
||||
m_loadedType = TypeNone;
|
||||
m_loadedType = BlendType::None;
|
||||
unsigned idx = 0;
|
||||
while (BlendTypeStrs[idx])
|
||||
{
|
||||
|
@ -35,15 +35,15 @@ class HMDLBuffers;
|
||||
class BlenderConnection
|
||||
{
|
||||
public:
|
||||
enum BlendType
|
||||
enum class BlendType
|
||||
{
|
||||
TypeNone,
|
||||
TypeMesh,
|
||||
TypeActor,
|
||||
TypeArea,
|
||||
TypeWorld,
|
||||
TypeMapArea,
|
||||
TypeMapUniverse
|
||||
None,
|
||||
Mesh,
|
||||
Actor,
|
||||
Area,
|
||||
World,
|
||||
MapArea,
|
||||
MapUniverse
|
||||
};
|
||||
private:
|
||||
bool m_lock = false;
|
||||
@ -54,7 +54,7 @@ private:
|
||||
#endif
|
||||
int m_readpipe[2];
|
||||
int m_writepipe[2];
|
||||
BlendType m_loadedType = TypeNone;
|
||||
BlendType m_loadedType = BlendType::None;
|
||||
ProjectPath m_loadedBlend;
|
||||
std::string m_startupBlend;
|
||||
size_t _readLine(char* buf, size_t bufSz);
|
||||
@ -72,11 +72,11 @@ public:
|
||||
bool saveBlend();
|
||||
void deleteBlend();
|
||||
|
||||
enum ANIMCurveType
|
||||
enum class ANIMCurveType
|
||||
{
|
||||
CurveRotate,
|
||||
CurveTranslate,
|
||||
CurveScale
|
||||
Rotate,
|
||||
Translate,
|
||||
Scale
|
||||
};
|
||||
|
||||
class PyOutStream : public std::ostream
|
||||
@ -522,7 +522,7 @@ public:
|
||||
static const char* MeshOutputModeString(HMDLTopology topology)
|
||||
{
|
||||
static const char* STRS[] = {"TRIANGLES", "TRISTRIPS"};
|
||||
return STRS[topology];
|
||||
return STRS[int(topology)];
|
||||
}
|
||||
|
||||
|
||||
@ -530,7 +530,7 @@ public:
|
||||
Mesh compileMesh(HMDLTopology topology, int skinSlotCount=10,
|
||||
Mesh::SurfProgFunc surfProg=[](int){})
|
||||
{
|
||||
if (m_parent->m_loadedType != TypeMesh)
|
||||
if (m_parent->m_loadedType != BlendType::Mesh)
|
||||
BlenderLog.report(LogVisor::FatalError, _S("%s is not a MESH blend"),
|
||||
m_parent->m_loadedBlend.getAbsolutePath().c_str());
|
||||
|
||||
@ -551,7 +551,7 @@ public:
|
||||
Mesh compileMesh(const std::string& name, HMDLTopology topology, int skinSlotCount=10,
|
||||
Mesh::SurfProgFunc surfProg=[](int){})
|
||||
{
|
||||
if (m_parent->m_loadedType != TypeArea)
|
||||
if (m_parent->m_loadedType != BlendType::Area)
|
||||
BlenderLog.report(LogVisor::FatalError, _S("%s is not an AREA blend"),
|
||||
m_parent->m_loadedBlend.getAbsolutePath().c_str());
|
||||
|
||||
@ -572,7 +572,7 @@ public:
|
||||
Mesh compileAllMeshes(HMDLTopology topology, int skinSlotCount=10, float maxOctantLength=5.0,
|
||||
Mesh::SurfProgFunc surfProg=[](int){})
|
||||
{
|
||||
if (m_parent->m_loadedType != TypeArea)
|
||||
if (m_parent->m_loadedType != BlendType::Area)
|
||||
BlenderLog.report(LogVisor::FatalError, _S("%s is not an AREA blend"),
|
||||
m_parent->m_loadedBlend.getAbsolutePath().c_str());
|
||||
|
||||
@ -657,7 +657,7 @@ public:
|
||||
|
||||
Actor compileActor()
|
||||
{
|
||||
if (m_parent->m_loadedType != TypeActor)
|
||||
if (m_parent->m_loadedType != BlendType::Actor)
|
||||
BlenderLog.report(LogVisor::FatalError, _S("%s is not an ACTOR blend"),
|
||||
m_parent->m_loadedBlend.getAbsolutePath().c_str());
|
||||
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
m_specPasses.reserve(HECL::Database::DATA_SPEC_REGISTRY.size());
|
||||
for (const HECL::Database::DataSpecEntry* entry : HECL::Database::DATA_SPEC_REGISTRY)
|
||||
{
|
||||
HECL::Database::IDataSpec* ds = entry->m_factory(*m_useProj, HECL::Database::TOOL_EXTRACT);
|
||||
HECL::Database::IDataSpec* ds = entry->m_factory(*m_useProj, HECL::Database::DataSpecTool::Extract);
|
||||
if (ds)
|
||||
{
|
||||
if (ds->canExtract(m_einfo, m_reps))
|
||||
|
2
hecl/extern/Athena
vendored
2
hecl/extern/Athena
vendored
@ -1 +1 @@
|
||||
Subproject commit 18e94dbc54cf1e88d7c5b697e96b05a1f583edee
|
||||
Subproject commit cdacc014f3c269f07c166499e0618bd879b412a5
|
2
hecl/extern/libBoo
vendored
2
hecl/extern/libBoo
vendored
@ -1 +1 @@
|
||||
Subproject commit 62fae6004226348bdf5e3b0f5401d091128ec86e
|
||||
Subproject commit c9edf8dd8573662921522d40cdd38837f7db2154
|
@ -391,7 +391,7 @@ struct GX : IBackend
|
||||
return -1;
|
||||
}
|
||||
|
||||
enum BlendFactor
|
||||
enum BlendFactor : uint16_t
|
||||
{
|
||||
BL_ZERO,
|
||||
BL_ONE,
|
||||
@ -524,14 +524,14 @@ struct GX : IBackend
|
||||
private:
|
||||
struct TraceResult
|
||||
{
|
||||
enum
|
||||
enum class Type
|
||||
{
|
||||
TraceInvalid,
|
||||
TraceTEVStage,
|
||||
TraceTEVColorArg,
|
||||
TraceTEVAlphaArg,
|
||||
TraceTEVKColorSel,
|
||||
TraceTEVKAlphaSel
|
||||
Invalid,
|
||||
TEVStage,
|
||||
TEVColorArg,
|
||||
TEVAlphaArg,
|
||||
TEVKColorSel,
|
||||
TEVKAlphaSel
|
||||
} type;
|
||||
union
|
||||
{
|
||||
@ -541,12 +541,12 @@ private:
|
||||
GX::TevKColorSel tevKColorSel;
|
||||
GX::TevKAlphaSel tevKAlphaSel;
|
||||
};
|
||||
TraceResult() : type(TraceInvalid) {}
|
||||
TraceResult(GX::TEVStage* stage) : type(TraceTEVStage), tevStage(stage) {}
|
||||
TraceResult(GX::TevColorArg arg) : type(TraceTEVColorArg), tevColorArg(arg) {}
|
||||
TraceResult(GX::TevAlphaArg arg) : type(TraceTEVAlphaArg), tevAlphaArg(arg) {}
|
||||
TraceResult(GX::TevKColorSel arg) : type(TraceTEVKColorSel), tevKColorSel(arg) {}
|
||||
TraceResult(GX::TevKAlphaSel arg) : type(TraceTEVKAlphaSel), tevKAlphaSel(arg) {}
|
||||
TraceResult() : type(Type::Invalid) {}
|
||||
TraceResult(GX::TEVStage* stage) : type(Type::TEVStage), tevStage(stage) {}
|
||||
TraceResult(GX::TevColorArg arg) : type(Type::TEVColorArg), tevColorArg(arg) {}
|
||||
TraceResult(GX::TevAlphaArg arg) : type(Type::TEVAlphaArg), tevAlphaArg(arg) {}
|
||||
TraceResult(GX::TevKColorSel arg) : type(Type::TEVKColorSel), tevKColorSel(arg) {}
|
||||
TraceResult(GX::TevKAlphaSel arg) : type(Type::TEVKAlphaSel), tevKAlphaSel(arg) {}
|
||||
};
|
||||
|
||||
unsigned addKColor(Diagnostics& diag, const SourceLocation& loc, const Color& color);
|
||||
|
@ -32,11 +32,11 @@ struct ProgrammableCommon : IBackend
|
||||
std::vector<TexSampling> m_texSamplings;
|
||||
unsigned m_texMapEnd = 0;
|
||||
|
||||
enum TexGenSrc
|
||||
enum class TexGenSrc
|
||||
{
|
||||
TG_POS,
|
||||
TG_NRM,
|
||||
TG_UV
|
||||
Position,
|
||||
Normal,
|
||||
UV
|
||||
};
|
||||
|
||||
struct TexCoordGen
|
||||
|
@ -38,10 +38,10 @@ class PackageDepsgraph
|
||||
public:
|
||||
struct Node
|
||||
{
|
||||
enum
|
||||
enum class Type
|
||||
{
|
||||
NODE_DATA,
|
||||
NODE_GROUP
|
||||
Data,
|
||||
Group
|
||||
} type;
|
||||
ProjectPath path;
|
||||
ProjectPath cookedPath;
|
||||
@ -132,11 +132,11 @@ public:
|
||||
/**
|
||||
* @brief Pre-emptive indication of what the constructed DataSpec is used for
|
||||
*/
|
||||
enum DataSpecTool
|
||||
enum class DataSpecTool
|
||||
{
|
||||
TOOL_EXTRACT,
|
||||
TOOL_COOK,
|
||||
TOOL_PACKAGE
|
||||
Extract,
|
||||
Cook,
|
||||
Package
|
||||
};
|
||||
|
||||
extern std::vector<const struct DataSpecEntry*> DATA_SPEC_REGISTRY;
|
||||
@ -175,22 +175,22 @@ protected:
|
||||
/**
|
||||
* @brief Byte-order of target system
|
||||
*/
|
||||
enum DataEndianness
|
||||
enum class DataEndianness
|
||||
{
|
||||
DE_NONE,
|
||||
DE_BIG, /**< Big-endian (PowerPC) */
|
||||
DE_LITTLE /**< Little-endian (Intel) */
|
||||
None,
|
||||
Big, /**< Big-endian (PowerPC) */
|
||||
Little /**< Little-endian (Intel) */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Data-formats of target system
|
||||
*/
|
||||
enum DataPlatform
|
||||
enum class DataPlatform
|
||||
{
|
||||
DP_NONE,
|
||||
DP_GENERIC, /**< Scanline textures and 3-way shader bundle (GLSL, HLSL, SPIR-V) */
|
||||
DP_REVOLUTION, /**< Tiled textures and GX register buffers */
|
||||
DP_CAFE /**< Swizzled textures and R700 shader objects */
|
||||
None,
|
||||
Generic, /**< Scanline textures and 3-way shader bundle (GLSL, HLSL, SPIR-V) */
|
||||
Revolution, /**< Tiled textures and GX register buffers */
|
||||
Cafe /**< Swizzled textures and R700 shader objects */
|
||||
};
|
||||
|
||||
typedef std::function<void(const void* data, size_t len)> FDataAppender;
|
||||
@ -294,12 +294,12 @@ public:
|
||||
*
|
||||
* This is used to provide pretty colors during the cook operation
|
||||
*/
|
||||
enum Cost
|
||||
enum class Cost
|
||||
{
|
||||
C_NONE,
|
||||
C_LIGHT,
|
||||
C_MEDIUM,
|
||||
C_HEAVY
|
||||
None,
|
||||
Light,
|
||||
Medium,
|
||||
Heavy
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -44,19 +44,19 @@ public:
|
||||
class Parser
|
||||
{
|
||||
public:
|
||||
enum TokenType
|
||||
enum class TokenType
|
||||
{
|
||||
TokenNone,
|
||||
TokenSourceBegin,
|
||||
TokenSourceEnd,
|
||||
TokenNumLiteral,
|
||||
TokenVectorSwizzle,
|
||||
TokenEvalGroupStart,
|
||||
TokenEvalGroupEnd,
|
||||
TokenFunctionStart,
|
||||
TokenFunctionEnd,
|
||||
TokenFunctionArgDelim,
|
||||
TokenArithmeticOp,
|
||||
None,
|
||||
SourceBegin,
|
||||
SourceEnd,
|
||||
NumLiteral,
|
||||
VectorSwizzle,
|
||||
EvalGroupStart,
|
||||
EvalGroupEnd,
|
||||
FunctionStart,
|
||||
FunctionEnd,
|
||||
FunctionArgDelim,
|
||||
ArithmeticOp,
|
||||
};
|
||||
private:
|
||||
Diagnostics& m_diag;
|
||||
@ -73,33 +73,33 @@ public:
|
||||
std::string m_tokenString;
|
||||
int m_tokenInt = 0;
|
||||
float m_tokenFloat = 0.0;
|
||||
Token() : m_type(TokenNone) {}
|
||||
Token() : m_type(TokenType::None) {}
|
||||
Token(TokenType type, SourceLocation loc) : m_type(type), m_location(loc) {}
|
||||
const char* typeString() const
|
||||
{
|
||||
switch (m_type)
|
||||
{
|
||||
case TokenNone:
|
||||
case TokenType::None:
|
||||
return "None";
|
||||
case TokenSourceBegin:
|
||||
case TokenType::SourceBegin:
|
||||
return "SourceBegin";
|
||||
case TokenSourceEnd:
|
||||
case TokenType::SourceEnd:
|
||||
return "SourceEnd";
|
||||
case TokenNumLiteral:
|
||||
case TokenType::NumLiteral:
|
||||
return "NumLiteral";
|
||||
case TokenVectorSwizzle:
|
||||
case TokenType::VectorSwizzle:
|
||||
return "VectorSwizzle";
|
||||
case TokenEvalGroupStart:
|
||||
case TokenType::EvalGroupStart:
|
||||
return "EvalGroupStart";
|
||||
case TokenEvalGroupEnd:
|
||||
case TokenType::EvalGroupEnd:
|
||||
return "EvalGroupEnd";
|
||||
case TokenFunctionStart:
|
||||
case TokenType::FunctionStart:
|
||||
return "FunctionStart";
|
||||
case TokenFunctionEnd:
|
||||
case TokenType::FunctionEnd:
|
||||
return "FunctionEnd";
|
||||
case TokenFunctionArgDelim:
|
||||
case TokenType::FunctionArgDelim:
|
||||
return "FunctionArgDelim";
|
||||
case TokenArithmeticOp:
|
||||
case TokenType::ArithmeticOp:
|
||||
return "ArithmeticOp";
|
||||
default: break;
|
||||
}
|
||||
@ -121,11 +121,11 @@ struct IR : BigDNA
|
||||
|
||||
enum OpType : uint8_t
|
||||
{
|
||||
OpNone, /**< NOP */
|
||||
OpCall, /**< Deferred function insertion for HECL backend using specified I/O regs */
|
||||
OpLoadImm, /**< Load a constant (numeric literal) into register */
|
||||
OpArithmetic, /**< Perform binary arithmetic between registers */
|
||||
OpSwizzle /**< Vector insertion/extraction/swizzling operation */
|
||||
None, /**< NOP */
|
||||
Call, /**< Deferred function insertion for HECL backend using specified I/O regs */
|
||||
LoadImm, /**< Load a constant (numeric literal) into register */
|
||||
Arithmetic, /**< Perform binary arithmetic between registers */
|
||||
Swizzle /**< Vector insertion/extraction/swizzling operation */
|
||||
};
|
||||
|
||||
using RegID = atUint16;
|
||||
@ -134,7 +134,7 @@ struct IR : BigDNA
|
||||
{
|
||||
Delete _d;
|
||||
|
||||
OpType m_op = OpNone;
|
||||
OpType m_op = OpType::None;
|
||||
RegID m_target = RegID(-1);
|
||||
SourceLocation m_loc;
|
||||
|
||||
@ -154,17 +154,17 @@ struct IR : BigDNA
|
||||
|
||||
enum ArithmeticOpType : uint8_t
|
||||
{
|
||||
ArithmeticOpNone,
|
||||
ArithmeticOpAdd,
|
||||
ArithmeticOpSubtract,
|
||||
ArithmeticOpMultiply,
|
||||
ArithmeticOpDivide
|
||||
None,
|
||||
Add,
|
||||
Subtract,
|
||||
Multiply,
|
||||
Divide
|
||||
};
|
||||
|
||||
struct Arithmetic : BigDNA
|
||||
{
|
||||
DECL_DNA
|
||||
Value<ArithmeticOpType> m_op = ArithmeticOpNone;
|
||||
Value<ArithmeticOpType> m_op = ArithmeticOpType::None;
|
||||
Value<atUint16> m_instIdxs[2];
|
||||
} m_arithmetic;
|
||||
|
||||
@ -181,11 +181,11 @@ struct IR : BigDNA
|
||||
{
|
||||
switch (m_op)
|
||||
{
|
||||
case OpCall:
|
||||
case OpType::Call:
|
||||
return m_call.m_argInstIdxs.size();
|
||||
case OpArithmetic:
|
||||
case OpType::Arithmetic:
|
||||
return 2;
|
||||
case OpSwizzle:
|
||||
case OpType::Swizzle:
|
||||
return 1;
|
||||
default:
|
||||
LogModule.report(LogVisor::FatalError, "invalid op type");
|
||||
@ -197,13 +197,13 @@ struct IR : BigDNA
|
||||
{
|
||||
switch (m_op)
|
||||
{
|
||||
case OpCall:
|
||||
case OpType::Call:
|
||||
return ir.m_instructions.at(m_call.m_argInstIdxs.at(idx));
|
||||
case OpArithmetic:
|
||||
case OpType::Arithmetic:
|
||||
if (idx > 1)
|
||||
LogModule.report(LogVisor::FatalError, "arithmetic child idx must be 0 or 1");
|
||||
return ir.m_instructions.at(m_arithmetic.m_instIdxs[idx]);
|
||||
case OpSwizzle:
|
||||
case OpType::Swizzle:
|
||||
if (idx > 0)
|
||||
LogModule.report(LogVisor::FatalError, "swizzle child idx must be 0");
|
||||
return ir.m_instructions.at(m_swizzle.m_instIdx);
|
||||
@ -215,7 +215,7 @@ struct IR : BigDNA
|
||||
|
||||
const atVec4f& getImmVec() const
|
||||
{
|
||||
if (m_op != OpLoadImm)
|
||||
if (m_op != OpType::LoadImm)
|
||||
LogModule.report(LogVisor::FatalError, "invalid op type");
|
||||
return m_loadImm.m_immVec;
|
||||
}
|
||||
@ -227,16 +227,16 @@ struct IR : BigDNA
|
||||
switch (m_op)
|
||||
{
|
||||
default: break;
|
||||
case OpCall:
|
||||
case OpType::Call:
|
||||
m_call.read(reader);
|
||||
break;
|
||||
case OpLoadImm:
|
||||
case OpType::LoadImm:
|
||||
m_loadImm.read(reader);
|
||||
break;
|
||||
case OpArithmetic:
|
||||
case OpType::Arithmetic:
|
||||
m_arithmetic.read(reader);
|
||||
break;
|
||||
case OpSwizzle:
|
||||
case OpType::Swizzle:
|
||||
m_swizzle.read(reader);
|
||||
break;
|
||||
}
|
||||
@ -249,16 +249,16 @@ struct IR : BigDNA
|
||||
switch (m_op)
|
||||
{
|
||||
default: break;
|
||||
case OpCall:
|
||||
case OpType::Call:
|
||||
m_call.write(writer);
|
||||
break;
|
||||
case OpLoadImm:
|
||||
case OpType::LoadImm:
|
||||
m_loadImm.write(writer);
|
||||
break;
|
||||
case OpArithmetic:
|
||||
case OpType::Arithmetic:
|
||||
m_arithmetic.write(writer);
|
||||
break;
|
||||
case OpSwizzle:
|
||||
case OpType::Swizzle:
|
||||
m_swizzle.write(writer);
|
||||
break;
|
||||
}
|
||||
@ -270,16 +270,16 @@ struct IR : BigDNA
|
||||
switch (m_op)
|
||||
{
|
||||
default: break;
|
||||
case OpCall:
|
||||
case OpType::Call:
|
||||
sz = m_call.binarySize(sz);
|
||||
break;
|
||||
case OpLoadImm:
|
||||
case OpType::LoadImm:
|
||||
sz = m_loadImm.binarySize(sz);
|
||||
break;
|
||||
case OpArithmetic:
|
||||
case OpType::Arithmetic:
|
||||
sz = m_arithmetic.binarySize(sz);
|
||||
break;
|
||||
case OpSwizzle:
|
||||
case OpType::Swizzle:
|
||||
sz = m_swizzle.binarySize(sz);
|
||||
break;
|
||||
}
|
||||
|
@ -194,13 +194,13 @@ static inline SystemChar* Getcwd(SystemChar* buf, int maxlen)
|
||||
#endif
|
||||
}
|
||||
|
||||
enum FileLockType
|
||||
enum class FileLockType
|
||||
{
|
||||
LNONE = 0,
|
||||
LREAD,
|
||||
LWRITE
|
||||
None = 0,
|
||||
Read,
|
||||
Write
|
||||
};
|
||||
static inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLockType lock=LNONE)
|
||||
static inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLockType lock=FileLockType::None)
|
||||
{
|
||||
#if HECL_UCS2
|
||||
FILE* fp = _wfopen(path, mode);
|
||||
@ -212,13 +212,13 @@ static inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLo
|
||||
LogModule.report(LogVisor::FatalError, "fopen %s: %s", path, strerror(errno));
|
||||
#endif
|
||||
|
||||
if (lock)
|
||||
if (lock != FileLockType::None)
|
||||
{
|
||||
#if _WIN32
|
||||
OVERLAPPED ov = {};
|
||||
LockFileEx((HANDLE)(uintptr_t)_fileno(fp), (lock == LWRITE) ? LOCKFILE_EXCLUSIVE_LOCK : 0, 0, 0, 1, &ov);
|
||||
#else
|
||||
if (flock(fileno(fp), ((lock == LWRITE) ? LOCK_EX : LOCK_SH) | LOCK_NB))
|
||||
if (flock(fileno(fp), ((lock == FileLockType::Write) ? LOCK_EX : LOCK_SH) | LOCK_NB))
|
||||
LogModule.report(LogVisor::FatalError, "flock %s: %s", path, strerror(errno));
|
||||
#endif
|
||||
}
|
||||
@ -741,20 +741,20 @@ public:
|
||||
/**
|
||||
* @brief Type of path
|
||||
*/
|
||||
enum PathType
|
||||
enum class Type
|
||||
{
|
||||
PT_NONE, /**< If path doesn't reference a valid filesystem entity, this is returned */
|
||||
PT_FILE, /**< Singular file path (confirmed with filesystem) */
|
||||
PT_DIRECTORY, /**< Singular directory path (confirmed with filesystem) */
|
||||
PT_GLOB, /**< Glob-path (whenever one or more '*' occurs in syntax) */
|
||||
PT_LINK /**< Link (symlink on POSIX, ShellLink on Windows) */
|
||||
None, /**< If path doesn't reference a valid filesystem entity, this is returned */
|
||||
File, /**< Singular file path (confirmed with filesystem) */
|
||||
Directory, /**< Singular directory path (confirmed with filesystem) */
|
||||
Glob, /**< Glob-path (whenever one or more '*' occurs in syntax) */
|
||||
Link /**< Link (symlink on POSIX, ShellLink on Windows) */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Get type of path based on syntax and filesystem queries
|
||||
* @return Type of path
|
||||
*/
|
||||
PathType getPathType() const;
|
||||
Type getPathType() const;
|
||||
|
||||
/**
|
||||
* @brief Get time of last modification with special behaviors for directories and glob-paths
|
||||
|
@ -7,10 +7,10 @@
|
||||
namespace HECL
|
||||
{
|
||||
|
||||
enum HMDLTopology : atUint32
|
||||
enum class HMDLTopology : atUint32
|
||||
{
|
||||
TopologyTriangles,
|
||||
TopologyTriStrips,
|
||||
Triangles,
|
||||
TriStrips,
|
||||
};
|
||||
|
||||
#define HECL_HMDL_META_SZ 32
|
||||
|
@ -105,7 +105,7 @@ class ShaderCacheExtensions
|
||||
{
|
||||
friend class ShaderCacheManager;
|
||||
boo::IGraphicsDataFactory::Platform m_plat;
|
||||
ShaderCacheExtensions() : m_plat(boo::IGraphicsDataFactory::PlatformNull) {}
|
||||
ShaderCacheExtensions() : m_plat(boo::IGraphicsDataFactory::Platform::Null) {}
|
||||
|
||||
uint64_t hashExtensions() const;
|
||||
public:
|
||||
@ -130,7 +130,7 @@ public:
|
||||
/* Index-0 has special default-meaning */
|
||||
m_extensionSlots.emplace_back();
|
||||
}
|
||||
operator bool() const {return m_plat != boo::IGraphicsDataFactory::PlatformNull;}
|
||||
operator bool() const {return m_plat != boo::IGraphicsDataFactory::Platform::Null;}
|
||||
|
||||
/* Strings must remain resident!! (intended to be stored static const) */
|
||||
unsigned registerExtensionSlot(Function lighting, Function post)
|
||||
|
@ -15,11 +15,11 @@ std::string GLSL::EmitTexGenSource2(TexGenSrc src, int uvIdx) const
|
||||
{
|
||||
switch (src)
|
||||
{
|
||||
case TG_POS:
|
||||
case TexGenSrc::Position:
|
||||
return "posIn.xy\n";
|
||||
case TG_NRM:
|
||||
case TexGenSrc::Normal:
|
||||
return "normIn.xy\n";
|
||||
case TG_UV:
|
||||
case TexGenSrc::UV:
|
||||
return HECL::Format("uvIn[%u]", uvIdx);
|
||||
default: break;
|
||||
}
|
||||
@ -30,11 +30,11 @@ std::string GLSL::EmitTexGenSource4(TexGenSrc src, int uvIdx) const
|
||||
{
|
||||
switch (src)
|
||||
{
|
||||
case TG_POS:
|
||||
case TexGenSrc::Position:
|
||||
return "vec4(posIn, 1.0)\n";
|
||||
case TG_NRM:
|
||||
case TexGenSrc::Normal:
|
||||
return "vec4(normIn, 1.0)\n";
|
||||
case TG_UV:
|
||||
case TexGenSrc::UV:
|
||||
return HECL::Format("vec4(uvIn[%u], 0.0, 1.0)", uvIdx);
|
||||
default: break;
|
||||
}
|
||||
@ -284,8 +284,8 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
||||
ShaderCachedData dataOut(tag, cachedSz);
|
||||
Athena::io::MemoryWriter w(dataOut.m_data.get(), dataOut.m_sz);
|
||||
w.writeUByte(m_backend.m_texMapEnd);
|
||||
w.writeUByte(m_backend.m_blendSrc);
|
||||
w.writeUByte(m_backend.m_blendDst);
|
||||
w.writeUByte(atUint8(m_backend.m_blendSrc));
|
||||
w.writeUByte(atUint8(m_backend.m_blendDst));
|
||||
w.writeString(vertSource);
|
||||
w.writeString(fragSource);
|
||||
|
||||
@ -349,8 +349,8 @@ struct GLSLBackendFactory : IShaderBackendFactory
|
||||
ShaderCachedData dataOut(tag, cachedSz);
|
||||
Athena::io::MemoryWriter w(dataOut.m_data.get(), dataOut.m_sz);
|
||||
w.writeUByte(m_backend.m_texMapEnd);
|
||||
w.writeUByte(m_backend.m_blendSrc);
|
||||
w.writeUByte(m_backend.m_blendDst);
|
||||
w.writeUByte(atUint8(m_backend.m_blendSrc));
|
||||
w.writeUByte(atUint8(m_backend.m_blendDst));
|
||||
w.writeString(vertSource);
|
||||
for (const std::string src : fragSources)
|
||||
w.writeString(src);
|
||||
|
@ -71,7 +71,7 @@ GX::TEVStage& GX::addTEVStage(Diagnostics& diag, const SourceLocation& loc)
|
||||
|
||||
unsigned GX::RecursiveTraceTexGen(const IR& ir, Diagnostics& diag, const IR::Instruction& inst, TexMtx mtx)
|
||||
{
|
||||
if (inst.m_op != IR::OpCall)
|
||||
if (inst.m_op != IR::OpType::Call)
|
||||
diag.reportBackendErr(inst.m_loc, "TexCoordGen resolution requires function");
|
||||
|
||||
const std::string& tcgName = inst.m_call.m_name;
|
||||
@ -109,7 +109,7 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
{
|
||||
switch (inst.m_op)
|
||||
{
|
||||
case IR::OpCall:
|
||||
case IR::OpType::Call:
|
||||
{
|
||||
const std::string& name = inst.m_call.m_name;
|
||||
if (!name.compare("Texture"))
|
||||
@ -147,7 +147,7 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
diag.reportBackendErr(inst.m_loc, "GX backend unable to interpret '%s'", name.c_str());
|
||||
break;
|
||||
}
|
||||
case IR::OpLoadImm:
|
||||
case IR::OpType::LoadImm:
|
||||
{
|
||||
const atVec4f& vec = inst.m_loadImm.m_immVec;
|
||||
if (vec.vec[0] == 0.f && vec.vec[1] == 0.f && vec.vec[2] == 0.f)
|
||||
@ -157,14 +157,14 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
unsigned idx = addKColor(diag, inst.m_loc, vec);
|
||||
return TraceResult(TevKColorSel(TEV_KCSEL_K0 + idx));
|
||||
}
|
||||
case IR::OpArithmetic:
|
||||
case IR::OpType::Arithmetic:
|
||||
{
|
||||
ArithmeticOp op = inst.m_arithmetic.m_op;
|
||||
const IR::Instruction& aInst = inst.getChildInst(ir, 0);
|
||||
const IR::Instruction& bInst = inst.getChildInst(ir, 1);
|
||||
TraceResult aTrace;
|
||||
TraceResult bTrace;
|
||||
if (aInst.m_op != IR::OpArithmetic && bInst.m_op == IR::OpArithmetic)
|
||||
if (aInst.m_op != IR::OpType::Arithmetic && bInst.m_op == IR::OpType::Arithmetic)
|
||||
{
|
||||
bTrace = RecursiveTraceColor(ir, diag, bInst);
|
||||
aTrace = RecursiveTraceColor(ir, diag, aInst);
|
||||
@ -174,8 +174,8 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
aTrace = RecursiveTraceColor(ir, diag, aInst);
|
||||
bTrace = RecursiveTraceColor(ir, diag, bInst);
|
||||
}
|
||||
if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVStage &&
|
||||
if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVStage &&
|
||||
getStageIdx(aTrace.tevStage) > getStageIdx(bTrace.tevStage))
|
||||
{
|
||||
TraceResult tmp = aTrace;
|
||||
@ -184,28 +184,28 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
}
|
||||
|
||||
TevKColorSel newKColor = TEV_KCSEL_1;
|
||||
if (aTrace.type == TraceResult::TraceTEVKColorSel &&
|
||||
bTrace.type == TraceResult::TraceTEVKColorSel)
|
||||
if (aTrace.type == TraceResult::Type::TEVKColorSel &&
|
||||
bTrace.type == TraceResult::Type::TEVKColorSel)
|
||||
diag.reportBackendErr(inst.m_loc, "unable to handle 2 KColors in one stage");
|
||||
else if (aTrace.type == TraceResult::TraceTEVKColorSel)
|
||||
else if (aTrace.type == TraceResult::Type::TEVKColorSel)
|
||||
{
|
||||
newKColor = aTrace.tevKColorSel;
|
||||
aTrace.type = TraceResult::TraceTEVColorArg;
|
||||
aTrace.type = TraceResult::Type::TEVColorArg;
|
||||
aTrace.tevColorArg = CC_KONST;
|
||||
}
|
||||
else if (bTrace.type == TraceResult::TraceTEVKColorSel)
|
||||
else if (bTrace.type == TraceResult::Type::TEVKColorSel)
|
||||
{
|
||||
newKColor = bTrace.tevKColorSel;
|
||||
bTrace.type = TraceResult::TraceTEVColorArg;
|
||||
bTrace.type = TraceResult::Type::TEVColorArg;
|
||||
bTrace.tevColorArg = CC_KONST;
|
||||
}
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case ArithmeticOp::ArithmeticOpAdd:
|
||||
case ArithmeticOp::Add:
|
||||
{
|
||||
if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
@ -228,8 +228,8 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
b->m_color[3] = CC_CPREV;
|
||||
return TraceResult(b);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVColorArg)
|
||||
else if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVColorArg)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
if (a->m_color[3] != CC_ZERO)
|
||||
@ -238,8 +238,8 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
a->m_kColor = newKColor;
|
||||
return TraceResult(a);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVColorArg &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
else if (aTrace.type == TraceResult::Type::TEVColorArg &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
if (b->m_color[3] != CC_ZERO)
|
||||
@ -250,10 +250,10 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpSubtract:
|
||||
case ArithmeticOp::Subtract:
|
||||
{
|
||||
if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
@ -269,8 +269,8 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
b->m_cop = TEV_SUB;
|
||||
return TraceResult(b);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVColorArg)
|
||||
else if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVColorArg)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
if (a->m_color[3] != CC_ZERO)
|
||||
@ -282,10 +282,10 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpMultiply:
|
||||
case ArithmeticOp::Multiply:
|
||||
{
|
||||
if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
@ -305,8 +305,8 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
b->m_color[3] = CC_ZERO;
|
||||
return TraceResult(b);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVColorArg &&
|
||||
bTrace.type == TraceResult::TraceTEVColorArg)
|
||||
else if (aTrace.type == TraceResult::Type::TEVColorArg &&
|
||||
bTrace.type == TraceResult::Type::TEVColorArg)
|
||||
{
|
||||
TEVStage& stage = addTEVStage(diag, inst.m_loc);
|
||||
stage.m_color[1] = aTrace.tevColorArg;
|
||||
@ -314,8 +314,8 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
stage.m_kColor = newKColor;
|
||||
return TraceResult(&stage);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVColorArg)
|
||||
else if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVColorArg)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
if (a->m_color[1] != CC_ZERO)
|
||||
@ -334,8 +334,8 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
a->m_kColor = newKColor;
|
||||
return TraceResult(a);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVColorArg &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
else if (aTrace.type == TraceResult::Type::TEVColorArg &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
if (b->m_color[1] != CC_ZERO)
|
||||
@ -362,13 +362,13 @@ GX::TraceResult GX::RecursiveTraceColor(const IR& ir, Diagnostics& diag, const I
|
||||
|
||||
diag.reportBackendErr(inst.m_loc, "unable to convert arithmetic to TEV stage");
|
||||
}
|
||||
case IR::OpSwizzle:
|
||||
case IR::OpType::Swizzle:
|
||||
{
|
||||
if (inst.m_swizzle.m_idxs[0] == 3 && inst.m_swizzle.m_idxs[1] == 3 &&
|
||||
inst.m_swizzle.m_idxs[2] == 3 && inst.m_swizzle.m_idxs[3] == -1)
|
||||
{
|
||||
const IR::Instruction& cInst = inst.getChildInst(ir, 0);
|
||||
if (cInst.m_op != IR::OpCall)
|
||||
if (cInst.m_op != IR::OpType::Call)
|
||||
diag.reportBackendErr(inst.m_loc, "only functions accepted for alpha swizzle");
|
||||
return RecursiveTraceColor(ir, diag, cInst, true);
|
||||
}
|
||||
@ -386,7 +386,7 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
{
|
||||
switch (inst.m_op)
|
||||
{
|
||||
case IR::OpCall:
|
||||
case IR::OpType::Call:
|
||||
{
|
||||
const std::string& name = inst.m_call.m_name;
|
||||
if (!name.compare("Texture"))
|
||||
@ -443,7 +443,7 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
diag.reportBackendErr(inst.m_loc, "GX backend unable to interpret '%s'", name.c_str());
|
||||
break;
|
||||
}
|
||||
case IR::OpLoadImm:
|
||||
case IR::OpType::LoadImm:
|
||||
{
|
||||
const atVec4f& vec = inst.m_loadImm.m_immVec;
|
||||
if (vec.vec[0] == 0.f)
|
||||
@ -451,14 +451,14 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
unsigned idx = addKAlpha(diag, inst.m_loc, vec.vec[0]);
|
||||
return TraceResult(TevKAlphaSel(TEV_KASEL_K0_A + idx));
|
||||
}
|
||||
case IR::OpArithmetic:
|
||||
case IR::OpType::Arithmetic:
|
||||
{
|
||||
ArithmeticOp op = inst.m_arithmetic.m_op;
|
||||
const IR::Instruction& aInst = inst.getChildInst(ir, 0);
|
||||
const IR::Instruction& bInst = inst.getChildInst(ir, 1);
|
||||
TraceResult aTrace;
|
||||
TraceResult bTrace;
|
||||
if (aInst.m_op != IR::OpArithmetic && bInst.m_op == IR::OpArithmetic)
|
||||
if (aInst.m_op != IR::OpType::Arithmetic && bInst.m_op == IR::OpType::Arithmetic)
|
||||
{
|
||||
bTrace = RecursiveTraceAlpha(ir, diag, bInst);
|
||||
aTrace = RecursiveTraceAlpha(ir, diag, aInst);
|
||||
@ -470,28 +470,28 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
}
|
||||
|
||||
TevKAlphaSel newKAlpha = TEV_KASEL_1;
|
||||
if (aTrace.type == TraceResult::TraceTEVKAlphaSel &&
|
||||
bTrace.type == TraceResult::TraceTEVKAlphaSel)
|
||||
if (aTrace.type == TraceResult::Type::TEVKAlphaSel &&
|
||||
bTrace.type == TraceResult::Type::TEVKAlphaSel)
|
||||
diag.reportBackendErr(inst.m_loc, "unable to handle 2 KAlphas in one stage");
|
||||
else if (aTrace.type == TraceResult::TraceTEVKAlphaSel)
|
||||
else if (aTrace.type == TraceResult::Type::TEVKAlphaSel)
|
||||
{
|
||||
newKAlpha = aTrace.tevKAlphaSel;
|
||||
aTrace.type = TraceResult::TraceTEVAlphaArg;
|
||||
aTrace.type = TraceResult::Type::TEVAlphaArg;
|
||||
aTrace.tevAlphaArg = CA_KONST;
|
||||
}
|
||||
else if (bTrace.type == TraceResult::TraceTEVKAlphaSel)
|
||||
else if (bTrace.type == TraceResult::Type::TEVKAlphaSel)
|
||||
{
|
||||
newKAlpha = bTrace.tevKAlphaSel;
|
||||
bTrace.type = TraceResult::TraceTEVAlphaArg;
|
||||
bTrace.type = TraceResult::Type::TEVAlphaArg;
|
||||
bTrace.tevAlphaArg = CA_KONST;
|
||||
}
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case ArithmeticOp::ArithmeticOpAdd:
|
||||
case ArithmeticOp::Add:
|
||||
{
|
||||
if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
@ -511,8 +511,8 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
b->m_alpha[3] = CA_APREV;
|
||||
return TraceResult(b);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVAlphaArg)
|
||||
else if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVAlphaArg)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
if (a->m_alpha[3] != CA_ZERO)
|
||||
@ -521,8 +521,8 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
a->m_kAlpha = newKAlpha;
|
||||
return TraceResult(a);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVAlphaArg &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
else if (aTrace.type == TraceResult::Type::TEVAlphaArg &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
if (b->m_alpha[3] != CA_ZERO)
|
||||
@ -533,10 +533,10 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpSubtract:
|
||||
case ArithmeticOp::Subtract:
|
||||
{
|
||||
if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
@ -558,8 +558,8 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
b->m_alpha[3] = CA_APREV;
|
||||
return TraceResult(b);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVAlphaArg)
|
||||
else if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVAlphaArg)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
if (a->m_aop != TEV_SUB)
|
||||
@ -572,10 +572,10 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpMultiply:
|
||||
case ArithmeticOp::Multiply:
|
||||
{
|
||||
if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
@ -595,8 +595,8 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
b->m_alpha[3] = CA_ZERO;
|
||||
return TraceResult(b);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVAlphaArg &&
|
||||
bTrace.type == TraceResult::TraceTEVAlphaArg)
|
||||
else if (aTrace.type == TraceResult::Type::TEVAlphaArg &&
|
||||
bTrace.type == TraceResult::Type::TEVAlphaArg)
|
||||
{
|
||||
TEVStage& stage = addTEVStage(diag, inst.m_loc);
|
||||
stage.m_color[3] = CC_CPREV;
|
||||
@ -605,8 +605,8 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
stage.m_kAlpha = newKAlpha;
|
||||
return TraceResult(&stage);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVStage &&
|
||||
bTrace.type == TraceResult::TraceTEVAlphaArg)
|
||||
else if (aTrace.type == TraceResult::Type::TEVStage &&
|
||||
bTrace.type == TraceResult::Type::TEVAlphaArg)
|
||||
{
|
||||
TEVStage* a = aTrace.tevStage;
|
||||
if (a->m_alpha[1] != CA_ZERO)
|
||||
@ -625,8 +625,8 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
a->m_kAlpha = newKAlpha;
|
||||
return TraceResult(a);
|
||||
}
|
||||
else if (aTrace.type == TraceResult::TraceTEVAlphaArg &&
|
||||
bTrace.type == TraceResult::TraceTEVStage)
|
||||
else if (aTrace.type == TraceResult::Type::TEVAlphaArg &&
|
||||
bTrace.type == TraceResult::Type::TEVStage)
|
||||
{
|
||||
TEVStage* b = bTrace.tevStage;
|
||||
if (b->m_alpha[1] != CA_ZERO)
|
||||
@ -653,13 +653,13 @@ GX::TraceResult GX::RecursiveTraceAlpha(const IR& ir, Diagnostics& diag, const I
|
||||
|
||||
diag.reportBackendErr(inst.m_loc, "unable to convert arithmetic to TEV stage");
|
||||
}
|
||||
case IR::OpSwizzle:
|
||||
case IR::OpType::Swizzle:
|
||||
{
|
||||
if (inst.m_swizzle.m_idxs[0] == 3 && inst.m_swizzle.m_idxs[1] == 3 &&
|
||||
inst.m_swizzle.m_idxs[2] == 3 && inst.m_swizzle.m_idxs[3] == -1)
|
||||
{
|
||||
const IR::Instruction& cInst = inst.getChildInst(ir, 0);
|
||||
if (cInst.m_op != IR::OpCall)
|
||||
if (cInst.m_op != IR::OpType::Call)
|
||||
diag.reportBackendErr(inst.m_loc, "only functions accepted for alpha swizzle");
|
||||
return RecursiveTraceAlpha(ir, diag, cInst);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ unsigned ProgrammableCommon::addTexSampling(unsigned mapIdx, unsigned tcgIdx)
|
||||
unsigned ProgrammableCommon::RecursiveTraceTexGen(const IR& ir, Diagnostics& diag,
|
||||
const IR::Instruction& inst, int mtx)
|
||||
{
|
||||
if (inst.m_op != IR::OpCall)
|
||||
if (inst.m_op != IR::OpType::Call)
|
||||
diag.reportBackendErr(inst.m_loc, "TexCoordGen resolution requires function");
|
||||
|
||||
const std::string& tcgName = inst.m_call.m_name;
|
||||
@ -52,12 +52,12 @@ unsigned ProgrammableCommon::RecursiveTraceTexGen(const IR& ir, Diagnostics& dia
|
||||
diag.reportBackendErr(inst.m_loc, "TexCoordGen UV(layerIdx) requires one argument");
|
||||
const IR::Instruction& idxInst = inst.getChildInst(ir, 0);
|
||||
const atVec4f& idxImm = idxInst.getImmVec();
|
||||
return addTexCoordGen(TG_UV, idxImm.vec[0], mtx);
|
||||
return addTexCoordGen(TexGenSrc::UV, idxImm.vec[0], mtx);
|
||||
}
|
||||
else if (!tcgName.compare("Normal"))
|
||||
return addTexCoordGen(TG_NRM, -1, mtx);
|
||||
return addTexCoordGen(TexGenSrc::Normal, -1, mtx);
|
||||
else if (!tcgName.compare("View"))
|
||||
return addTexCoordGen(TG_POS, -1, mtx);
|
||||
return addTexCoordGen(TexGenSrc::Position, -1, mtx);
|
||||
|
||||
/* Otherwise treat as game-specific function */
|
||||
const IR::Instruction& tcgSrcInst = inst.getChildInst(ir, 0);
|
||||
@ -79,7 +79,7 @@ std::string ProgrammableCommon::RecursiveTraceColor(const IR& ir, Diagnostics& d
|
||||
{
|
||||
switch (inst.m_op)
|
||||
{
|
||||
case IR::OpCall:
|
||||
case IR::OpType::Call:
|
||||
{
|
||||
const std::string& name = inst.m_call.m_name;
|
||||
if (!name.compare("Texture"))
|
||||
@ -111,12 +111,12 @@ std::string ProgrammableCommon::RecursiveTraceColor(const IR& ir, Diagnostics& d
|
||||
diag.reportBackendErr(inst.m_loc, "unable to interpret '%s'", name.c_str());
|
||||
break;
|
||||
}
|
||||
case IR::OpLoadImm:
|
||||
case IR::OpType::LoadImm:
|
||||
{
|
||||
const atVec4f& vec = inst.m_loadImm.m_immVec;
|
||||
return EmitVec3(vec);
|
||||
}
|
||||
case IR::OpArithmetic:
|
||||
case IR::OpType::Arithmetic:
|
||||
{
|
||||
ArithmeticOp op = inst.m_arithmetic.m_op;
|
||||
const IR::Instruction& aInst = inst.getChildInst(ir, 0);
|
||||
@ -126,19 +126,19 @@ std::string ProgrammableCommon::RecursiveTraceColor(const IR& ir, Diagnostics& d
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case ArithmeticOp::ArithmeticOpAdd:
|
||||
case ArithmeticOp::Add:
|
||||
{
|
||||
return EmitAdd(aTrace, bTrace);
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpSubtract:
|
||||
case ArithmeticOp::Subtract:
|
||||
{
|
||||
return EmitSub(aTrace, bTrace);
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpMultiply:
|
||||
case ArithmeticOp::Multiply:
|
||||
{
|
||||
return EmitMult(aTrace, bTrace);
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpDivide:
|
||||
case ArithmeticOp::Divide:
|
||||
{
|
||||
return EmitDiv(aTrace, bTrace);
|
||||
}
|
||||
@ -146,7 +146,7 @@ std::string ProgrammableCommon::RecursiveTraceColor(const IR& ir, Diagnostics& d
|
||||
diag.reportBackendErr(inst.m_loc, "invalid arithmetic op");
|
||||
}
|
||||
}
|
||||
case IR::OpSwizzle:
|
||||
case IR::OpType::Swizzle:
|
||||
{
|
||||
const IR::Instruction& aInst = inst.getChildInst(ir, 0);
|
||||
std::string aTrace = RecursiveTraceColor(ir, diag, aInst);
|
||||
@ -164,7 +164,7 @@ std::string ProgrammableCommon::RecursiveTraceAlpha(const IR& ir, Diagnostics& d
|
||||
{
|
||||
switch (inst.m_op)
|
||||
{
|
||||
case IR::OpCall:
|
||||
case IR::OpType::Call:
|
||||
{
|
||||
const std::string& name = inst.m_call.m_name;
|
||||
if (!name.compare("Texture"))
|
||||
@ -196,12 +196,12 @@ std::string ProgrammableCommon::RecursiveTraceAlpha(const IR& ir, Diagnostics& d
|
||||
diag.reportBackendErr(inst.m_loc, "unable to interpret '%s'", name.c_str());
|
||||
break;
|
||||
}
|
||||
case IR::OpLoadImm:
|
||||
case IR::OpType::LoadImm:
|
||||
{
|
||||
const atVec4f& vec = inst.m_loadImm.m_immVec;
|
||||
return EmitVal(vec.vec[0]);
|
||||
}
|
||||
case IR::OpArithmetic:
|
||||
case IR::OpType::Arithmetic:
|
||||
{
|
||||
ArithmeticOp op = inst.m_arithmetic.m_op;
|
||||
const IR::Instruction& aInst = inst.getChildInst(ir, 0);
|
||||
@ -211,19 +211,19 @@ std::string ProgrammableCommon::RecursiveTraceAlpha(const IR& ir, Diagnostics& d
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case ArithmeticOp::ArithmeticOpAdd:
|
||||
case ArithmeticOp::Add:
|
||||
{
|
||||
return EmitAdd(aTrace, bTrace);
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpSubtract:
|
||||
case ArithmeticOp::Subtract:
|
||||
{
|
||||
return EmitSub(aTrace, bTrace);
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpMultiply:
|
||||
case ArithmeticOp::Multiply:
|
||||
{
|
||||
return EmitMult(aTrace, bTrace);
|
||||
}
|
||||
case ArithmeticOp::ArithmeticOpDivide:
|
||||
case ArithmeticOp::Divide:
|
||||
{
|
||||
return EmitDiv(aTrace, bTrace);
|
||||
}
|
||||
@ -231,7 +231,7 @@ std::string ProgrammableCommon::RecursiveTraceAlpha(const IR& ir, Diagnostics& d
|
||||
diag.reportBackendErr(inst.m_loc, "invalid arithmetic op");
|
||||
}
|
||||
}
|
||||
case IR::OpSwizzle:
|
||||
case IR::OpType::Swizzle:
|
||||
{
|
||||
const IR::Instruction& aInst = inst.getChildInst(ir, 0);
|
||||
std::string aTrace = RecursiveTraceAlpha(ir, diag, aInst);
|
||||
@ -253,19 +253,19 @@ void ProgrammableCommon::reset(const IR& ir, Diagnostics& diag, const char* back
|
||||
bool doAlpha = false;
|
||||
if (!rootCall.m_call.m_name.compare("HECLOpaque"))
|
||||
{
|
||||
m_blendSrc = boo::BlendFactorOne;
|
||||
m_blendDst = boo::BlendFactorZero;
|
||||
m_blendSrc = boo::BlendFactor::One;
|
||||
m_blendDst = boo::BlendFactor::Zero;
|
||||
}
|
||||
else if (!rootCall.m_call.m_name.compare("HECLAlpha"))
|
||||
{
|
||||
m_blendSrc = boo::BlendFactorSrcAlpha;
|
||||
m_blendDst = boo::BlendFactorInvSrcAlpha;
|
||||
m_blendSrc = boo::BlendFactor::SrcAlpha;
|
||||
m_blendDst = boo::BlendFactor::InvSrcAlpha;
|
||||
doAlpha = true;
|
||||
}
|
||||
else if (!rootCall.m_call.m_name.compare("HECLAdditive"))
|
||||
{
|
||||
m_blendSrc = boo::BlendFactorSrcAlpha;
|
||||
m_blendDst = boo::BlendFactorOne;
|
||||
m_blendSrc = boo::BlendFactor::SrcAlpha;
|
||||
m_blendDst = boo::BlendFactor::One;
|
||||
doAlpha = true;
|
||||
}
|
||||
else
|
||||
|
@ -53,7 +53,7 @@ std::vector<std::string>& Project::ConfigFile::lockAndRead()
|
||||
if (m_lockedFile)
|
||||
return m_lines;
|
||||
|
||||
m_lockedFile = HECL::Fopen(m_filepath.c_str(), _S("a+"), LWRITE);
|
||||
m_lockedFile = HECL::Fopen(m_filepath.c_str(), _S("a+"), FileLockType::Write);
|
||||
|
||||
std::string mainString;
|
||||
char readBuf[1024];
|
||||
@ -151,7 +151,7 @@ bool Project::ConfigFile::unlockAndCommit()
|
||||
}
|
||||
|
||||
SystemString newPath = m_filepath + _S(".part");
|
||||
FILE* newFile = HECL::Fopen(newPath.c_str(), _S("w"), LWRITE);
|
||||
FILE* newFile = HECL::Fopen(newPath.c_str(), _S("w"), FileLockType::Write);
|
||||
bool fail = false;
|
||||
for (const std::string& line : m_lines)
|
||||
{
|
||||
@ -383,7 +383,7 @@ static void VisitFile(const ProjectPath& path, bool force, bool fast,
|
||||
ProjectPath cooked = path.getCookedPath(*spec.first);
|
||||
if (fast)
|
||||
cooked = cooked.getWithExtension(_S(".fast"));
|
||||
if (force || cooked.getPathType() == ProjectPath::PT_NONE ||
|
||||
if (force || cooked.getPathType() == ProjectPath::Type::None ||
|
||||
path.getModtime() > cooked.getModtime())
|
||||
{
|
||||
progress.reportFile(spec.first);
|
||||
@ -411,15 +411,15 @@ static void VisitDirectory(const ProjectPath& dir,
|
||||
{
|
||||
switch (child.second.getPathType())
|
||||
{
|
||||
case ProjectPath::PT_FILE:
|
||||
case ProjectPath::Type::File:
|
||||
{
|
||||
++childFileCount;
|
||||
break;
|
||||
}
|
||||
case ProjectPath::PT_LINK:
|
||||
case ProjectPath::Type::Link:
|
||||
{
|
||||
ProjectPath target = child.second.resolveLink();
|
||||
if (target.getPathType() == ProjectPath::PT_FILE)
|
||||
if (target.getPathType() == ProjectPath::Type::File)
|
||||
++childFileCount;
|
||||
break;
|
||||
}
|
||||
@ -435,16 +435,16 @@ static void VisitDirectory(const ProjectPath& dir,
|
||||
{
|
||||
switch (child.second.getPathType())
|
||||
{
|
||||
case ProjectPath::PT_FILE:
|
||||
case ProjectPath::Type::File:
|
||||
{
|
||||
progress.changeFile(child.first.c_str(), progNum++/progDenom);
|
||||
VisitFile(child.second, force, fast, specInsts, progress);
|
||||
break;
|
||||
}
|
||||
case ProjectPath::PT_LINK:
|
||||
case ProjectPath::Type::Link:
|
||||
{
|
||||
ProjectPath target = child.second.resolveLink();
|
||||
if (target.getPathType() == ProjectPath::PT_FILE)
|
||||
if (target.getPathType() == ProjectPath::Type::File)
|
||||
{
|
||||
progress.changeFile(target.getLastComponent(), progNum++/progDenom);
|
||||
VisitFile(target, force, fast, specInsts, progress);
|
||||
@ -463,7 +463,7 @@ static void VisitDirectory(const ProjectPath& dir,
|
||||
{
|
||||
switch (child.second.getPathType())
|
||||
{
|
||||
case ProjectPath::PT_DIRECTORY:
|
||||
case ProjectPath::Type::Directory:
|
||||
{
|
||||
VisitDirectory(child.second, recursive, force, fast, specInsts, progress);
|
||||
break;
|
||||
@ -488,15 +488,15 @@ static void VisitGlob(const ProjectPath& path,
|
||||
{
|
||||
switch (child.getPathType())
|
||||
{
|
||||
case ProjectPath::PT_FILE:
|
||||
case ProjectPath::Type::File:
|
||||
{
|
||||
++childFileCount;
|
||||
break;
|
||||
}
|
||||
case ProjectPath::PT_LINK:
|
||||
case ProjectPath::Type::Link:
|
||||
{
|
||||
ProjectPath target = path.resolveLink();
|
||||
if (target.getPathType() == ProjectPath::PT_FILE)
|
||||
if (target.getPathType() == ProjectPath::Type::File)
|
||||
++childFileCount;
|
||||
break;
|
||||
}
|
||||
@ -512,16 +512,16 @@ static void VisitGlob(const ProjectPath& path,
|
||||
{
|
||||
switch (child.getPathType())
|
||||
{
|
||||
case ProjectPath::PT_FILE:
|
||||
case ProjectPath::Type::File:
|
||||
{
|
||||
progress.changeFile(child.getLastComponent(), progNum++/progDenom);
|
||||
VisitFile(child, force, fast, specInsts, progress);
|
||||
break;
|
||||
}
|
||||
case ProjectPath::PT_LINK:
|
||||
case ProjectPath::Type::Link:
|
||||
{
|
||||
ProjectPath target = path.resolveLink();
|
||||
if (target.getPathType() == ProjectPath::PT_FILE)
|
||||
if (target.getPathType() == ProjectPath::Type::File)
|
||||
{
|
||||
progress.changeFile(target.getLastComponent(), progNum++/progDenom);
|
||||
VisitFile(target, force, fast, specInsts, progress);
|
||||
@ -540,7 +540,7 @@ static void VisitGlob(const ProjectPath& path,
|
||||
{
|
||||
switch (child.getPathType())
|
||||
{
|
||||
case ProjectPath::PT_DIRECTORY:
|
||||
case ProjectPath::Type::Directory:
|
||||
{
|
||||
VisitDirectory(child, recursive, force, fast, specInsts, progress);
|
||||
break;
|
||||
@ -560,34 +560,34 @@ bool Project::cookPath(const ProjectPath& path, FProgress progress,
|
||||
for (const ProjectDataSpec& spec : m_compiledSpecs)
|
||||
if (spec.active)
|
||||
specInsts.emplace_back(&spec.spec,
|
||||
std::unique_ptr<IDataSpec>(spec.spec.m_factory(*this, TOOL_COOK)));
|
||||
std::unique_ptr<IDataSpec>(spec.spec.m_factory(*this, DataSpecTool::Cook)));
|
||||
|
||||
/* Iterate complete directory/file/glob list */
|
||||
CookProgress cookProg(progress);
|
||||
switch (path.getPathType())
|
||||
{
|
||||
case ProjectPath::PT_FILE:
|
||||
case ProjectPath::Type::File:
|
||||
{
|
||||
cookProg.changeFile(path.getLastComponent(), 0.0);
|
||||
VisitFile(path, force, fast, specInsts, cookProg);
|
||||
break;
|
||||
}
|
||||
case ProjectPath::PT_LINK:
|
||||
case ProjectPath::Type::Link:
|
||||
{
|
||||
ProjectPath target = path.resolveLink();
|
||||
if (target.getPathType() == ProjectPath::PT_FILE)
|
||||
if (target.getPathType() == ProjectPath::Type::File)
|
||||
{
|
||||
cookProg.changeFile(target.getLastComponent(), 0.0);
|
||||
VisitFile(target, force, fast, specInsts, cookProg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProjectPath::PT_DIRECTORY:
|
||||
case ProjectPath::Type::Directory:
|
||||
{
|
||||
VisitDirectory(path, recursive, force, fast, specInsts, cookProg);
|
||||
break;
|
||||
}
|
||||
case ProjectPath::PT_GLOB:
|
||||
case ProjectPath::Type::Glob:
|
||||
{
|
||||
VisitGlob(path, recursive, force, fast, specInsts, cookProg);
|
||||
break;
|
||||
|
@ -13,15 +13,15 @@ static IR::Instruction::ArithmeticOpType ArithType(int aChar)
|
||||
switch (aChar)
|
||||
{
|
||||
case '+':
|
||||
return IR::Instruction::ArithmeticOpAdd;
|
||||
return IR::Instruction::ArithmeticOpType::Add;
|
||||
case '-':
|
||||
return IR::Instruction::ArithmeticOpSubtract;
|
||||
return IR::Instruction::ArithmeticOpType::Subtract;
|
||||
case '*':
|
||||
return IR::Instruction::ArithmeticOpMultiply;
|
||||
return IR::Instruction::ArithmeticOpType::Multiply;
|
||||
case '/':
|
||||
return IR::Instruction::ArithmeticOpDivide;
|
||||
return IR::Instruction::ArithmeticOpType::Divide;
|
||||
default:
|
||||
return IR::Instruction::ArithmeticOpNone;
|
||||
return IR::Instruction::ArithmeticOpType::None;
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
{
|
||||
reset();
|
||||
Parser::Token firstTok = parser.consumeToken();
|
||||
if (firstTok.m_type != Parser::TokenSourceBegin)
|
||||
if (firstTok.m_type != Parser::TokenType::SourceBegin)
|
||||
{
|
||||
m_diag.reportLexerErr(firstTok.m_location, "expected start token");
|
||||
return;
|
||||
@ -93,15 +93,15 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
{
|
||||
std::vector<SourceLocation> funcStack;
|
||||
std::vector<SourceLocation> groupStack;
|
||||
while (lastNode->m_tok.m_type != Parser::TokenSourceEnd)
|
||||
while (lastNode->m_tok.m_type != Parser::TokenType::SourceEnd)
|
||||
{
|
||||
Parser::Token tok = parser.consumeToken();
|
||||
switch (tok.m_type)
|
||||
{
|
||||
case Parser::TokenEvalGroupStart:
|
||||
case Parser::TokenType::EvalGroupStart:
|
||||
groupStack.push_back(tok.m_location);
|
||||
break;
|
||||
case Parser::TokenEvalGroupEnd:
|
||||
case Parser::TokenType::EvalGroupEnd:
|
||||
if (groupStack.empty())
|
||||
{
|
||||
m_diag.reportLexerErr(tok.m_location, "unbalanced group detected");
|
||||
@ -109,10 +109,10 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
}
|
||||
groupStack.pop_back();
|
||||
break;
|
||||
case Parser::TokenFunctionStart:
|
||||
case Parser::TokenType::FunctionStart:
|
||||
funcStack.push_back(tok.m_location);
|
||||
break;
|
||||
case Parser::TokenFunctionEnd:
|
||||
case Parser::TokenType::FunctionEnd:
|
||||
if (funcStack.empty())
|
||||
{
|
||||
m_diag.reportLexerErr(tok.m_location, "unbalanced function detected");
|
||||
@ -120,11 +120,11 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
}
|
||||
funcStack.pop_back();
|
||||
break;
|
||||
case Parser::TokenSourceEnd:
|
||||
case Parser::TokenNumLiteral:
|
||||
case Parser::TokenVectorSwizzle:
|
||||
case Parser::TokenFunctionArgDelim:
|
||||
case Parser::TokenArithmeticOp:
|
||||
case Parser::TokenType::SourceEnd:
|
||||
case Parser::TokenType::NumLiteral:
|
||||
case Parser::TokenType::VectorSwizzle:
|
||||
case Parser::TokenType::FunctionArgDelim:
|
||||
case Parser::TokenType::ArithmeticOp:
|
||||
break;
|
||||
default:
|
||||
m_diag.reportLexerErr(tok.m_location, "invalid token");
|
||||
@ -150,7 +150,7 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
}
|
||||
|
||||
/* Ensure first non-start node is a function */
|
||||
if (firstNode->m_next->m_tok.m_type != Parser::TokenFunctionStart)
|
||||
if (firstNode->m_next->m_tok.m_type != Parser::TokenType::FunctionStart)
|
||||
{
|
||||
m_diag.reportLexerErr(firstNode->m_tok.m_location, "expected root function");
|
||||
return;
|
||||
@ -159,17 +159,17 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
/* Organize marked function args into implicit groups */
|
||||
for (Lexer::OperationNode* n = firstNode ; n != lastNode ; n = n->m_next)
|
||||
{
|
||||
if (n->m_tok.m_type == Parser::TokenFunctionStart)
|
||||
if (n->m_tok.m_type == Parser::TokenType::FunctionStart)
|
||||
{
|
||||
if (n->m_next->m_tok.m_type != Parser::TokenFunctionEnd)
|
||||
if (n->m_next->m_tok.m_type != Parser::TokenType::FunctionEnd)
|
||||
{
|
||||
if (n->m_next->m_tok.m_type == Parser::TokenFunctionArgDelim)
|
||||
if (n->m_next->m_tok.m_type == Parser::TokenType::FunctionArgDelim)
|
||||
{
|
||||
m_diag.reportLexerErr(n->m_next->m_tok.m_location, "empty function arg");
|
||||
return;
|
||||
}
|
||||
m_pool.emplace_front(std::move(
|
||||
Parser::Token(Parser::TokenEvalGroupStart, n->m_next->m_tok.m_location)));
|
||||
Parser::Token(Parser::TokenType::EvalGroupStart, n->m_next->m_tok.m_location)));
|
||||
Lexer::OperationNode* grp = &m_pool.front();
|
||||
grp->m_next = n->m_next;
|
||||
grp->m_prev = n;
|
||||
@ -177,12 +177,12 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
n->m_next = grp;
|
||||
}
|
||||
}
|
||||
else if (n->m_tok.m_type == Parser::TokenFunctionEnd)
|
||||
else if (n->m_tok.m_type == Parser::TokenType::FunctionEnd)
|
||||
{
|
||||
if (n->m_prev->m_tok.m_type != Parser::TokenFunctionStart)
|
||||
if (n->m_prev->m_tok.m_type != Parser::TokenType::FunctionStart)
|
||||
{
|
||||
m_pool.emplace_front(std::move(
|
||||
Parser::Token(Parser::TokenEvalGroupEnd, n->m_tok.m_location)));
|
||||
Parser::Token(Parser::TokenType::EvalGroupEnd, n->m_tok.m_location)));
|
||||
Lexer::OperationNode* grp = &m_pool.front();
|
||||
grp->m_next = n;
|
||||
grp->m_prev = n->m_prev;
|
||||
@ -190,21 +190,21 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
n->m_prev = grp;
|
||||
}
|
||||
}
|
||||
else if (n->m_tok.m_type == Parser::TokenFunctionArgDelim)
|
||||
else if (n->m_tok.m_type == Parser::TokenType::FunctionArgDelim)
|
||||
{
|
||||
if (n->m_next->m_tok.m_type == Parser::TokenFunctionArgDelim ||
|
||||
n->m_next->m_tok.m_type == Parser::TokenFunctionEnd)
|
||||
if (n->m_next->m_tok.m_type == Parser::TokenType::FunctionArgDelim ||
|
||||
n->m_next->m_tok.m_type == Parser::TokenType::FunctionEnd)
|
||||
{
|
||||
m_diag.reportLexerErr(n->m_next->m_tok.m_location, "empty function arg");
|
||||
return;
|
||||
}
|
||||
|
||||
m_pool.emplace_front(std::move(
|
||||
Parser::Token(Parser::TokenEvalGroupEnd, n->m_tok.m_location)));
|
||||
Parser::Token(Parser::TokenType::EvalGroupEnd, n->m_tok.m_location)));
|
||||
Lexer::OperationNode* egrp = &m_pool.front();
|
||||
|
||||
m_pool.emplace_front(std::move(
|
||||
Parser::Token(Parser::TokenEvalGroupStart, n->m_next->m_tok.m_location)));
|
||||
Parser::Token(Parser::TokenType::EvalGroupStart, n->m_next->m_tok.m_location)));
|
||||
Lexer::OperationNode* sgrp = &m_pool.front();
|
||||
|
||||
egrp->m_next = sgrp;
|
||||
@ -222,9 +222,9 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
std::vector<Lexer::OperationNode*> groupStack;
|
||||
for (Lexer::OperationNode* n = firstNode ; n != lastNode ; n = n->m_next)
|
||||
{
|
||||
if (n->m_tok.m_type == Parser::TokenEvalGroupStart)
|
||||
if (n->m_tok.m_type == Parser::TokenType::EvalGroupStart)
|
||||
groupStack.push_back(n);
|
||||
else if (n->m_tok.m_type == Parser::TokenEvalGroupEnd)
|
||||
else if (n->m_tok.m_type == Parser::TokenType::EvalGroupEnd)
|
||||
{
|
||||
Lexer::OperationNode* start = groupStack.back();
|
||||
groupStack.pop_back();
|
||||
@ -245,11 +245,11 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
/* Organize functions into tree-hierarchy */
|
||||
for (Lexer::OperationNode& n : m_pool)
|
||||
{
|
||||
if (n.m_tok.m_type == Parser::TokenFunctionStart)
|
||||
if (n.m_tok.m_type == Parser::TokenType::FunctionStart)
|
||||
{
|
||||
for (Lexer::OperationNode* sn = n.m_next ; sn ; sn = sn->m_next)
|
||||
{
|
||||
if (sn->m_tok.m_type == Parser::TokenFunctionEnd)
|
||||
if (sn->m_tok.m_type == Parser::TokenType::FunctionEnd)
|
||||
{
|
||||
n.m_sub = n.m_next;
|
||||
if (n.m_next == sn)
|
||||
@ -270,9 +270,9 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
/* Organize vector swizzles into tree-hierarchy */
|
||||
for (Lexer::OperationNode& n : m_pool)
|
||||
{
|
||||
if (n.m_tok.m_type == Parser::TokenVectorSwizzle)
|
||||
if (n.m_tok.m_type == Parser::TokenType::VectorSwizzle)
|
||||
{
|
||||
if (n.m_prev->m_tok.m_type != Parser::TokenFunctionStart)
|
||||
if (n.m_prev->m_tok.m_type != Parser::TokenType::FunctionStart)
|
||||
{
|
||||
m_diag.reportLexerErr(n.m_tok.m_location,
|
||||
"vector swizzles may only follow functions");
|
||||
@ -296,13 +296,13 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
/* Ensure evaluation groups have proper arithmetic usage */
|
||||
for (Lexer::OperationNode& n : m_pool)
|
||||
{
|
||||
if (n.m_tok.m_type == Parser::TokenEvalGroupStart)
|
||||
if (n.m_tok.m_type == Parser::TokenType::EvalGroupStart)
|
||||
{
|
||||
int idx = 0;
|
||||
for (Lexer::OperationNode* sn = n.m_sub ; sn ; sn = sn->m_next, ++idx)
|
||||
{
|
||||
if ((sn->m_tok.m_type == Parser::TokenArithmeticOp && !(idx & 1)) ||
|
||||
(sn->m_tok.m_type != Parser::TokenArithmeticOp && (idx & 1)))
|
||||
if ((sn->m_tok.m_type == Parser::TokenType::ArithmeticOp && !(idx & 1)) ||
|
||||
(sn->m_tok.m_type != Parser::TokenType::ArithmeticOp && (idx & 1)))
|
||||
{
|
||||
m_diag.reportLexerErr(sn->m_tok.m_location, "improper arithmetic expression");
|
||||
return;
|
||||
@ -314,27 +314,27 @@ void Lexer::consumeAllTokens(Parser& parser)
|
||||
/* Organize arithmetic usage into tree-hierarchy */
|
||||
for (Lexer::OperationNode& n : m_pool)
|
||||
{
|
||||
if (n.m_tok.m_type == Parser::TokenEvalGroupStart)
|
||||
if (n.m_tok.m_type == Parser::TokenType::EvalGroupStart)
|
||||
{
|
||||
Lexer::OperationNode* newSub = nullptr;
|
||||
Lexer::OperationNode* lastSub = nullptr;
|
||||
for (Lexer::OperationNode* sn = n.m_sub ; sn ; sn = sn->m_next)
|
||||
{
|
||||
if (sn->m_tok.m_type == Parser::TokenArithmeticOp)
|
||||
if (sn->m_tok.m_type == Parser::TokenType::ArithmeticOp)
|
||||
{
|
||||
IR::Instruction::ArithmeticOpType op = ArithType(sn->m_tok.m_tokenInt);
|
||||
if (op == IR::Instruction::ArithmeticOpMultiply ||
|
||||
op == IR::Instruction::ArithmeticOpDivide)
|
||||
if (op == IR::Instruction::ArithmeticOpType::Multiply ||
|
||||
op == IR::Instruction::ArithmeticOpType::Divide)
|
||||
ReconnectArithmetic(sn, &lastSub, &newSub);
|
||||
}
|
||||
}
|
||||
for (Lexer::OperationNode* sn = n.m_sub ; sn ; sn = sn->m_next)
|
||||
{
|
||||
if (sn->m_tok.m_type == Parser::TokenArithmeticOp)
|
||||
if (sn->m_tok.m_type == Parser::TokenType::ArithmeticOp)
|
||||
{
|
||||
IR::Instruction::ArithmeticOpType op = ArithType(sn->m_tok.m_tokenInt);
|
||||
if (op == IR::Instruction::ArithmeticOpAdd ||
|
||||
op == IR::Instruction::ArithmeticOpSubtract)
|
||||
if (op == IR::Instruction::ArithmeticOpType::Add ||
|
||||
op == IR::Instruction::ArithmeticOpType::Subtract)
|
||||
ReconnectArithmetic(sn, &lastSub, &newSub);
|
||||
}
|
||||
}
|
||||
@ -360,7 +360,7 @@ void Lexer::EmitVec3(IR& ir, const Lexer::OperationNode* funcNode, IR::RegID tar
|
||||
const Lexer::OperationNode* gn = funcNode->m_sub;
|
||||
if (!gn)
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, funcNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, funcNode->m_tok.m_location);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ void Lexer::EmitVec3(IR& ir, const Lexer::OperationNode* funcNode, IR::RegID tar
|
||||
const Parser::Token* imms[3];
|
||||
for (int i=0 ; i<3 ; ++i)
|
||||
{
|
||||
if (!gn->m_sub || gn->m_sub->m_tok.m_type != Parser::TokenNumLiteral)
|
||||
if (!gn->m_sub || gn->m_sub->m_tok.m_type != Parser::TokenType::NumLiteral)
|
||||
{
|
||||
opt = false;
|
||||
break;
|
||||
@ -379,7 +379,7 @@ void Lexer::EmitVec3(IR& ir, const Lexer::OperationNode* funcNode, IR::RegID tar
|
||||
}
|
||||
if (opt)
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, funcNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, funcNode->m_tok.m_location);
|
||||
atVec4f& vec = ir.m_instructions.back().m_loadImm.m_immVec;
|
||||
vec.vec[0] = imms[0]->m_tokenFloat;
|
||||
vec.vec[1] = imms[1]->m_tokenFloat;
|
||||
@ -398,7 +398,7 @@ void Lexer::EmitVec4(IR& ir, const Lexer::OperationNode* funcNode, IR::RegID tar
|
||||
const Lexer::OperationNode* gn = funcNode->m_sub;
|
||||
if (!gn)
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, funcNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, funcNode->m_tok.m_location);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ void Lexer::EmitVec4(IR& ir, const Lexer::OperationNode* funcNode, IR::RegID tar
|
||||
const Parser::Token* imms[4];
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
if (!gn->m_sub || gn->m_sub->m_tok.m_type != Parser::TokenNumLiteral)
|
||||
if (!gn->m_sub || gn->m_sub->m_tok.m_type != Parser::TokenType::NumLiteral)
|
||||
{
|
||||
opt = false;
|
||||
break;
|
||||
@ -417,7 +417,7 @@ void Lexer::EmitVec4(IR& ir, const Lexer::OperationNode* funcNode, IR::RegID tar
|
||||
}
|
||||
if (opt)
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, funcNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, funcNode->m_tok.m_location);
|
||||
atVec4f& vec = ir.m_instructions.back().m_loadImm.m_immVec;
|
||||
vec.vec[0] = imms[0]->m_tokenFloat;
|
||||
vec.vec[1] = imms[1]->m_tokenFloat;
|
||||
@ -443,7 +443,7 @@ void Lexer::EmitArithmetic(IR& ir, const Lexer::OperationNode* arithNode, IR::Re
|
||||
const Parser::Token& tok = on->m_tok;
|
||||
switch (tok.m_type)
|
||||
{
|
||||
case Parser::TokenFunctionStart:
|
||||
case Parser::TokenType::FunctionStart:
|
||||
if (!tok.m_tokenString.compare("vec3"))
|
||||
EmitVec3(ir, on, tgt);
|
||||
else if (!tok.m_tokenString.compare("vec4"))
|
||||
@ -451,12 +451,12 @@ void Lexer::EmitArithmetic(IR& ir, const Lexer::OperationNode* arithNode, IR::Re
|
||||
else
|
||||
RecursiveFuncCompile(ir, on, tgt);
|
||||
break;
|
||||
case Parser::TokenEvalGroupStart:
|
||||
case Parser::TokenType::EvalGroupStart:
|
||||
RecursiveGroupCompile(ir, on, tgt);
|
||||
break;
|
||||
case Parser::TokenNumLiteral:
|
||||
case Parser::TokenType::NumLiteral:
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, arithNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, arithNode->m_tok.m_location);
|
||||
IR::Instruction& inst = ir.m_instructions.back();
|
||||
inst.m_target = tgt;
|
||||
inst.m_loadImm.m_immVec.vec[0] = tok.m_tokenFloat;
|
||||
@ -465,7 +465,7 @@ void Lexer::EmitArithmetic(IR& ir, const Lexer::OperationNode* arithNode, IR::Re
|
||||
inst.m_loadImm.m_immVec.vec[3] = tok.m_tokenFloat;
|
||||
break;
|
||||
}
|
||||
case Parser::TokenVectorSwizzle:
|
||||
case Parser::TokenType::VectorSwizzle:
|
||||
EmitVectorSwizzle(ir, on, tgt);
|
||||
break;
|
||||
default:
|
||||
@ -473,7 +473,7 @@ void Lexer::EmitArithmetic(IR& ir, const Lexer::OperationNode* arithNode, IR::Re
|
||||
break;
|
||||
};
|
||||
argInsts[i] = ir.m_instructions.size() - 1;
|
||||
if (ir.m_instructions.back().m_op == IR::OpLoadImm)
|
||||
if (ir.m_instructions.back().m_op == IR::OpType::LoadImm)
|
||||
opt[i] = &ir.m_instructions.back().m_loadImm.m_immVec;
|
||||
on = on->m_next;
|
||||
}
|
||||
@ -484,25 +484,25 @@ void Lexer::EmitArithmetic(IR& ir, const Lexer::OperationNode* arithNode, IR::Re
|
||||
atVec4f eval;
|
||||
switch (ArithType(arithNode->m_tok.m_tokenInt))
|
||||
{
|
||||
case IR::Instruction::ArithmeticOpAdd:
|
||||
case IR::Instruction::ArithmeticOpType::Add:
|
||||
eval.vec[0] = opt[0]->vec[0] + opt[1]->vec[0];
|
||||
eval.vec[1] = opt[0]->vec[1] + opt[1]->vec[1];
|
||||
eval.vec[2] = opt[0]->vec[2] + opt[1]->vec[2];
|
||||
eval.vec[3] = opt[0]->vec[3] + opt[1]->vec[3];
|
||||
break;
|
||||
case IR::Instruction::ArithmeticOpSubtract:
|
||||
case IR::Instruction::ArithmeticOpType::Subtract:
|
||||
eval.vec[0] = opt[0]->vec[0] - opt[1]->vec[0];
|
||||
eval.vec[1] = opt[0]->vec[1] - opt[1]->vec[1];
|
||||
eval.vec[2] = opt[0]->vec[2] - opt[1]->vec[2];
|
||||
eval.vec[3] = opt[0]->vec[3] - opt[1]->vec[3];
|
||||
break;
|
||||
case IR::Instruction::ArithmeticOpMultiply:
|
||||
case IR::Instruction::ArithmeticOpType::Multiply:
|
||||
eval.vec[0] = opt[0]->vec[0] * opt[1]->vec[0];
|
||||
eval.vec[1] = opt[0]->vec[1] * opt[1]->vec[1];
|
||||
eval.vec[2] = opt[0]->vec[2] * opt[1]->vec[2];
|
||||
eval.vec[3] = opt[0]->vec[3] * opt[1]->vec[3];
|
||||
break;
|
||||
case IR::Instruction::ArithmeticOpDivide:
|
||||
case IR::Instruction::ArithmeticOpType::Divide:
|
||||
eval.vec[0] = opt[0]->vec[0] / opt[1]->vec[0];
|
||||
eval.vec[1] = opt[0]->vec[1] / opt[1]->vec[1];
|
||||
eval.vec[2] = opt[0]->vec[2] / opt[1]->vec[2];
|
||||
@ -514,14 +514,14 @@ void Lexer::EmitArithmetic(IR& ir, const Lexer::OperationNode* arithNode, IR::Re
|
||||
}
|
||||
ir.m_instructions.pop_back();
|
||||
ir.m_instructions.pop_back();
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, arithNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, arithNode->m_tok.m_location);
|
||||
IR::Instruction& inst = ir.m_instructions.back();
|
||||
inst.m_target = target;
|
||||
inst.m_loadImm.m_immVec = eval;
|
||||
}
|
||||
else
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpArithmetic, arithNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::Arithmetic, arithNode->m_tok.m_location);
|
||||
IR::Instruction& inst = ir.m_instructions.back();
|
||||
inst.m_target = target;
|
||||
inst.m_arithmetic.m_instIdxs[0] = argInsts[0];
|
||||
@ -565,7 +565,7 @@ void Lexer::EmitVectorSwizzle(IR& ir, const Lexer::OperationNode* swizNode, IR::
|
||||
const Parser::Token& tok = on->m_tok;
|
||||
switch (tok.m_type)
|
||||
{
|
||||
case Parser::TokenFunctionStart:
|
||||
case Parser::TokenType::FunctionStart:
|
||||
if (!tok.m_tokenString.compare("vec3"))
|
||||
EmitVec3(ir, on, target);
|
||||
else if (!tok.m_tokenString.compare("vec4"))
|
||||
@ -573,12 +573,12 @@ void Lexer::EmitVectorSwizzle(IR& ir, const Lexer::OperationNode* swizNode, IR::
|
||||
else
|
||||
RecursiveFuncCompile(ir, on, target);
|
||||
break;
|
||||
case Parser::TokenEvalGroupStart:
|
||||
case Parser::TokenType::EvalGroupStart:
|
||||
RecursiveGroupCompile(ir, on, target);
|
||||
break;
|
||||
case Parser::TokenNumLiteral:
|
||||
case Parser::TokenType::NumLiteral:
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, swizNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, swizNode->m_tok.m_location);
|
||||
IR::Instruction& inst = ir.m_instructions.back();
|
||||
inst.m_target = target;
|
||||
inst.m_loadImm.m_immVec.vec[0] = tok.m_tokenFloat;
|
||||
@ -587,7 +587,7 @@ void Lexer::EmitVectorSwizzle(IR& ir, const Lexer::OperationNode* swizNode, IR::
|
||||
inst.m_loadImm.m_immVec.vec[3] = tok.m_tokenFloat;
|
||||
break;
|
||||
}
|
||||
case Parser::TokenVectorSwizzle:
|
||||
case Parser::TokenType::VectorSwizzle:
|
||||
EmitVectorSwizzle(ir, on, target);
|
||||
break;
|
||||
default:
|
||||
@ -596,7 +596,7 @@ void Lexer::EmitVectorSwizzle(IR& ir, const Lexer::OperationNode* swizNode, IR::
|
||||
};
|
||||
|
||||
/* Optimization case: if operand imm load, pre-evalulate */
|
||||
if (ir.m_instructions.back().m_op == IR::OpLoadImm && (ir.m_instructions.size() - instCount == 1))
|
||||
if (ir.m_instructions.back().m_op == IR::OpType::LoadImm && (ir.m_instructions.size() - instCount == 1))
|
||||
{
|
||||
atVec4f* opt = &ir.m_instructions.back().m_loadImm.m_immVec;
|
||||
const SourceLocation& loc = ir.m_instructions.back().m_loc;
|
||||
@ -626,14 +626,14 @@ void Lexer::EmitVectorSwizzle(IR& ir, const Lexer::OperationNode* swizNode, IR::
|
||||
}
|
||||
|
||||
ir.m_instructions.pop_back();
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, swizNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, swizNode->m_tok.m_location);
|
||||
IR::Instruction& inst = ir.m_instructions.back();
|
||||
inst.m_target = target;
|
||||
inst.m_loadImm.m_immVec = eval;
|
||||
}
|
||||
else
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpSwizzle, swizNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::Swizzle, swizNode->m_tok.m_location);
|
||||
IR::Instruction& inst = ir.m_instructions.back();
|
||||
inst.m_swizzle.m_instIdx = ir.m_instructions.size() - 2;
|
||||
inst.m_target = target;
|
||||
@ -650,7 +650,7 @@ void Lexer::RecursiveGroupCompile(IR& ir, const Lexer::OperationNode* groupNode,
|
||||
const Parser::Token& tok = sn->m_tok;
|
||||
switch (tok.m_type)
|
||||
{
|
||||
case Parser::TokenFunctionStart:
|
||||
case Parser::TokenType::FunctionStart:
|
||||
if (!tok.m_tokenString.compare("vec3"))
|
||||
EmitVec3(ir, sn, tgt);
|
||||
else if (!tok.m_tokenString.compare("vec4"))
|
||||
@ -658,12 +658,12 @@ void Lexer::RecursiveGroupCompile(IR& ir, const Lexer::OperationNode* groupNode,
|
||||
else
|
||||
RecursiveFuncCompile(ir, sn, tgt);
|
||||
break;
|
||||
case Parser::TokenEvalGroupStart:
|
||||
case Parser::TokenType::EvalGroupStart:
|
||||
RecursiveGroupCompile(ir, sn, tgt);
|
||||
break;
|
||||
case Parser::TokenNumLiteral:
|
||||
case Parser::TokenType::NumLiteral:
|
||||
{
|
||||
ir.m_instructions.emplace_back(IR::OpLoadImm, tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::LoadImm, tok.m_location);
|
||||
IR::Instruction& inst = ir.m_instructions.back();
|
||||
inst.m_target = tgt;
|
||||
inst.m_loadImm.m_immVec.vec[0] = tok.m_tokenFloat;
|
||||
@ -672,10 +672,10 @@ void Lexer::RecursiveGroupCompile(IR& ir, const Lexer::OperationNode* groupNode,
|
||||
inst.m_loadImm.m_immVec.vec[3] = tok.m_tokenFloat;
|
||||
break;
|
||||
}
|
||||
case Parser::TokenArithmeticOp:
|
||||
case Parser::TokenType::ArithmeticOp:
|
||||
EmitArithmetic(ir, sn, tgt);
|
||||
break;
|
||||
case Parser::TokenVectorSwizzle:
|
||||
case Parser::TokenType::VectorSwizzle:
|
||||
EmitVectorSwizzle(ir, sn, tgt);
|
||||
break;
|
||||
default:
|
||||
@ -696,7 +696,7 @@ void Lexer::RecursiveFuncCompile(IR& ir, const Lexer::OperationNode* funcNode, I
|
||||
RecursiveGroupCompile(ir, gn, tgt);
|
||||
instIdxs.push_back(ir.m_instructions.size() - 1);
|
||||
}
|
||||
ir.m_instructions.emplace_back(IR::OpCall, funcNode->m_tok.m_location);
|
||||
ir.m_instructions.emplace_back(IR::OpType::Call, funcNode->m_tok.m_location);
|
||||
IR::Instruction& inst = ir.m_instructions.back();
|
||||
inst.m_call.m_name = funcNode->m_tok.m_tokenString;
|
||||
inst.m_call.m_argInstCount = instIdxs.size();
|
||||
|
@ -39,13 +39,13 @@ void Parser::reset(const std::string& source)
|
||||
Parser::Token Parser::consumeToken()
|
||||
{
|
||||
if (!m_source)
|
||||
return Parser::Token(TokenNone, SourceLocation());
|
||||
return Parser::Token(TokenType::None, SourceLocation());
|
||||
|
||||
/* If parser has just been reset, emit begin token */
|
||||
if (m_reset)
|
||||
{
|
||||
m_reset = false;
|
||||
return Parser::Token(TokenSourceBegin, getLocation());
|
||||
return Parser::Token(TokenType::SourceBegin, getLocation());
|
||||
}
|
||||
|
||||
/* Skip whitespace */
|
||||
@ -53,7 +53,7 @@ Parser::Token Parser::consumeToken()
|
||||
|
||||
/* Check for source end */
|
||||
if (m_sourceIt == m_source->cend())
|
||||
return Parser::Token(TokenSourceEnd, getLocation());
|
||||
return Parser::Token(TokenType::SourceEnd, getLocation());
|
||||
|
||||
/* Check for numeric literal */
|
||||
{
|
||||
@ -61,7 +61,7 @@ Parser::Token Parser::consumeToken()
|
||||
float val = strtof(&*m_sourceIt, &strEnd);
|
||||
if (&*m_sourceIt != strEnd)
|
||||
{
|
||||
Parser::Token tok(TokenNumLiteral, getLocation());
|
||||
Parser::Token tok(TokenType::NumLiteral, getLocation());
|
||||
tok.m_tokenFloat = val;
|
||||
m_sourceIt += (strEnd - &*m_sourceIt);
|
||||
return tok;
|
||||
@ -91,7 +91,7 @@ Parser::Token Parser::consumeToken()
|
||||
}
|
||||
if (count)
|
||||
{
|
||||
Parser::Token tok(TokenVectorSwizzle, getLocation());
|
||||
Parser::Token tok(TokenType::VectorSwizzle, getLocation());
|
||||
for (int i=0 ; i<count ; ++i)
|
||||
{
|
||||
std::string::const_iterator tmp2 = tmp + i;
|
||||
@ -105,7 +105,7 @@ Parser::Token Parser::consumeToken()
|
||||
/* Check for arithmetic op */
|
||||
if (*m_sourceIt == '+' || *m_sourceIt == '-' || *m_sourceIt == '*' || *m_sourceIt == '/')
|
||||
{
|
||||
Parser::Token tok(TokenArithmeticOp, getLocation());
|
||||
Parser::Token tok(TokenType::ArithmeticOp, getLocation());
|
||||
tok.m_tokenInt = *m_sourceIt;
|
||||
++m_sourceIt;
|
||||
return tok;
|
||||
@ -117,7 +117,7 @@ Parser::Token Parser::consumeToken()
|
||||
if (m_parenStack.empty())
|
||||
{
|
||||
m_diag.reportParserErr(getLocation(), "unexpected ')' while parsing");
|
||||
return Parser::Token(TokenNone, SourceLocation());
|
||||
return Parser::Token(TokenType::None, SourceLocation());
|
||||
}
|
||||
Parser::Token tok(m_parenStack.back(), getLocation());
|
||||
++m_sourceIt;
|
||||
@ -128,8 +128,8 @@ Parser::Token Parser::consumeToken()
|
||||
/* Check for group start */
|
||||
if (*m_sourceIt == '(')
|
||||
{
|
||||
m_parenStack.push_back(TokenEvalGroupEnd);
|
||||
Parser::Token tok(TokenEvalGroupStart, getLocation());
|
||||
m_parenStack.push_back(TokenType::EvalGroupEnd);
|
||||
Parser::Token tok(TokenType::EvalGroupStart, getLocation());
|
||||
++m_sourceIt;
|
||||
return tok;
|
||||
}
|
||||
@ -144,10 +144,10 @@ Parser::Token Parser::consumeToken()
|
||||
skipWhitespace(tmp);
|
||||
if (*tmp == '(')
|
||||
{
|
||||
Parser::Token tok(TokenFunctionStart, getLocation());
|
||||
Parser::Token tok(TokenType::FunctionStart, getLocation());
|
||||
tok.m_tokenString.assign(m_sourceIt, nameEnd);
|
||||
m_sourceIt = tmp + 1;
|
||||
m_parenStack.push_back(TokenFunctionEnd);
|
||||
m_parenStack.push_back(TokenType::FunctionEnd);
|
||||
return tok;
|
||||
}
|
||||
}
|
||||
@ -155,19 +155,19 @@ Parser::Token Parser::consumeToken()
|
||||
/* Check for function arg delimitation */
|
||||
if (*m_sourceIt == ',')
|
||||
{
|
||||
if (m_parenStack.empty() || m_parenStack.back() != TokenFunctionEnd)
|
||||
if (m_parenStack.empty() || m_parenStack.back() != TokenType::FunctionEnd)
|
||||
{
|
||||
m_diag.reportParserErr(getLocation(), "unexpected ',' while parsing");
|
||||
return Parser::Token(TokenNone, SourceLocation());
|
||||
return Parser::Token(TokenType::None, SourceLocation());
|
||||
}
|
||||
Parser::Token tok(TokenFunctionArgDelim, getLocation());
|
||||
Parser::Token tok(TokenType::FunctionArgDelim, getLocation());
|
||||
++m_sourceIt;
|
||||
return tok;
|
||||
}
|
||||
|
||||
/* Error condition if reached */
|
||||
m_diag.reportParserErr(getLocation(), "unexpected token while parsing");
|
||||
return Parser::Token(TokenNone, SourceLocation());
|
||||
return Parser::Token(TokenType::None, SourceLocation());
|
||||
}
|
||||
|
||||
SourceLocation Parser::getLocation() const
|
||||
|
@ -140,28 +140,28 @@ ProjectPath ProjectPath::getCookedPath(const Database::DataSpecEntry& spec) cons
|
||||
return ProjectPath(m_proj->getProjectCookedPath(spec), woExt.getRelativePath());
|
||||
}
|
||||
|
||||
ProjectPath::PathType ProjectPath::getPathType() const
|
||||
ProjectPath::Type ProjectPath::getPathType() const
|
||||
{
|
||||
#if WIN32
|
||||
if (TestShellLink(m_absPath.c_str()))
|
||||
return PT_LINK;
|
||||
return Type::Link;
|
||||
#else
|
||||
HECL::Sstat lnStat;
|
||||
if (lstat(m_absPath.c_str(), &lnStat))
|
||||
return PT_NONE;
|
||||
return Type::None;
|
||||
if (S_ISLNK(lnStat.st_mode))
|
||||
return PT_LINK;
|
||||
return Type::Link;
|
||||
#endif
|
||||
if (std::regex_search(m_absPath, regGLOB))
|
||||
return PT_GLOB;
|
||||
return Type::Glob;
|
||||
Sstat theStat;
|
||||
if (HECL::Stat(m_absPath.c_str(), &theStat))
|
||||
return PT_NONE;
|
||||
return Type::None;
|
||||
if (S_ISDIR(theStat.st_mode))
|
||||
return PT_DIRECTORY;
|
||||
return Type::Directory;
|
||||
if (S_ISREG(theStat.st_mode))
|
||||
return PT_FILE;
|
||||
return PT_NONE;
|
||||
return Type::File;
|
||||
return Type::None;
|
||||
}
|
||||
|
||||
Time ProjectPath::getModtime() const
|
||||
|
@ -19,8 +19,8 @@ HMDLData::HMDLData(boo::IGraphicsDataFactory* factory,
|
||||
if (meta.magic != 'TACO')
|
||||
Log.report(LogVisor::FatalError, "invalid HMDL magic");
|
||||
|
||||
m_vbo = factory->newStaticBuffer(boo::BufferUseVertex, vbo, meta.vertStride, meta.vertCount);
|
||||
m_ibo = factory->newStaticBuffer(boo::BufferUseIndex, ibo, 4, meta.indexCount);
|
||||
m_vbo = factory->newStaticBuffer(boo::BufferUse::Vertex, vbo, meta.vertStride, meta.vertCount);
|
||||
m_ibo = factory->newStaticBuffer(boo::BufferUse::Index, ibo, 4, meta.indexCount);
|
||||
|
||||
if (factory->bindingNeedsVertexFormat())
|
||||
m_vtxFmt = NewVertexFormat(factory, meta, m_vbo, m_ibo);
|
||||
@ -38,25 +38,25 @@ boo::IVertexFormat* HMDLData::NewVertexFormat(boo::IGraphicsDataFactory* factory
|
||||
vdescs[i].indexBuffer = ibo;
|
||||
}
|
||||
|
||||
vdescs[0].semantic = boo::VertexSemanticPosition;
|
||||
vdescs[1].semantic = boo::VertexSemanticNormal;
|
||||
vdescs[0].semantic = boo::VertexSemantic::Position;
|
||||
vdescs[1].semantic = boo::VertexSemantic::Normal;
|
||||
size_t e = 2;
|
||||
|
||||
for (size_t i=0 ; i<meta.colorCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticColor;
|
||||
vdescs[e].semantic = boo::VertexSemantic::Color;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
for (size_t i=0 ; i<meta.uvCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticUV;
|
||||
vdescs[e].semantic = boo::VertexSemantic::UV;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
for (size_t i=0 ; i<meta.weightCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticWeight;
|
||||
vdescs[e].semantic = boo::VertexSemantic::Weight;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
@ -74,25 +74,25 @@ boo::IVertexFormat* ShaderTag::newVertexFormat(boo::IGraphicsDataFactory *factor
|
||||
vdescs[i].indexBuffer = nullptr;
|
||||
}
|
||||
|
||||
vdescs[0].semantic = boo::VertexSemanticPosition;
|
||||
vdescs[1].semantic = boo::VertexSemanticNormal;
|
||||
vdescs[0].semantic = boo::VertexSemantic::Position;
|
||||
vdescs[1].semantic = boo::VertexSemantic::Normal;
|
||||
size_t e = 2;
|
||||
|
||||
for (size_t i=0 ; i<m_colorCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticColor;
|
||||
vdescs[e].semantic = boo::VertexSemantic::Color;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
for (size_t i=0 ; i<m_uvCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticUV;
|
||||
vdescs[e].semantic = boo::VertexSemantic::UV;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
for (size_t i=0 ; i<m_weightCount ; ++i, ++e)
|
||||
{
|
||||
vdescs[e].semantic = boo::VertexSemanticWeight;
|
||||
vdescs[e].semantic = boo::VertexSemantic::Weight;
|
||||
vdescs[e].semanticIdx = i;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ ShaderCacheManager::ShaderCacheManager(const FileStoreManager& storeMgr,
|
||||
|
||||
switch (plat)
|
||||
{
|
||||
case boo::IGraphicsDataFactory::PlatformOGL:
|
||||
case boo::IGraphicsDataFactory::Platform::OGL:
|
||||
m_factory.reset(_NewGLSLBackendFactory(gfxFactory));
|
||||
break;
|
||||
#if _WIN32
|
||||
|
@ -90,7 +90,7 @@ struct HECLApplicationCallback : boo::IApplicationCallback
|
||||
|
||||
/* Generate meta structure (usually statically serialized) */
|
||||
HECL::HMDLMeta testMeta;
|
||||
testMeta.topology = HECL::TopologyTriStrips;
|
||||
testMeta.topology = HECL::HMDLTopology::TriStrips;
|
||||
testMeta.vertStride = 32;
|
||||
testMeta.vertCount = 4;
|
||||
testMeta.indexCount = 4;
|
||||
@ -136,10 +136,10 @@ struct HECLApplicationCallback : boo::IApplicationCallback
|
||||
tex[i][j][3] = 0xff;
|
||||
}
|
||||
boo::ITexture* texture =
|
||||
gfxF->newStaticTexture(256, 256, 1, boo::TextureFormatRGBA8, tex, 256*256*4);
|
||||
gfxF->newStaticTexture(256, 256, 1, boo::TextureFormat::RGBA8, tex, 256*256*4);
|
||||
|
||||
/* Make vertex uniform buffer */
|
||||
vubo = gfxF->newDynamicBuffer(boo::BufferUseUniform, sizeof(VertexUBO), 1);
|
||||
vubo = gfxF->newDynamicBuffer(boo::BufferUse::Uniform, sizeof(VertexUBO), 1);
|
||||
|
||||
/* Assemble data binding */
|
||||
binding = testData.newShaderDataBindng(gfxF, testShaderObj, 1, (boo::IGraphicsBuffer**)&vubo, 1, &texture);
|
||||
@ -191,7 +191,7 @@ struct HECLApplicationCallback : boo::IApplicationCallback
|
||||
float rgba[] = {sinf(frameIdx / 60.0), cosf(frameIdx / 60.0), 0.0, 1.0};
|
||||
gfxQ->setClearColor(rgba);
|
||||
gfxQ->clearTarget();
|
||||
gfxQ->setDrawPrimitive(boo::PrimitiveTriStrips);
|
||||
gfxQ->setDrawPrimitive(boo::Primitive::TriStrips);
|
||||
|
||||
vuboData.modelview[3][0] = sinf(frameIdx / 60.0) * 0.5;
|
||||
vuboData.modelview[3][1] = cosf(frameIdx / 60.0) * 0.5;
|
||||
@ -232,7 +232,7 @@ int main(int argc, const boo::SystemChar** argv)
|
||||
atSetExceptionHandler(AthenaExcHandler);
|
||||
LogVisor::RegisterConsoleLogger();
|
||||
HECLApplicationCallback appCb;
|
||||
int ret = boo::ApplicationRun(boo::IApplication::PLAT_AUTO,
|
||||
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto,
|
||||
appCb, _S("heclTest"), _S("HECL Test"), argc, argv);
|
||||
printf("IM DYING!!\n");
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user