#include "hecl/Backend/ProgrammableCommon.hpp" #include namespace hecl::Backend { unsigned ProgrammableCommon::addTexCoordGen(TexGenSrc src, int uvIdx, int mtx, bool normalize) { for (unsigned i=0 ; i 1) { const IR::Instruction& alphaRoot = ir.m_instructions.at(rootCall.m_call.m_argInstIdxs.at(1)); m_alphaExpr = RecursiveTraceAlpha(ir, diag, alphaRoot, false); } } static const char SWIZZLE_CHARS[] = "rgba"; std::string ProgrammableCommon::EmitSwizzle3(Diagnostics& diag, const SourceLocation& loc, const std::string& a, const atInt8 swiz[4]) const { std::string retval = a + '.'; for (int i=0 ; i<3 ; ++i) { if (swiz[i] < 0 || swiz[i] > 3) diag.reportBackendErr(loc, "unable to use swizzle as RGB value"); retval += SWIZZLE_CHARS[swiz[i]]; } return retval; } std::string ProgrammableCommon::EmitSwizzle1(Diagnostics& diag, const SourceLocation& loc, const std::string& a, const atInt8 swiz[4]) const { std::string retval = a + '.'; if (swiz[0] < 0 || swiz[0] > 3) diag.reportBackendErr(loc, "unable to use swizzle as Alpha value"); retval += SWIZZLE_CHARS[swiz[0]]; return retval; } }