Commit 6e56a47c by John Kessenich

Merge branch GitHub 'master' into GitLab master

parents 1f2c9771 3ac051e4
......@@ -827,7 +827,7 @@ int C_DECL main(int argc, char* argv[])
// Print out all the resulting infologs
for (int w = 0; w < NumWorkItems; ++w) {
if (Work[w]) {
if (printShaderNames)
if (printShaderNames || Work[w]->results.size() > 0)
PutsIfNonEmpty(Work[w]->name.c_str());
PutsIfNonEmpty(Work[w]->results.c_str());
delete Work[w];
......
100Limits.vert
ERROR: 0:24: 'limitation' : while loops not available
ERROR: 0:26: 'limitation' : do-while loops not available
ERROR: 0:28: 'limitations' : inductive-loop init-declaration requires the form "type-specifier loop-index = constant-expression"
......
......@@ -257,6 +257,19 @@ ERROR: node is still EOpNull!
0:120 1.000000
0:120 Constant:
0:120 3 (const int)
0:126 Function Definition: foo3( (global void)
0:126 Function Parameters:
0:128 Sequence
0:128 Sequence
0:128 move second child to first child (temp 3X2 matrix of float)
0:128 'r32' (temp 3X2 matrix of float)
0:128 Constant:
0:128 43.000000
0:128 64.000000
0:128 51.000000
0:128 76.000000
0:128 59.000000
0:128 88.000000
0:? Linker Objects
0:? 'a' (const int)
0:? 1 (const int)
......@@ -331,6 +344,18 @@ ERROR: node is still EOpNull!
0:? 4.000000
0:? 5.000000
0:? 'a4' (global 2-element array of float)
0:? 'mm2' (const 2X2 matrix of float)
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:? 'mm32' (const 3X2 matrix of float)
0:? 10.000000
0:? 11.000000
0:? 12.000000
0:? 13.000000
0:? 14.000000
0:? 15.000000
Linked fragment stage:
......@@ -584,6 +609,19 @@ ERROR: node is still EOpNull!
0:120 1.000000
0:120 Constant:
0:120 3 (const int)
0:126 Function Definition: foo3( (global void)
0:126 Function Parameters:
0:128 Sequence
0:128 Sequence
0:128 move second child to first child (temp 3X2 matrix of float)
0:128 'r32' (temp 3X2 matrix of float)
0:128 Constant:
0:128 43.000000
0:128 64.000000
0:128 51.000000
0:128 76.000000
0:128 59.000000
0:128 88.000000
0:? Linker Objects
0:? 'a' (const int)
0:? 1 (const int)
......@@ -658,4 +696,16 @@ ERROR: node is still EOpNull!
0:? 4.000000
0:? 5.000000
0:? 'a4' (global 2-element array of float)
0:? 'mm2' (const 2X2 matrix of float)
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:? 'mm32' (const 3X2 matrix of float)
0:? 10.000000
0:? 11.000000
0:? 12.000000
0:? 13.000000
0:? 14.000000
0:? 15.000000
......@@ -333,7 +333,7 @@ Linked fragment stage:
214: 96 Load 98(i2DMS)
215: 29(ivec2) Load 142(ic2D)
217: 125(fvec4) Load 127(v)
ImageWrite 214 215 216
ImageWrite 214 215 217 Sample 216
218: 106 Load 108(i2DMSArray)
219: 7(ivec3) Load 152(ic3D)
221: 125(fvec4) ImageRead 218 219 Sample 220
......@@ -343,7 +343,7 @@ Linked fragment stage:
224: 106 Load 108(i2DMSArray)
225: 7(ivec3) Load 152(ic3D)
227: 125(fvec4) Load 127(v)
ImageWrite 224 225 226
ImageWrite 224 225 227 Sample 226
Store 229(ui) 19
233: 6(int) Load 132(ic1D)
236: 235(ptr) ImageTexelPointer 232(ii1D) 233 0
......
......@@ -119,3 +119,11 @@ void foo2()
float f = vec4(7.8 < 2.4 ? -1.333 : 1.444).a;
f = vec4(inv.x < 2.4 ? -1.0 : 1.0).a; // not folded, ensuring no propagation
}
const mat2 mm2 = mat2(1.0, 2.0, 3.0, 4.0);
const mat3x2 mm32 = mat3x2(10.0, 11.0, 12.0, 13.0, 14.0, 15.0);
void foo3()
{
mat3x2 r32 = mm2 * mm32;
}
#version 450
uniform int i1;
uniform ivec2 i2;
uniform ivec3 i3;
uniform ivec4 i4;
uniform uint u1;
uniform uvec2 u2;
uniform uvec3 u3;
uniform uvec4 u4;
uniform float f1;
uniform vec2 f2;
uniform vec3 f3;
uniform vec4 f4;
out vec4 fragColor;
void main()
{
ivec4 idata = ivec4(0);
idata.x += floatBitsToInt(f1);
idata.xy += floatBitsToInt(f2);
idata.xyz += floatBitsToInt(f3);
idata += floatBitsToInt(f4);
uvec4 udata = uvec4(0);
udata.x += floatBitsToUint(f1);
udata.xy += floatBitsToUint(f2);
udata.xyz += floatBitsToUint(f3);
udata += floatBitsToUint(f4);
vec4 fdata = vec4(0.0);
fdata.x += intBitsToFloat(i1);
fdata.xy += intBitsToFloat(i2);
fdata.xyz += intBitsToFloat(i3);
fdata += intBitsToFloat(i4);
fdata.x += uintBitsToFloat(u1);
fdata.xy += uintBitsToFloat(u2);
fdata.xyz += uintBitsToFloat(u3);
fdata += uintBitsToFloat(u4);
fragColor = (idata == udata) ? fdata : fdata + vec4(0.2);
}
\ No newline at end of file
#version 450
// should get 3 SPV types for S: no layout, 140, and 430
struct S
{
highp uvec3 a;
mediump mat2 b[4];
lowp uint c;
};
layout(set = 0, binding = 0, std140) uniform Block140
{
mediump int u;
S s[2][3];
mediump vec2 v;
} inst140;
layout(set = 0, binding = 1, std430) buffer Block430
{
mediump int u;
S s[2][3];
mediump vec2 v;
} inst430;
S s;
// should get 5 SPV types for T: no layout, 140/row, 140/col, 430/row, and 430/col
struct T {
mat2 m;
int a;
};
T t;
struct Nestor {
T nestorT;
};
layout(set = 1, binding = 0, std140) uniform Bt1
{
layout(row_major) Nestor nt;
} Btn1;
layout(set = 1, binding = 0, std140) uniform Bt2
{
layout(column_major) Nestor nt;
} Btn2;
layout(row_major, set = 1, binding = 0, std140) uniform Bt3
{
layout(column_major) Nestor ntcol;
Nestor ntrow; // should be row major decoration version of Nestor
} Btn3;
layout(set = 1, binding = 0, std430) buffer bBt1
{
layout(row_major) Nestor nt;
} bBtn1;
layout(set = 1, binding = 0, std430) buffer bBt2
{
layout(column_major) Nestor nt;
} bBtn2;
layout(set = 1, binding = 0, std430) buffer bBt3
{
layout(row_major) Nestor ntcol;
Nestor ntrow; // should be col major decoration version of Nestor
} bBtn3;
void main()
{
}
......@@ -30,6 +30,7 @@ spv.accessChain.frag
spv.aggOps.frag
spv.always-discard.frag
spv.always-discard2.frag
spv.bitCast.frag
spv.bool.vert
spv.conditionalDiscard.frag
spv.conversion.frag
......@@ -47,6 +48,7 @@ spv.forwardFun.frag
spv.functionCall.frag
spv.functionSemantics.frag
spv.interpOps.frag
spv.layoutNested.vert
spv.length.frag
spv.localAggregates.frag
spv.loops.frag
......
......@@ -186,15 +186,15 @@ enum TLayoutPacking {
ElpShared, // default, but different than saying nothing
ElpStd140,
ElpStd430,
ElpPacked
// If expanding, see bitfield width below
ElpPacked,
ElpCount // If expanding, see bitfield width below
};
enum TLayoutMatrix {
ElmNone,
ElmRowMajor,
ElmColumnMajor // default, but different than saying nothing
// If expanding, see bitfield width below
ElmColumnMajor, // default, but different than saying nothing
ElmCount // If expanding, see bitfield width below
};
// Union of geometry shader and tessellation shader geometry types.
......
......@@ -2,5 +2,5 @@
// 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).
#define GLSLANG_REVISION "SPIRV99.845"
#define GLSLANG_DATE "13-Dec-2015"
#define GLSLANG_REVISION "SPIRV99.861"
#define GLSLANG_DATE "20-Dec-2015"
......@@ -3048,7 +3048,7 @@ void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage langua
SpecialQualifier("gl_FragColor", EvqFragColor, EbvFragColor, symbolTable);
SpecialQualifier("gl_FragDepth", EvqFragDepth, EbvFragDepth, symbolTable);
SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, EbvFragDepth, symbolTable);
SpecialQualifier("gl_HelperInvocation", EvqIn, EbvHelperInvocation, symbolTable);
SpecialQualifier("gl_HelperInvocation", EvqVaryingIn, EbvHelperInvocation, symbolTable);
BuiltInVariable("gl_ClipDistance", EbvClipDistance, symbolTable);
BuiltInVariable("gl_CullDistance", EbvCullDistance, symbolTable);
......
......@@ -5345,8 +5345,11 @@ void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typ
const TSourceLoc& memberLoc = typeList[member].loc;
// "When align is applied to an array, it effects only the start of the array, not the array's internal stride."
int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, qualifier.layoutPacking == ElpStd140);
// modify just the children's view of matrix layout, if there is one for this member
TLayoutMatrix subMatrixLayout = typeList[member].type->getQualifier().layoutMatrix;
int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, qualifier.layoutPacking == ElpStd140,
subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor : qualifier.layoutMatrix == ElmRowMajor);
if (memberQualifier.hasOffset()) {
// "The specified offset must be a multiple
// of the base alignment of the type of the block member it qualifies, or a compile-time error results."
......
......@@ -309,7 +309,7 @@ struct str_hash
unsigned long hash = 5381;
int c;
while (c = *str++)
while ((c = *str++))
hash = ((hash << 5) + hash) + c;
return hash;
......
......@@ -859,7 +859,7 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
//
// The size is returned in the 'size' parameter
// Return value is the alignment of the type.
int TIntermediate::getBaseAlignment(const TType& type, int& size, bool std140)
int TIntermediate::getBaseAlignment(const TType& type, int& size, bool std140, bool rowMajor)
{
int alignment;
......@@ -921,7 +921,7 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, bool std140)
if (type.isArray()) {
// TODO: perf: this might be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
TType derefType(type, 0);
alignment = getBaseAlignment(derefType, size, std140);
alignment = getBaseAlignment(derefType, size, std140, rowMajor);
if (std140)
alignment = std::max(baseAlignmentVec4Std140, alignment);
RoundToPow2(size, alignment);
......@@ -937,7 +937,10 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, bool std140)
int maxAlignment = std140 ? baseAlignmentVec4Std140 : 0;
for (size_t m = 0; m < memberList.size(); ++m) {
int memberSize;
int memberAlignment = getBaseAlignment(*memberList[m].type, memberSize, std140);
// modify just the children's view of matrix layout, if there is one for this member
TLayoutMatrix subMatrixLayout = memberList[m].type->getQualifier().layoutMatrix;
int memberAlignment = getBaseAlignment(*memberList[m].type, memberSize, std140,
(subMatrixLayout != ElmNone) ? (subMatrixLayout == ElmRowMajor) : rowMajor);
maxAlignment = std::max(maxAlignment, memberAlignment);
RoundToPow2(size, memberAlignment);
size += memberSize;
......@@ -968,11 +971,11 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, bool std140)
// rule 5: deref to row, not to column, meaning the size of vector is num columns instead of num rows
TType derefType(type, 0, type.getQualifier().layoutMatrix == ElmRowMajor);
alignment = getBaseAlignment(derefType, size, std140);
alignment = getBaseAlignment(derefType, size, std140, rowMajor);
if (std140)
alignment = std::max(baseAlignmentVec4Std140, alignment);
RoundToPow2(size, alignment);
if (type.getQualifier().layoutMatrix == ElmRowMajor)
if (rowMajor)
size *= type.getMatrixRows();
else
size *= type.getMatrixCols();
......
......@@ -305,7 +305,7 @@ public:
}
int addXfbBufferOffset(const TType&);
unsigned int computeTypeXfbSize(const TType&, bool& containsDouble) const;
static int getBaseAlignment(const TType&, int& size, bool std140);
static int getBaseAlignment(const TType&, int& size, bool std140, bool rowMajor);
protected:
void error(TInfoSink& infoSink, const char*);
......
......@@ -123,7 +123,10 @@ public:
int memberSize;
int offset = 0;
for (int m = 0; m <= index; ++m) {
int memberAlignment = intermediate.getBaseAlignment(*memberList[m].type, memberSize, type.getQualifier().layoutPacking == ElpStd140);
// modify just the children's view of matrix layout, if there is one for this member
TLayoutMatrix subMatrixLayout = memberList[m].type->getQualifier().layoutMatrix;
int memberAlignment = intermediate.getBaseAlignment(*memberList[m].type, memberSize, type.getQualifier().layoutPacking == ElpStd140,
subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor : type.getQualifier().layoutMatrix == ElmRowMajor);
RoundToPow2(offset, memberAlignment);
if (m < index)
offset += memberSize;
......@@ -141,7 +144,8 @@ public:
int lastOffset = getOffset(blockType, lastIndex);
int lastMemberSize;
intermediate.getBaseAlignment(*memberList[lastIndex].type, lastMemberSize, blockType.getQualifier().layoutPacking == ElpStd140);
intermediate.getBaseAlignment(*memberList[lastIndex].type, lastMemberSize, blockType.getQualifier().layoutPacking == ElpStd140,
blockType.getQualifier().layoutMatrix == ElmRowMajor);
return lastOffset + lastMemberSize;
}
......
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