Commit f5dd2f5c by John Kessenich

Expand implicit argument conversions to also include handling built-in function calls.

parent 0af1e7c6
...@@ -136,4 +136,5 @@ void foo2() ...@@ -136,4 +136,5 @@ void foo2()
outFunRet(i, f, i, v4); outFunRet(i, f, i, v4);
float ret = outFunRet(i, f, i, v4); float ret = outFunRet(i, f, i, v4);
vec2 ret2 = outFunRet(i, v4, i, v4); vec2 ret2 = outFunRet(i, v4, i, v4);
bool b = any(lessThan(v4, attv4)); // tests aggregate arg to unary built-in
} }
...@@ -26,3 +26,9 @@ layout(location=3) in vec4 vl; // ERROR ...@@ -26,3 +26,9 @@ layout(location=3) in vec4 vl; // ERROR
#extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_separate_shader_objects : enable
layout(location=4) in vec4 vl2; layout(location=4) in vec4 vl2;
void foo()
{
vec2 r1 = modf(v.xy, v.zw); // ERROR, v.zw not l-value
vec2 r2 = modf(o.xy, o.zw);
}
...@@ -56,3 +56,9 @@ void foo23() ...@@ -56,3 +56,9 @@ void foo23()
patch in vec4 patchIn; // ERROR patch in vec4 patchIn; // ERROR
patch out vec4 patchOut; // ERROR patch out vec4 patchOut; // ERROR
void foo24()
{
dvec3 df, di;
df = modf(outp.xyz, di);
}
\ No newline at end of file
...@@ -148,7 +148,7 @@ ERROR: node is still EOpNull! ...@@ -148,7 +148,7 @@ ERROR: node is still EOpNull!
0:98 Constant: 0:98 Constant:
0:98 0.000000 0:98 0.000000
0:100 Constant: 0:100 Constant:
0:100 0.000000 0:100 0.841471
0:101 Function Call: texture2D(s21;vf2; (4-component vector of float) 0:101 Function Call: texture2D(s21;vf2; (4-component vector of float)
0:101 's2D' (uniform sampler2D) 0:101 's2D' (uniform sampler2D)
0:101 Constant: 0:101 Constant:
...@@ -157,16 +157,17 @@ ERROR: node is still EOpNull! ...@@ -157,16 +157,17 @@ ERROR: node is still EOpNull!
0:102 clamp (4-component vector of float) 0:102 clamp (4-component vector of float)
0:102 'attv4' (in 4-component vector of float) 0:102 'attv4' (in 4-component vector of float)
0:102 Constant: 0:102 Constant:
0:102 0 (const int) 0:102 0.000000
0:102 Constant: 0:102 Constant:
0:102 1 (const int) 0:102 1.000000
0:103 clamp (4-component vector of float) 0:103 clamp (4-component vector of float)
0:103 Convert float to int (4-component vector of int) 0:103 Convert int to float (4-component vector of float)
0:103 'attv4' (in 4-component vector of float) 0:103 Convert float to int (4-component vector of int)
0:103 'attv4' (in 4-component vector of float)
0:103 Constant: 0:103 Constant:
0:103 0 (const int) 0:103 0.000000
0:103 Constant: 0:103 Constant:
0:103 1 (const int) 0:103 1.000000
0:106 Constant: 0:106 Constant:
0:106 0.000000 0:106 0.000000
0:107 Constant: 0:107 Constant:
...@@ -272,6 +273,13 @@ ERROR: node is still EOpNull! ...@@ -272,6 +273,13 @@ ERROR: node is still EOpNull!
0:138 Convert int to float (4-component vector of float) 0:138 Convert int to float (4-component vector of float)
0:138 'tempArg' (4-component vector of int) 0:138 'tempArg' (4-component vector of int)
0:138 'tempReturn' (2-component vector of int) 0:138 'tempReturn' (2-component vector of int)
0:139 Sequence
0:139 move second child to first child (bool)
0:139 'b' (bool)
0:139 any (bool)
0:139 Compare Less Than (4-component vector of bool)
0:139 'v4' (4-component vector of float)
0:139 'attv4' (in 4-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? 'i' (in 4-component vector of float) 0:? 'i' (in 4-component vector of float)
0:? 'o' (smooth out 4-component vector of float) 0:? 'o' (smooth out 4-component vector of float)
......
...@@ -5,7 +5,9 @@ ERROR: 0:17: '#error' : GL_ES is not set ...@@ -5,7 +5,9 @@ ERROR: 0:17: '#error' : GL_ES is not set
ERROR: 0:20: 'fragment-shader struct input' : not supported for this version or the enabled extensions ERROR: 0:20: 'fragment-shader struct input' : not supported for this version or the enabled extensions
ERROR: 0:24: 'location' : not supported for this version or the enabled extensions ERROR: 0:24: 'location' : not supported for this version or the enabled extensions
ERROR: 0:24: 'location qualifier on input' : not supported for this version or the enabled extensions ERROR: 0:24: 'location qualifier on input' : not supported for this version or the enabled extensions
ERROR: 4 compilation errors. No code generated. ERROR: 0:32: 'assign' : l-value required "v" (can't modify shader input)
ERROR: 0:32: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters.
ERROR: 6 compilation errors. No code generated.
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
...@@ -24,6 +26,45 @@ ERROR: node is still EOpNull! ...@@ -24,6 +26,45 @@ ERROR: node is still EOpNull!
0:22 'patch' (float) 0:22 'patch' (float)
0:22 Constant: 0:22 Constant:
0:22 3.100000 0:22 3.100000
0:30 Function Definition: foo( (void)
0:30 Function Parameters:
0:32 Sequence
0:32 Sequence
0:32 move second child to first child (2-component vector of float)
0:32 'r1' (2-component vector of float)
0:32 modf (2-component vector of float)
0:32 vector swizzle (2-component vector of float)
0:32 'v' (smooth in 4-component vector of float)
0:32 Sequence
0:32 Constant:
0:32 0 (const int)
0:32 Constant:
0:32 1 (const int)
0:32 vector swizzle (2-component vector of float)
0:32 'v' (smooth in 4-component vector of float)
0:32 Sequence
0:32 Constant:
0:32 2 (const int)
0:32 Constant:
0:32 3 (const int)
0:33 Sequence
0:33 move second child to first child (2-component vector of float)
0:33 'r2' (2-component vector of float)
0:33 modf (2-component vector of float)
0:33 vector swizzle (2-component vector of float)
0:33 'o' (out 4-component vector of float)
0:33 Sequence
0:33 Constant:
0:33 0 (const int)
0:33 Constant:
0:33 1 (const int)
0:33 vector swizzle (2-component vector of float)
0:33 'o' (out 4-component vector of float)
0:33 Sequence
0:33 Constant:
0:33 2 (const int)
0:33 Constant:
0:33 3 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'v' (smooth in 4-component vector of float) 0:? 'v' (smooth in 4-component vector of float)
0:? 'i' (smooth in 4-component vector of float) 0:? 'i' (smooth in 4-component vector of float)
......
...@@ -190,6 +190,31 @@ ERROR: node is still EOpNull! ...@@ -190,6 +190,31 @@ ERROR: node is still EOpNull!
0:54 Constant: 0:54 Constant:
0:54 -10 (const int) 0:54 -10 (const int)
0:54 20 (const int) 0:54 20 (const int)
0:60 Function Definition: foo24( (void)
0:60 Function Parameters:
0:? Sequence
0:63 move second child to first child (3-component vector of double)
0:63 'df' (3-component vector of double)
0:63 Convert float to double (3-component vector of double)
0:63 Comma (3-component vector of float)
0:63 move second child to first child (3-component vector of float)
0:63 'tempReturn' (3-component vector of float)
0:63 modf (3-component vector of float)
0:63 vector swizzle (3-component vector of float)
0:63 'outp' (out 4-component vector of float)
0:63 Sequence
0:63 Constant:
0:63 0 (const int)
0:63 Constant:
0:63 1 (const int)
0:63 Constant:
0:63 2 (const int)
0:63 'tempArg' (3-component vector of float)
0:63 move second child to first child (3-component vector of double)
0:63 'di' (3-component vector of double)
0:63 Convert float to double (3-component vector of double)
0:63 'tempArg' (3-component vector of float)
0:63 'tempReturn' (3-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? 'c2D' (smooth in 2-component vector of float) 0:? 'c2D' (smooth in 2-component vector of float)
0:? 'i' (flat in int) 0:? 'i' (flat in int)
......
...@@ -511,14 +511,14 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt ...@@ -511,14 +511,14 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
// from the shader or the above code. // from the shader or the above code.
switch (promoteTo) { switch (promoteTo) {
case EbtDouble: case EbtDouble:
//switch (node->getBasicType()) { switch (node->getBasicType()) {
//case EbtInt: newOp = EOpConvIntToDouble; break; case EbtInt: newOp = EOpConvIntToDouble; break;
//case EbtUint: newOp = EOpConvUintToDouble; break; case EbtUint: newOp = EOpConvUintToDouble; break;
//case EbtBool: newOp = EOpConvBoolToDouble; break; case EbtBool: newOp = EOpConvBoolToDouble; break;
//case EbtFloat: newOp = EOpConvFloatToDouble; break; case EbtFloat: newOp = EOpConvFloatToDouble; break;
//default: default:
return 0; return 0;
//} }
break; break;
case EbtFloat: case EbtFloat:
switch (node->getBasicType()) { switch (node->getBasicType()) {
......
...@@ -98,7 +98,8 @@ public: ...@@ -98,7 +98,8 @@ public:
TIntermAggregate* handleFunctionDefinition(TSourceLoc, TFunction&); TIntermAggregate* handleFunctionDefinition(TSourceLoc, TFunction&);
TIntermTyped* handleFunctionCall(TSourceLoc, TFunction*, TIntermNode*); TIntermTyped* handleFunctionCall(TSourceLoc, TFunction*, TIntermNode*);
TIntermTyped* handleLengthMethod(TSourceLoc, TFunction*, TIntermNode*); TIntermTyped* handleLengthMethod(TSourceLoc, TFunction*, TIntermNode*);
TIntermTyped* handleArgumentConversions(const TFunction&, TIntermAggregate&) const; void addInputArgumentConversions(const TFunction&, TIntermNode*&) const;
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const;
void nonOpBuiltInCheck(TSourceLoc, const TFunction&, TIntermAggregate&); void nonOpBuiltInCheck(TSourceLoc, const TFunction&, TIntermAggregate&);
TFunction* handleConstructorCall(TSourceLoc, const TPublicType&); TFunction* handleConstructorCall(TSourceLoc, const TPublicType&);
......
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