Commit a723b309 by John Kessenich

Merge branch 'master' into khronosmaster

parents 237b6c51 76f71397
...@@ -1174,9 +1174,9 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right) ...@@ -1174,9 +1174,9 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right)
int direction = getNumComponents(right) - getNumComponents(left); int direction = getNumComponents(right) - getNumComponents(left);
if (direction > 0) if (direction > 0)
left = smearScalar(precision, left, getTypeId(right)); left = smearScalar(precision, left, makeVectorType(getTypeId(left), getNumComponents(right)));
else if (direction < 0) else if (direction < 0)
right = smearScalar(precision, right, getTypeId(left)); right = smearScalar(precision, right, makeVectorType(getTypeId(right), getNumComponents(left)));
return; return;
} }
...@@ -1185,6 +1185,7 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right) ...@@ -1185,6 +1185,7 @@ void Builder::promoteScalar(Decoration precision, Id& left, Id& right)
Id Builder::smearScalar(Decoration /*precision*/, Id scalar, Id vectorType) Id Builder::smearScalar(Decoration /*precision*/, Id scalar, Id vectorType)
{ {
assert(getNumComponents(scalar) == 1); assert(getNumComponents(scalar) == 1);
assert(getTypeId(scalar) == getScalarTypeId(vectorType));
int numComponents = getNumTypeComponents(vectorType); int numComponents = getNumTypeComponents(vectorType);
if (numComponents == 1) if (numComponents == 1)
......
...@@ -279,12 +279,17 @@ public: ...@@ -279,12 +279,17 @@ public:
// - promoteScalar(scalar, scalar) // do nothing // - promoteScalar(scalar, scalar) // do nothing
// Other forms are not allowed. // Other forms are not allowed.
// //
// Generally, the type of 'scalar' does not need to be the same type as the components in 'vector'.
// The type of the created vector is a vector of components of the same type as the scalar.
//
// Note: One of the arguments will change, with the result coming back that way rather than // Note: One of the arguments will change, with the result coming back that way rather than
// through the return value. // through the return value.
void promoteScalar(Decoration precision, Id& left, Id& right); void promoteScalar(Decoration precision, Id& left, Id& right);
// make a value by smearing the scalar to fill the type // Make a value by smearing the scalar to fill the type.
Id smearScalar(Decoration precision, Id scalarVal, Id); // vectorType should be the correct type for making a vector of scalarVal.
// (No conversions are done.)
Id smearScalar(Decoration precision, Id scalarVal, Id vectorType);
// Create a call to a built-in function. // Create a call to a built-in function.
Id createBuiltinCall(Decoration precision, Id resultType, Id builtins, int entryPoint, std::vector<Id>& args); Id createBuiltinCall(Decoration precision, Id resultType, Id builtins, int entryPoint, std::vector<Id>& args);
......
...@@ -43,3 +43,8 @@ void barWxyz() ...@@ -43,3 +43,8 @@ void barWxyz()
ivec4 t42 = texelFetch(ismsa, ivec3(2), samp); ivec4 t42 = texelFetch(ismsa, ivec3(2), samp);
uvec4 t43 = texelFetch(usmsa, p3, samp); uvec4 t43 = texelFetch(usmsa, p3, samp);
} }
int primitiveID()
{
return gl_PrimitiveID;
}
...@@ -146,3 +146,8 @@ void interp() ...@@ -146,3 +146,8 @@ void interp()
interpolateAtCentroid(sampInArray[2].xy); interpolateAtCentroid(sampInArray[2].xy);
interpolateAtSample(sampInArray[2].x.x, 2); interpolateAtSample(sampInArray[2].x.x, 2);
} }
int layer()
{
return gl_Layer;
}
...@@ -101,6 +101,11 @@ ERROR: node is still EOpNull! ...@@ -101,6 +101,11 @@ ERROR: node is still EOpNull!
0:44 'usmsa' (uniform usampler2DMSArray) 0:44 'usmsa' (uniform usampler2DMSArray)
0:44 'p3' (flat in 3-component vector of int) 0:44 'p3' (flat in 3-component vector of int)
0:44 'samp' (flat in int) 0:44 'samp' (flat in int)
0:47 Function Definition: primitiveID( (global int)
0:47 Function Parameters:
0:49 Sequence
0:49 Branch: Return with expression
0:49 'gl_PrimitiveID' (flat in int PrimitiveID)
0:? Linker Objects 0:? Linker Objects
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float FragCoord) 0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float FragCoord)
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float FragCoord) 0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float FragCoord)
...@@ -216,6 +221,11 @@ ERROR: node is still EOpNull! ...@@ -216,6 +221,11 @@ ERROR: node is still EOpNull!
0:44 'usmsa' (uniform usampler2DMSArray) 0:44 'usmsa' (uniform usampler2DMSArray)
0:44 'p3' (flat in 3-component vector of int) 0:44 'p3' (flat in 3-component vector of int)
0:44 'samp' (flat in int) 0:44 'samp' (flat in int)
0:47 Function Definition: primitiveID( (global int)
0:47 Function Parameters:
0:49 Sequence
0:49 Branch: Return with expression
0:49 'gl_PrimitiveID' (flat in int PrimitiveID)
0:? Linker Objects 0:? Linker Objects
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float FragCoord) 0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float FragCoord)
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float FragCoord) 0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float FragCoord)
......
...@@ -77,6 +77,11 @@ ERROR: node is still EOpNull! ...@@ -77,6 +77,11 @@ ERROR: node is still EOpNull!
0:147 0 (const int) 0:147 0 (const int)
0:147 Constant: 0:147 Constant:
0:147 2 (const int) 0:147 2 (const int)
0:150 Function Definition: layer( (global int)
0:150 Function Parameters:
0:152 Sequence
0:152 Branch: Return with expression
0:152 'gl_Layer' (flat in int Layer)
0:? Linker Objects 0:? Linker Objects
0:? 'a' (layout(location=4 component=2 ) smooth in 2-component vector of float) 0:? 'a' (layout(location=4 component=2 ) smooth in 2-component vector of float)
0:? 'b' (layout(location=4 component=1 ) smooth in float) 0:? 'b' (layout(location=4 component=1 ) smooth in float)
...@@ -145,6 +150,11 @@ ERROR: node is still EOpNull! ...@@ -145,6 +150,11 @@ ERROR: node is still EOpNull!
0:147 0 (const int) 0:147 0 (const int)
0:147 Constant: 0:147 Constant:
0:147 2 (const int) 0:147 2 (const int)
0:150 Function Definition: layer( (global int)
0:150 Function Parameters:
0:152 Sequence
0:152 Branch: Return with expression
0:152 'gl_Layer' (flat in int Layer)
0:? Linker Objects 0:? Linker Objects
0:? 'a' (layout(location=4 component=2 ) smooth in 2-component vector of float) 0:? 'a' (layout(location=4 component=2 ) smooth in 2-component vector of float)
0:? 'b' (layout(location=4 component=1 ) smooth in float) 0:? 'b' (layout(location=4 component=1 ) smooth in float)
......
spv.shiftOps.frag
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 38
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9 25
ExecutionMode 4 OriginLowerLeft
Source GLSL 450
Name 4 "main"
Name 9 "icolor"
Name 11 "i3"
Name 15 "u1"
Name 25 "ucolor"
Name 27 "u3"
Name 30 "i1"
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypeVector 6(int) 3
8: TypePointer Output 7(ivec3)
9(icolor): 8(ptr) Variable Output
10: TypePointer UniformConstant 7(ivec3)
11(i3): 10(ptr) Variable UniformConstant
13: TypeInt 32 0
14: TypePointer UniformConstant 13(int)
15(u1): 14(ptr) Variable UniformConstant
17: TypeVector 13(int) 3
20: 13(int) Constant 4
24: TypePointer Output 17(ivec3)
25(ucolor): 24(ptr) Variable Output
26: TypePointer UniformConstant 17(ivec3)
27(u3): 26(ptr) Variable UniformConstant
29: TypePointer UniformConstant 6(int)
30(i1): 29(ptr) Variable UniformConstant
34: 6(int) Constant 5
4(main): 2 Function None 3
5: Label
12: 7(ivec3) Load 11(i3)
16: 13(int) Load 15(u1)
18: 17(ivec3) CompositeConstruct 16 16 16
19: 7(ivec3) ShiftLeftLogical 12 18
Store 9(icolor) 19
21: 7(ivec3) Load 9(icolor)
22: 17(ivec3) CompositeConstruct 20 20 20
23: 7(ivec3) ShiftLeftLogical 21 22
Store 9(icolor) 23
28: 17(ivec3) Load 27(u3)
31: 6(int) Load 30(i1)
32: 7(ivec3) CompositeConstruct 31 31 31
33: 17(ivec3) ShiftRightLogical 28 32
Store 25(ucolor) 33
35: 17(ivec3) Load 25(ucolor)
36: 7(ivec3) CompositeConstruct 34 34 34
37: 17(ivec3) ShiftRightLogical 35 36
Store 25(ucolor) 37
Return
FunctionEnd
#version 450
uniform int i1;
uniform uint u1;
uniform ivec3 i3;
uniform uvec3 u3;
out ivec3 icolor;
out uvec3 ucolor;
void main()
{
icolor = i3 << u1;
icolor <<= 4u;
ucolor = u3 >> i1;
ucolor >>= 5;
}
...@@ -61,6 +61,7 @@ spv.intOps.vert ...@@ -61,6 +61,7 @@ spv.intOps.vert
spv.precision.frag spv.precision.frag
spv.prepost.frag spv.prepost.frag
spv.qualifiers.vert spv.qualifiers.vert
spv.shiftOps.frag
spv.simpleFunctionCall.frag spv.simpleFunctionCall.frag
spv.simpleMat.vert spv.simpleMat.vert
spv.structAssignment.frag spv.structAssignment.frag
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "SPIRV99.831" #define GLSLANG_REVISION "SPIRV99.836"
#define GLSLANG_DATE "08-Dec-2015" #define GLSLANG_DATE "09-Dec-2015"
...@@ -3165,8 +3165,11 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage langua ...@@ -3165,8 +3165,11 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage langua
} }
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth); symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);
symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader);
symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader); if (profile == EEsProfile) {
symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader);
symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader);
}
if (profile == EEsProfile) { if (profile == EEsProfile) {
symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic); symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic);
......
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