Updated glslang.

This commit is contained in:
Branimir Karadžić 2018-11-17 00:09:17 -08:00
parent 66a7d6ab05
commit 9e34375c8b
41 changed files with 4251 additions and 97 deletions

View File

@ -50,7 +50,7 @@ macro(glslang_pch SRCS PCHCPP)
if (CMAKE_GENERATOR MATCHES "^Visual Studio")
set(PCH_NAME "$(IntDir)\\pch.pch")
else()
set(PCH_NAME "pch.pch")
set(PCH_NAME "${CMAKE_CURRENT_BINARY_DIR}/pch.pch")
endif()
# make source files use/depend on PCH_NAME
set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}")

View File

@ -2775,7 +2775,9 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
// can still have a mapping to a SPIR-V Id.
// This includes specialization constants.
if (node->getQualifier().isConstant()) {
return createSpvConstant(*node);
spv::Id result = createSpvConstant(*node);
if (result != spv::NoResult)
return result;
}
// Now, handle actual variables
@ -3457,6 +3459,7 @@ glslang::TLayoutPacking TGlslangToSpvTraverser::getExplicitLayout(const glslang:
switch (type.getQualifier().layoutPacking) {
case glslang::ElpStd140:
case glslang::ElpStd430:
case glslang::ElpScalar:
return type.getQualifier().layoutPacking;
default:
return glslang::ElpNone;
@ -3468,7 +3471,7 @@ int TGlslangToSpvTraverser::getArrayStride(const glslang::TType& arrayType, glsl
{
int size;
int stride;
glslangIntermediate->getBaseAlignment(arrayType, size, stride, explicitLayout == glslang::ElpStd140, matrixLayout == glslang::ElmRowMajor);
glslangIntermediate->getMemberAlignment(arrayType, size, stride, explicitLayout, matrixLayout == glslang::ElmRowMajor);
return stride;
}
@ -3483,7 +3486,7 @@ int TGlslangToSpvTraverser::getMatrixStride(const glslang::TType& matrixType, gl
int size;
int stride;
glslangIntermediate->getBaseAlignment(elementType, size, stride, explicitLayout == glslang::ElpStd140, matrixLayout == glslang::ElmRowMajor);
glslangIntermediate->getMemberAlignment(elementType, size, stride, explicitLayout, matrixLayout == glslang::ElmRowMajor);
return stride;
}
@ -3525,7 +3528,7 @@ void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& structType
int memberSize;
int dummyStride;
int memberAlignment = glslangIntermediate->getBaseAlignment(memberType, memberSize, dummyStride, explicitLayout == glslang::ElpStd140, matrixLayout == glslang::ElmRowMajor);
int memberAlignment = glslangIntermediate->getMemberAlignment(memberType, memberSize, dummyStride, explicitLayout, matrixLayout == glslang::ElmRowMajor);
// Adjust alignment for HLSL rules
// TODO: make this consistent in early phases of code:
@ -3544,7 +3547,7 @@ void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& structType
glslang::RoundToPow2(currentOffset, memberAlignment);
// Bump up to vec4 if there is a bad straddle
if (glslangIntermediate->improperStraddle(memberType, memberSize, currentOffset))
if (explicitLayout != glslang::ElpScalar && glslangIntermediate->improperStraddle(memberType, memberSize, currentOffset))
glslang::RoundToPow2(currentOffset, 16);
nextOffset = currentOffset + memberSize;
@ -4631,7 +4634,9 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpD
assert(builder.isScalar(right));
needMatchingVectors = false;
binOp = spv::OpVectorTimesScalar;
} else
} else if (isFloat)
binOp = spv::OpFMul;
else
binOp = spv::OpIMul;
break;
case glslang::EOpVectorTimesMatrix:
@ -6910,6 +6915,17 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::
// We might need the remaining arguments, e.g. in the EOpFrexp case.
std::vector<spv::Id> callArguments(operands.begin(), operands.begin() + consumedOperands);
id = builder.createBuiltinCall(typeId, extBuiltins >= 0 ? extBuiltins : stdBuiltins, libCall, callArguments);
} else if (opCode == spv::OpDot && !isFloat) {
// int dot(int, int)
// NOTE: never called for scalar/vector1, this is turned into simple mul before this can be reached
const int componentCount = builder.getNumComponents(operands[0]);
spv::Id mulOp = builder.createBinOp(spv::OpIMul, builder.getTypeId(operands[0]), operands[0], operands[1]);
builder.setPrecision(mulOp, precision);
id = builder.createCompositeExtract(mulOp, typeId, 0);
for (int i = 1; i < componentCount; ++i) {
builder.setPrecision(id, precision);
id = builder.createBinOp(spv::OpIAdd, typeId, id, builder.createCompositeExtract(operands[0], typeId, i));
}
} else {
switch (consumedOperands) {
case 0:
@ -7302,6 +7318,9 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
} else if (auto* const_union_array = &sn->getConstArray()) {
int nextConst = 0;
result = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true);
} else {
logger->missingFunctionality("Invalid initializer for spec onstant.");
return spv::NoResult;
}
builder.addName(result, sn->getName().c_str());
return result;
@ -7310,7 +7329,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
// Neither a front-end constant node, nor a specialization constant node with constant union array or
// constant sub tree as initializer.
logger->missingFunctionality("Neither a front-end constant nor a spec constant.");
exit(1);
return spv::NoResult;
}

View File

@ -39,7 +39,7 @@ ERROR: 0:168: 'Binst' : cannot add storage, auxiliary, memory, interpolation, la
ERROR: 0:169: 'Bblock' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable
ERROR: 0:170: 'Bfoo' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable
ERROR: 0:172: 'std430' : not supported for this version or the enabled extensions
ERROR: 0:172: 'std430' : requires the 'buffer' storage qualifier
ERROR: 0:172: 'std430 requires the buffer storage qualifier' : required extension not requested: GL_EXT_scalar_block_layout
ERROR: 0:175: '' : array size required
ERROR: 0:185: 'assign' : cannot convert from ' temp 4-element array of highp float' to ' temp 3-element array of highp float'
ERROR: 0:186: 'assign' : cannot convert from ' temp 3-element array of highp float' to ' temp 4-element array of highp float'

View File

@ -15,7 +15,7 @@ ERROR: 0:78: 'vertex-shader array-of-struct output' : not supported with this pr
ERROR: 0:79: 'vertex-shader array-of-struct output' : not supported with this profile: es
ERROR: 0:81: 'vertex-shader struct output containing an array' : not supported with this profile: es
ERROR: 0:83: 'vertex-shader struct output containing structure' : not supported with this profile: es
ERROR: 0:85: 'std430' : requires the 'buffer' storage qualifier
ERROR: 0:85: 'std430 requires the buffer storage qualifier' : required extension not requested: GL_EXT_scalar_block_layout
ERROR: 0:97: 's' : member of block cannot be or contain a sampler, image, or atomic_uint type
ERROR: 0:105: 'location' : overlapping use of location 12
ERROR: 0:107: 'input block' : not supported in this stage: vertex

View File

@ -46,7 +46,7 @@ ERROR: 0:142: 'r8_snorm' : does not apply to signed integer images
ERROR: 0:143: 'rgba32ui' : does not apply to signed integer images
ERROR: 0:144: 'r8ui' : does not apply to signed integer images
ERROR: 0:147: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:147: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:147: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:157: 'textureQueryLevels' : no matching overloaded function found
ERROR: 0:157: 'assign' : cannot convert from ' const float' to ' temp int'
ERROR: 0:158: 'textureQueryLevels' : no matching overloaded function found

View File

@ -27,9 +27,9 @@ ERROR: 0:64: 'uniform buffer-member align' : not supported for this version or t
ERROR: 0:65: 'uniform buffer-member align' : not supported for this version or the enabled extensions
ERROR: 0:65: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:66: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:64: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:65: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:66: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:64: 'align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:65: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:66: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:71: 'offset on block member' : not supported for this version or the enabled extensions
ERROR: 0:74: 'gl_MaxTransformFeedbackBuffers' : required extension not requested: GL_ARB_enhanced_layouts
ERROR: 0:75: 'gl_MaxTransformFeedbackInterleavedComponents' : required extension not requested: GL_ARB_enhanced_layouts

View File

@ -21,11 +21,11 @@ ERROR: 0:38: 'offset' : only applies to block members, not blocks
ERROR: 0:39: 'output block' : not supported in this stage: fragment
ERROR: 0:39: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:39: 'offset' : only applies to block members, not blocks
ERROR: 0:42: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:43: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:42: 'align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:43: 'align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:43: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:44: 'output block' : not supported in this stage: fragment
ERROR: 0:44: 'align' : can only be used with std140 or std430 layout packing
ERROR: 0:44: 'align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:44: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:46: 'offset' : cannot specify on a variable declaration
ERROR: 0:47: 'layout' : offset/align can only be used on a uniform or buffer
@ -36,9 +36,9 @@ ERROR: 0:52: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:54: 'layout' : matrix or packing qualifiers can only be used on a uniform or buffer
ERROR: 0:55: 'layout' : cannot specify packing on a variable declaration
ERROR: 0:57: 'align' : must be a power of 2
ERROR: 0:58: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:62: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:63: 'offset/align' : can only be used with std140 or std430 layout packing
ERROR: 0:58: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:62: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:63: 'offset/align' : can only be used with std140, std430, or scalar layout packing
ERROR: 0:62: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:63: 'layout' : offset/align can only be used on a uniform or buffer
ERROR: 0:84: 'align' : must be a power of 2

View File

@ -171,6 +171,8 @@ ERROR: xfb_buffer 0, xfb_stride 92
ERROR: Linking vertex stage: xfb_stride must be multiple of 4:
ERROR: xfb_buffer 5, xfb_stride 6
ERROR: Linking vertex stage: xfb_stride is too large:
ERROR: xfb_buffer 6, components (1/4 stride) needed are 500, gl_MaxTransformFeedbackInterleavedComponents is 64
ERROR: Linking vertex stage: xfb_stride is too large:
ERROR: xfb_buffer 7, components (1/4 stride) needed are 66, gl_MaxTransformFeedbackInterleavedComponents is 64
Shader version: 440

View File

@ -146,7 +146,7 @@ gl_FragCoord origin is upper left
0:? 'input' ( in 4-component vector of float FragCoord)
error: SPIRV-Tools Validation Errors
error: Structure id 50 decorated as BufferBlock for variable in Uniform storage class must follow standard storage buffer layout rules: member 7 at offset 128 overlaps previous member ending at offset 171
error: Structure id 50 decorated as BufferBlock for variable in Uniform storage class must follow relaxed storage buffer layout rules: member 7 at offset 128 overlaps previous member ending at offset 171
%tbufName = OpTypeStruct %v4float %int %float %float %float %float %float %float %mat3v4float %mat3v4float %mat3v4float %mat3v4float
// Module Version 10000

View File

@ -132,7 +132,9 @@ gl_FragCoord origin is upper left
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
error: SPIRV-Tools Validation Errors
error: Only a single level of array is allowed for descriptor set variables
error: Uniform OpVariable <id> '18[cb3] 'has illegal type.
From Vulkan spec, section 14.5.2:
Variables identified with the Uniform storage class are used to access transparent buffer backed resources. Such variables must be typed as OpTypeStruct, or an array of this type
%cb3_0 = OpVariable %_ptr_Uniform__arr__arr_cb3_uint_4_uint_2 Uniform
// Module Version 10000

View File

@ -64,10 +64,6 @@ gl_FragCoord origin is upper left
0:? 'f1' ( global 1-component vector of float)
0:? 'scalar' ( global float)
error: SPIRV-Tools Validation Errors
error: Expected int scalar or vector type as Result Type: IMul
%20 = OpIMul %float %18 %19
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 27
@ -106,10 +102,10 @@ error: Expected int scalar or vector type as Result Type: IMul
12: Label
18: 6(float) Load 14(f1)
19: 6(float) Load 16(scalar)
20: 6(float) IMul 18 19
20: 6(float) FMul 18 19
21: 6(float) Load 9(inFloat1)
22: 6(float) Load 10(inScalar)
23: 6(float) IMul 21 22
23: 6(float) FMul 21 22
24: 6(float) FAdd 20 23
ReturnValue 24
FunctionEnd

View File

@ -0,0 +1,339 @@
hlsl.int.dot.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:1 Function Definition: @main( ( temp 4-component vector of float)
0:1 Function Parameters:
0:? Sequence
0:2 Sequence
0:2 move second child to first child ( temp int)
0:2 'i' ( temp int)
0:2 Constant:
0:2 1 (const int)
0:3 Sequence
0:3 move second child to first child ( temp 1-component vector of int)
0:3 'i2' ( temp 1-component vector of int)
0:3 Constant:
0:3 2 (const int)
0:4 Sequence
0:4 move second child to first child ( temp 2-component vector of int)
0:4 'i3' ( temp 2-component vector of int)
0:4 Constant:
0:4 3 (const int)
0:4 3 (const int)
0:5 Sequence
0:5 move second child to first child ( temp 3-component vector of int)
0:5 'i4' ( temp 3-component vector of int)
0:5 Constant:
0:5 4 (const int)
0:5 4 (const int)
0:5 4 (const int)
0:6 Sequence
0:6 move second child to first child ( temp 4-component vector of int)
0:6 'i5' ( temp 4-component vector of int)
0:6 Constant:
0:6 5 (const int)
0:6 5 (const int)
0:6 5 (const int)
0:6 5 (const int)
0:8 move second child to first child ( temp int)
0:8 'i' ( temp int)
0:8 dot-product ( temp int)
0:8 'i' ( temp int)
0:8 'i' ( temp int)
0:9 move second child to first child ( temp 1-component vector of int)
0:9 'i2' ( temp 1-component vector of int)
0:9 Construct int ( temp 1-component vector of int)
0:9 dot-product ( temp int)
0:9 Construct int ( in int)
0:9 'i2' ( temp 1-component vector of int)
0:9 Construct int ( in int)
0:9 'i2' ( temp 1-component vector of int)
0:10 move second child to first child ( temp 2-component vector of int)
0:10 'i3' ( temp 2-component vector of int)
0:10 Construct ivec2 ( temp 2-component vector of int)
0:10 dot-product ( temp int)
0:10 'i3' ( temp 2-component vector of int)
0:10 'i3' ( temp 2-component vector of int)
0:11 move second child to first child ( temp 3-component vector of int)
0:11 'i4' ( temp 3-component vector of int)
0:11 Construct ivec3 ( temp 3-component vector of int)
0:11 dot-product ( temp int)
0:11 'i4' ( temp 3-component vector of int)
0:11 'i4' ( temp 3-component vector of int)
0:12 move second child to first child ( temp 4-component vector of int)
0:12 'i5' ( temp 4-component vector of int)
0:12 Construct ivec4 ( temp 4-component vector of int)
0:12 dot-product ( temp int)
0:12 'i5' ( temp 4-component vector of int)
0:12 'i5' ( temp 4-component vector of int)
0:13 Branch: Return with expression
0:13 Convert int to float ( temp 4-component vector of float)
0:13 add ( temp 4-component vector of int)
0:13 add ( temp 4-component vector of int)
0:13 add ( temp 4-component vector of int)
0:13 add ( temp 4-component vector of int)
0:13 'i' ( temp int)
0:13 Construct ivec4 ( temp 4-component vector of int)
0:13 Construct int ( temp int)
0:13 'i2' ( temp 1-component vector of int)
0:13 vector swizzle ( temp 4-component vector of int)
0:13 'i3' ( temp 2-component vector of int)
0:13 Sequence
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 vector swizzle ( temp 4-component vector of int)
0:13 'i4' ( temp 3-component vector of int)
0:13 Sequence
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 2 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 'i5' ( temp 4-component vector of int)
0:1 Function Definition: main( ( temp void)
0:1 Function Parameters:
0:? Sequence
0:1 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:1 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:1 Function Definition: @main( ( temp 4-component vector of float)
0:1 Function Parameters:
0:? Sequence
0:2 Sequence
0:2 move second child to first child ( temp int)
0:2 'i' ( temp int)
0:2 Constant:
0:2 1 (const int)
0:3 Sequence
0:3 move second child to first child ( temp 1-component vector of int)
0:3 'i2' ( temp 1-component vector of int)
0:3 Constant:
0:3 2 (const int)
0:4 Sequence
0:4 move second child to first child ( temp 2-component vector of int)
0:4 'i3' ( temp 2-component vector of int)
0:4 Constant:
0:4 3 (const int)
0:4 3 (const int)
0:5 Sequence
0:5 move second child to first child ( temp 3-component vector of int)
0:5 'i4' ( temp 3-component vector of int)
0:5 Constant:
0:5 4 (const int)
0:5 4 (const int)
0:5 4 (const int)
0:6 Sequence
0:6 move second child to first child ( temp 4-component vector of int)
0:6 'i5' ( temp 4-component vector of int)
0:6 Constant:
0:6 5 (const int)
0:6 5 (const int)
0:6 5 (const int)
0:6 5 (const int)
0:8 move second child to first child ( temp int)
0:8 'i' ( temp int)
0:8 dot-product ( temp int)
0:8 'i' ( temp int)
0:8 'i' ( temp int)
0:9 move second child to first child ( temp 1-component vector of int)
0:9 'i2' ( temp 1-component vector of int)
0:9 Construct int ( temp 1-component vector of int)
0:9 dot-product ( temp int)
0:9 Construct int ( in int)
0:9 'i2' ( temp 1-component vector of int)
0:9 Construct int ( in int)
0:9 'i2' ( temp 1-component vector of int)
0:10 move second child to first child ( temp 2-component vector of int)
0:10 'i3' ( temp 2-component vector of int)
0:10 Construct ivec2 ( temp 2-component vector of int)
0:10 dot-product ( temp int)
0:10 'i3' ( temp 2-component vector of int)
0:10 'i3' ( temp 2-component vector of int)
0:11 move second child to first child ( temp 3-component vector of int)
0:11 'i4' ( temp 3-component vector of int)
0:11 Construct ivec3 ( temp 3-component vector of int)
0:11 dot-product ( temp int)
0:11 'i4' ( temp 3-component vector of int)
0:11 'i4' ( temp 3-component vector of int)
0:12 move second child to first child ( temp 4-component vector of int)
0:12 'i5' ( temp 4-component vector of int)
0:12 Construct ivec4 ( temp 4-component vector of int)
0:12 dot-product ( temp int)
0:12 'i5' ( temp 4-component vector of int)
0:12 'i5' ( temp 4-component vector of int)
0:13 Branch: Return with expression
0:13 Convert int to float ( temp 4-component vector of float)
0:13 add ( temp 4-component vector of int)
0:13 add ( temp 4-component vector of int)
0:13 add ( temp 4-component vector of int)
0:13 add ( temp 4-component vector of int)
0:13 'i' ( temp int)
0:13 Construct ivec4 ( temp 4-component vector of int)
0:13 Construct int ( temp int)
0:13 'i2' ( temp 1-component vector of int)
0:13 vector swizzle ( temp 4-component vector of int)
0:13 'i3' ( temp 2-component vector of int)
0:13 Sequence
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 vector swizzle ( temp 4-component vector of int)
0:13 'i4' ( temp 3-component vector of int)
0:13 Sequence
0:13 Constant:
0:13 0 (const int)
0:13 Constant:
0:13 1 (const int)
0:13 Constant:
0:13 2 (const int)
0:13 Constant:
0:13 0 (const int)
0:13 'i5' ( temp 4-component vector of int)
0:1 Function Definition: main( ( temp void)
0:1 Function Parameters:
0:? Sequence
0:1 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:1 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
// Module Version 10300
// Generated by (magic number): 80007
// Id's are bound by 84
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 82
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 9 "@main("
Name 13 "i"
Name 15 "i2"
Name 19 "i3"
Name 24 "i4"
Name 29 "i5"
Name 82 "@entryPointOutput"
Decorate 82(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
11: TypeInt 32 1
12: TypePointer Function 11(int)
14: 11(int) Constant 1
16: 11(int) Constant 2
17: TypeVector 11(int) 2
18: TypePointer Function 17(ivec2)
20: 11(int) Constant 3
21: 17(ivec2) ConstantComposite 20 20
22: TypeVector 11(int) 3
23: TypePointer Function 22(ivec3)
25: 11(int) Constant 4
26: 22(ivec3) ConstantComposite 25 25 25
27: TypeVector 11(int) 4
28: TypePointer Function 27(ivec4)
30: 11(int) Constant 5
31: 27(ivec4) ConstantComposite 30 30 30 30
81: TypePointer Output 7(fvec4)
82(@entryPointOutput): 81(ptr) Variable Output
4(main): 2 Function None 3
5: Label
83: 7(fvec4) FunctionCall 9(@main()
Store 82(@entryPointOutput) 83
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
10: Label
13(i): 12(ptr) Variable Function
15(i2): 12(ptr) Variable Function
19(i3): 18(ptr) Variable Function
24(i4): 23(ptr) Variable Function
29(i5): 28(ptr) Variable Function
Store 13(i) 14
Store 15(i2) 16
Store 19(i3) 21
Store 24(i4) 26
Store 29(i5) 31
32: 11(int) Load 13(i)
33: 11(int) Load 13(i)
34: 11(int) IMul 32 33
Store 13(i) 34
35: 11(int) Load 15(i2)
36: 11(int) Load 15(i2)
37: 11(int) IMul 35 36
Store 15(i2) 37
38: 17(ivec2) Load 19(i3)
39: 17(ivec2) Load 19(i3)
40: 17(ivec2) IMul 38 39
41: 11(int) CompositeExtract 40 0
42: 11(int) CompositeExtract 38 1
43: 11(int) IAdd 41 42
44: 17(ivec2) CompositeConstruct 43 43
Store 19(i3) 44
45: 22(ivec3) Load 24(i4)
46: 22(ivec3) Load 24(i4)
47: 22(ivec3) IMul 45 46
48: 11(int) CompositeExtract 47 0
49: 11(int) CompositeExtract 45 1
50: 11(int) IAdd 48 49
51: 11(int) CompositeExtract 45 2
52: 11(int) IAdd 50 51
53: 22(ivec3) CompositeConstruct 52 52 52
Store 24(i4) 53
54: 27(ivec4) Load 29(i5)
55: 27(ivec4) Load 29(i5)
56: 27(ivec4) IMul 54 55
57: 11(int) CompositeExtract 56 0
58: 11(int) CompositeExtract 54 1
59: 11(int) IAdd 57 58
60: 11(int) CompositeExtract 54 2
61: 11(int) IAdd 59 60
62: 11(int) CompositeExtract 54 3
63: 11(int) IAdd 61 62
64: 27(ivec4) CompositeConstruct 63 63 63 63
Store 29(i5) 64
65: 11(int) Load 13(i)
66: 11(int) Load 15(i2)
67: 27(ivec4) CompositeConstruct 66 66 66 66
68: 27(ivec4) CompositeConstruct 65 65 65 65
69: 27(ivec4) IAdd 68 67
70: 17(ivec2) Load 19(i3)
71: 27(ivec4) VectorShuffle 70 70 0 1 0 1
72: 27(ivec4) IAdd 69 71
73: 22(ivec3) Load 24(i4)
74: 27(ivec4) VectorShuffle 73 73 0 1 2 0
75: 27(ivec4) IAdd 72 74
76: 27(ivec4) Load 29(i5)
77: 27(ivec4) IAdd 75 76
78: 7(fvec4) ConvertSToF 77
ReturnValue 78
FunctionEnd

View File

@ -155,6 +155,12 @@ gl_FragCoord origin is upper left
0:? 'g_texdata_array2[2].nonopaque_thing' ( uniform int)
0:? 'ps_output.color' (layout( location=0) out 4-component vector of float)
error: SPIRV-Tools Validation Errors
error: UniformConstant OpVariable <id> '65[g_texdata.nonopaque_thing] 'has illegal type.
From Vulkan spec, section 14.5.2:
Variables identified with the UniformConstant storage class are used only as handles to refer to opaque resources. Such variables must be typed as OpTypeImage, OpTypeSampler, OpTypeSampledImage, OpTypeAccelerationStructureNV, or an array of one of these types.
%g_texdata_nonopaque_thing = OpVariable %_ptr_UniformConstant_int UniformConstant
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 80

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,9 @@ spv.AofA.frag
WARNING: 0:6: '[][]' : Generating SPIR-V array-of-arrays, but Vulkan only supports single array level for this resource
error: SPIRV-Tools Validation Errors
error: Only a single level of array is allowed for descriptor set variables
error: Uniform OpVariable <id> '98[nameAofA] 'has illegal type.
From Vulkan spec, section 14.5.2:
Variables identified with the Uniform storage class are used to access transparent buffer backed resources. Such variables must be typed as OpTypeStruct, or an array of this type
%nameAofA = OpVariable %_ptr_Uniform__arr__arr_uAofA_uint_5_uint_3 Uniform
// Module Version 10000

View File

@ -1,4 +1,10 @@
spv.functionNestedOpaque.vert
error: SPIRV-Tools Validation Errors
error: UniformConstant OpVariable <id> '36[si] 'has illegal type.
From Vulkan spec, section 14.5.2:
Variables identified with the UniformConstant storage class are used only as handles to refer to opaque resources. Such variables must be typed as OpTypeImage, OpTypeSampler, OpTypeSampledImage, OpTypeAccelerationStructureNV, or an array of one of these types.
%si = OpVariable %_ptr_UniformConstant_S UniformConstant
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 39

View File

@ -0,0 +1,80 @@
spv.scalarlayout.frag
error: SPIRV-Tools Validation Errors
error: Structure id 17 decorated as Block for variable in Uniform storage class must follow standard uniform buffer layout rules: member 1 at offset 4 is not aligned to 8
%B1 = OpTypeStruct %float %v2float %v3float %_arr_float_uint_2 %mat2v3float %_arr_mat2v3float_uint_2 %float %S %_arr_S_uint_2
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 20
Capability Shader
Capability Float64
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_scalar_block_layout"
Name 4 "main"
Name 15 "S"
MemberName 15(S) 0 "a"
MemberName 15(S) 1 "b"
MemberName 15(S) 2 "c"
MemberName 15(S) 3 "d"
MemberName 15(S) 4 "e"
MemberName 15(S) 5 "f"
Name 17 "B1"
MemberName 17(B1) 0 "a"
MemberName 17(B1) 1 "b"
MemberName 17(B1) 2 "c"
MemberName 17(B1) 3 "d"
MemberName 17(B1) 4 "e"
MemberName 17(B1) 5 "f"
MemberName 17(B1) 6 "g"
MemberName 17(B1) 7 "h"
MemberName 17(B1) 8 "i"
Name 19 ""
Decorate 11 ArrayStride 4
Decorate 13 ArrayStride 24
MemberDecorate 15(S) 0 Offset 0
MemberDecorate 15(S) 1 Offset 4
MemberDecorate 15(S) 2 Offset 16
MemberDecorate 15(S) 3 Offset 24
MemberDecorate 15(S) 4 Offset 28
MemberDecorate 15(S) 5 Offset 40
Decorate 16 ArrayStride 48
MemberDecorate 17(B1) 0 Offset 0
MemberDecorate 17(B1) 1 Offset 4
MemberDecorate 17(B1) 2 Offset 12
MemberDecorate 17(B1) 3 Offset 24
MemberDecorate 17(B1) 4 ColMajor
MemberDecorate 17(B1) 4 Offset 32
MemberDecorate 17(B1) 4 MatrixStride 12
MemberDecorate 17(B1) 5 ColMajor
MemberDecorate 17(B1) 5 Offset 56
MemberDecorate 17(B1) 5 MatrixStride 12
MemberDecorate 17(B1) 6 Offset 104
MemberDecorate 17(B1) 7 Offset 112
MemberDecorate 17(B1) 8 Offset 160
Decorate 17(B1) Block
Decorate 19 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 2
8: TypeVector 6(float) 3
9: TypeInt 32 0
10: 9(int) Constant 2
11: TypeArray 6(float) 10
12: TypeMatrix 8(fvec3) 2
13: TypeArray 12 10
14: TypeFloat 64
15(S): TypeStruct 6(float) 7(fvec2) 14(float64_t) 6(float) 8(fvec3) 6(float)
16: TypeArray 15(S) 10
17(B1): TypeStruct 6(float) 7(fvec2) 8(fvec3) 11 12 13 6(float) 15(S) 16
18: TypePointer Uniform 17(B1)
19: 18(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
Return
FunctionEnd

View File

@ -0,0 +1,72 @@
spv.scalarlayoutfloat16.frag
error: SPIRV-Tools Validation Errors
error: Structure id 15 decorated as Block for variable in Uniform storage class must follow standard uniform buffer layout rules: member 1 at offset 2 is not aligned to 4
%B1 = OpTypeStruct %half %v2half %v3half %_arr_half_uint_2 %half %S %_arr_S_uint_2
// Module Version 10000
// Generated by (magic number): 80007
// Id's are bound by 18
Capability Shader
Capability Float64
Capability StorageUniform16
Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_scalar_block_layout"
SourceExtension "GL_EXT_shader_16bit_storage"
Name 4 "main"
Name 13 "S"
MemberName 13(S) 0 "a"
MemberName 13(S) 1 "b"
MemberName 13(S) 2 "c"
MemberName 13(S) 3 "d"
MemberName 13(S) 4 "e"
MemberName 13(S) 5 "f"
Name 15 "B1"
MemberName 15(B1) 0 "a"
MemberName 15(B1) 1 "b"
MemberName 15(B1) 2 "c"
MemberName 15(B1) 3 "d"
MemberName 15(B1) 4 "g"
MemberName 15(B1) 5 "h"
MemberName 15(B1) 6 "i"
Name 17 ""
Decorate 11 ArrayStride 2
MemberDecorate 13(S) 0 Offset 0
MemberDecorate 13(S) 1 Offset 2
MemberDecorate 13(S) 2 Offset 8
MemberDecorate 13(S) 3 Offset 16
MemberDecorate 13(S) 4 Offset 18
MemberDecorate 13(S) 5 Offset 24
Decorate 14 ArrayStride 32
MemberDecorate 15(B1) 0 Offset 0
MemberDecorate 15(B1) 1 Offset 2
MemberDecorate 15(B1) 2 Offset 6
MemberDecorate 15(B1) 3 Offset 12
MemberDecorate 15(B1) 4 Offset 16
MemberDecorate 15(B1) 5 Offset 24
MemberDecorate 15(B1) 6 Offset 56
Decorate 15(B1) Block
Decorate 17 DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 16
7: TypeVector 6(float16_t) 2
8: TypeVector 6(float16_t) 3
9: TypeInt 32 0
10: 9(int) Constant 2
11: TypeArray 6(float16_t) 10
12: TypeFloat 64
13(S): TypeStruct 6(float16_t) 7(f16vec2) 12(float64_t) 6(float16_t) 8(f16vec3) 6(float16_t)
14: TypeArray 13(S) 10
15(B1): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) 11 6(float16_t) 13(S) 14
16: TypePointer Uniform 15(B1)
17: 16(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
Return
FunctionEnd

14
3rdparty/glslang/Test/hlsl.int.dot.frag vendored Normal file
View File

@ -0,0 +1,14 @@
float4 main() : SV_Target {
int i = 1;
int1 i2 = 2;
int2 i3 = 3;
int3 i4 = 4;
int4 i5 = 5;
i = dot(i, i);
i2 = dot(i2, i2);
i3 = dot(i3, i3);
i4 = dot(i4, i4);
i5 = dot(i5, i5);
return i + i2.xxxx + i3.xyxy + i4.xyzx + i5;
}

View File

@ -5,7 +5,7 @@ struct sb_t
bool test2;
}; // stride = 20
StructuredBuffer<sb_t> sbuf : register(c10);
StructuredBuffer<sb_t> sbuf : register(t10);
StructuredBuffer<float> sbuf2;
float4 main(uint pos : FOO) : SV_Target0

View File

@ -0,0 +1,190 @@
#define zeros 0
#define zeros1 0
#define zeros2 0, 0
#define zeros3 0, 0, 0
#define zeros4 0, 0, 0, 0
#define zeros5 0, 0, 0, 0, 0
#define zeros6 0, 0, 0, 0, 0, 0
#define zeros7 0, 0, 0, 0, 0, 0, 0
#define zeros8 0, 0, 0, 0, 0, 0, 0, 0
#define zeros9 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros11 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros12 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros13 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros14 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros15 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
float4 main() : SV_Target {
float var0 = float(zeros1);
float2 var13 = float(zeros1);
float2 var14 = float2(zeros2);
float3 var26 = float(zeros1);
float3 var28 = float3(zeros3);
float4 var39 = float(zeros1);
float4 var42 = float4(zeros4);
float4 var43 = float2x2(zeros4);
float2x2 var52 = float(zeros1);
float2x2 var55 = float4(zeros4);
float2x2 var56 = float2x2(zeros4);
float2x3 var65 = float(zeros1);
float2x3 var70 = float2x3(zeros6);
float2x4 var78 = float(zeros1);
float2x4 var84 = float2x4(zeros8);
float3x2 var91 = float(zeros1);
float3x2 var98 = float3x2(zeros6);
float3x3 var104 = float(zeros1);
float3x3 var112 = float3x3(zeros9);
float3x4 var117 = float(zeros1);
float3x4 var126 = float3x4(zeros12);
float4x2 var130 = float(zeros1);
float4x2 var140 = float4x2(zeros8);
float4x3 var143 = float(zeros1);
float4x3 var154 = float4x3(zeros12);
float4x4 var156 = float(zeros1);
float4x4 var168 = float4x4(zeros16);
float var1 = float2(zeros2);// warning X3206: implicit truncation of vector type
float var2 = float3(zeros3);// warning X3206: implicit truncation of vector type
float var3 = float4(zeros4);// warning X3206: implicit truncation of vector type
float var4 = float2x2(zeros4);// warning X3206: implicit truncation of vector type
float var5 = float2x3(zeros6);// warning X3206: implicit truncation of vector type
float var6 = float2x4(zeros8);// warning X3206: implicit truncation of vector type
float var7 = float3x2(zeros6);// warning X3206: implicit truncation of vector type
float var8 = float3x3(zeros9);// warning X3206: implicit truncation of vector type
float var9 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float var10 = float4x2(zeros8);// warning X3206: implicit truncation of vector type
float var11 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float var12 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float2 var15 = float3(zeros3);// warning X3206: implicit truncation of vector type
float2 var16 = float4(zeros4);// warning X3206: implicit truncation of vector type
float3 var29 = float4(zeros4);// warning X3206: implicit truncation of vector type
float2x2 var57 = float2x3(zeros6);// warning X3206: implicit truncation of vector type
float2x2 var58 = float2x4(zeros8);// warning X3206: implicit truncation of vector type
float2x2 var59 = float3x2(zeros6);// warning X3206: implicit truncation of vector type
float2x2 var60 = float3x3(zeros9);// warning X3206: implicit truncation of vector type
float2x2 var61 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float2x2 var62 = float4x2(zeros8);// warning X3206: implicit truncation of vector type
float2x2 var63 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float2x2 var64 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float2x3 var71 = float2x4(zeros8);// warning X3206: implicit truncation of vector type
float2x3 var73 = float3x3(zeros9);// warning X3206: implicit truncation of vector type
float2x3 var74 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float2x3 var76 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float2x3 var77 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float2x4 var87 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float2x4 var90 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float3x2 var99 = float3x3(zeros9);// warning X3206: implicit truncation of vector type
float3x2 var100 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float3x2 var101 = float4x2(zeros8);// warning X3206: implicit truncation of vector type
float3x2 var102 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float3x2 var103 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float3x3 var113 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float3x3 var115 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float3x3 var116 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float3x4 var129 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float4x2 var141 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float4x2 var142 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float4x3 var155 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float2 var17 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float2'
float2 var18 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float2'
float2 var19 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float2'
float2 var20 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float2'
float2 var21 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float2'
float2 var22 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float2'
float2 var23 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float2'
float2 var24 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float2'
float2 var25 = float4x4(zeros16);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x4' to 'float2'
float3 var27 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float3'
float3 var30 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float3'
float3 var31 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float3'
float3 var32 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float3'
float3 var33 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float3'
float3 var34 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float3'
float3 var35 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float3'
float3 var36 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float3'
float3 var37 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float3'
float3 var38 = float4x4(zeros16);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x4' to 'float3'
float4 var40 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float4'
float4 var41 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float4'
float4 var44 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float4'
float4 var45 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float4'
float4 var46 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float4'
float4 var47 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float4'
float4 var48 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float4'
float4 var49 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float4'
float4 var50 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float4'
float4 var51 = float4x4(zeros16);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x4' to 'float4'
float2x2 var53 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float2x2'
float2x2 var54 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float2x2'
float2x3 var66 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float2x3'
float2x3 var67 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float2x3'
float2x3 var68 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float2x3'
float2x3 var69 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float2x3'
float2x3 var72 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float2x3'
float2x3 var75 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float2x3'
float2x4 var79 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float2x4'
float2x4 var80 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float2x4'
float2x4 var81 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float2x4'
float2x4 var82 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float2x4'
float2x4 var83 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float2x4'
float2x4 var85 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float2x4'
float2x4 var86 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float2x4'
float2x4 var88 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float2x4'
float2x4 var89 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float2x4'
float3x2 var92 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float3x2'
float3x2 var93 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float3x2'
float3x2 var94 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float3x2'
float3x2 var95 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float3x2'
float3x2 var96 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float3x2'
float3x2 var97 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float3x2'
float3x3 var105 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float3x3'
float3x3 var106 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float3x3'
float3x3 var107 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float3x3'
float3x3 var108 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float3x3'
float3x3 var109 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float3x3'
float3x3 var110 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float3x3'
float3x3 var111 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float3x3'
float3x3 var114 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float3x3'
float3x4 var118 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float3x4'
float3x4 var119 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float3x4'
float3x4 var120 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float3x4'
float3x4 var121 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float3x4'
float3x4 var122 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float3x4'
float3x4 var123 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float3x4'
float3x4 var124 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float3x4'
float3x4 var125 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float3x4'
float3x4 var127 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float3x4'
float3x4 var128 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float3x4'
float4x2 var131 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float4x2'
float4x2 var132 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float4x2'
float4x2 var133 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float4x2'
float4x2 var134 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float4x2'
float4x2 var135 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float4x2'
float4x2 var136 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float4x2'
float4x2 var137 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float4x2'
float4x2 var138 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float4x2'
float4x2 var139 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float4x2'
float4x3 var144 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float4x3'
float4x3 var145 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float4x3'
float4x3 var146 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float4x3'
float4x3 var147 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float4x3'
float4x3 var148 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float4x3'
float4x3 var149 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float4x3'
float4x3 var150 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float4x3'
float4x3 var151 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float4x3'
float4x3 var152 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float4x3'
float4x3 var153 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float4x3'
float4x4 var157 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float4x4'
float4x4 var158 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float4x4'
float4x4 var159 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float4x4'
float4x4 var160 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float4x4'
float4x4 var161 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float4x4'
float4x4 var162 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float4x4'
float4x4 var163 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float4x4'
float4x4 var164 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float4x4'
float4x4 var165 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float4x4'
float4x4 var166 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float4x4'
float4x4 var167 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float4x4'
return 0;
}

View File

@ -0,0 +1,90 @@
#define zeros 0
#define zeros1 0
#define zeros2 0, 0
#define zeros3 0, 0, 0
#define zeros4 0, 0, 0, 0
#define zeros5 0, 0, 0, 0, 0
#define zeros6 0, 0, 0, 0, 0, 0
#define zeros7 0, 0, 0, 0, 0, 0, 0
#define zeros8 0, 0, 0, 0, 0, 0, 0, 0
#define zeros9 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros11 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros12 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros13 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros14 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros15 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
#define zeros16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
float4 main() : SV_Target {
float var0 = float(zeros1);
float2 var13 = float(zeros1);
float2 var14 = float2(zeros2);
float3 var26 = float(zeros1);
float3 var28 = float3(zeros3);
float4 var39 = float(zeros1);
float4 var42 = float4(zeros4);
float4 var43 = float2x2(zeros4);
float2x2 var52 = float(zeros1);
float2x2 var55 = float4(zeros4);
float2x2 var56 = float2x2(zeros4);
float2x3 var65 = float(zeros1);
float2x3 var70 = float2x3(zeros6);
float2x4 var78 = float(zeros1);
float2x4 var84 = float2x4(zeros8);
float3x2 var91 = float(zeros1);
float3x2 var98 = float3x2(zeros6);
float3x3 var104 = float(zeros1);
float3x3 var112 = float3x3(zeros9);
float3x4 var117 = float(zeros1);
float3x4 var126 = float3x4(zeros12);
float4x2 var130 = float(zeros1);
float4x2 var140 = float4x2(zeros8);
float4x3 var143 = float(zeros1);
float4x3 var154 = float4x3(zeros12);
float4x4 var156 = float(zeros1);
float4x4 var168 = float4x4(zeros16);
float var1 = float2(zeros2);// warning X3206: implicit truncation of vector type
float var2 = float3(zeros3);// warning X3206: implicit truncation of vector type
float var3 = float4(zeros4);// warning X3206: implicit truncation of vector type
float var4 = float2x2(zeros4);// warning X3206: implicit truncation of vector type
float var5 = float2x3(zeros6);// warning X3206: implicit truncation of vector type
float var6 = float2x4(zeros8);// warning X3206: implicit truncation of vector type
float var7 = float3x2(zeros6);// warning X3206: implicit truncation of vector type
float var8 = float3x3(zeros9);// warning X3206: implicit truncation of vector type
float var9 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float var10 = float4x2(zeros8);// warning X3206: implicit truncation of vector type
float var11 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float var12 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float2 var15 = float3(zeros3);// warning X3206: implicit truncation of vector type
float2 var16 = float4(zeros4);// warning X3206: implicit truncation of vector type
float3 var29 = float4(zeros4);// warning X3206: implicit truncation of vector type
float2x2 var57 = float2x3(zeros6);// warning X3206: implicit truncation of vector type
float2x2 var58 = float2x4(zeros8);// warning X3206: implicit truncation of vector type
float2x2 var59 = float3x2(zeros6);// warning X3206: implicit truncation of vector type
float2x2 var60 = float3x3(zeros9);// warning X3206: implicit truncation of vector type
float2x2 var61 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float2x2 var62 = float4x2(zeros8);// warning X3206: implicit truncation of vector type
float2x2 var63 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float2x2 var64 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float2x3 var71 = float2x4(zeros8);// warning X3206: implicit truncation of vector type
float2x3 var73 = float3x3(zeros9);// warning X3206: implicit truncation of vector type
float2x3 var74 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float2x3 var76 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float2x3 var77 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float2x4 var87 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float2x4 var90 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float3x2 var99 = float3x3(zeros9);// warning X3206: implicit truncation of vector type
float3x2 var100 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float3x2 var101 = float4x2(zeros8);// warning X3206: implicit truncation of vector type
float3x2 var102 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float3x2 var103 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float3x3 var113 = float3x4(zeros12);// warning X3206: implicit truncation of vector type
float3x3 var115 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float3x3 var116 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float3x4 var129 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float4x2 var141 = float4x3(zeros12);// warning X3206: implicit truncation of vector type
float4x2 var142 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
float4x3 var155 = float4x4(zeros16);// warning X3206: implicit truncation of vector type
return 0;
}

View File

@ -0,0 +1,32 @@
#version 450 core
#extension GL_EXT_scalar_block_layout : enable
// Block memory layout
struct S
{
float a; // offset 0
vec2 b; // offset 4
double c; // offset 16
float d; // offset 24
vec3 e; // offset 28
float f; // offset 40
// size = 44, align = 8
};
layout(column_major, scalar) uniform B1
{
float a; // offset = 0
vec2 b; // offset = 4
vec3 c; // offset = 12
float d[2]; // offset = 24
mat2x3 e; // offset = 32, takes 24 bytes, matrixstride = 12
mat2x3 f[2]; // offset = 56, takes 48 bytes, matrixstride = 12, arraystride = 24
float g; // offset = 104
S h; // offset = 112 (aligned to multiple of 8)
S i[2]; // offset = 160 (aligned to multiple of 8) stride = 48
};
void main()
{
}

View File

@ -0,0 +1,31 @@
#version 450 core
#extension GL_EXT_shader_16bit_storage: enable
#extension GL_EXT_scalar_block_layout : enable
// Block memory layout
struct S
{
float16_t a; // offset 0
f16vec2 b; // offset 2
double c; // offset 8
float16_t d; // offset 16
f16vec3 e; // offset 18
float16_t f; // offset 24
// size = 26, align = 8
};
layout(column_major, scalar) uniform B1
{
float16_t a; // offset = 0
f16vec2 b; // offset = 2
f16vec3 c; // offset = 6
float16_t d[2]; // offset = 12 stride = 2
float16_t g; // offset = 16
S h; // offset = 24 (aligned to multiple of 8)
S i[2]; // offset = 56 (aligned to multiple of 8) stride = 32
};
void main()
{
}

View File

@ -2,6 +2,8 @@
#extension GL_ARB_shader_stencil_export: enable
out int gl_FragStencilRefARB;
void main()
{
gl_FragStencilRefARB = 100;

44
3rdparty/glslang/glslang/Include/Types.h vendored Normal file → Executable file
View File

@ -277,6 +277,7 @@ enum TLayoutPacking {
ElpStd140,
ElpStd430,
ElpPacked,
ElpScalar,
ElpCount // If expanding, see bitfield width below
};
@ -774,40 +775,40 @@ public:
int layoutOffset;
int layoutAlign;
unsigned int layoutLocation :12;
static const unsigned int layoutLocationEnd = 0xFFF;
unsigned int layoutLocation : 12;
static const unsigned int layoutLocationEnd = 0xFFF;
unsigned int layoutComponent : 3;
static const unsigned int layoutComponentEnd = 4;
unsigned int layoutComponent : 3;
static const unsigned int layoutComponentEnd = 4;
unsigned int layoutSet : 7;
static const unsigned int layoutSetEnd = 0x3F;
unsigned int layoutSet : 7;
static const unsigned int layoutSetEnd = 0x3F;
unsigned int layoutBinding : 16;
static const unsigned int layoutBindingEnd = 0xFFFF;
unsigned int layoutBinding : 16;
static const unsigned int layoutBindingEnd = 0xFFFF;
unsigned int layoutIndex : 8;
static const unsigned int layoutIndexEnd = 0xFF;
unsigned int layoutIndex : 8;
static const unsigned int layoutIndexEnd = 0xFF;
unsigned int layoutStream : 8;
static const unsigned int layoutStreamEnd = 0xFF;
unsigned int layoutStream : 8;
static const unsigned int layoutStreamEnd = 0xFF;
unsigned int layoutXfbBuffer : 4;
static const unsigned int layoutXfbBufferEnd = 0xF;
unsigned int layoutXfbBuffer : 4;
static const unsigned int layoutXfbBufferEnd = 0xF;
unsigned int layoutXfbStride : 10;
static const unsigned int layoutXfbStrideEnd = 0x3FF;
unsigned int layoutXfbStride : 14;
static const unsigned int layoutXfbStrideEnd = 0x3FFF;
unsigned int layoutXfbOffset : 10;
static const unsigned int layoutXfbOffsetEnd = 0x3FF;
unsigned int layoutXfbOffset : 13;
static const unsigned int layoutXfbOffsetEnd = 0x1FFF;
unsigned int layoutAttachment : 8; // for input_attachment_index
static const unsigned int layoutAttachmentEnd = 0XFF;
unsigned int layoutAttachment : 8; // for input_attachment_index
static const unsigned int layoutAttachmentEnd = 0XFF;
unsigned int layoutSpecConstantId : 11;
static const unsigned int layoutSpecConstantIdEnd = 0x7FF;
TLayoutFormat layoutFormat : 8;
TLayoutFormat layoutFormat : 8;
bool layoutPushConstant;
@ -951,6 +952,7 @@ public:
case ElpShared: return "shared";
case ElpStd140: return "std140";
case ElpStd430: return "std430";
case ElpScalar: return "scalar";
default: return "none";
}
}

View File

@ -1,3 +1,3 @@
// This header is generated by the make-revision script.
#define GLSLANG_PATCH_LEVEL 2933
#define GLSLANG_PATCH_LEVEL 2992

View File

@ -1119,9 +1119,12 @@ void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, T
rhsNode = addUniShapeConversion(op, lhsNode->getType(), rhsNode);
return;
case EOpMul:
// matrix multiply does not change shapes
if (lhsNode->isMatrix() && rhsNode->isMatrix())
return;
case EOpAdd:
case EOpSub:
case EOpMul:
case EOpDiv:
// want to support vector * scalar native ops in AST and lower, not smear, similarly for
// matrix * vector, etc.
@ -1194,9 +1197,19 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped*
// The new node that handles the conversion
TOperator constructorOp = mapTypeToConstructorOp(type);
// HLSL has custom semantics for scalar->mat shape conversions.
if (source == EShSourceHlsl) {
if (node->getType().isScalarOrVec1() && type.isMatrix()) {
// HLSL rules for scalar, vector and matrix conversions:
// 1) scalar can become anything, initializing every component with its value
// 2) vector and matrix can become scalar, first element is used (warning: truncation)
// 3) matrix can become matrix with less rows and/or columns (warning: truncation)
// 4) vector can become vector with less rows size (warning: truncation)
// 5a) vector 4 can become 2x2 matrix (special case) (same packing layout, its a reinterpret)
// 5b) 2x2 matrix can become vector 4 (special case) (same packing layout, its a reinterpret)
const TType &sourceType = node->getType();
// rule 1 for scalar to matrix is special
if (sourceType.isScalarOrVec1() && type.isMatrix()) {
// HLSL semantics: the scalar (or vec1) is replicated to every component of the matrix. Left to its
// own devices, the constructor from a scalar would populate the diagonal. This forces replication
@ -1204,7 +1217,7 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped*
// Note that if the node is complex (e.g, a function call), we don't want to duplicate it here
// repeatedly, so we copy it to a temp, then use the temp.
const int matSize = type.getMatrixRows() * type.getMatrixCols();
const int matSize = type.computeNumComponents();
TIntermAggregate* rhsAggregate = new TIntermAggregate();
const bool isSimple = (node->getAsSymbolNode() != nullptr) || (node->getAsConstantUnion() != nullptr);
@ -1212,12 +1225,44 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped*
if (!isSimple) {
assert(0); // TODO: use node replicator service when available.
}
for (int x=0; x<matSize; ++x)
for (int x = 0; x < matSize; ++x)
rhsAggregate->getSequence().push_back(node);
return setAggregateOperator(rhsAggregate, constructorOp, type, node->getLoc());
}
// rule 1 and 2
if ((sourceType.isScalar() && !type.isScalar()) || (!sourceType.isScalar() && type.isScalar()))
return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc());
// rule 3 and 5b
if (sourceType.isMatrix()) {
// rule 3
if (type.isMatrix()) {
if ((sourceType.getMatrixCols() != type.getMatrixCols() || sourceType.getMatrixRows() != type.getMatrixRows()) &&
sourceType.getMatrixCols() >= type.getMatrixCols() && sourceType.getMatrixRows() >= type.getMatrixRows())
return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc());
// rule 5b
} else if (type.isVector()) {
if (type.getVectorSize() == 4 && sourceType.getMatrixCols() == 2 && sourceType.getMatrixRows() == 2)
return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc());
}
}
// rule 4 and 5a
if (sourceType.isVector()) {
// rule 4
if (type.isVector())
{
if (sourceType.getVectorSize() > type.getVectorSize())
return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc());
// rule 5a
} else if (type.isMatrix()) {
if (sourceType.getVectorSize() == 4 && type.getMatrixCols() == 2 && type.getMatrixRows() == 2)
return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc());
}
}
}
// scalar -> vector or vec1 -> vector or

View File

@ -3872,6 +3872,8 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
identifier == "gl_BackSecondaryColor" ||
identifier == "gl_SecondaryColor" ||
(identifier == "gl_Color" && language == EShLangFragment) ||
(identifier == "gl_FragStencilRefARB" && (nonEsRedecls && version >= 140)
&& language == EShLangFragment) ||
#ifdef NV_EXTENSIONS
identifier == "gl_SampleMask" ||
identifier == "gl_Layer" ||
@ -3954,6 +3956,12 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
error(loc, "all redeclarations must use the same depth layout on", "redeclaration", symbol->getName().c_str());
}
}
else if (identifier == "gl_FragStencilRefARB") {
if (qualifier.hasLayout())
error(loc, "cannot apply layout qualifier to", "redeclaration", symbol->getName().c_str());
if (qualifier.storage != EvqVaryingOut)
error(loc, "cannot change output storage qualification of", "redeclaration", symbol->getName().c_str());
}
#ifdef NV_EXTENSIONS
else if (identifier == "gl_SampleMask") {
if (!publicType.layoutOverrideCoverage) {
@ -4603,6 +4611,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
publicType.qualifier.layoutPacking = ElpStd430;
return;
}
if (id == TQualifier::getLayoutPackingString(ElpScalar)) {
requireVulkan(loc, "scalar");
requireExtensions(loc, 1, &E_GL_EXT_scalar_block_layout, "scalar block layout");
publicType.qualifier.layoutPacking = ElpScalar;
return;
}
// TODO: compile-time performance: may need to stop doing linear searches
for (TLayoutFormat format = (TLayoutFormat)(ElfNone + 1); format < ElfCount; format = (TLayoutFormat)(format + 1)) {
if (id == TQualifier::getLayoutFormatString(format)) {
@ -4928,11 +4942,13 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
} else if (id == "xfb_stride") {
// "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the
// implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents."
if (value > 4 * resources.maxTransformFeedbackInterleavedComponents)
error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d", resources.maxTransformFeedbackInterleavedComponents);
else if (value >= (int)TQualifier::layoutXfbStrideEnd)
if (value > 4 * resources.maxTransformFeedbackInterleavedComponents) {
error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d",
resources.maxTransformFeedbackInterleavedComponents);
}
if (value >= (int)TQualifier::layoutXfbStrideEnd)
error(loc, "stride is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbStrideEnd-1);
if (value < (int)TQualifier::layoutXfbStrideEnd)
else
publicType.qualifier.layoutXfbStride = value;
return;
}
@ -6776,8 +6792,10 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
// "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts."
if (currentBlockQualifier.hasAlign()) {
if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430) {
error(loc, "can only be used with std140 or std430 layout packing", "align", "");
if (defaultQualification.layoutPacking != ElpStd140 &&
defaultQualification.layoutPacking != ElpStd430 &&
defaultQualification.layoutPacking != ElpScalar) {
error(loc, "can only be used with std140, std430, or scalar layout packing", "align", "");
defaultQualification.layoutAlign = -1;
}
}
@ -6826,8 +6844,10 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
// "The offset qualifier can only be used on block members of blocks declared with std140 or std430 layouts."
// "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts."
if (memberQualifier.hasAlign() || memberQualifier.hasOffset()) {
if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430)
error(memberLoc, "can only be used with std140 or std430 layout packing", "offset/align", "");
if (defaultQualification.layoutPacking != ElpStd140 &&
defaultQualification.layoutPacking != ElpStd430 &&
defaultQualification.layoutPacking != ElpScalar)
error(memberLoc, "can only be used with std140, std430, or scalar layout packing", "offset/align", "");
}
#ifdef NV_EXTENSIONS
@ -6938,7 +6958,7 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q
profileRequires(loc, EEsProfile, 300, nullptr, "uniform block");
profileRequires(loc, ENoProfile, 140, nullptr, "uniform block");
if (currentBlockQualifier.layoutPacking == ElpStd430 && ! currentBlockQualifier.layoutPushConstant)
error(loc, "requires the 'buffer' storage qualifier", "std430", "");
requireExtensions(loc, 1, &E_GL_EXT_scalar_block_layout, "std430 requires the buffer storage qualifier");
break;
case EvqBuffer:
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "buffer block");
@ -7137,7 +7157,7 @@ void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typ
{
if (!qualifier.isUniformOrBuffer() && !qualifier.isTaskMemory())
return;
if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430)
if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430 && qualifier.layoutPacking != ElpScalar)
return;
int offset = 0;
@ -7151,8 +7171,8 @@ void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typ
// modify just the children's view of matrix layout, if there is one for this member
TLayoutMatrix subMatrixLayout = typeList[member].type->getQualifier().layoutMatrix;
int dummyStride;
int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, dummyStride, qualifier.layoutPacking == ElpStd140,
subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor : qualifier.layoutMatrix == ElmRowMajor);
int memberAlignment = intermediate.getMemberAlignment(*typeList[member].type, memberSize, dummyStride, qualifier.layoutPacking,
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."

View File

@ -204,6 +204,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_control_flow_attributes] = EBhDisable;
extensionBehavior[E_GL_EXT_nonuniform_qualifier] = EBhDisable;
extensionBehavior[E_GL_EXT_samplerless_texture_functions] = EBhDisable;
extensionBehavior[E_GL_EXT_scalar_block_layout] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_16bit_storage] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_8bit_storage] = EBhDisable;
@ -378,6 +379,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_shader_16bit_storage 1\n"
"#define GL_EXT_shader_8bit_storage 1\n"
"#define GL_EXT_samplerless_texture_functions 1\n"
"#define GL_EXT_scalar_block_layout 1\n"
// GL_KHR_shader_subgroup
"#define GL_KHR_shader_subgroup_basic 1\n"

View File

@ -166,6 +166,7 @@ const char* const E_GL_EXT_post_depth_coverage = "GL_EXT_post_depth
const char* const E_GL_EXT_control_flow_attributes = "GL_EXT_control_flow_attributes";
const char* const E_GL_EXT_nonuniform_qualifier = "GL_EXT_nonuniform_qualifier";
const char* const E_GL_EXT_samplerless_texture_functions = "GL_EXT_samplerless_texture_functions";
const char* const E_GL_EXT_scalar_block_layout = "GL_EXT_scalar_block_layout";
// Arrays of extensions for the above viewportEXTs duplications

View File

@ -1372,10 +1372,11 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
// stride comes from the flattening down to vectors.
//
// Return value is the alignment of the type.
int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, bool std140, bool rowMajor)
int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor)
{
int alignment;
bool std140 = layoutPacking == glslang::ElpStd140;
// When using the std140 storage layout, structures will be laid out in buffer
// storage with its members stored in monotonically increasing order based on their
// location in the declaration. A structure and each structure member have a base
@ -1439,7 +1440,7 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b
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, dummyStride, std140, rowMajor);
alignment = getBaseAlignment(derefType, size, dummyStride, layoutPacking, rowMajor);
if (std140)
alignment = std::max(baseAlignmentVec4Std140, alignment);
RoundToPow2(size, alignment);
@ -1459,7 +1460,7 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b
int memberSize;
// 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, dummyStride, std140,
int memberAlignment = getBaseAlignment(*memberList[m].type, memberSize, dummyStride, layoutPacking,
(subMatrixLayout != ElmNone) ? (subMatrixLayout == ElmRowMajor) : rowMajor);
maxAlignment = std::max(maxAlignment, memberAlignment);
RoundToPow2(size, memberAlignment);
@ -1498,7 +1499,7 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b
// rule 5: deref to row, not to column, meaning the size of vector is num columns instead of num rows
TType derefType(type, 0, rowMajor);
alignment = getBaseAlignment(derefType, size, dummyStride, std140, rowMajor);
alignment = getBaseAlignment(derefType, size, dummyStride, layoutPacking, rowMajor);
if (std140)
alignment = std::max(baseAlignmentVec4Std140, alignment);
RoundToPow2(size, alignment);
@ -1526,4 +1527,79 @@ bool TIntermediate::improperStraddle(const TType& type, int size, int offset)
: offset % 16 != 0;
}
int TIntermediate::getScalarAlignment(const TType& type, int& size, int& stride, bool rowMajor)
{
int alignment;
stride = 0;
int dummyStride;
if (type.isArray()) {
TType derefType(type, 0);
alignment = getScalarAlignment(derefType, size, dummyStride, rowMajor);
stride = size;
RoundToPow2(stride, alignment);
size = stride * (type.getOuterArraySize() - 1) + size;
return alignment;
}
if (type.getBasicType() == EbtStruct) {
const TTypeList& memberList = *type.getStruct();
size = 0;
int maxAlignment = 0;
for (size_t m = 0; m < memberList.size(); ++m) {
int memberSize;
// 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 = getScalarAlignment(*memberList[m].type, memberSize, dummyStride,
(subMatrixLayout != ElmNone) ? (subMatrixLayout == ElmRowMajor) : rowMajor);
maxAlignment = std::max(maxAlignment, memberAlignment);
RoundToPow2(size, memberAlignment);
size += memberSize;
}
return maxAlignment;
}
if (type.isScalar())
return getBaseAlignmentScalar(type, size);
if (type.isVector()) {
int scalarAlign = getBaseAlignmentScalar(type, size);
size *= type.getVectorSize();
return scalarAlign;
}
if (type.isMatrix()) {
TType derefType(type, 0, rowMajor);
alignment = getScalarAlignment(derefType, size, dummyStride, rowMajor);
stride = size; // use intra-matrix stride for stride of a just a matrix
if (rowMajor)
size = stride * type.getMatrixRows();
else
size = stride * type.getMatrixCols();
return alignment;
}
assert(0); // all cases should be covered above
size = 1;
return 1;
}
int TIntermediate::getMemberAlignment(const TType& type, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor)
{
if (layoutPacking == glslang::ElpScalar) {
return getScalarAlignment(type, size, stride, rowMajor);
} else {
return getBaseAlignment(type, size, stride, layoutPacking, rowMajor);
}
}
} // end namespace glslang

View File

@ -634,7 +634,9 @@ public:
int addXfbBufferOffset(const TType&);
unsigned int computeTypeXfbSize(const TType&, bool& containsDouble) const;
static int getBaseAlignmentScalar(const TType&, int& size);
static int getBaseAlignment(const TType&, int& size, int& stride, bool std140, bool rowMajor);
static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor);
static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
static bool improperStraddle(const TType& type, int size, int offset);
bool promote(TIntermOperator*);

View File

@ -131,11 +131,11 @@ public:
for (int m = 0; m <= index; ++m) {
// 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, dummyStride,
type.getQualifier().layoutPacking == ElpStd140,
subMatrixLayout != ElmNone
? subMatrixLayout == ElmRowMajor
: type.getQualifier().layoutMatrix == ElmRowMajor);
int memberAlignment = intermediate.getMemberAlignment(*memberList[m].type, memberSize, dummyStride,
type.getQualifier().layoutPacking,
subMatrixLayout != ElmNone
? subMatrixLayout == ElmRowMajor
: type.getQualifier().layoutMatrix == ElmRowMajor);
RoundToPow2(offset, memberAlignment);
if (m < index)
offset += memberSize;
@ -154,9 +154,9 @@ public:
int lastMemberSize;
int dummyStride;
intermediate.getBaseAlignment(*memberList[lastIndex].type, lastMemberSize, dummyStride,
blockType.getQualifier().layoutPacking == ElpStd140,
blockType.getQualifier().layoutMatrix == ElmRowMajor);
intermediate.getMemberAlignment(*memberList[lastIndex].type, lastMemberSize, dummyStride,
blockType.getQualifier().layoutPacking,
blockType.getQualifier().layoutMatrix == ElmRowMajor);
return lastOffset + lastMemberSize;
}

View File

@ -70,7 +70,7 @@
// This should always increase, as some paths to do not consume
// a more major number.
// It should increment by one when new functionality is added.
#define GLSLANG_MINOR_VERSION 10
#define GLSLANG_MINOR_VERSION 11
//
// Call before doing any other compiler/linker operations.

View File

@ -382,7 +382,8 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.typeGraphCopy.vert", "main"},
{"hlsl.typedef.frag", "PixelShaderFunction"},
{"hlsl.whileLoop.frag", "PixelShaderFunction"},
{"hlsl.void.frag", "PixelShaderFunction"}
{"hlsl.void.frag", "PixelShaderFunction"},
{"hlsl.type.type.conversion.all.frag", "main"}
}),
FileNameAsCustomTestSuffix
);
@ -399,6 +400,8 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.wavequery.frag", "PixelShaderFunction"},
{"hlsl.wavereduction.comp", "CSMain"},
{"hlsl.wavevote.comp", "CSMain"},
{ "hlsl.type.type.conversion.valid.frag", "main" },
{"hlsl.int.dot.frag", "main"}
}),
FileNameAsCustomTestSuffix
);

View File

@ -309,6 +309,8 @@ INSTANTIATE_TEST_CASE_P(
"spv.sampleId.frag",
"spv.samplePosition.frag",
"spv.sampleMaskOverrideCoverage.frag",
"spv.scalarlayout.frag",
"spv.scalarlayoutfloat16.frag",
"spv.shaderBallot.comp",
"spv.shaderDrawParams.vert",
"spv.shaderGroupVote.comp",

View File

@ -3477,8 +3477,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
if (argStride != nullptr) {
int size;
int stride;
intermediate.getBaseAlignment(argArray->getType(), size, stride, false,
argArray->getType().getQualifier().layoutMatrix == ElmRowMajor);
intermediate.getMemberAlignment(argArray->getType(), size, stride, argArray->getType().getQualifier().layoutPacking,
argArray->getType().getQualifier().layoutMatrix == ElmRowMajor);
TIntermTyped* assign = intermediate.addAssign(EOpAssign, argStride,
intermediate.addConstantUnion(stride, loc, true), loc);
@ -6066,13 +6066,22 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
}
}
// TODO: learn what all these really mean and how they interact with regNumber and subComponent
// more information about register types see
// https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-variable-register
const std::vector<std::string>& resourceInfo = intermediate.getResourceSetBinding();
switch (std::tolower(desc[0])) {
case 'b':
case 't':
case 'c':
// c register is the register slot in the global const buffer
// each slot is a vector of 4 32 bit components
qualifier.layoutOffset = regNumber * 4 * 4;
break;
// const buffer register slot
case 'b':
// textrues and structured buffers
case 't':
// samplers
case 's':
// uav resources
case 'u':
// if nothing else has set the binding, do so now
// (other mechanisms override this one)
@ -8679,7 +8688,7 @@ void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TType
{
if (! qualifier.isUniformOrBuffer())
return;
if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430)
if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430 && qualifier.layoutPacking != ElpScalar)
return;
int offset = 0;
@ -8693,11 +8702,11 @@ void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TType
// modify just the children's view of matrix layout, if there is one for this member
TLayoutMatrix subMatrixLayout = typeList[member].type->getQualifier().layoutMatrix;
int dummyStride;
int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, dummyStride,
qualifier.layoutPacking == ElpStd140,
subMatrixLayout != ElmNone
? subMatrixLayout == ElmRowMajor
: qualifier.layoutMatrix == ElmRowMajor);
int memberAlignment = intermediate.getMemberAlignment(*typeList[member].type, memberSize, dummyStride,
qualifier.layoutPacking,
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."

View File

@ -5,7 +5,7 @@
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Tools",
"subdir" : "External/spirv-tools",
"commit" : "9d699f6d4038f432c55310d5d0b4a6d507c1b686"
"commit" : "8e9be303b00ba352ee25dbcd352769641637a853"
},
{
"name" : "spirv-tools/external/spirv-headers",

View File

@ -199,6 +199,7 @@ project "glslang"
configuration { "mingw* or linux or osx" }
buildoptions {
"-Wno-ignored-qualifiers",
"-Wno-implicit-fallthrough"
"-Wno-missing-field-initializers",
"-Wno-reorder",
"-Wno-return-type",