Commit c64a9dd6 by John Kessenich

Test: Make another test legal HLSL, and rationalize GLSL vs HLSL addConstructor().

parent bdbbc68e
...@@ -4,8 +4,10 @@ struct { ...@@ -4,8 +4,10 @@ struct {
float4 m[7]; float4 m[7];
} s[11]; } s[11];
float4 PixelShaderFunction(int i, float4 input[3]) : COLOR0 static float4 C = float4(1,2,3,4);
float4 PixelShaderFunction(int i : sem1, float4 input[3] : sem2) : SV_TARGET0
{ {
float4 b[10]; float4 b[10] = { C, C, C, C, C, C, C, C, C, C };
return a[1] + a[i] + input[2] + input[i] + b[5] + b[i] + s[i].m[i]; return a[1] + a[i] + input[2] + input[i] + b[5] + b[i] + s[i].m[i];
} }
\ No newline at end of file
...@@ -7807,12 +7807,13 @@ TIntermTyped* HlslParseContext::handleConstructor(const TSourceLoc& loc, TInterm ...@@ -7807,12 +7807,13 @@ TIntermTyped* HlslParseContext::handleConstructor(const TSourceLoc& loc, TInterm
// //
TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyped* node, const TType& type) TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyped* node, const TType& type)
{ {
TIntermAggregate* aggrNode = node->getAsAggregate();
TOperator op = intermediate.mapTypeToConstructorOp(type); TOperator op = intermediate.mapTypeToConstructorOp(type);
// Combined texture-sampler constructors are completely semantic checked // Combined texture-sampler constructors are completely semantic checked
// in constructorTextureSamplerError() // in constructorTextureSamplerError()
if (op == EOpConstructTextureSampler) if (op == EOpConstructTextureSampler)
return intermediate.setAggregateOperator(node->getAsAggregate(), op, type, loc); return intermediate.setAggregateOperator(aggrNode, op, type, loc);
TTypeList::const_iterator memberTypes; TTypeList::const_iterator memberTypes;
if (op == EOpConstructStruct) if (op == EOpConstructStruct)
...@@ -7826,7 +7827,6 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp ...@@ -7826,7 +7827,6 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp
elementType.shallowCopy(type); elementType.shallowCopy(type);
bool singleArg; bool singleArg;
TIntermAggregate* aggrNode = node->getAsAggregate();
if (aggrNode != nullptr) { if (aggrNode != nullptr) {
if (aggrNode->getOp() != EOpNull || aggrNode->getSequence().size() == 1) if (aggrNode->getOp() != EOpNull || aggrNode->getSequence().size() == 1)
singleArg = true; singleArg = true;
...@@ -7844,7 +7844,7 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp ...@@ -7844,7 +7844,7 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp
newNode = convertArray(node, type); newNode = convertArray(node, type);
// If structure constructor or array constructor is being called // If structure constructor or array constructor is being called
// for only one parameter inside the structure, we need to call constructAggregate function once. // for only one parameter inside the aggregate, we need to call constructAggregate function once.
else if (type.isArray()) else if (type.isArray())
newNode = constructAggregate(node, elementType, 1, node->getLoc()); newNode = constructAggregate(node, elementType, 1, node->getLoc());
else if (op == EOpConstructStruct) else if (op == EOpConstructStruct)
...@@ -7868,7 +7868,7 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp ...@@ -7868,7 +7868,7 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp
// //
// Handle list of arguments. // Handle list of arguments.
// //
TIntermSequence &sequenceVector = aggrNode->getSequence(); // Stores the information about the parameter to the constructor TIntermSequence& sequenceVector = aggrNode->getSequence(); // Stores the information about the parameter to the constructor
// if the structure constructor contains more than one parameter, then construct // if the structure constructor contains more than one parameter, then construct
// each parameter // each parameter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment