当前位置: 首页>>代码示例>>C++>>正文


C++ TType函数代码示例

本文整理汇总了C++中TType函数的典型用法代码示例。如果您正苦于以下问题:C++ TType函数的具体用法?C++ TType怎么用?C++ TType使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ir_add_vector_swizzle

TIntermTyped* ir_add_vector_swizzle(TVectorFields& fields, TIntermTyped* arg, TSourceLoc lineDot, TSourceLoc lineIndex)
{	
	// swizzle on a constant -> fold it
	if (arg->getType().getQualifier() == EvqConst)
	{
		TIntermTyped* res = ir_add_const_vector_swizzle(fields, arg, lineIndex);
		if (res)
			return res;
	}
		
	TIntermTyped* res = NULL;
	if (fields.num == 1)
	{
		TIntermConstant* index = ir_add_constant(TType(EbtInt, EbpUndefined, EvqConst), lineIndex);
		index->setValue(fields.offsets[0]);
		res = ir_add_index(EOpIndexDirect, arg, index, lineDot);
		res->setType(TType(arg->getBasicType(), arg->getPrecision()));
	}
	else
	{
		TIntermTyped* index = ir_add_swizzle(fields, lineIndex);
		res = ir_add_index(EOpVectorSwizzle, arg, index, lineDot);
		res->setType(TType(arg->getBasicType(), arg->getPrecision(), EvqTemporary, 1, fields.num));
	}
	return res;
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:26,代码来源:Intermediate.cpp

示例2: error

//
// See if this qualifier can be an array.
//
// Returns true if there is an error.
//
bool TParseContext::arrayQualifierErrorCheck(int line, TPublicType type)
{
    if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqConst)) {
        error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str(), "");
        return true;
    }

    return false;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:14,代码来源:ParseHelper.cpp

示例3: var

void TCompiler::initializeGLPosition(TIntermNode* root)
{
    InitializeVariables::InitVariableInfoList variables;
    InitializeVariables::InitVariableInfo var(
        "gl_Position", TType(EbtFloat, EbpUndefined, EvqPosition, 4));
    variables.push_back(var);
    InitializeVariables initializer(variables);
    root->traverse(&initializer);
}
开发者ID:FahimArnob,项目名称:angle,代码行数:9,代码来源:Compiler.cpp

示例4: error

//
// See if this qualifier can be an array.
//
// Returns true if there is an error.
//
bool TParseContext::arrayQualifierErrorCheck(int line, TPublicType type)
{
    if (type.qualifier == EvqAttribute) {
        error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str(), "");
        return true;
    }

    if (type.qualifier == EvqConst && extensionErrorCheck(line, "GL_3DL_array_objects"))
        return true;

    return false;
}
开发者ID:pelegri,项目名称:WebKit-PlayBook,代码行数:17,代码来源:ParseHelper.cpp

示例5: TFunction

// The function_call identifier was already recognized, and passed in as idToken.
//
// function_call
//      : [idToken] arguments
//
bool HlslGrammar::acceptFunctionCall(HlslToken idToken, TIntermTyped*& node)
{
    // arguments
    TFunction* function = new TFunction(idToken.string, TType(EbtVoid));
    TIntermTyped* arguments = nullptr;
    if (! acceptArguments(function, arguments))
        return false;

    node = parseContext.handleFunctionCall(idToken.loc, function, arguments);

    return true;
}
开发者ID:Corralx,项目名称:helios,代码行数:17,代码来源:hlslGrammar.cpp

示例6: GetHigherPrecision

bool TIntermSelection::promoteTernary(TInfoSink& infoSink)
{
	if (!condition->isVector())
		return true;
	
	int size = condition->getRowsCount();
	TIntermTyped* trueb = trueBlock->getAsTyped();
	TIntermTyped* falseb = falseBlock->getAsTyped();
	if (!trueb || !falseb)
		return false;
	
	if (trueb->getRowsCount() == size && falseb->getRowsCount() == size)
		return true;
	
	// Base assumption: just make the type a float vector
	TPrecision higherPrecision = GetHigherPrecision(trueb->getPrecision(), falseb->getPrecision());
	setType(TType(EbtFloat, higherPrecision, EvqTemporary, 1, size, condition->isMatrix()));
	
	TOperator convert = EOpNull;	
	{
		convert = TOperator( EOpConstructVec2 + size - 2);
		TIntermAggregate *node = new TIntermAggregate(convert);
		node->setLine(trueb->getLine());
		node->setType(TType(condition->getBasicType(), higherPrecision, trueb->getQualifier() == EvqConst ? EvqConst : EvqTemporary, 1, size, condition->isMatrix()));
		node->getNodes().push_back(trueb);
		trueBlock = node;
	}
	{
		convert = TOperator( EOpConstructVec2 + size - 2);
		TIntermAggregate *node = new TIntermAggregate(convert);
		node->setLine(falseb->getLine());
		node->setType(TType(condition->getBasicType(), higherPrecision, falseb->getQualifier() == EvqConst ? EvqConst : EvqTemporary, 1, size, condition->isMatrix()));
		node->getNodes().push_back(falseb);
		falseBlock = node;
	}
	
	return true;
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:38,代码来源:Intermediate.cpp

示例7: ir_add_selection

// For "if" test nodes.  There are three children; a condition,
// a true path, and a false path.  The two paths are in the
// nodePair.
TIntermNode* ir_add_selection(TIntermTyped* cond, TIntermNodePair nodePair, TSourceLoc line, TInfoSink& infoSink)
{   
   // Convert float/int to bool
   if ( cond->getBasicType() != EbtBool)
   {
      cond = ir_add_conversion (EOpConstructBool,
                             TType (EbtBool, cond->getPrecision(), cond->getQualifier(), cond->getColsCount(), cond->getRowsCount(), cond->isMatrix(), cond->isArray()),
                             cond, infoSink);
   }

   TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2);
   node->setLine(line);

   return node;
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:18,代码来源:Intermediate.cpp

示例8: ir_add_swizzle

TIntermTyped* ir_add_swizzle(TVectorFields& fields, TSourceLoc line)
{
	TIntermAggregate* node = new TIntermAggregate(EOpSequence);

	node->setLine(line);
	TNodeArray& nodes = node->getNodes();

	for (int i = 0; i < fields.num; i++)
	{
		TIntermConstant* constant = ir_add_constant(TType(EbtInt, EbpUndefined, EvqConst), line);
		constant->setValue(fields.offsets[i]);
		nodes.push_back(constant);
	}

	return node;
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:16,代码来源:Intermediate.cpp

示例9: constArray

//
// Make a constant vector node or constant scalar node, representing a given 
// constant vector and constant swizzle into it.
//
TIntermTyped* TIntermediate::foldSwizzle(TIntermTyped* node, TVectorFields& fields, const TSourceLoc& loc)
{
    const TConstUnionArray& unionArray = node->getAsConstantUnion()->getConstArray();
    TConstUnionArray constArray(fields.num);

    for (int i = 0; i < fields.num; i++)
        constArray[i] = unionArray[fields.offsets[i]];

    TIntermTyped* result = addConstantUnion(constArray, node->getType(), loc);

    if (result == 0)
        result = node;
    else
        result->setType(TType(node->getBasicType(), EvqConst, fields.num));

    return result;
}
开发者ID:neilogd,项目名称:glslang,代码行数:21,代码来源:Constant.cpp

示例10: recover

//
// Do semantic checking for a variable declaration that has no initializer,
// and update the symbol table.
//
// Returns true if there was an error.
//
bool TParseContext::nonInitErrorCheck(int line, TString& identifier, TPublicType& type)
{
    if (reservedErrorCheck(line, identifier))
        recover();

    TVariable* variable = new TVariable(&identifier, TType(type));

    if (! symbolTable.insert(*variable)) {
        error(line, "redefinition", variable->getName().c_str(), "");
        delete variable;
        return true;
    }

    if (voidErrorCheck(line, identifier, type))
        return true;

    return false;
}
开发者ID:pelegri,项目名称:WebKit-PlayBook,代码行数:24,代码来源:ParseHelper.cpp

示例11: ir_add_const_vector_swizzle

// This function returns the tree representation for the vector field(s) being accessed from contant vector.
// If only one component of vector is accessed (v.x or v[0] where v is a contant vector), then a contant node is
// returned, else an aggregate node is returned (for v.xy). The input to this function could either be the symbol
// node or it could be the intermediate tree representation of accessing fields in a constant structure or column of 
// a constant matrix.
TIntermTyped* ir_add_const_vector_swizzle(const TVectorFields& fields, TIntermTyped* node, TSourceLoc line)
{
	TIntermConstant* constNode = node->getAsConstant();
	if (!constNode)
		return NULL;
	
	TIntermConstant* res = ir_add_constant(node->getType(), line);
	for (int i = 0; i < fields.num; ++i)
	{
		int index = fields.offsets[i];
		assert(index >= 0 && index < constNode->getCount());
		res->setValue(i, constNode->getValue (index));
	}
	
	res->setType(TType(node->getBasicType(), node->getPrecision(), EvqConst, fields.num));
	
	return res;
}
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:23,代码来源:Intermediate.cpp

示例12: TIntermAggregate

TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, TSourceLoc line)
{

    TIntermAggregate* node = new TIntermAggregate(EOpSequence);

    node->setLine(line);
    TIntermConstantUnion* constIntNode;
    TIntermSequence &sequenceVector = node->getSequence();
    ConstantUnion* unionArray;

    for (int i = 0; i < fields.num; i++) {
        unionArray = new ConstantUnion[1];
        unionArray->setIConst(fields.offsets[i]);
        constIntNode = addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), line);
        sequenceVector.push_back(constIntNode);
    }

    return node;
}
开发者ID:JSilver99,项目名称:mozilla-central,代码行数:19,代码来源:Intermediate.cpp

示例13: ir_add_selection

// For "if" test nodes.  There are three children; a condition,
// a true path, and a false path.  The two paths are in the
// nodePair.
TIntermNode* ir_add_selection(TIntermTyped* cond, TIntermNodePair nodePair, TSourceLoc line, TInfoSink& infoSink)
{   
   // Convert float/int to bool
   switch ( cond->getBasicType() )
   {
   case EbtFloat:
   case EbtInt:
      cond = ir_add_conversion (EOpConstructBool, 
                             TType (EbtBool, cond->getPrecision(), cond->getQualifier(), cond->getNominalSize(), cond->isMatrix(), cond->isArray()),
                             cond, infoSink);
      break;
   default:
      // Do nothing
      break;
   }

   TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2);
   node->setLine(line);

   return node;
}
开发者ID:jjiezheng,项目名称:hlsl2glslfork,代码行数:24,代码来源:Intermediate.cpp

示例14: atomic_inc

 TType atomic_inc( TType * p ) { return TType(); }
开发者ID:JuantAldea,项目名称:clever,代码行数:1,代码来源:builtin.hpp

示例15: ir_add_binary_math

// Connect two nodes with a new parent that does a binary operation on the nodes.
TIntermTyped* ir_add_binary_math(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line, TParseContext& ctx)
{
	if (!left || !right)
		return 0;
	
	switch (op)
	{
	case EOpLessThan:
	case EOpGreaterThan:
	case EOpLessThanEqual:
	case EOpGreaterThanEqual:
		if (left->getType().isMatrix() || left->getType().isArray() || left->getType().getBasicType() == EbtStruct)
		{
			return 0;
		}
		break;
	case EOpLogicalOr:
	case EOpLogicalXor:
	case EOpLogicalAnd:
		if (left->getType().isMatrix() || left->getType().isArray())
			return 0;
		
		if ( left->getBasicType() != EbtBool )
		{
			if ( left->getType().getBasicType() != EbtInt && left->getType().getBasicType() != EbtFloat )
				return 0;
			else
			{
				// If the left is a float or int, convert to a bool.  This is the conversion that HLSL
				// does
				left = ir_add_conversion(EOpConstructBool, 
									 TType ( EbtBool, left->getPrecision(), left->getQualifier(),
											left->getColsCount(), left->getRowsCount(), left->isMatrix(), left->isArray()), 
									 left, ctx.infoSink);
				
				if ( left == 0 )
					return 0;
			}
			
		}
		
		if (right->getType().isMatrix() || right->getType().isArray() || right->getType().isVector())
			return 0;
		
		if ( right->getBasicType() != EbtBool )
		{
			if ( right->getType().getBasicType() != EbtInt && right->getType().getBasicType() != EbtFloat )
				return 0;
			else
			{
				// If the right is a float or int, convert to a bool.  This is the conversion that HLSL
				// does
				right = ir_add_conversion(EOpConstructBool, 
									  TType ( EbtBool, right->getPrecision(), right->getQualifier(),
											 right->getColsCount(), right->getRowsCount(), right->isMatrix(), right->isArray()), 
									  right, ctx.infoSink);
				
				if ( right == 0 )
					return 0;
			}
			
		}
		break;
	case EOpAdd:
	case EOpSub:
	case EOpDiv:
	case EOpMul:
	case EOpMod:
		{
			TBasicType ltype = left->getType().getBasicType();
			TBasicType rtype = right->getType().getBasicType();
			if (ltype == EbtStruct)
				return 0;
			
			// If left or right type is a bool, convert to float.
			bool leftToFloat = (ltype == EbtBool);
			bool rightToFloat = (rtype == EbtBool);
			// For modulus, if either is an integer, convert to float as well.
			if (op == EOpMod)
			{
				leftToFloat |= (ltype == EbtInt);
				rightToFloat |= (rtype == EbtInt);
			}
				
			if (leftToFloat)
			{
				left = ir_add_conversion (EOpConstructFloat, TType (EbtFloat, left->getPrecision(), left->getQualifier(), left->getColsCount(), left->getRowsCount(), left->isMatrix(), left->isArray()), left, ctx.infoSink);
				if (left == 0)
					return 0;
			}
			if (rightToFloat)
			{
				right = ir_add_conversion (EOpConstructFloat, TType (EbtFloat, right->getPrecision(), right->getQualifier(), right->getColsCount(), right->getRowsCount(), right->isMatrix(), right->isArray()), right, ctx.infoSink);
				if (right == 0)
					return 0;
			}
		}
		break;
	default:
//.........这里部分代码省略.........
开发者ID:Groovounet,项目名称:hlsl2glslfork,代码行数:101,代码来源:Intermediate.cpp


注:本文中的TType函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。