Merge pull request #2367 from KhronosGroup/fix-semantic-checking
Remove incorrect style of extension-based semantic checking.
This commit is contained in:
commit
5bfb42301a
@ -1444,7 +1444,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
|
|||||||
// Add the source extensions
|
// Add the source extensions
|
||||||
const auto& sourceExtensions = glslangIntermediate->getRequestedExtensions();
|
const auto& sourceExtensions = glslangIntermediate->getRequestedExtensions();
|
||||||
for (auto it = sourceExtensions.begin(); it != sourceExtensions.end(); ++it)
|
for (auto it = sourceExtensions.begin(); it != sourceExtensions.end(); ++it)
|
||||||
builder.addSourceExtension(it->first.c_str());
|
builder.addSourceExtension(it->c_str());
|
||||||
|
|
||||||
// Add the top-level modes for this shader.
|
// Add the top-level modes for this shader.
|
||||||
|
|
||||||
|
@ -2,8 +2,12 @@ spv.bufferhandle17_Errors.frag
|
|||||||
ERROR: 0:11: 'qualifier' : variables with reference type can't have qualifier 'const'
|
ERROR: 0:11: 'qualifier' : variables with reference type can't have qualifier 'const'
|
||||||
ERROR: 0:16: 'qualifier' : variables with reference type can't have qualifier 'const'
|
ERROR: 0:16: 'qualifier' : variables with reference type can't have qualifier 'const'
|
||||||
ERROR: 0:18: '==' : can't use with reference types
|
ERROR: 0:18: '==' : can't use with reference types
|
||||||
|
ERROR: 0:18: 'buffer reference math' : required extension not requested: GL_EXT_buffer_reference2
|
||||||
|
ERROR: 0:18: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type ' temp reference' and a right operand of type ' temp reference' (or there is no acceptable conversion)
|
||||||
ERROR: 0:19: '!=' : can't use with reference types
|
ERROR: 0:19: '!=' : can't use with reference types
|
||||||
ERROR: 4 compilation errors. No code generated.
|
ERROR: 0:19: 'buffer reference math' : required extension not requested: GL_EXT_buffer_reference2
|
||||||
|
ERROR: 0:19: '!=' : wrong operand types: no operation '!=' exists that takes a left-hand operand of type ' temp reference' and a right operand of type ' temp reference' (or there is no acceptable conversion)
|
||||||
|
ERROR: 8 compilation errors. No code generated.
|
||||||
|
|
||||||
|
|
||||||
SPIR-V is not generated for failed compile or link
|
SPIR-V is not generated for failed compile or link
|
||||||
|
@ -7,7 +7,6 @@ ERROR: 4 compilation errors. No code generated.
|
|||||||
|
|
||||||
|
|
||||||
Shader version: 110
|
Shader version: 110
|
||||||
Requested GL_ARB_texture_rectangle
|
|
||||||
ERROR: node is still EOpNull!
|
ERROR: node is still EOpNull!
|
||||||
0:42 Function Definition: main( ( global void)
|
0:42 Function Definition: main( ( global void)
|
||||||
0:42 Function Parameters:
|
0:42 Function Parameters:
|
||||||
@ -28,7 +27,6 @@ Linked fragment stage:
|
|||||||
|
|
||||||
|
|
||||||
Shader version: 110
|
Shader version: 110
|
||||||
Requested GL_ARB_texture_rectangle
|
|
||||||
ERROR: node is still EOpNull!
|
ERROR: node is still EOpNull!
|
||||||
0:42 Function Definition: main( ( global void)
|
0:42 Function Definition: main( ( global void)
|
||||||
0:42 Function Parameters:
|
0:42 Function Parameters:
|
||||||
|
@ -113,14 +113,14 @@ TIntermSymbol* TIntermediate::addSymbol(const TType& type, const TSourceLoc& loc
|
|||||||
//
|
//
|
||||||
// Returns nullptr if the working conversions and promotions could not be found.
|
// Returns nullptr if the working conversions and promotions could not be found.
|
||||||
//
|
//
|
||||||
TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc)
|
TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc& loc)
|
||||||
{
|
{
|
||||||
// No operations work on blocks
|
// No operations work on blocks
|
||||||
if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock)
|
if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Convert "reference +/- int" and "reference - reference" to integer math
|
// Convert "reference +/- int" and "reference - reference" to integer math
|
||||||
if ((op == EOpAdd || op == EOpSub) && extensionRequested(E_GL_EXT_buffer_reference2)) {
|
if (op == EOpAdd || op == EOpSub) {
|
||||||
|
|
||||||
// No addressing math on struct with unsized array.
|
// No addressing math on struct with unsized array.
|
||||||
if ((left->isReference() && left->getType().getReferentType()->containsUnsizedArray()) ||
|
if ((left->isReference() && left->getType().getReferentType()->containsUnsizedArray()) ||
|
||||||
@ -140,43 +140,44 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
|||||||
node = addBuiltInFunctionCall(loc, EOpConvUint64ToPtr, true, node, referenceType);
|
node = addBuiltInFunctionCall(loc, EOpConvUint64ToPtr, true, node, referenceType);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op == EOpAdd && right->isReference() && isTypeInt(left->getBasicType())) {
|
|
||||||
const TType& referenceType = right->getType();
|
|
||||||
TIntermConstantUnion* size = addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(right->getType()), loc, true);
|
|
||||||
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
|
|
||||||
|
|
||||||
left = createConversion(EbtInt64, left);
|
|
||||||
left = addBinaryMath(EOpMul, left, size, loc);
|
|
||||||
|
|
||||||
TIntermTyped *node = addBinaryMath(op, left, right, loc);
|
|
||||||
node = addBuiltInFunctionCall(loc, EOpConvUint64ToPtr, true, node, referenceType);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (op == EOpSub && left->isReference() && right->isReference()) {
|
|
||||||
TIntermConstantUnion* size = addConstantUnion((long long)computeBufferReferenceTypeSize(left->getType()), loc, true);
|
|
||||||
|
|
||||||
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
|
|
||||||
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
|
|
||||||
|
|
||||||
left = addBuiltInFunctionCall(loc, EOpConvUint64ToInt64, true, left, TType(EbtInt64));
|
|
||||||
right = addBuiltInFunctionCall(loc, EOpConvUint64ToInt64, true, right, TType(EbtInt64));
|
|
||||||
|
|
||||||
left = addBinaryMath(EOpSub, left, right, loc);
|
|
||||||
|
|
||||||
TIntermTyped *node = addBinaryMath(EOpDiv, left, size, loc);
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No other math operators supported on references
|
|
||||||
if (left->isReference() || right->isReference()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op == EOpAdd && right->isReference() && isTypeInt(left->getBasicType())) {
|
||||||
|
const TType& referenceType = right->getType();
|
||||||
|
TIntermConstantUnion* size =
|
||||||
|
addConstantUnion((unsigned long long)computeBufferReferenceTypeSize(right->getType()), loc, true);
|
||||||
|
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
|
||||||
|
|
||||||
|
left = createConversion(EbtInt64, left);
|
||||||
|
left = addBinaryMath(EOpMul, left, size, loc);
|
||||||
|
|
||||||
|
TIntermTyped *node = addBinaryMath(op, left, right, loc);
|
||||||
|
node = addBuiltInFunctionCall(loc, EOpConvUint64ToPtr, true, node, referenceType);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (op == EOpSub && left->isReference() && right->isReference()) {
|
||||||
|
TIntermConstantUnion* size =
|
||||||
|
addConstantUnion((long long)computeBufferReferenceTypeSize(left->getType()), loc, true);
|
||||||
|
|
||||||
|
left = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, left, TType(EbtUint64));
|
||||||
|
right = addBuiltInFunctionCall(loc, EOpConvPtrToUint64, true, right, TType(EbtUint64));
|
||||||
|
|
||||||
|
left = addBuiltInFunctionCall(loc, EOpConvUint64ToInt64, true, left, TType(EbtInt64));
|
||||||
|
right = addBuiltInFunctionCall(loc, EOpConvUint64ToInt64, true, right, TType(EbtInt64));
|
||||||
|
|
||||||
|
left = addBinaryMath(EOpSub, left, right, loc);
|
||||||
|
|
||||||
|
TIntermTyped *node = addBinaryMath(EOpDiv, left, size, loc);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No other math operators supported on references
|
||||||
|
if (left->isReference() || right->isReference())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
// Try converting the children's base types to compatible types.
|
// Try converting the children's base types to compatible types.
|
||||||
auto children = addConversion(op, left, right);
|
auto children = addPairConversion(op, left, right);
|
||||||
left = std::get<0>(children);
|
left = std::get<0>(children);
|
||||||
right = std::get<1>(children);
|
right = std::get<1>(children);
|
||||||
|
|
||||||
@ -226,13 +227,12 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
|
|||||||
//
|
//
|
||||||
// Low level: add binary node (no promotions or other argument modifications)
|
// Low level: add binary node (no promotions or other argument modifications)
|
||||||
//
|
//
|
||||||
TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc) const
|
TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right,
|
||||||
|
const TSourceLoc& loc) const
|
||||||
{
|
{
|
||||||
// build the node
|
// build the node
|
||||||
TIntermBinary* node = new TIntermBinary(op);
|
TIntermBinary* node = new TIntermBinary(op);
|
||||||
if (loc.line == 0)
|
node->setLoc(loc.line != 0 ? loc : left->getLoc());
|
||||||
loc = left->getLoc();
|
|
||||||
node->setLoc(loc);
|
|
||||||
node->setLeft(left);
|
node->setLeft(left);
|
||||||
node->setRight(right);
|
node->setRight(right);
|
||||||
|
|
||||||
@ -242,7 +242,8 @@ TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TI
|
|||||||
//
|
//
|
||||||
// like non-type form, but sets node's type.
|
// like non-type form, but sets node's type.
|
||||||
//
|
//
|
||||||
TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc, const TType& type) const
|
TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right,
|
||||||
|
const TSourceLoc& loc, const TType& type) const
|
||||||
{
|
{
|
||||||
TIntermBinary* node = addBinaryNode(op, left, right, loc);
|
TIntermBinary* node = addBinaryNode(op, left, right, loc);
|
||||||
node->setType(type);
|
node->setType(type);
|
||||||
@ -252,12 +253,10 @@ TIntermBinary* TIntermediate::addBinaryNode(TOperator op, TIntermTyped* left, TI
|
|||||||
//
|
//
|
||||||
// Low level: add unary node (no promotions or other argument modifications)
|
// Low level: add unary node (no promotions or other argument modifications)
|
||||||
//
|
//
|
||||||
TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc loc) const
|
TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, const TSourceLoc& loc) const
|
||||||
{
|
{
|
||||||
TIntermUnary* node = new TIntermUnary(op);
|
TIntermUnary* node = new TIntermUnary(op);
|
||||||
if (loc.line == 0)
|
node->setLoc(loc.line != 0 ? loc : child->getLoc());
|
||||||
loc = child->getLoc();
|
|
||||||
node->setLoc(loc);
|
|
||||||
node->setOperand(child);
|
node->setOperand(child);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
@ -266,7 +265,8 @@ TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSo
|
|||||||
//
|
//
|
||||||
// like non-type form, but sets node's type.
|
// like non-type form, but sets node's type.
|
||||||
//
|
//
|
||||||
TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc loc, const TType& type) const
|
TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, const TSourceLoc& loc, const TType& type)
|
||||||
|
const
|
||||||
{
|
{
|
||||||
TIntermUnary* node = addUnaryNode(op, child, loc);
|
TIntermUnary* node = addUnaryNode(op, child, loc);
|
||||||
node->setType(type);
|
node->setType(type);
|
||||||
@ -281,7 +281,8 @@ TIntermUnary* TIntermediate::addUnaryNode(TOperator op, TIntermTyped* child, TSo
|
|||||||
// Returns nullptr if the 'right' type could not be converted to match the 'left' type,
|
// Returns nullptr if the 'right' type could not be converted to match the 'left' type,
|
||||||
// or the resulting operation cannot be properly promoted.
|
// or the resulting operation cannot be properly promoted.
|
||||||
//
|
//
|
||||||
TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc loc)
|
TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right,
|
||||||
|
const TSourceLoc& loc)
|
||||||
{
|
{
|
||||||
// No block assignment
|
// No block assignment
|
||||||
if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock)
|
if (left->getType().getBasicType() == EbtBlock || right->getType().getBasicType() == EbtBlock)
|
||||||
@ -290,9 +291,7 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
|
|||||||
// Convert "reference += int" to "reference = reference + int". We need this because the
|
// Convert "reference += int" to "reference = reference + int". We need this because the
|
||||||
// "reference + int" calculation involves a cast back to the original type, which makes it
|
// "reference + int" calculation involves a cast back to the original type, which makes it
|
||||||
// not an lvalue.
|
// not an lvalue.
|
||||||
if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference() &&
|
if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference()) {
|
||||||
extensionRequested(E_GL_EXT_buffer_reference2)) {
|
|
||||||
|
|
||||||
if (!(right->getType().isScalar() && right->getType().isIntegerDomain()))
|
if (!(right->getType().isScalar() && right->getType().isIntegerDomain()))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@ -338,7 +337,8 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
|
|||||||
// Returns the added node.
|
// Returns the added node.
|
||||||
// The caller should set the type of the returned node.
|
// The caller should set the type of the returned node.
|
||||||
//
|
//
|
||||||
TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc loc)
|
TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index,
|
||||||
|
const TSourceLoc& loc)
|
||||||
{
|
{
|
||||||
// caller should set the type
|
// caller should set the type
|
||||||
return addBinaryNode(op, base, index, loc);
|
return addBinaryNode(op, base, index, loc);
|
||||||
@ -349,7 +349,8 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT
|
|||||||
//
|
//
|
||||||
// Returns the added node.
|
// Returns the added node.
|
||||||
//
|
//
|
||||||
TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSourceLoc loc)
|
TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child,
|
||||||
|
const TSourceLoc& loc)
|
||||||
{
|
{
|
||||||
if (child == 0)
|
if (child == 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -495,7 +496,8 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOper
|
|||||||
// Returns an aggregate node, which could be the one passed in if
|
// Returns an aggregate node, which could be the one passed in if
|
||||||
// it was already an aggregate.
|
// it was already an aggregate.
|
||||||
//
|
//
|
||||||
TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, const TType& type, TSourceLoc loc)
|
TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, const TType& type,
|
||||||
|
const TSourceLoc& loc)
|
||||||
{
|
{
|
||||||
TIntermAggregate* aggNode;
|
TIntermAggregate* aggNode;
|
||||||
|
|
||||||
@ -510,8 +512,6 @@ TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator o
|
|||||||
//
|
//
|
||||||
aggNode = new TIntermAggregate();
|
aggNode = new TIntermAggregate();
|
||||||
aggNode->getSequence().push_back(node);
|
aggNode->getSequence().push_back(node);
|
||||||
if (loc.line == 0)
|
|
||||||
loc = node->getLoc();
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
aggNode = new TIntermAggregate();
|
aggNode = new TIntermAggregate();
|
||||||
@ -520,8 +520,8 @@ TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator o
|
|||||||
// Set the operator.
|
// Set the operator.
|
||||||
//
|
//
|
||||||
aggNode->setOperator(op);
|
aggNode->setOperator(op);
|
||||||
if (loc.line != 0)
|
if (loc.line != 0 || node != nullptr)
|
||||||
aggNode->setLoc(loc);
|
aggNode->setLoc(loc.line != 0 ? loc : node->getLoc());
|
||||||
|
|
||||||
aggNode->setType(type);
|
aggNode->setType(type);
|
||||||
|
|
||||||
@ -819,22 +819,25 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
|||||||
node->getBasicType() == EbtFloat ||
|
node->getBasicType() == EbtFloat ||
|
||||||
node->getBasicType() == EbtDouble);
|
node->getBasicType() == EbtDouble);
|
||||||
|
|
||||||
if (! getArithemeticInt8Enabled()) {
|
if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) ||
|
||||||
if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) ||
|
((node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8) && ! convertToIntTypes)) {
|
||||||
((node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8) && ! convertToIntTypes))
|
if (! getArithemeticInt8Enabled()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! getArithemeticInt16Enabled()) {
|
if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) ||
|
||||||
if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) ||
|
((node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16) && ! convertToIntTypes)) {
|
||||||
((node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16) && ! convertToIntTypes))
|
if (! getArithemeticInt16Enabled()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! getArithemeticFloat16Enabled()) {
|
if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) ||
|
||||||
if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) ||
|
(node->getBasicType() == EbtFloat16 && ! convertToFloatTypes)) {
|
||||||
(node->getBasicType() == EbtFloat16 && ! convertToFloatTypes))
|
if (! getArithemeticFloat16Enabled()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -887,7 +890,7 @@ TIntermTyped* TIntermediate::addConversion(TBasicType convertTo, TIntermTyped* n
|
|||||||
// Returns the converted pair of nodes.
|
// Returns the converted pair of nodes.
|
||||||
// Returns <nullptr, nullptr> when there is no conversion.
|
// Returns <nullptr, nullptr> when there is no conversion.
|
||||||
std::tuple<TIntermTyped*, TIntermTyped*>
|
std::tuple<TIntermTyped*, TIntermTyped*>
|
||||||
TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* node1)
|
TIntermediate::addPairConversion(TOperator op, TIntermTyped* node0, TIntermTyped* node1)
|
||||||
{
|
{
|
||||||
if (!isConversionAllowed(op, node0) || !isConversionAllowed(op, node1))
|
if (!isConversionAllowed(op, node0) || !isConversionAllowed(op, node1))
|
||||||
return std::make_tuple(nullptr, nullptr);
|
return std::make_tuple(nullptr, nullptr);
|
||||||
@ -940,7 +943,7 @@ TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* no
|
|||||||
if (node0->getBasicType() == node1->getBasicType())
|
if (node0->getBasicType() == node1->getBasicType())
|
||||||
return std::make_tuple(node0, node1);
|
return std::make_tuple(node0, node1);
|
||||||
|
|
||||||
promoteTo = getConversionDestinatonType(node0->getBasicType(), node1->getBasicType(), op);
|
promoteTo = getConversionDestinationType(node0->getBasicType(), node1->getBasicType(), op);
|
||||||
if (std::get<0>(promoteTo) == EbtNumTypes || std::get<1>(promoteTo) == EbtNumTypes)
|
if (std::get<0>(promoteTo) == EbtNumTypes || std::get<1>(promoteTo) == EbtNumTypes)
|
||||||
return std::make_tuple(nullptr, nullptr);
|
return std::make_tuple(nullptr, nullptr);
|
||||||
|
|
||||||
@ -1040,64 +1043,30 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
// Note: callers are responsible for other aspects of shape,
|
// Note: callers are responsible for other aspects of shape,
|
||||||
// like vector and matrix sizes.
|
// like vector and matrix sizes.
|
||||||
|
|
||||||
TBasicType promoteTo;
|
|
||||||
// GL_EXT_shader_16bit_storage can't do OpConstantComposite with
|
|
||||||
// 16-bit types, so disable promotion for those types.
|
|
||||||
bool canPromoteConstant = true;
|
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
//
|
//
|
||||||
// Explicit conversions (unary operations)
|
// Explicit conversions (unary operations)
|
||||||
//
|
//
|
||||||
case EOpConstructBool:
|
case EOpConstructBool:
|
||||||
promoteTo = EbtBool;
|
|
||||||
break;
|
|
||||||
case EOpConstructFloat:
|
case EOpConstructFloat:
|
||||||
promoteTo = EbtFloat;
|
|
||||||
break;
|
|
||||||
case EOpConstructInt:
|
case EOpConstructInt:
|
||||||
promoteTo = EbtInt;
|
|
||||||
break;
|
|
||||||
case EOpConstructUint:
|
case EOpConstructUint:
|
||||||
promoteTo = EbtUint;
|
|
||||||
break;
|
|
||||||
#ifndef GLSLANG_WEB
|
#ifndef GLSLANG_WEB
|
||||||
case EOpConstructDouble:
|
case EOpConstructDouble:
|
||||||
promoteTo = EbtDouble;
|
|
||||||
break;
|
|
||||||
case EOpConstructFloat16:
|
case EOpConstructFloat16:
|
||||||
promoteTo = EbtFloat16;
|
|
||||||
canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
|
|
||||||
break;
|
|
||||||
case EOpConstructInt8:
|
case EOpConstructInt8:
|
||||||
promoteTo = EbtInt8;
|
|
||||||
canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
|
|
||||||
break;
|
|
||||||
case EOpConstructUint8:
|
case EOpConstructUint8:
|
||||||
promoteTo = EbtUint8;
|
|
||||||
canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
|
|
||||||
break;
|
|
||||||
case EOpConstructInt16:
|
case EOpConstructInt16:
|
||||||
promoteTo = EbtInt16;
|
|
||||||
canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
|
||||||
break;
|
|
||||||
case EOpConstructUint16:
|
case EOpConstructUint16:
|
||||||
promoteTo = EbtUint16;
|
|
||||||
canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
|
||||||
break;
|
|
||||||
case EOpConstructInt64:
|
case EOpConstructInt64:
|
||||||
promoteTo = EbtInt64;
|
|
||||||
break;
|
|
||||||
case EOpConstructUint64:
|
case EOpConstructUint64:
|
||||||
promoteTo = EbtUint64;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Implicit conversions
|
||||||
|
//
|
||||||
case EOpLogicalNot:
|
case EOpLogicalNot:
|
||||||
|
|
||||||
case EOpFunctionCall:
|
case EOpFunctionCall:
|
||||||
@ -1152,9 +1121,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
if (type.getBasicType() == node->getType().getBasicType())
|
if (type.getBasicType() == node->getType().getBasicType())
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
if (canImplicitlyPromote(node->getBasicType(), type.getBasicType(), op))
|
if (! canImplicitlyPromote(node->getBasicType(), type.getBasicType(), op))
|
||||||
promoteTo = type.getBasicType();
|
|
||||||
else
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1164,9 +1131,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
case EOpLeftShiftAssign:
|
case EOpLeftShiftAssign:
|
||||||
case EOpRightShiftAssign:
|
case EOpRightShiftAssign:
|
||||||
{
|
{
|
||||||
if (getSource() == EShSourceHlsl && node->getType().getBasicType() == EbtBool)
|
if (!(getSource() == EShSourceHlsl && node->getType().getBasicType() == EbtBool)) {
|
||||||
promoteTo = type.getBasicType();
|
|
||||||
else {
|
|
||||||
if (isTypeInt(type.getBasicType()) && isTypeInt(node->getBasicType()))
|
if (isTypeInt(type.getBasicType()) && isTypeInt(node->getBasicType()))
|
||||||
return node;
|
return node;
|
||||||
else
|
else
|
||||||
@ -1184,13 +1149,42 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool canPromoteConstant = true;
|
||||||
|
#ifndef GLSLANG_WEB
|
||||||
|
// GL_EXT_shader_16bit_storage can't do OpConstantComposite with
|
||||||
|
// 16-bit types, so disable promotion for those types.
|
||||||
|
// Many issues with this, from JohnK:
|
||||||
|
// - this isn't really right to discuss SPIR-V here
|
||||||
|
// - this could easily be entirely about scalars, so is overstepping
|
||||||
|
// - we should be looking at what the shader asked for, and saying whether or
|
||||||
|
// not it can be done, in the parser, by calling requireExtensions(), not
|
||||||
|
// changing language sementics on the fly by asking what extensions are in use
|
||||||
|
// - at the time of this writing (14-Aug-2020), no test results are changed by this.
|
||||||
|
switch (op) {
|
||||||
|
case EOpConstructFloat16:
|
||||||
|
canPromoteConstant = numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) ||
|
||||||
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_float16);
|
||||||
|
break;
|
||||||
|
case EOpConstructInt8:
|
||||||
|
case EOpConstructUint8:
|
||||||
|
canPromoteConstant = numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) ||
|
||||||
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int8);
|
||||||
|
break;
|
||||||
|
case EOpConstructInt16:
|
||||||
|
case EOpConstructUint16:
|
||||||
|
canPromoteConstant = numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) ||
|
||||||
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int16);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (canPromoteConstant && node->getAsConstantUnion())
|
if (canPromoteConstant && node->getAsConstantUnion())
|
||||||
return promoteConstantUnion(promoteTo, node->getAsConstantUnion());
|
return promoteConstantUnion(type.getBasicType(), node->getAsConstantUnion());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add a new newNode for the conversion.
|
// Add a new newNode for the conversion.
|
||||||
//
|
//
|
||||||
TIntermTyped* newNode = createConversion(promoteTo, node);
|
TIntermTyped* newNode = createConversion(type.getBasicType(), node);
|
||||||
|
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
@ -1659,64 +1653,45 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool explicitTypesEnabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
if (getSource() == EShSourceHlsl) {
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8) ||
|
// HLSL
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16) ||
|
if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int32) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int64) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float32) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float64);
|
|
||||||
|
|
||||||
if (explicitTypesEnabled) {
|
|
||||||
// integral promotions
|
|
||||||
if (isIntegralPromotion(from, to)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
|
// GLSL
|
||||||
|
if (isIntegralPromotion(from, to) ||
|
||||||
|
isFPPromotion(from, to) ||
|
||||||
|
isIntegralConversion(from, to) ||
|
||||||
|
isFPConversion(from, to) ||
|
||||||
|
isFPIntegralConversion(from, to)) {
|
||||||
|
|
||||||
// floating-point promotions
|
if (numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) ||
|
||||||
if (isFPPromotion(from, to)) {
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int8) ||
|
||||||
return true;
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int16) ||
|
||||||
}
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int32) ||
|
||||||
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int64) ||
|
||||||
// integral conversions
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_float16) ||
|
||||||
if (isIntegralConversion(from, to)) {
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_float32) ||
|
||||||
return true;
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_float64)) {
|
||||||
}
|
|
||||||
|
|
||||||
// floating-point conversions
|
|
||||||
if (isFPConversion(from, to)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// floating-integral conversions
|
|
||||||
if (isFPIntegralConversion(from, to)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// hlsl supported conversions
|
|
||||||
if (getSource() == EShSourceHlsl) {
|
|
||||||
if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (isEsProfile()) {
|
}
|
||||||
|
|
||||||
|
if (isEsProfile()) {
|
||||||
switch (to) {
|
switch (to) {
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
return extensionRequested(E_GL_EXT_shader_implicit_conversions);
|
return numericFeatures.contains(TNumericFeatures::shader_implicit_conversions);
|
||||||
case EbtFloat:
|
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
return extensionRequested(E_GL_EXT_shader_implicit_conversions);
|
return numericFeatures.contains(TNumericFeatures::shader_implicit_conversions);
|
||||||
case EbtUint:
|
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1732,15 +1707,14 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
return version >= 400 || numericFeatures.contains(TNumericFeatures::gpu_shader_fp64);
|
||||||
return version >= 400 || extensionRequested(E_GL_ARB_gpu_shader_fp64);
|
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return (version >= 400 || extensionRequested(E_GL_ARB_gpu_shader_fp64)) &&
|
return (version >= 400 || numericFeatures.contains(TNumericFeatures::gpu_shader_fp64)) &&
|
||||||
extensionRequested(E_GL_AMD_gpu_shader_int16);
|
numericFeatures.contains(TNumericFeatures::gpu_shader_int16);
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
return (version >= 400 || extensionRequested(E_GL_ARB_gpu_shader_fp64)) &&
|
return (version >= 400 || numericFeatures.contains(TNumericFeatures::gpu_shader_fp64)) &&
|
||||||
extensionRequested(E_GL_AMD_gpu_shader_half_float);
|
numericFeatures.contains(TNumericFeatures::gpu_shader_half_float);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1748,16 +1722,15 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
case EbtFloat:
|
|
||||||
return true;
|
return true;
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return getSource() == EShSourceHlsl;
|
return getSource() == EShSourceHlsl;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return numericFeatures.contains(TNumericFeatures::gpu_shader_int16);
|
||||||
case EbtFloat16:
|
case EbtFloat16:
|
||||||
return
|
return numericFeatures.contains(TNumericFeatures::gpu_shader_half_float) ||
|
||||||
extensionRequested(E_GL_AMD_gpu_shader_half_float) || getSource() == EShSourceHlsl;
|
getSource() == EShSourceHlsl;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1765,24 +1738,20 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
return version >= 400 || getSource() == EShSourceHlsl;
|
return version >= 400 || getSource() == EShSourceHlsl;
|
||||||
case EbtUint:
|
|
||||||
return true;
|
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return getSource() == EShSourceHlsl;
|
return getSource() == EShSourceHlsl;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return numericFeatures.contains(TNumericFeatures::gpu_shader_int16);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
|
||||||
return true;
|
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return getSource() == EShSourceHlsl;
|
return getSource() == EShSourceHlsl;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return numericFeatures.contains(TNumericFeatures::gpu_shader_int16);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1791,21 +1760,19 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
case EbtUint64:
|
|
||||||
return true;
|
return true;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return numericFeatures.contains(TNumericFeatures::gpu_shader_int16);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtInt64:
|
|
||||||
return true;
|
return true;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return numericFeatures.contains(TNumericFeatures::gpu_shader_int16);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1813,9 +1780,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return numericFeatures.contains(TNumericFeatures::gpu_shader_int16);
|
||||||
case EbtFloat16:
|
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_half_float);
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1823,8 +1788,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
return numericFeatures.contains(TNumericFeatures::gpu_shader_int16);
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1951,13 +1915,13 @@ static TBasicType getCorrespondingUnsignedType(TBasicType type)
|
|||||||
// integer type corresponding to the type of the operand with signed
|
// integer type corresponding to the type of the operand with signed
|
||||||
// integer type.
|
// integer type.
|
||||||
|
|
||||||
std::tuple<TBasicType, TBasicType> TIntermediate::getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const
|
std::tuple<TBasicType, TBasicType> TIntermediate::getConversionDestinationType(TBasicType type0, TBasicType type1, TOperator op) const
|
||||||
{
|
{
|
||||||
TBasicType res0 = EbtNumTypes;
|
TBasicType res0 = EbtNumTypes;
|
||||||
TBasicType res1 = EbtNumTypes;
|
TBasicType res1 = EbtNumTypes;
|
||||||
|
|
||||||
if ((isEsProfile() &&
|
if ((isEsProfile() &&
|
||||||
(version < 310 || !extensionRequested(E_GL_EXT_shader_implicit_conversions))) ||
|
(version < 310 || !numericFeatures.contains(TNumericFeatures::shader_implicit_conversions))) ||
|
||||||
version == 110)
|
version == 110)
|
||||||
return std::make_tuple(res0, res1);
|
return std::make_tuple(res0, res1);
|
||||||
|
|
||||||
@ -2490,7 +2454,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
|
|||||||
//
|
//
|
||||||
// Get compatible types.
|
// Get compatible types.
|
||||||
//
|
//
|
||||||
auto children = addConversion(EOpSequence, trueBlock, falseBlock);
|
auto children = addPairConversion(EOpSequence, trueBlock, falseBlock);
|
||||||
trueBlock = std::get<0>(children);
|
trueBlock = std::get<0>(children);
|
||||||
falseBlock = std::get<1>(children);
|
falseBlock = std::get<1>(children);
|
||||||
|
|
||||||
|
@ -751,8 +751,11 @@ TIntermTyped* TParseContext::handleBinaryMath(const TSourceLoc& loc, const char*
|
|||||||
}
|
}
|
||||||
|
|
||||||
TIntermTyped* result = nullptr;
|
TIntermTyped* result = nullptr;
|
||||||
if (allowed)
|
if (allowed) {
|
||||||
|
if ((left->isReference() || right->isReference()))
|
||||||
|
requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "buffer reference math");
|
||||||
result = intermediate.addBinaryMath(op, left, right, loc);
|
result = intermediate.addBinaryMath(op, left, right, loc);
|
||||||
|
}
|
||||||
|
|
||||||
if (result == nullptr)
|
if (result == nullptr)
|
||||||
binaryOpError(loc, str, left->getCompleteString(), right->getCompleteString());
|
binaryOpError(loc, str, left->getCompleteString(), right->getCompleteString());
|
||||||
@ -1680,6 +1683,14 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TIntermTyped* TParseContext::addAssign(const TSourceLoc& loc, TOperator op, TIntermTyped* left, TIntermTyped* right)
|
||||||
|
{
|
||||||
|
if ((op == EOpAddAssign || op == EOpSubAssign) && left->isReference())
|
||||||
|
requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "+= and -= on a buffer reference");
|
||||||
|
|
||||||
|
return intermediate.addAssign(op, left, right, loc);
|
||||||
|
}
|
||||||
|
|
||||||
void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& fnCandidate, const TIntermOperator& callNode)
|
void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& fnCandidate, const TIntermOperator& callNode)
|
||||||
{
|
{
|
||||||
const TIntermSequence* argp = &callNode.getAsAggregate()->getSequence();
|
const TIntermSequence* argp = &callNode.getAsAggregate()->getSequence();
|
||||||
@ -7305,6 +7316,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
|||||||
if (!node->getType().isCoopMat()) {
|
if (!node->getType().isCoopMat()) {
|
||||||
if (type.getBasicType() != node->getType().getBasicType()) {
|
if (type.getBasicType() != node->getType().getBasicType()) {
|
||||||
node = intermediate.addConversion(type.getBasicType(), node);
|
node = intermediate.addConversion(type.getBasicType(), node);
|
||||||
|
if (node == nullptr)
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
node = intermediate.setAggregateOperator(node, EOpConstructCooperativeMatrix, type, node->getLoc());
|
node = intermediate.setAggregateOperator(node, EOpConstructCooperativeMatrix, type, node->getLoc());
|
||||||
} else {
|
} else {
|
||||||
|
@ -328,6 +328,7 @@ public:
|
|||||||
TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*);
|
TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*);
|
||||||
void addInputArgumentConversions(const TFunction&, TIntermNode*&) const;
|
void addInputArgumentConversions(const TFunction&, TIntermNode*&) const;
|
||||||
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const;
|
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const;
|
||||||
|
TIntermTyped* addAssign(const TSourceLoc&, TOperator op, TIntermTyped* left, TIntermTyped* right);
|
||||||
void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);
|
void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);
|
||||||
void nonOpBuiltInCheck(const TSourceLoc&, const TFunction&, TIntermAggregate&);
|
void nonOpBuiltInCheck(const TSourceLoc&, const TFunction&, TIntermAggregate&);
|
||||||
void userFunctionCallCheck(const TSourceLoc&, TIntermAggregate&);
|
void userFunctionCallCheck(const TSourceLoc&, TIntermAggregate&);
|
||||||
|
@ -762,7 +762,8 @@ bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExte
|
|||||||
// Use when there are no profile/version to check, it's just an error if one of the
|
// Use when there are no profile/version to check, it's just an error if one of the
|
||||||
// extensions is not present.
|
// extensions is not present.
|
||||||
//
|
//
|
||||||
void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc)
|
void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[],
|
||||||
|
const char* featureDesc)
|
||||||
{
|
{
|
||||||
if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc))
|
if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc))
|
||||||
return;
|
return;
|
||||||
@ -781,7 +782,8 @@ void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions,
|
|||||||
// Use by preprocessor when there are no profile/version to check, it's just an error if one of the
|
// Use by preprocessor when there are no profile/version to check, it's just an error if one of the
|
||||||
// extensions is not present.
|
// extensions is not present.
|
||||||
//
|
//
|
||||||
void TParseVersions::ppRequireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc)
|
void TParseVersions::ppRequireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[],
|
||||||
|
const char* featureDesc)
|
||||||
{
|
{
|
||||||
if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc))
|
if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc))
|
||||||
return;
|
return;
|
||||||
@ -847,6 +849,7 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
|
|||||||
error(getCurrentLoc(), "behavior not supported:", "#extension", behaviorString);
|
error(getCurrentLoc(), "behavior not supported:", "#extension", behaviorString);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bool on = behavior != EBhDisable;
|
||||||
|
|
||||||
// check if extension is used with correct shader stage
|
// check if extension is used with correct shader stage
|
||||||
checkExtensionStage(getCurrentLoc(), extension);
|
checkExtensionStage(getCurrentLoc(), extension);
|
||||||
@ -916,6 +919,32 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
|
|||||||
updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_int64", behaviorString);
|
updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_int64", behaviorString);
|
||||||
else if (strcmp(extension, "GL_EXT_shader_subgroup_extended_types_float16") == 0)
|
else if (strcmp(extension, "GL_EXT_shader_subgroup_extended_types_float16") == 0)
|
||||||
updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_float16", behaviorString);
|
updateExtensionBehavior(line, "GL_EXT_shader_explicit_arithmetic_types_float16", behaviorString);
|
||||||
|
|
||||||
|
// see if we need to update the numeric features
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_explicit_arithmetic_types") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_explicit_arithmetic_types, on);
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_explicit_arithmetic_types_int8") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_explicit_arithmetic_types_int8, on);
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_explicit_arithmetic_types_int16") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_explicit_arithmetic_types_int16, on);
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_explicit_arithmetic_types_int32") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_explicit_arithmetic_types_int32, on);
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_explicit_arithmetic_types_int64") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_explicit_arithmetic_types_int64, on);
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_explicit_arithmetic_types_float16") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_explicit_arithmetic_types_float16, on);
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_explicit_arithmetic_types_float32") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_explicit_arithmetic_types_float32, on);
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_explicit_arithmetic_types_float64") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_explicit_arithmetic_types_float64, on);
|
||||||
|
else if (strcmp(extension, "GL_EXT_shader_implicit_conversions") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::shader_implicit_conversions, on);
|
||||||
|
else if (strcmp(extension, "GL_ARB_gpu_shader_fp64") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::gpu_shader_fp64, on);
|
||||||
|
else if (strcmp(extension, "GL_AMD_gpu_shader_int16") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::gpu_shader_int16, on);
|
||||||
|
else if (strcmp(extension, "GL_AMD_gpu_shader_half_float") == 0)
|
||||||
|
intermediate.updateNumericFeature(TNumericFeatures::gpu_shader_half_float, on);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior)
|
void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior)
|
||||||
@ -951,8 +980,8 @@ void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBe
|
|||||||
} else {
|
} else {
|
||||||
if (iter->second == EBhDisablePartial)
|
if (iter->second == EBhDisablePartial)
|
||||||
warn(getCurrentLoc(), "extension is only partially supported:", "#extension", extension);
|
warn(getCurrentLoc(), "extension is only partially supported:", "#extension", extension);
|
||||||
if (behavior == EBhEnable || behavior == EBhRequire || behavior == EBhDisable)
|
if (behavior != EBhDisable)
|
||||||
intermediate.updateRequestedExtension(extension, behavior);
|
intermediate.addRequestedExtension(extension);
|
||||||
iter->second = behavior;
|
iter->second = behavior;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -778,7 +778,7 @@ assignment_expression
|
|||||||
parseContext.specializationCheck($2.loc, $1->getType(), "=");
|
parseContext.specializationCheck($2.loc, $1->getType(), "=");
|
||||||
parseContext.lValueErrorCheck($2.loc, "assign", $1);
|
parseContext.lValueErrorCheck($2.loc, "assign", $1);
|
||||||
parseContext.rValueErrorCheck($2.loc, "assign", $3);
|
parseContext.rValueErrorCheck($2.loc, "assign", $3);
|
||||||
$$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc);
|
$$ = parseContext.addAssign($2.loc, $2.op, $1, $3);
|
||||||
if ($$ == 0) {
|
if ($$ == 0) {
|
||||||
parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
|
parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
|
@ -778,7 +778,7 @@ assignment_expression
|
|||||||
parseContext.specializationCheck($2.loc, $1->getType(), "=");
|
parseContext.specializationCheck($2.loc, $1->getType(), "=");
|
||||||
parseContext.lValueErrorCheck($2.loc, "assign", $1);
|
parseContext.lValueErrorCheck($2.loc, "assign", $1);
|
||||||
parseContext.rValueErrorCheck($2.loc, "assign", $3);
|
parseContext.rValueErrorCheck($2.loc, "assign", $3);
|
||||||
$$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc);
|
$$ = parseContext.addAssign($2.loc, $2.op, $1, $3);
|
||||||
if ($$ == 0) {
|
if ($$ == 0) {
|
||||||
parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
|
parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
@ -3885,4 +3885,3 @@ single_attribute
|
|||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -30,8 +30,8 @@
|
|||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||||
# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
|
# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
|
||||||
/* Debug traces. */
|
/* Debug traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG 1
|
# define YYDEBUG 1
|
||||||
@ -470,7 +470,7 @@ extern int yydebug;
|
|||||||
|
|
||||||
union YYSTYPE
|
union YYSTYPE
|
||||||
{
|
{
|
||||||
#line 97 "glslang.y" /* yacc.c:1909 */
|
#line 97 "MachineIndependent/glslang.y" /* yacc.c:1909 */
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
glslang::TSourceLoc loc;
|
glslang::TSourceLoc loc;
|
||||||
@ -506,7 +506,7 @@ union YYSTYPE
|
|||||||
glslang::TArraySizes* typeParameters;
|
glslang::TArraySizes* typeParameters;
|
||||||
} interm;
|
} interm;
|
||||||
|
|
||||||
#line 510 "glslang_tab.cpp.h" /* yacc.c:1909 */
|
#line 510 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef union YYSTYPE YYSTYPE;
|
typedef union YYSTYPE YYSTYPE;
|
||||||
@ -518,4 +518,4 @@ typedef union YYSTYPE YYSTYPE;
|
|||||||
|
|
||||||
int yyparse (glslang::TParseContext* pParseContext);
|
int yyparse (glslang::TParseContext* pParseContext);
|
||||||
|
|
||||||
#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */
|
#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */
|
||||||
|
@ -1466,7 +1466,7 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
|||||||
infoSink.debug << "Shader version: " << version << "\n";
|
infoSink.debug << "Shader version: " << version << "\n";
|
||||||
if (requestedExtensions.size() > 0) {
|
if (requestedExtensions.size() > 0) {
|
||||||
for (auto extIt = requestedExtensions.begin(); extIt != requestedExtensions.end(); ++extIt)
|
for (auto extIt = requestedExtensions.begin(); extIt != requestedExtensions.end(); ++extIt)
|
||||||
infoSink.debug << "Requested " << extIt->first << "\n";
|
infoSink.debug << "Requested " << *extIt << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xfbMode)
|
if (xfbMode)
|
||||||
|
@ -233,6 +233,31 @@ private:
|
|||||||
TMap<TString, int> maps[EsiCount];
|
TMap<TString, int> maps[EsiCount];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TNumericFeatures {
|
||||||
|
public:
|
||||||
|
TNumericFeatures() : features(0) { }
|
||||||
|
TNumericFeatures(const TNumericFeatures&) = delete;
|
||||||
|
TNumericFeatures& operator=(const TNumericFeatures&) = delete;
|
||||||
|
typedef enum : unsigned int {
|
||||||
|
shader_explicit_arithmetic_types = 1 << 0,
|
||||||
|
shader_explicit_arithmetic_types_int8 = 1 << 1,
|
||||||
|
shader_explicit_arithmetic_types_int16 = 1 << 2,
|
||||||
|
shader_explicit_arithmetic_types_int32 = 1 << 3,
|
||||||
|
shader_explicit_arithmetic_types_int64 = 1 << 4,
|
||||||
|
shader_explicit_arithmetic_types_float16 = 1 << 5,
|
||||||
|
shader_explicit_arithmetic_types_float32 = 1 << 6,
|
||||||
|
shader_explicit_arithmetic_types_float64 = 1 << 7,
|
||||||
|
shader_implicit_conversions = 1 << 8,
|
||||||
|
gpu_shader_fp64 = 1 << 9,
|
||||||
|
gpu_shader_int16 = 1 << 10,
|
||||||
|
gpu_shader_half_float = 1 << 11,
|
||||||
|
} feature;
|
||||||
|
void insert(feature f) { features |= f; }
|
||||||
|
void erase(feature f) { features &= ~f; }
|
||||||
|
bool contains(feature f) const { return (features & f) != 0; }
|
||||||
|
private:
|
||||||
|
unsigned int features;
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set of helper functions to help parse and build the tree.
|
// Set of helper functions to help parse and build the tree.
|
||||||
@ -371,15 +396,8 @@ public:
|
|||||||
}
|
}
|
||||||
const SpvVersion& getSpv() const { return spvVersion; }
|
const SpvVersion& getSpv() const { return spvVersion; }
|
||||||
EShLanguage getStage() const { return language; }
|
EShLanguage getStage() const { return language; }
|
||||||
void updateRequestedExtension(const char* extension, TExtensionBehavior behavior) {
|
void addRequestedExtension(const char* extension) { requestedExtensions.insert(extension); }
|
||||||
if(requestedExtensions.find(extension) != requestedExtensions.end()) {
|
const std::set<std::string>& getRequestedExtensions() const { return requestedExtensions; }
|
||||||
requestedExtensions[extension] = behavior;
|
|
||||||
} else {
|
|
||||||
requestedExtensions.insert(std::make_pair(extension, behavior));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::map<std::string, TExtensionBehavior>& getRequestedExtensions() const { return requestedExtensions; }
|
|
||||||
|
|
||||||
void setTreeRoot(TIntermNode* r) { treeRoot = r; }
|
void setTreeRoot(TIntermNode* r) { treeRoot = r; }
|
||||||
TIntermNode* getTreeRoot() const { return treeRoot; }
|
TIntermNode* getTreeRoot() const { return treeRoot; }
|
||||||
@ -425,15 +443,15 @@ public:
|
|||||||
TIntermSymbol* addSymbol(const TType&, const TSourceLoc&);
|
TIntermSymbol* addSymbol(const TType&, const TSourceLoc&);
|
||||||
TIntermSymbol* addSymbol(const TIntermSymbol&);
|
TIntermSymbol* addSymbol(const TIntermSymbol&);
|
||||||
TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*);
|
TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*);
|
||||||
std::tuple<TIntermTyped*, TIntermTyped*> addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* node1);
|
std::tuple<TIntermTyped*, TIntermTyped*> addPairConversion(TOperator op, TIntermTyped* node0, TIntermTyped* node1);
|
||||||
TIntermTyped* addUniShapeConversion(TOperator, const TType&, TIntermTyped*);
|
TIntermTyped* addUniShapeConversion(TOperator, const TType&, TIntermTyped*);
|
||||||
TIntermTyped* addConversion(TBasicType convertTo, TIntermTyped* node) const;
|
TIntermTyped* addConversion(TBasicType convertTo, TIntermTyped* node) const;
|
||||||
void addBiShapeConversion(TOperator, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode);
|
void addBiShapeConversion(TOperator, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode);
|
||||||
TIntermTyped* addShapeConversion(const TType&, TIntermTyped*);
|
TIntermTyped* addShapeConversion(const TType&, TIntermTyped*);
|
||||||
TIntermTyped* addBinaryMath(TOperator, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
|
TIntermTyped* addBinaryMath(TOperator, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
|
||||||
TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
|
TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
|
||||||
TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc);
|
TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&);
|
||||||
TIntermTyped* addUnaryMath(TOperator, TIntermTyped* child, TSourceLoc);
|
TIntermTyped* addUnaryMath(TOperator, TIntermTyped* child, const TSourceLoc&);
|
||||||
TIntermTyped* addBuiltInFunctionCall(const TSourceLoc& line, TOperator, bool unary, TIntermNode*, const TType& returnType);
|
TIntermTyped* addBuiltInFunctionCall(const TSourceLoc& line, TOperator, bool unary, TIntermNode*, const TType& returnType);
|
||||||
bool canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op = EOpNull) const;
|
bool canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op = EOpNull) const;
|
||||||
bool isIntegralPromotion(TBasicType from, TBasicType to) const;
|
bool isIntegralPromotion(TBasicType from, TBasicType to) const;
|
||||||
@ -447,7 +465,7 @@ public:
|
|||||||
TIntermAggregate* makeAggregate(TIntermNode* node);
|
TIntermAggregate* makeAggregate(TIntermNode* node);
|
||||||
TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&);
|
TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&);
|
||||||
TIntermAggregate* makeAggregate(const TSourceLoc&);
|
TIntermAggregate* makeAggregate(const TSourceLoc&);
|
||||||
TIntermTyped* setAggregateOperator(TIntermNode*, TOperator, const TType& type, TSourceLoc);
|
TIntermTyped* setAggregateOperator(TIntermNode*, TOperator, const TType& type, const TSourceLoc&);
|
||||||
bool areAllChildConst(TIntermAggregate* aggrNode);
|
bool areAllChildConst(TIntermAggregate* aggrNode);
|
||||||
TIntermSelection* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&);
|
TIntermSelection* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&);
|
||||||
TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&);
|
TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&);
|
||||||
@ -476,10 +494,11 @@ public:
|
|||||||
|
|
||||||
// Low level functions to add nodes (no conversions or other higher level transformations)
|
// Low level functions to add nodes (no conversions or other higher level transformations)
|
||||||
// If a type is provided, the node's type will be set to it.
|
// If a type is provided, the node's type will be set to it.
|
||||||
TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc) const;
|
TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&) const;
|
||||||
TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc, const TType&) const;
|
TIntermBinary* addBinaryNode(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&,
|
||||||
TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc) const;
|
const TType&) const;
|
||||||
TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc, const TType&) const;
|
TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, const TSourceLoc&) const;
|
||||||
|
TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, const TSourceLoc&, const TType&) const;
|
||||||
|
|
||||||
// Constant folding (in Constant.cpp)
|
// Constant folding (in Constant.cpp)
|
||||||
TIntermTyped* fold(TIntermAggregate* aggrNode);
|
TIntermTyped* fold(TIntermAggregate* aggrNode);
|
||||||
@ -866,22 +885,25 @@ public:
|
|||||||
bool getArithemeticInt8Enabled() const { return false; }
|
bool getArithemeticInt8Enabled() const { return false; }
|
||||||
bool getArithemeticInt16Enabled() const { return false; }
|
bool getArithemeticInt16Enabled() const { return false; }
|
||||||
bool getArithemeticFloat16Enabled() const { return false; }
|
bool getArithemeticFloat16Enabled() const { return false; }
|
||||||
|
void updateNumericFeature(TNumericFeatures::feature f, bool on) { }
|
||||||
#else
|
#else
|
||||||
bool getArithemeticInt8Enabled() const {
|
bool getArithemeticInt8Enabled() const {
|
||||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) ||
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8);
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int8);
|
||||||
}
|
}
|
||||||
bool getArithemeticInt16Enabled() const {
|
bool getArithemeticInt16Enabled() const {
|
||||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) ||
|
||||||
extensionRequested(E_GL_AMD_gpu_shader_int16) ||
|
numericFeatures.contains(TNumericFeatures::gpu_shader_int16) ||
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16);
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_int16);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getArithemeticFloat16Enabled() const {
|
bool getArithemeticFloat16Enabled() const {
|
||||||
return extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
return numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types) ||
|
||||||
extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
|
numericFeatures.contains(TNumericFeatures::gpu_shader_half_float) ||
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16);
|
numericFeatures.contains(TNumericFeatures::shader_explicit_arithmetic_types_float16);
|
||||||
}
|
}
|
||||||
|
void updateNumericFeature(TNumericFeatures::feature f, bool on)
|
||||||
|
{ on ? numericFeatures.insert(f) : numericFeatures.erase(f); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -913,23 +935,7 @@ protected:
|
|||||||
bool specConstantPropagates(const TIntermTyped&, const TIntermTyped&);
|
bool specConstantPropagates(const TIntermTyped&, const TIntermTyped&);
|
||||||
void performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root);
|
void performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root);
|
||||||
bool isConversionAllowed(TOperator op, TIntermTyped* node) const;
|
bool isConversionAllowed(TOperator op, TIntermTyped* node) const;
|
||||||
std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const;
|
std::tuple<TBasicType, TBasicType> getConversionDestinationType(TBasicType type0, TBasicType type1, TOperator op) const;
|
||||||
|
|
||||||
// JohnK: I think this function should go away.
|
|
||||||
// This data structure is just a log to pass on to back ends.
|
|
||||||
// Versioning and extensions are handled in Version.cpp, with a rich
|
|
||||||
// set of functions for querying stages, versions, extension enable/disabled, etc.
|
|
||||||
#ifdef GLSLANG_WEB
|
|
||||||
bool extensionRequested(const char *extension) const { return false; }
|
|
||||||
#else
|
|
||||||
bool extensionRequested(const char *extension) const {
|
|
||||||
auto it = requestedExtensions.find(extension);
|
|
||||||
if (it != requestedExtensions.end()) {
|
|
||||||
return (it->second == EBhDisable) ? false : true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char* getResourceName(TResourceType);
|
static const char* getResourceName(TResourceType);
|
||||||
|
|
||||||
@ -948,7 +954,7 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
SpvVersion spvVersion;
|
SpvVersion spvVersion;
|
||||||
TIntermNode* treeRoot;
|
TIntermNode* treeRoot;
|
||||||
std::map<std::string, TExtensionBehavior> requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them
|
std::set<std::string> requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them
|
||||||
TBuiltInResource resources;
|
TBuiltInResource resources;
|
||||||
int numEntryPoints;
|
int numEntryPoints;
|
||||||
int numErrors;
|
int numErrors;
|
||||||
@ -1019,6 +1025,7 @@ protected:
|
|||||||
|
|
||||||
std::unordered_map<std::string, int> uniformLocationOverrides;
|
std::unordered_map<std::string, int> uniformLocationOverrides;
|
||||||
int uniformLocationBase;
|
int uniformLocationBase;
|
||||||
|
TNumericFeatures numericFeatures;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::unordered_set<int> usedConstantId; // specialization constant ids used
|
std::unordered_set<int> usedConstantId; // specialization constant ids used
|
||||||
|
@ -229,7 +229,7 @@ public:
|
|||||||
TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree
|
TIntermediate& intermediate; // helper for making and hooking up pieces of the parse tree
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TMap<TString, TExtensionBehavior> extensionBehavior; // for each extension string, what its current behavior is set to
|
TMap<TString, TExtensionBehavior> extensionBehavior; // for each extension string, what its current behavior is
|
||||||
TMap<TString, unsigned int> extensionMinSpv; // for each extension string, store minimum spirv required
|
TMap<TString, unsigned int> extensionMinSpv; // for each extension string, store minimum spirv required
|
||||||
EShMessages messages; // errors/warnings/rule-sets
|
EShMessages messages; // errors/warnings/rule-sets
|
||||||
int numErrors; // number of compile-time errors encountered
|
int numErrors; // number of compile-time errors encountered
|
||||||
|
Loading…
x
Reference in New Issue
Block a user