Updated glslang.

This commit is contained in:
Branimir Karadžić 2017-04-22 00:26:44 -07:00
parent 3be8d34adb
commit 4ee3b81c61
61 changed files with 6385 additions and 4051 deletions

View File

@ -245,7 +245,7 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage)
}
// Translate glslang type to SPIR-V storage class.
spv::StorageClass TranslateStorageClass(const glslang::TType& type)
spv::StorageClass TranslateStorageClass(const glslang::TType& type, bool useStorageBuffer)
{
if (type.getQualifier().isPipeInput())
return spv::StorageClassInput;
@ -255,6 +255,8 @@ spv::StorageClass TranslateStorageClass(const glslang::TType& type)
return spv::StorageClassAtomicCounter;
else if (type.containsOpaque())
return spv::StorageClassUniformConstant;
else if (useStorageBuffer && type.getQualifier().storage == glslang::EvqBuffer)
return spv::StorageClassStorageBuffer;
else if (type.getQualifier().isUniformOrBuffer()) {
if (type.getQualifier().layoutPushConstant)
return spv::StorageClassPushConstant;
@ -310,12 +312,12 @@ spv::Decoration TranslatePrecisionDecoration(const glslang::TType& type)
}
// Translate glslang type to SPIR-V block decorations.
spv::Decoration TranslateBlockDecoration(const glslang::TType& type)
spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useStorageBuffer)
{
if (type.getBasicType() == glslang::EbtBlock) {
switch (type.getQualifier().storage) {
case glslang::EvqUniform: return spv::DecorationBlock;
case glslang::EvqBuffer: return spv::DecorationBufferBlock;
case glslang::EvqBuffer: return useStorageBuffer ? spv::DecorationBlock : spv::DecorationBufferBlock;
case glslang::EvqVaryingIn: return spv::DecorationBlock;
case glslang::EvqVaryingOut: return spv::DecorationBlock;
default:
@ -2071,7 +2073,7 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
}
// Now, handle actual variables
spv::StorageClass storageClass = TranslateStorageClass(node->getType());
spv::StorageClass storageClass = TranslateStorageClass(node->getType(), glslangIntermediate->usingStorageBuffer());
spv::Id spvType = convertGlslangToSpvType(node->getType());
#ifdef AMD_EXTENSIONS
@ -2491,7 +2493,7 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
// Decorate the structure
addDecoration(spvType, TranslateLayoutDecoration(type, qualifier.layoutMatrix));
addDecoration(spvType, TranslateBlockDecoration(type));
addDecoration(spvType, TranslateBlockDecoration(type, glslangIntermediate->usingStorageBuffer()));
if (type.getQualifier().hasStream() && glslangIntermediate->isMultiStream()) {
builder.addCapability(spv::CapabilityGeometryStreams);
builder.addDecoration(spvType, spv::DecorationStream, type.getQualifier().layoutStream);
@ -2834,7 +2836,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
(paramType.getBasicType() == glslang::EbtBlock &&
paramType.getQualifier().storage == glslang::EvqBuffer) || // SSBO
(p == 0 && implicitThis)) // implicit 'this'
typeId = builder.makePointer(TranslateStorageClass(paramType), typeId);
typeId = builder.makePointer(TranslateStorageClass(paramType, glslangIntermediate->usingStorageBuffer()), typeId);
else if (paramType.getQualifier().storage != glslang::EvqConstReadOnly)
typeId = builder.makePointer(spv::StorageClassFunction, typeId);
else

View File

@ -180,7 +180,7 @@ const char* ExecutionModeString(int mode)
}
}
const int StorageClassCeiling = 12;
const int StorageClassCeiling = 13;
const char* StorageClassString(int StorageClass)
{
@ -197,6 +197,7 @@ const char* StorageClassString(int StorageClass)
case 9: return "PushConstant";
case 10: return "AtomicCounter";
case 11: return "Image";
case 12: return "StorageBuffer";
case StorageClassCeiling:
default: return "Bad";

View File

@ -87,6 +87,7 @@ enum TOptions {
EOptionNoStorageFormat = (1 << 21),
EOptionKeepUncalled = (1 << 22),
EOptionHlslOffsets = (1 << 23),
EOptionHlslIoMapping = (1 << 24),
};
//
@ -166,6 +167,7 @@ std::array<unsigned int, EShLangCount> baseTextureBinding;
std::array<unsigned int, EShLangCount> baseImageBinding;
std::array<unsigned int, EShLangCount> baseUboBinding;
std::array<unsigned int, EShLangCount> baseSsboBinding;
std::array<unsigned int, EShLangCount> baseUavBinding;
//
// Create the default name for saving a binary if -o is not provided.
@ -256,6 +258,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
baseImageBinding.fill(0);
baseUboBinding.fill(0);
baseSsboBinding.fill(0);
baseUavBinding.fill(0);
ExecutableName = argv[0];
workItems.reserve(argc);
@ -285,12 +288,19 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
ProcessBindingBase(argc, argv, baseImageBinding);
} else if (lowerword == "shift-ubo-bindings" || // synonyms
lowerword == "shift-ubo-binding" ||
lowerword == "sub") {
lowerword == "shift-cbuffer-bindings" ||
lowerword == "shift-cbuffer-binding" ||
lowerword == "sub" ||
lowerword == "scb") {
ProcessBindingBase(argc, argv, baseUboBinding);
} else if (lowerword == "shift-ssbo-bindings" || // synonyms
lowerword == "shift-ssbo-binding" ||
lowerword == "sbb") {
ProcessBindingBase(argc, argv, baseSsboBinding);
} else if (lowerword == "shift-uav-bindings" || // synonyms
lowerword == "shift-uav-binding" ||
lowerword == "suavb") {
ProcessBindingBase(argc, argv, baseUavBinding);
} else if (lowerword == "auto-map-bindings" || // synonyms
lowerword == "auto-map-binding" ||
lowerword == "amb") {
@ -326,6 +336,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Options |= EOptionKeepUncalled;
} else if (lowerword == "hlsl-offsets") {
Options |= EOptionHlslOffsets;
} else if (lowerword == "hlsl-iomap" ||
lowerword == "hlsl-iomapper" ||
lowerword == "hlsl-iomapping") {
Options |= EOptionHlslIoMapping;
} else {
usage();
}
@ -577,9 +591,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
shader->setShiftImageBinding(baseImageBinding[compUnit.stage]);
shader->setShiftUboBinding(baseUboBinding[compUnit.stage]);
shader->setShiftSsboBinding(baseSsboBinding[compUnit.stage]);
shader->setShiftUavBinding(baseUavBinding[compUnit.stage]);
shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
if (Options & EOptionHlslIoMapping)
shader->setHlslIoMapping(true);
if (Options & EOptionAutoMapBindings)
shader->setAutoMapBindings(true);
@ -982,11 +1000,15 @@ void usage()
" --sib [stage] num synonym for --shift-image-binding\n"
"\n"
" --shift-UBO-binding [stage] num set base binding number for UBOs\n"
" --shift-cbuffer-binding [stage] num synonym for --shift-UBO-binding\n"
" --sub [stage] num synonym for --shift-UBO-binding\n"
"\n"
" --shift-ssbo-binding [stage] num set base binding number for SSBOs\n"
" --sbb [stage] num synonym for --shift-ssbo-binding\n"
"\n"
" --shift-uav-binding [stage] num set base binding number for UAVs\n"
" --suavb [stage] num synonym for --shift-uav-binding\n"
"\n"
" --auto-map-bindings automatically bind uniform variables without\n"
" explicit bindings.\n"
" --amb synonym for --auto-map-bindings\n"
@ -1009,6 +1031,8 @@ void usage()
"\n"
" --hlsl-offsets Allow block offsets to follow HLSL rules instead of GLSL rules.\n"
" Works independently of source language.\n"
"\n"
" --hlsl-iomap Perform IO mapping in HLSL register space.\n"
);
exit(EFailUsage);

View File

@ -184,10 +184,8 @@ void qlod()
lod = textureQueryLod(sampRect, pf2); // ERROR
}
struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member
uniform uint uu;
out int iout;
out uint iout;
void bitwiseConv()
{
@ -195,3 +193,5 @@ void bitwiseConv()
iout += uu ^ i;
iout += i | uu;
}
struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member

View File

@ -84,7 +84,7 @@ ERROR: 0:194: '.' : cannot apply to an array: method
ERROR: 0:194: 'a' : can't use function syntax on variable
ERROR: 0:214: 'non-constant global initializer (needs GL_EXT_shader_non_constant_global_initializers)' : not supported for this version or the enabled extensions
ERROR: 0:3000: '#error' : line of this error should be 3000
ERROR: 0:3002: '' : syntax error
ERROR: 0:3002: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 77 compilation errors. No code generated.

View File

@ -52,7 +52,7 @@ ERROR: 0:209: 'assign' : cannot convert from ' const float' to ' temp 4-compone
ERROR: 0:212: 'sampler2DRect' : Reserved word.
ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' global void' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const int' and a right operand of type ' global void' (or there is no acceptable conversion)
ERROR: 0:248: '' : syntax error
ERROR: 0:248: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON
ERROR: 54 compilation errors. No code generated.

View File

@ -43,7 +43,7 @@ ERROR: 0:156: 'invariant' : can only apply to an output
ERROR: 0:157: 'invariant' : can only apply to an output
ERROR: 0:158: 'invariant' : can only apply to an output
ERROR: 0:160: 'imageBuffer' : Reserved word.
ERROR: 0:160: '' : syntax error
ERROR: 0:160: '' : syntax error, unexpected IMAGEBUFFER, expecting COMMA or SEMICOLON
ERROR: 45 compilation errors. No code generated.

View File

@ -34,7 +34,7 @@ ERROR: 0:183: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:183: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 0:184: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:184: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 0:187: '' : syntax error
ERROR: 0:197: '' : syntax error, unexpected PRECISE, expecting IDENTIFIER
ERROR: 35 compilation errors. No code generated.
@ -469,6 +469,27 @@ ERROR: node is still EOpNull!
0:181 'pf3' ( temp 3-component vector of float)
0:183 'lod' ( temp 2-component vector of float)
0:184 'lod' ( temp 2-component vector of float)
0:190 Function Definition: bitwiseConv( ( global void)
0:190 Function Parameters:
0:192 Sequence
0:192 move second child to first child ( temp uint)
0:192 'iout' ( out uint)
0:192 bitwise and ( temp uint)
0:192 'uu' ( uniform uint)
0:192 Convert int to uint ( temp uint)
0:192 'i' ( flat in int)
0:193 add second child into first child ( temp uint)
0:193 'iout' ( out uint)
0:193 exclusive-or ( temp uint)
0:193 'uu' ( uniform uint)
0:193 Convert int to uint ( temp uint)
0:193 'i' ( flat in int)
0:194 add second child into first child ( temp uint)
0:194 'iout' ( out uint)
0:194 inclusive-or ( temp uint)
0:194 Convert int to uint ( temp uint)
0:194 'i' ( flat in int)
0:194 'uu' ( uniform uint)
0:? Linker Objects
0:? 'c2D' ( smooth in 2-component vector of float)
0:? 'i' ( flat in int)
@ -512,6 +533,8 @@ ERROR: node is still EOpNull!
0:? 'sampCubeAs' ( uniform samplerCubeArrayShadow)
0:? 'sampBuf' ( uniform samplerBuffer)
0:? 'sampRect' ( uniform sampler2DRect)
0:? 'uu' ( uniform uint)
0:? 'iout' ( out uint)
Linked fragment stage:
@ -685,4 +708,6 @@ ERROR: node is still EOpNull!
0:? 'sampCubeAs' ( uniform samplerCubeArrayShadow)
0:? 'sampBuf' ( uniform samplerBuffer)
0:? 'sampRect' ( uniform sampler2DRect)
0:? 'uu' ( uniform uint)
0:? 'iout' ( out uint)

View File

@ -6,7 +6,7 @@ ERROR: 0:4: 'preprocessor evaluation' : bad expression
ERROR: 0:4: '#if' : unexpected tokens following directive
ERROR: 0:6: '€' : unexpected token
ERROR: 0:7: 'string' : End of line in string
ERROR: 0:7: '' : syntax error
ERROR: 0:7: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR: 8 compilation errors. No code generated.

View File

@ -4,7 +4,7 @@ ERROR: 0:2: '#if' : unexpected tokens following directive
ERROR: 0:5: 'string' : End of line in string
ERROR: 0:5: 'macro expansion' : expected '(' following n
ERROR: 0:5: '""' : string literals not supported
ERROR: 0:5: '' : syntax error
ERROR: 0:5: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR: 6 compilation errors. No code generated.

View File

@ -1,6 +1,6 @@
cppIndent.vert
ERROR: 0:61: 'macro expansion' : Too few args in Macro FUNC
ERROR: 0:61: '' : syntax error
ERROR: 0:61: '' : syntax error, unexpected COMMA
ERROR: 2 compilation errors. No code generated.

View File

@ -2,7 +2,7 @@ glspv.frag
ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error )
ERROR: 0:6: '#error' : GL_SPIR is 100
ERROR: 0:14: 'input_attachment_index' : only allowed when using GLSL for Vulkan
ERROR: 0:14: '' : syntax error
ERROR: 0:14: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 4 compilation errors. No code generated.

View File

@ -7,7 +7,7 @@ ERROR: 0:9: 'packed' : not allowed when generating SPIR-V
ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier
ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier
ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier
ERROR: 0:20: '' : syntax error
ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 8 compilation errors. No code generated.

View File

@ -0,0 +1,29 @@
hlsl.automap.frag
Uniform reflection:
t1: offset -1, type 8b5d, size 1, index -1, binding 11
t2: offset -1, type 8b5e, size 1, index -1, binding 12
t3: offset -1, type 8b5f, size 1, index -1, binding 13
t4.@data: offset 0, type 8b52, size 1, index 0, binding -1
t5.@data: offset 0, type 1405, size 0, index 1, binding -1
t6: offset -1, type 8dc2, size 1, index -1, binding 16
s1: offset -1, type 0, size 1, index -1, binding 31
s2: offset -1, type 0, size 1, index -1, binding 32
u1: offset -1, type 904c, size 1, index -1, binding 41
u2: offset -1, type 904d, size 1, index -1, binding 42
u3: offset -1, type 904e, size 1, index -1, binding 43
u4: offset -1, type 9051, size 1, index -1, binding 44
u5.@data: offset 0, type 1405, size 0, index 2, binding -1
u6.@data: offset 0, type 1406, size 1, index 3, binding -1
cb1: offset 0, type 1404, size 1, index 4, binding -1
tb1: offset 0, type 1404, size 1, index 5, binding -1
Uniform block reflection:
t4: offset -1, type ffffffff, size 0, index -1, binding 14
t5: offset -1, type ffffffff, size 0, index -1, binding 15
u5: offset -1, type ffffffff, size 0, index -1, binding 45
u6: offset -1, type ffffffff, size 0, index -1, binding 46
cb: offset -1, type ffffffff, size 4, index -1, binding 51
tb: offset -1, type ffffffff, size 4, index -1, binding 17
Vertex attribute reflection:

View File

@ -17,7 +17,7 @@ gl_FragCoord origin is upper left
0:31 Constant:
0:31 0 (const uint)
0:31 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
0:31 'anon@1' (layout( row_major std430) buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:31 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:31 Constant:
0:31 0 (const uint)
0:31 v3: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
@ -25,7 +25,7 @@ gl_FragCoord origin is upper left
0:31 Constant:
0:31 0 (const uint)
0:31 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:31 'anon@3' (layout( binding=8 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
0:31 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
0:31 Constant:
0:31 0 (const uint)
0:30 Function Definition: PixelShaderFunction( ( temp void)
@ -40,9 +40,9 @@ gl_FragCoord origin is upper left
0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
0:? 'anon@1' (layout( row_major std430) buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:? 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:? 'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
0:? 'anon@3' (layout( binding=8 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
0:? 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float)
@ -68,7 +68,7 @@ gl_FragCoord origin is upper left
0:31 Constant:
0:31 0 (const uint)
0:31 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
0:31 'anon@1' (layout( row_major std430) buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:31 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:31 Constant:
0:31 0 (const uint)
0:31 v3: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
@ -76,7 +76,7 @@ gl_FragCoord origin is upper left
0:31 Constant:
0:31 0 (const uint)
0:31 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:31 'anon@3' (layout( binding=8 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
0:31 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
0:31 Constant:
0:31 0 (const uint)
0:30 Function Definition: PixelShaderFunction( ( temp void)
@ -91,9 +91,9 @@ gl_FragCoord origin is upper left
0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
0:? 'anon@1' (layout( row_major std430) buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:? 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
0:? 'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
0:? 'anon@3' (layout( binding=8 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
0:? 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float)
@ -141,6 +141,7 @@ gl_FragCoord origin is upper left
MemberDecorate 14 0 Offset 0
Decorate 14 Block
Decorate 16 DescriptorSet 0
MemberDecorate 23 0 NonWritable
MemberDecorate 23 0 Offset 0
Decorate 23 BufferBlock
Decorate 25 DescriptorSet 0
@ -149,24 +150,36 @@ gl_FragCoord origin is upper left
Decorate 29(cbufName) Block
Decorate 31 DescriptorSet 10
Decorate 31 Binding 2
MemberDecorate 36(tbufName) 0 NonWritable
MemberDecorate 36(tbufName) 0 Offset 16
MemberDecorate 36(tbufName) 1 NonWritable
MemberDecorate 36(tbufName) 1 Offset 48
MemberDecorate 36(tbufName) 2 NonWritable
MemberDecorate 36(tbufName) 2 Offset 60
MemberDecorate 36(tbufName) 3 NonWritable
MemberDecorate 36(tbufName) 3 Offset 64
MemberDecorate 36(tbufName) 4 NonWritable
MemberDecorate 36(tbufName) 4 Offset 68
MemberDecorate 36(tbufName) 5 NonWritable
MemberDecorate 36(tbufName) 5 Offset 72
MemberDecorate 36(tbufName) 6 NonWritable
MemberDecorate 36(tbufName) 6 Offset 76
MemberDecorate 36(tbufName) 7 NonWritable
MemberDecorate 36(tbufName) 7 Offset 80
MemberDecorate 36(tbufName) 8 RowMajor
MemberDecorate 36(tbufName) 8 NonWritable
MemberDecorate 36(tbufName) 8 Offset 96
MemberDecorate 36(tbufName) 8 MatrixStride 16
MemberDecorate 36(tbufName) 9 ColMajor
MemberDecorate 36(tbufName) 9 NonWritable
MemberDecorate 36(tbufName) 9 Offset 160
MemberDecorate 36(tbufName) 9 MatrixStride 16
MemberDecorate 36(tbufName) 10 RowMajor
MemberDecorate 36(tbufName) 10 NonWritable
MemberDecorate 36(tbufName) 10 Offset 208
MemberDecorate 36(tbufName) 10 MatrixStride 16
MemberDecorate 36(tbufName) 11 RowMajor
MemberDecorate 36(tbufName) 11 NonWritable
MemberDecorate 36(tbufName) 11 Offset 272
MemberDecorate 36(tbufName) 11 MatrixStride 16
Decorate 36(tbufName) BufferBlock

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,9 @@ hlsl.doLoop.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:2 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:2 Function Definition: @PixelShaderFunction(f1; ( temp 4-component vector of float)
0:2 Function Parameters:
0:2 'input' ( in 4-component vector of float)
0:2 'input' ( in float)
0:? Sequence
0:3 Loop with condition not tested first
0:3 Loop Condition
@ -18,26 +18,56 @@ gl_FragCoord origin is upper left
0:4 No loop body
0:5 Loop with condition not tested first
0:5 Loop Condition
0:5 all ( temp bool)
0:5 Equal ( temp 4-component vector of bool)
0:5 'input' ( in 4-component vector of float)
0:5 'input' ( in 4-component vector of float)
0:5 Compare Greater Than ( temp bool)
0:5 'input' ( in float)
0:5 Constant:
0:5 2.000000
0:5 Loop Body
0:? Sequence
0:5 Branch: Return with expression
0:5 'input' ( in 4-component vector of float)
0:5 Construct vec4 ( temp 4-component vector of float)
0:5 'input' ( in float)
0:6 Loop with condition not tested first
0:6 Loop Condition
0:6 Compare Less Than ( temp bool)
0:6 'input' ( in float)
0:6 Constant:
0:6 10.000000
0:6 Loop Body
0:6 Pre-Increment ( temp float)
0:6 'input' ( in float)
0:7 Loop with condition not tested first
0:7 Loop Condition
0:7 Compare Less Than ( temp bool)
0:7 Pre-Increment ( temp float)
0:7 'input' ( in float)
0:7 Constant:
0:7 10.000000
0:7 Loop Body
0:7 Loop with condition tested first
0:7 Loop Condition
0:7 Compare Less Than ( temp bool)
0:7 Pre-Increment ( temp float)
0:7 'input' ( in float)
0:7 Constant:
0:7 10.000000
0:7 No loop body
0:8 Branch: Return with expression
0:8 Construct vec4 ( temp 4-component vector of float)
0:8 'input' ( in float)
0:2 Function Definition: PixelShaderFunction( ( temp void)
0:2 Function Parameters:
0:? Sequence
0:2 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float)
0:2 move second child to first child ( temp float)
0:? 'input' ( temp float)
0:? 'input' (layout( location=0) in float)
0:2 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(f1; ( temp 4-component vector of float)
0:? 'input' ( temp float)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float)
0:? 'input' (layout( location=0) in float)
Linked fragment stage:
@ -46,9 +76,9 @@ Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:2 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:2 Function Definition: @PixelShaderFunction(f1; ( temp 4-component vector of float)
0:2 Function Parameters:
0:2 'input' ( in 4-component vector of float)
0:2 'input' ( in float)
0:? Sequence
0:3 Loop with condition not tested first
0:3 Loop Condition
@ -62,73 +92,105 @@ gl_FragCoord origin is upper left
0:4 No loop body
0:5 Loop with condition not tested first
0:5 Loop Condition
0:5 all ( temp bool)
0:5 Equal ( temp 4-component vector of bool)
0:5 'input' ( in 4-component vector of float)
0:5 'input' ( in 4-component vector of float)
0:5 Compare Greater Than ( temp bool)
0:5 'input' ( in float)
0:5 Constant:
0:5 2.000000
0:5 Loop Body
0:? Sequence
0:5 Branch: Return with expression
0:5 'input' ( in 4-component vector of float)
0:5 Construct vec4 ( temp 4-component vector of float)
0:5 'input' ( in float)
0:6 Loop with condition not tested first
0:6 Loop Condition
0:6 Compare Less Than ( temp bool)
0:6 'input' ( in float)
0:6 Constant:
0:6 10.000000
0:6 Loop Body
0:6 Pre-Increment ( temp float)
0:6 'input' ( in float)
0:7 Loop with condition not tested first
0:7 Loop Condition
0:7 Compare Less Than ( temp bool)
0:7 Pre-Increment ( temp float)
0:7 'input' ( in float)
0:7 Constant:
0:7 10.000000
0:7 Loop Body
0:7 Loop with condition tested first
0:7 Loop Condition
0:7 Compare Less Than ( temp bool)
0:7 Pre-Increment ( temp float)
0:7 'input' ( in float)
0:7 Constant:
0:7 10.000000
0:7 No loop body
0:8 Branch: Return with expression
0:8 Construct vec4 ( temp 4-component vector of float)
0:8 'input' ( in float)
0:2 Function Definition: PixelShaderFunction( ( temp void)
0:2 Function Parameters:
0:? Sequence
0:2 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float)
0:2 move second child to first child ( temp float)
0:? 'input' ( temp float)
0:? 'input' (layout( location=0) in float)
0:2 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:2 Function Call: @PixelShaderFunction(f1; ( temp 4-component vector of float)
0:? 'input' ( temp float)
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float)
0:? 'input' (layout( location=0) in float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 44
// Id's are bound by 71
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 37 40
EntryPoint Fragment 4 "PixelShaderFunction" 64 67
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "PixelShaderFunction"
Name 11 "@PixelShaderFunction(vf4;"
Name 11 "@PixelShaderFunction(f1;"
Name 10 "input"
Name 35 "input"
Name 37 "input"
Name 40 "@entryPointOutput"
Name 41 "param"
Decorate 37(input) Location 0
Decorate 40(@entryPointOutput) Location 0
Name 62 "input"
Name 64 "input"
Name 67 "@entryPointOutput"
Name 68 "param"
Decorate 64(input) Location 0
Decorate 67(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
9: TypeFunction 7(fvec4) 8(ptr)
7: TypePointer Function 6(float)
8: TypeVector 6(float) 4
9: TypeFunction 8(fvec4) 7(ptr)
17: TypeBool
18: 17(bool) ConstantFalse
31: TypeVector 17(bool) 4
36: TypePointer Input 7(fvec4)
37(input): 36(ptr) Variable Input
39: TypePointer Output 7(fvec4)
40(@entryPointOutput): 39(ptr) Variable Output
31: 6(float) Constant 1073741824
38: 6(float) Constant 1065353216
41: 6(float) Constant 1092616192
63: TypePointer Input 6(float)
64(input): 63(ptr) Variable Input
66: TypePointer Output 8(fvec4)
67(@entryPointOutput): 66(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3
5: Label
35(input): 8(ptr) Variable Function
41(param): 8(ptr) Variable Function
38: 7(fvec4) Load 37(input)
Store 35(input) 38
42: 7(fvec4) Load 35(input)
Store 41(param) 42
43: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 41(param)
Store 40(@entryPointOutput) 43
62(input): 7(ptr) Variable Function
68(param): 7(ptr) Variable Function
65: 6(float) Load 64(input)
Store 62(input) 65
69: 6(float) Load 62(input)
Store 68(param) 69
70: 8(fvec4) FunctionCall 11(@PixelShaderFunction(f1;) 68(param)
Store 67(@entryPointOutput) 70
Return
FunctionEnd
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9
10(input): 8(ptr) FunctionParameter
11(@PixelShaderFunction(f1;): 8(fvec4) Function None 9
10(input): 7(ptr) FunctionParameter
12: Label
Branch 13
13: Label
@ -153,15 +215,57 @@ gl_FragCoord origin is upper left
LoopMerge 25 26 None
Branch 24
24: Label
27: 7(fvec4) Load 10(input)
ReturnValue 27
27: 6(float) Load 10(input)
28: 8(fvec4) CompositeConstruct 27 27 27 27
ReturnValue 28
26: Label
29: 7(fvec4) Load 10(input)
30: 7(fvec4) Load 10(input)
32: 31(bvec4) FOrdEqual 29 30
33: 17(bool) All 32
BranchConditional 33 23 25
30: 6(float) Load 10(input)
32: 17(bool) FOrdGreaterThan 30 31
BranchConditional 32 23 25
25: Label
34: 7(fvec4) Undef
ReturnValue 34
Branch 33
33: Label
LoopMerge 35 36 None
Branch 34
34: Label
37: 6(float) Load 10(input)
39: 6(float) FAdd 37 38
Store 10(input) 39
Branch 36
36: Label
40: 6(float) Load 10(input)
42: 17(bool) FOrdLessThan 40 41
BranchConditional 42 33 35
35: Label
Branch 43
43: Label
LoopMerge 45 46 None
Branch 44
44: Label
Branch 47
47: Label
LoopMerge 49 50 None
Branch 51
51: Label
52: 6(float) Load 10(input)
53: 6(float) FAdd 52 38
Store 10(input) 53
54: 17(bool) FOrdLessThan 53 41
BranchConditional 54 48 49
48: Label
Branch 50
50: Label
Branch 47
49: Label
Branch 46
46: Label
55: 6(float) Load 10(input)
56: 6(float) FAdd 55 38
Store 10(input) 56
57: 17(bool) FOrdLessThan 56 41
BranchConditional 57 43 45
45: Label
58: 6(float) Load 10(input)
59: 8(fvec4) CompositeConstruct 58 58 58 58
ReturnValue 59
FunctionEnd

View File

@ -118,6 +118,7 @@ gl_FragCoord origin is upper left
0:24 Convert int to bool ( temp bool)
0:24 'i' ( temp int)
0:24 Loop Body
0:? Sequence
0:24 Pre-Decrement ( temp int)
0:24 'i' ( temp int)
0:? Sequence
@ -286,6 +287,7 @@ gl_FragCoord origin is upper left
0:24 Convert int to bool ( temp bool)
0:24 'i' ( temp int)
0:24 Loop Body
0:? Sequence
0:24 Pre-Decrement ( temp int)
0:24 'i' ( temp int)
0:? Sequence

View File

@ -12,23 +12,23 @@ gl_FragCoord origin is upper left
0:17 add ( temp 4-component vector of float)
0:17 'input' ( in 4-component vector of float)
0:17 v1: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:17 'anon@0' (layout( set=3 binding=5 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1})
0:17 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1})
0:17 Constant:
0:17 0 (const uint)
0:17 v5: direct index for structure (layout( row_major std430 offset=0) buffer 4-component vector of float)
0:17 'anon@1' (layout( row_major std430 push_constant) buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5})
0:17 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5})
0:17 Constant:
0:17 0 (const uint)
0:17 v1PostLayout: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:17 'anon@2' (layout( set=4 binding=7 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout})
0:17 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout})
0:17 Constant:
0:17 0 (const uint)
0:? Linker Objects
0:? 'anon@0' (layout( set=3 binding=5 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1})
0:? 'anon@1' (layout( row_major std430 push_constant) buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5})
0:? 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1})
0:? 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5})
0:? 'specConst' ( specialization-constant const int)
0:? 10 (const int)
0:? 'anon@2' (layout( set=4 binding=7 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout})
0:? 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout})
Linked fragment stage:
@ -48,23 +48,23 @@ gl_FragCoord origin is upper left
0:17 add ( temp 4-component vector of float)
0:17 'input' ( in 4-component vector of float)
0:17 v1: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:17 'anon@0' (layout( set=3 binding=5 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1})
0:17 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1})
0:17 Constant:
0:17 0 (const uint)
0:17 v5: direct index for structure (layout( row_major std430 offset=0) buffer 4-component vector of float)
0:17 'anon@1' (layout( row_major std430 push_constant) buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5})
0:17 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5})
0:17 Constant:
0:17 0 (const uint)
0:17 v1PostLayout: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
0:17 'anon@2' (layout( set=4 binding=7 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout})
0:17 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout})
0:17 Constant:
0:17 0 (const uint)
0:? Linker Objects
0:? 'anon@0' (layout( set=3 binding=5 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1})
0:? 'anon@1' (layout( row_major std430 push_constant) buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5})
0:? 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1})
0:? 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5})
0:? 'specConst' ( specialization-constant const int)
0:? 10 (const int)
0:? 'anon@2' (layout( set=4 binding=7 row_major std430) buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout})
0:? 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout})
// Module Version 10000
// Generated by (magic number): 80001
@ -89,12 +89,15 @@ gl_FragCoord origin is upper left
MemberName 30(tbufName2) 0 "v1PostLayout"
Name 32 ""
Name 38 "specConst"
MemberDecorate 14(tbufName) 0 NonWritable
MemberDecorate 14(tbufName) 0 Offset 16
Decorate 14(tbufName) BufferBlock
Decorate 16 DescriptorSet 3
Decorate 16 Binding 5
MemberDecorate 23(tbufName2) 0 NonWritable
MemberDecorate 23(tbufName2) 0 Offset 0
Decorate 23(tbufName2) BufferBlock
MemberDecorate 30(tbufName2) 0 NonWritable
MemberDecorate 30(tbufName2) 0 Offset 16
Decorate 30(tbufName2) BufferBlock
Decorate 32 DescriptorSet 4

View File

@ -0,0 +1,96 @@
hlsl.samplecmp.negative.frag
ERROR: 0:9: '' : expected: SamplerComparisonState
ERROR: 1 compilation errors. No code generated.
Shader version: 500
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
0:7 Function Definition: @main( ( temp 4-component vector of float)
0:7 Function Parameters:
0:? Sequence
0:8 texture ( temp float)
0:8 Construct combined texture-sampler ( temp sampler2DShadow)
0:8 'g_shadowTex' ( uniform texture2D)
0:8 'g_shadowSamplerComp' ( uniform sampler)
0:8 Construct vec3 ( temp 3-component vector of float)
0:? Constant:
0:? 0.000000
0:? 0.000000
0:8 Constant:
0:8 0.000000
0:9 ERROR: Bad aggregation op
( temp float)
0:9 'g_shadowTex' ( uniform texture2D)
0:9 'g_shadowSampler' ( uniform sampler)
0:? Constant:
0:? 0.000000
0:? 0.000000
0:9 Constant:
0:9 0.000000
0:11 Branch: Return with expression
0:11 Constant:
0:11 0.000000
0:11 0.000000
0:11 0.000000
0:11 0.000000
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:7 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'g_shadowTex' ( uniform texture2D)
0:? 'g_shadowSampler' ( uniform sampler)
0:? 'g_shadowSamplerComp' ( uniform sampler)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
0:7 Function Definition: @main( ( temp 4-component vector of float)
0:7 Function Parameters:
0:? Sequence
0:8 texture ( temp float)
0:8 Construct combined texture-sampler ( temp sampler2DShadow)
0:8 'g_shadowTex' ( uniform texture2D)
0:8 'g_shadowSamplerComp' ( uniform sampler)
0:8 Construct vec3 ( temp 3-component vector of float)
0:? Constant:
0:? 0.000000
0:? 0.000000
0:8 Constant:
0:8 0.000000
0:9 ERROR: Bad aggregation op
( temp float)
0:9 'g_shadowTex' ( uniform texture2D)
0:9 'g_shadowSampler' ( uniform sampler)
0:? Constant:
0:? 0.000000
0:? 0.000000
0:9 Constant:
0:9 0.000000
0:11 Branch: Return with expression
0:11 Constant:
0:11 0.000000
0:11 0.000000
0:11 0.000000
0:11 0.000000
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:7 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'g_shadowTex' ( uniform texture2D)
0:? 'g_shadowSampler' ( uniform sampler)
0:? 'g_shadowSamplerComp' ( uniform sampler)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
SPIR-V is not generated for failed compile or link

View File

@ -0,0 +1,80 @@
hlsl.samplecmp.negative2.frag
ERROR: 0:7: '' : expected: SamplerComparisonState
ERROR: 1 compilation errors. No code generated.
Shader version: 500
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
0:6 Function Definition: @main( ( temp 4-component vector of float)
0:6 Function Parameters:
0:? Sequence
0:7 ERROR: Bad aggregation op
( temp 4-component vector of float)
0:7 'g_shadowTex' ( uniform texture2D)
0:7 'g_shadowSampler' ( uniform sampler)
0:? Constant:
0:? 0.000000
0:? 0.000000
0:7 Constant:
0:7 0.000000
0:? Constant:
0:? 0 (const int)
0:? 0 (const int)
0:9 Branch: Return with expression
0:9 Constant:
0:9 0.000000
0:9 0.000000
0:9 0.000000
0:9 0.000000
0:6 Function Definition: main( ( temp void)
0:6 Function Parameters:
0:? Sequence
0:6 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:6 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'g_shadowTex' ( uniform texture2D)
0:? 'g_shadowSampler' ( uniform sampler)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
ERROR: node is still EOpNull!
0:6 Function Definition: @main( ( temp 4-component vector of float)
0:6 Function Parameters:
0:? Sequence
0:7 ERROR: Bad aggregation op
( temp 4-component vector of float)
0:7 'g_shadowTex' ( uniform texture2D)
0:7 'g_shadowSampler' ( uniform sampler)
0:? Constant:
0:? 0.000000
0:? 0.000000
0:7 Constant:
0:7 0.000000
0:? Constant:
0:? 0 (const int)
0:? 0 (const int)
0:9 Branch: Return with expression
0:9 Constant:
0:9 0.000000
0:9 0.000000
0:9 0.000000
0:9 0.000000
0:6 Function Definition: main( ( temp void)
0:6 Function Parameters:
0:? Sequence
0:6 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:6 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'g_shadowTex' ( uniform texture2D)
0:? 'g_shadowSampler' ( uniform sampler)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
SPIR-V is not generated for failed compile or link

View File

@ -95,27 +95,66 @@ gl_FragCoord origin is upper left
0:22 Construct vec4 ( temp 4-component vector of float)
0:22 'f' ( in float)
0:22 'v' ( temp 4-component vector of float)
0:26 Compare Equal ( temp bool)
0:26 Equal ( temp 4-component vector of bool)
0:26 Construct vec4 ( temp 4-component vector of float)
0:26 'f1' ( temp 1-component vector of float)
0:26 Construct float ( temp 1-component vector of float)
0:26 'v' ( temp 4-component vector of float)
0:27 Compare Less Than ( temp bool)
0:27 Construct float ( temp 1-component vector of float)
0:27 Compare Less Than ( temp 4-component vector of bool)
0:27 'v' ( temp 4-component vector of float)
0:27 Construct vec4 ( temp 4-component vector of float)
0:27 'f1' ( temp 1-component vector of float)
0:28 Construct float ( temp float)
0:28 'f1' ( temp 1-component vector of float)
0:29 Construct vec3 ( temp 3-component vector of float)
0:29 Construct float ( temp float)
0:29 'f1' ( temp 1-component vector of float)
0:33 Branch: Return with expression
0:33 component-wise multiply ( temp 4-component vector of float)
0:33 'input' ( in 4-component vector of float)
0:33 Constant:
0:33 3.000000
0:33 3.000000
0:33 3.000000
0:33 3.000000
0:36 right-shift ( temp 3-component vector of uint)
0:36 Construct uvec3 ( temp 3-component vector of uint)
0:36 'ui' ( temp uint)
0:36 'ui3' ( temp 3-component vector of uint)
0:37 right-shift ( temp 3-component vector of uint)
0:37 'ui3' ( temp 3-component vector of uint)
0:37 'ui' ( temp uint)
0:39 multiply second child into first child ( temp 4-component vector of float)
0:39 'v' ( temp 4-component vector of float)
0:39 'f1' ( temp 1-component vector of float)
0:40 multiply second child into first child ( temp 1-component vector of float)
0:40 'f1' ( temp 1-component vector of float)
0:40 Construct float ( temp 1-component vector of float)
0:40 'v' ( temp 4-component vector of float)
0:42 Sequence
0:42 move second child to first child ( temp 3-component vector of float)
0:42 'mixed' ( temp 3-component vector of float)
0:42 component-wise multiply ( temp 3-component vector of float)
0:42 'u' ( temp 3-component vector of float)
0:42 Construct vec3 ( temp 3-component vector of float)
0:42 'v' ( temp 4-component vector of float)
0:43 move second child to first child ( temp float)
0:43 'f' ( in float)
0:43 Construct float ( in float)
0:43 'u' ( temp 3-component vector of float)
0:44 move second child to first child ( temp 1-component vector of float)
0:44 'f1' ( temp 1-component vector of float)
0:44 Construct float ( temp 1-component vector of float)
0:44 'u' ( temp 3-component vector of float)
0:45 Sequence
0:45 move second child to first child ( temp float)
0:45 'sf' ( temp float)
0:45 Construct float ( temp float)
0:45 'v' ( temp 4-component vector of float)
0:46 Sequence
0:46 move second child to first child ( temp 1-component vector of float)
0:46 'sf1' ( temp 1-component vector of float)
0:46 Construct float ( temp 1-component vector of float)
0:46 'v' ( temp 4-component vector of float)
0:48 Branch: Return with expression
0:48 component-wise multiply ( temp 4-component vector of float)
0:48 'input' ( in 4-component vector of float)
0:48 Constant:
0:48 3.000000
0:48 3.000000
0:48 3.000000
0:48 3.000000
0:? Linker Objects
@ -219,32 +258,71 @@ gl_FragCoord origin is upper left
0:22 Construct vec4 ( temp 4-component vector of float)
0:22 'f' ( in float)
0:22 'v' ( temp 4-component vector of float)
0:26 Compare Equal ( temp bool)
0:26 Equal ( temp 4-component vector of bool)
0:26 Construct vec4 ( temp 4-component vector of float)
0:26 'f1' ( temp 1-component vector of float)
0:26 Construct float ( temp 1-component vector of float)
0:26 'v' ( temp 4-component vector of float)
0:27 Compare Less Than ( temp bool)
0:27 Construct float ( temp 1-component vector of float)
0:27 Compare Less Than ( temp 4-component vector of bool)
0:27 'v' ( temp 4-component vector of float)
0:27 Construct vec4 ( temp 4-component vector of float)
0:27 'f1' ( temp 1-component vector of float)
0:28 Construct float ( temp float)
0:28 'f1' ( temp 1-component vector of float)
0:29 Construct vec3 ( temp 3-component vector of float)
0:29 Construct float ( temp float)
0:29 'f1' ( temp 1-component vector of float)
0:33 Branch: Return with expression
0:33 component-wise multiply ( temp 4-component vector of float)
0:33 'input' ( in 4-component vector of float)
0:33 Constant:
0:33 3.000000
0:33 3.000000
0:33 3.000000
0:33 3.000000
0:36 right-shift ( temp 3-component vector of uint)
0:36 Construct uvec3 ( temp 3-component vector of uint)
0:36 'ui' ( temp uint)
0:36 'ui3' ( temp 3-component vector of uint)
0:37 right-shift ( temp 3-component vector of uint)
0:37 'ui3' ( temp 3-component vector of uint)
0:37 'ui' ( temp uint)
0:39 multiply second child into first child ( temp 4-component vector of float)
0:39 'v' ( temp 4-component vector of float)
0:39 'f1' ( temp 1-component vector of float)
0:40 multiply second child into first child ( temp 1-component vector of float)
0:40 'f1' ( temp 1-component vector of float)
0:40 Construct float ( temp 1-component vector of float)
0:40 'v' ( temp 4-component vector of float)
0:42 Sequence
0:42 move second child to first child ( temp 3-component vector of float)
0:42 'mixed' ( temp 3-component vector of float)
0:42 component-wise multiply ( temp 3-component vector of float)
0:42 'u' ( temp 3-component vector of float)
0:42 Construct vec3 ( temp 3-component vector of float)
0:42 'v' ( temp 4-component vector of float)
0:43 move second child to first child ( temp float)
0:43 'f' ( in float)
0:43 Construct float ( in float)
0:43 'u' ( temp 3-component vector of float)
0:44 move second child to first child ( temp 1-component vector of float)
0:44 'f1' ( temp 1-component vector of float)
0:44 Construct float ( temp 1-component vector of float)
0:44 'u' ( temp 3-component vector of float)
0:45 Sequence
0:45 move second child to first child ( temp float)
0:45 'sf' ( temp float)
0:45 Construct float ( temp float)
0:45 'v' ( temp 4-component vector of float)
0:46 Sequence
0:46 move second child to first child ( temp 1-component vector of float)
0:46 'sf1' ( temp 1-component vector of float)
0:46 Construct float ( temp 1-component vector of float)
0:46 'v' ( temp 4-component vector of float)
0:48 Branch: Return with expression
0:48 component-wise multiply ( temp 4-component vector of float)
0:48 'input' ( in 4-component vector of float)
0:48 Constant:
0:48 3.000000
0:48 3.000000
0:48 3.000000
0:48 3.000000
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 88
// Id's are bound by 127
Capability Shader
1: ExtInstImport "GLSL.std.450"
@ -263,6 +341,11 @@ gl_FragCoord origin is upper left
Name 34 "MyVal"
Name 37 "foo"
Name 70 "f1"
Name 83 "ui"
Name 88 "ui3"
Name 103 "mixed"
Name 115 "sf"
Name 118 "sf1"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -294,8 +377,11 @@ gl_FragCoord origin is upper left
56: TypeInt 32 0
57: 56(int) Constant 0
62: TypeVector 41(bool) 4
83: 6(float) Constant 1077936128
84: 7(fvec4) ConstantComposite 83 83 83 83
82: TypePointer Function 56(int)
85: TypeVector 56(int) 3
87: TypePointer Function 85(ivec3)
122: 6(float) Constant 1077936128
123: 7(fvec4) ConstantComposite 122 122 122 122
4(main): 2 Function None 3
5: Label
Return
@ -311,6 +397,11 @@ gl_FragCoord origin is upper left
34(MyVal): 23(ptr) Variable Function
37(foo): 23(ptr) Variable Function
70(f1): 9(ptr) Variable Function
83(ui): 82(ptr) Variable Function
88(ui3): 87(ptr) Variable Function
103(mixed): 23(ptr) Variable Function
115(sf): 9(ptr) Variable Function
118(sf1): 9(ptr) Variable Function
Store 15(v) 17
Store 15(v) 19
20: 6(float) Load 12(f)
@ -346,17 +437,55 @@ gl_FragCoord origin is upper left
68: 62(bvec4) FOrdNotEqual 66 67
69: 41(bool) Any 68
71: 6(float) Load 70(f1)
72: 7(fvec4) Load 15(v)
73: 6(float) CompositeExtract 72 0
74: 41(bool) FOrdEqual 71 73
72: 7(fvec4) CompositeConstruct 71 71 71 71
73: 7(fvec4) Load 15(v)
74: 62(bvec4) FOrdEqual 72 73
75: 7(fvec4) Load 15(v)
76: 6(float) CompositeExtract 75 0
77: 6(float) Load 70(f1)
78: 41(bool) FOrdLessThan 76 77
76: 6(float) Load 70(f1)
77: 7(fvec4) CompositeConstruct 76 76 76 76
78: 62(bvec4) FOrdLessThan 75 77
79: 6(float) Load 70(f1)
80: 6(float) Load 70(f1)
81: 22(fvec3) CompositeConstruct 80 80 80
82: 7(fvec4) Load 11(input)
85: 7(fvec4) FMul 82 84
ReturnValue 85
84: 56(int) Load 83(ui)
86: 85(ivec3) CompositeConstruct 84 84 84
89: 85(ivec3) Load 88(ui3)
90: 85(ivec3) ShiftRightLogical 86 89
91: 85(ivec3) Load 88(ui3)
92: 56(int) Load 83(ui)
93: 85(ivec3) CompositeConstruct 92 92 92
94: 85(ivec3) ShiftRightLogical 91 93
95: 6(float) Load 70(f1)
96: 7(fvec4) Load 15(v)
97: 7(fvec4) CompositeConstruct 95 95 95 95
98: 7(fvec4) FMul 96 97
Store 15(v) 98
99: 7(fvec4) Load 15(v)
100: 6(float) CompositeExtract 99 0
101: 6(float) Load 70(f1)
102: 6(float) FMul 101 100
Store 70(f1) 102
104: 22(fvec3) Load 24(u)
105: 7(fvec4) Load 15(v)
106: 6(float) CompositeExtract 105 0
107: 6(float) CompositeExtract 105 1
108: 6(float) CompositeExtract 105 2
109: 22(fvec3) CompositeConstruct 106 107 108
110: 22(fvec3) FMul 104 109
Store 103(mixed) 110
111: 22(fvec3) Load 24(u)
112: 6(float) CompositeExtract 111 0
Store 12(f) 112
113: 22(fvec3) Load 24(u)
114: 6(float) CompositeExtract 113 0
Store 70(f1) 114
116: 7(fvec4) Load 15(v)
117: 6(float) CompositeExtract 116 0
Store 115(sf) 117
119: 7(fvec4) Load 15(v)
120: 6(float) CompositeExtract 119 0
Store 118(sf1) 120
121: 7(fvec4) Load 11(input)
124: 7(fvec4) FMul 121 123
ReturnValue 124
FunctionEnd

View File

@ -0,0 +1,223 @@
hlsl.structbuffer.append.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: @main(u1; ( temp 4-component vector of float)
0:7 Function Parameters:
0:7 'pos' ( in uint)
0:? Sequence
0:8 move second child to first child ( temp 4-component vector of float)
0:8 indirect index (layout( row_major std430) buffer 4-component vector of float)
0:8 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
0:8 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:8 Constant:
0:8 0 (const uint)
0:8 AtomicAdd ( temp uint)
0:8 @count: direct index for structure ( temp int)
0:8 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:8 Constant:
0:8 0 (const int)
0:8 Constant:
0:8 1 (const int)
0:? Constant:
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:10 Branch: Return with expression
0:10 indirect index (layout( row_major std430) buffer 4-component vector of float)
0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
0:10 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:10 Constant:
0:10 0 (const uint)
0:10 add ( temp uint)
0:10 AtomicAdd ( temp uint)
0:10 @count: direct index for structure ( temp int)
0:10 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:10 Constant:
0:10 0 (const int)
0:10 Constant:
0:10 -1 (const int)
0:10 Constant:
0:10 -1 (const int)
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp uint)
0:? 'pos' ( temp uint)
0:? 'pos' (layout( location=0) in uint)
0:7 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:7 Function Call: @main(u1; ( temp 4-component vector of float)
0:? 'pos' ( temp uint)
0:? Linker Objects
0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'pos' (layout( location=0) in uint)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: @main(u1; ( temp 4-component vector of float)
0:7 Function Parameters:
0:7 'pos' ( in uint)
0:? Sequence
0:8 move second child to first child ( temp 4-component vector of float)
0:8 indirect index (layout( row_major std430) buffer 4-component vector of float)
0:8 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
0:8 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:8 Constant:
0:8 0 (const uint)
0:8 AtomicAdd ( temp uint)
0:8 @count: direct index for structure ( temp int)
0:8 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:8 Constant:
0:8 0 (const int)
0:8 Constant:
0:8 1 (const int)
0:? Constant:
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:10 Branch: Return with expression
0:10 indirect index (layout( row_major std430) buffer 4-component vector of float)
0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
0:10 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:10 Constant:
0:10 0 (const uint)
0:10 add ( temp uint)
0:10 AtomicAdd ( temp uint)
0:10 @count: direct index for structure ( temp int)
0:10 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:10 Constant:
0:10 0 (const int)
0:10 Constant:
0:10 -1 (const int)
0:10 Constant:
0:10 -1 (const int)
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp uint)
0:? 'pos' ( temp uint)
0:? 'pos' (layout( location=0) in uint)
0:7 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:7 Function Call: @main(u1; ( temp 4-component vector of float)
0:? 'pos' ( temp uint)
0:? Linker Objects
0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'pos' (layout( location=0) in uint)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 56
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 48 51
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 12 "@main(u1;"
Name 11 "pos"
Name 15 "sbuf_a"
MemberName 15(sbuf_a) 0 "@data"
Name 17 "sbuf_a"
Name 20 "sbuf_a@count"
MemberName 20(sbuf_a@count) 0 "@count"
Name 22 "sbuf_a@count"
Name 36 "sbuf_c"
Name 37 "sbuf_c@count"
Name 46 "pos"
Name 48 "pos"
Name 51 "@entryPointOutput"
Name 52 "param"
Name 55 "sbuf_unused"
Decorate 14 ArrayStride 16
MemberDecorate 15(sbuf_a) 0 Offset 0
Decorate 15(sbuf_a) BufferBlock
Decorate 17(sbuf_a) DescriptorSet 0
MemberDecorate 20(sbuf_a@count) 0 Offset 0
Decorate 20(sbuf_a@count) BufferBlock
Decorate 22(sbuf_a@count) DescriptorSet 0
Decorate 36(sbuf_c) DescriptorSet 0
Decorate 37(sbuf_c@count) DescriptorSet 0
Decorate 48(pos) Location 0
Decorate 51(@entryPointOutput) Location 0
Decorate 55(sbuf_unused) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
14: TypeRuntimeArray 9(fvec4)
15(sbuf_a): TypeStruct 14
16: TypePointer Uniform 15(sbuf_a)
17(sbuf_a): 16(ptr) Variable Uniform
18: TypeInt 32 1
19: 18(int) Constant 0
20(sbuf_a@count): TypeStruct 18(int)
21: TypePointer Uniform 20(sbuf_a@count)
22(sbuf_a@count): 21(ptr) Variable Uniform
23: TypePointer Uniform 18(int)
25: 18(int) Constant 1
26: 6(int) Constant 1
27: 6(int) Constant 0
29: 8(float) Constant 1065353216
30: 8(float) Constant 1073741824
31: 8(float) Constant 1077936128
32: 8(float) Constant 1082130432
33: 9(fvec4) ConstantComposite 29 30 31 32
34: TypePointer Uniform 9(fvec4)
36(sbuf_c): 16(ptr) Variable Uniform
37(sbuf_c@count): 21(ptr) Variable Uniform
39: 18(int) Constant 4294967295
47: TypePointer Input 6(int)
48(pos): 47(ptr) Variable Input
50: TypePointer Output 9(fvec4)
51(@entryPointOutput): 50(ptr) Variable Output
55(sbuf_unused): 16(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
46(pos): 7(ptr) Variable Function
52(param): 7(ptr) Variable Function
49: 6(int) Load 48(pos)
Store 46(pos) 49
53: 6(int) Load 46(pos)
Store 52(param) 53
54: 9(fvec4) FunctionCall 12(@main(u1;) 52(param)
Store 51(@entryPointOutput) 54
Return
FunctionEnd
12(@main(u1;): 9(fvec4) Function None 10
11(pos): 7(ptr) FunctionParameter
13: Label
24: 23(ptr) AccessChain 22(sbuf_a@count) 19
28: 6(int) AtomicIAdd 24 26 27 25
35: 34(ptr) AccessChain 17(sbuf_a) 19 28
Store 35 33
38: 23(ptr) AccessChain 37(sbuf_c@count) 19
40: 6(int) AtomicIAdd 38 26 27 39
41: 6(int) IAdd 40 39
42: 34(ptr) AccessChain 36(sbuf_c) 19 41
43: 9(fvec4) Load 42
ReturnValue 43
FunctionEnd

View File

@ -0,0 +1,326 @@
hlsl.structbuffer.floatidx.comp
Shader version: 500
local_size = (1, 1, 1)
0:? Sequence
0:13 Function Definition: @main(vu3; ( temp void)
0:13 Function Parameters:
0:13 'nThreadId' ( in 3-component vector of uint)
0:? Sequence
0:14 Sequence
0:14 move second child to first child ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:14 'data' ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:14 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:14 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data})
0:14 Constant:
0:14 0 (const uint)
0:14 add ( temp uint)
0:14 AtomicAdd ( temp uint)
0:14 @count: direct index for structure ( temp int)
0:14 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 -1 (const int)
0:14 Constant:
0:14 -1 (const int)
0:15 Sequence
0:15 move second child to first child ( temp 2-component vector of float)
0:15 'coord' ( temp 2-component vector of float)
0:15 Convert uint to float ( temp 2-component vector of float)
0:15 vector swizzle ( temp 2-component vector of uint)
0:15 threadId: direct index for structure ( temp 2-component vector of uint)
0:15 'data' ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:15 Constant:
0:15 1 (const int)
0:15 Sequence
0:15 Constant:
0:15 0 (const int)
0:15 Constant:
0:15 1 (const int)
0:16 Sequence
0:16 move second child to first child ( temp 4-component vector of float)
0:16 'storeTemp' ( temp 4-component vector of float)
0:16 color: direct index for structure ( temp 4-component vector of float)
0:16 'data' ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:16 Constant:
0:16 0 (const int)
0:16 imageStore ( temp void)
0:16 'outtx' (layout( rgba32f) uniform image2D)
0:16 Convert float to uint ( temp 2-component vector of uint)
0:16 'coord' ( temp 2-component vector of float)
0:16 'storeTemp' ( temp 4-component vector of float)
0:16 'storeTemp' ( temp 4-component vector of float)
0:18 move second child to first child ( temp 4-component vector of float)
0:18 indirect index (layout( row_major std430) buffer 4-component vector of float)
0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:18 Constant:
0:18 0 (const uint)
0:18 Convert float to uint ( temp uint)
0:18 direct index ( temp float)
0:18 'coord' ( temp 2-component vector of float)
0:18 Constant:
0:18 0 (const int)
0:18 indirect index (layout( row_major std430) buffer 4-component vector of float)
0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:18 Constant:
0:18 0 (const uint)
0:18 Convert float to uint ( temp uint)
0:18 direct index ( temp float)
0:18 'coord' ( temp 2-component vector of float)
0:18 Constant:
0:18 1 (const int)
0:13 Function Definition: main( ( temp void)
0:13 Function Parameters:
0:? Sequence
0:13 move second child to first child ( temp 3-component vector of uint)
0:? 'nThreadId' ( temp 3-component vector of uint)
0:? 'nThreadId' ( in 3-component vector of uint GlobalInvocationID)
0:13 Function Call: @main(vu3; ( temp void)
0:? 'nThreadId' ( temp 3-component vector of uint)
0:? Linker Objects
0:? 'outtx' (layout( rgba32f) uniform image2D)
0:? 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data})
0:? 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:? 'nThreadId' ( in 3-component vector of uint GlobalInvocationID)
Linked compute stage:
Shader version: 500
local_size = (1, 1, 1)
0:? Sequence
0:13 Function Definition: @main(vu3; ( temp void)
0:13 Function Parameters:
0:13 'nThreadId' ( in 3-component vector of uint)
0:? Sequence
0:14 Sequence
0:14 move second child to first child ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:14 'data' ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:14 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:14 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data})
0:14 Constant:
0:14 0 (const uint)
0:14 add ( temp uint)
0:14 AtomicAdd ( temp uint)
0:14 @count: direct index for structure ( temp int)
0:14 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 -1 (const int)
0:14 Constant:
0:14 -1 (const int)
0:15 Sequence
0:15 move second child to first child ( temp 2-component vector of float)
0:15 'coord' ( temp 2-component vector of float)
0:15 Convert uint to float ( temp 2-component vector of float)
0:15 vector swizzle ( temp 2-component vector of uint)
0:15 threadId: direct index for structure ( temp 2-component vector of uint)
0:15 'data' ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:15 Constant:
0:15 1 (const int)
0:15 Sequence
0:15 Constant:
0:15 0 (const int)
0:15 Constant:
0:15 1 (const int)
0:16 Sequence
0:16 move second child to first child ( temp 4-component vector of float)
0:16 'storeTemp' ( temp 4-component vector of float)
0:16 color: direct index for structure ( temp 4-component vector of float)
0:16 'data' ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId})
0:16 Constant:
0:16 0 (const int)
0:16 imageStore ( temp void)
0:16 'outtx' (layout( rgba32f) uniform image2D)
0:16 Convert float to uint ( temp 2-component vector of uint)
0:16 'coord' ( temp 2-component vector of float)
0:16 'storeTemp' ( temp 4-component vector of float)
0:16 'storeTemp' ( temp 4-component vector of float)
0:18 move second child to first child ( temp 4-component vector of float)
0:18 indirect index (layout( row_major std430) buffer 4-component vector of float)
0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:18 Constant:
0:18 0 (const uint)
0:18 Convert float to uint ( temp uint)
0:18 direct index ( temp float)
0:18 'coord' ( temp 2-component vector of float)
0:18 Constant:
0:18 0 (const int)
0:18 indirect index (layout( row_major std430) buffer 4-component vector of float)
0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:18 Constant:
0:18 0 (const uint)
0:18 Convert float to uint ( temp uint)
0:18 direct index ( temp float)
0:18 'coord' ( temp 2-component vector of float)
0:18 Constant:
0:18 1 (const int)
0:13 Function Definition: main( ( temp void)
0:13 Function Parameters:
0:? Sequence
0:13 move second child to first child ( temp 3-component vector of uint)
0:? 'nThreadId' ( temp 3-component vector of uint)
0:? 'nThreadId' ( in 3-component vector of uint GlobalInvocationID)
0:13 Function Call: @main(vu3; ( temp void)
0:? 'nThreadId' ( temp 3-component vector of uint)
0:? Linker Objects
0:? 'outtx' (layout( rgba32f) uniform image2D)
0:? 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data})
0:? 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
0:? 'nThreadId' ( in 3-component vector of uint GlobalInvocationID)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 84
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 79
ExecutionMode 4 LocalSize 1 1 1
Source HLSL 500
Name 4 "main"
Name 11 "@main(vu3;"
Name 10 "nThreadId"
Name 16 "sb_t"
MemberName 16(sb_t) 0 "color"
MemberName 16(sb_t) 1 "threadId"
Name 18 "data"
Name 19 "sb_t"
MemberName 19(sb_t) 0 "color"
MemberName 19(sb_t) 1 "threadId"
Name 21 "csb"
MemberName 21(csb) 0 "@data"
Name 23 "csb"
Name 26 "csb@count"
MemberName 26(csb@count) 0 "@count"
Name 28 "csb@count"
Name 48 "coord"
Name 52 "storeTemp"
Name 57 "outtx"
Name 63 "rwsb"
MemberName 63(rwsb) 0 "@data"
Name 65 "rwsb"
Name 77 "nThreadId"
Name 79 "nThreadId"
Name 81 "param"
MemberDecorate 19(sb_t) 0 Offset 0
MemberDecorate 19(sb_t) 1 Offset 16
Decorate 20 ArrayStride 32
MemberDecorate 21(csb) 0 Offset 0
Decorate 21(csb) BufferBlock
Decorate 23(csb) DescriptorSet 0
Decorate 23(csb) Binding 1
MemberDecorate 26(csb@count) 0 Offset 0
Decorate 26(csb@count) BufferBlock
Decorate 28(csb@count) DescriptorSet 0
Decorate 57(outtx) DescriptorSet 0
Decorate 62 ArrayStride 16
MemberDecorate 63(rwsb) 0 Offset 0
Decorate 63(rwsb) BufferBlock
Decorate 65(rwsb) DescriptorSet 0
Decorate 79(nThreadId) BuiltIn GlobalInvocationId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeVector 6(int) 3
8: TypePointer Function 7(ivec3)
9: TypeFunction 2 8(ptr)
13: TypeFloat 32
14: TypeVector 13(float) 4
15: TypeVector 6(int) 2
16(sb_t): TypeStruct 14(fvec4) 15(ivec2)
17: TypePointer Function 16(sb_t)
19(sb_t): TypeStruct 14(fvec4) 15(ivec2)
20: TypeRuntimeArray 19(sb_t)
21(csb): TypeStruct 20
22: TypePointer Uniform 21(csb)
23(csb): 22(ptr) Variable Uniform
24: TypeInt 32 1
25: 24(int) Constant 0
26(csb@count): TypeStruct 24(int)
27: TypePointer Uniform 26(csb@count)
28(csb@count): 27(ptr) Variable Uniform
29: TypePointer Uniform 24(int)
31: 24(int) Constant 4294967295
32: 6(int) Constant 1
33: 6(int) Constant 0
36: TypePointer Uniform 19(sb_t)
40: TypePointer Function 14(fvec4)
43: 24(int) Constant 1
44: TypePointer Function 15(ivec2)
46: TypeVector 13(float) 2
47: TypePointer Function 46(fvec2)
55: TypeImage 13(float) 2D nonsampled format:Rgba32f
56: TypePointer UniformConstant 55
57(outtx): 56(ptr) Variable UniformConstant
62: TypeRuntimeArray 14(fvec4)
63(rwsb): TypeStruct 62
64: TypePointer Uniform 63(rwsb)
65(rwsb): 64(ptr) Variable Uniform
66: TypePointer Function 13(float)
73: TypePointer Uniform 14(fvec4)
78: TypePointer Input 7(ivec3)
79(nThreadId): 78(ptr) Variable Input
4(main): 2 Function None 3
5: Label
77(nThreadId): 8(ptr) Variable Function
81(param): 8(ptr) Variable Function
80: 7(ivec3) Load 79(nThreadId)
Store 77(nThreadId) 80
82: 7(ivec3) Load 77(nThreadId)
Store 81(param) 82
83: 2 FunctionCall 11(@main(vu3;) 81(param)
Return
FunctionEnd
11(@main(vu3;): 2 Function None 9
10(nThreadId): 8(ptr) FunctionParameter
12: Label
18(data): 17(ptr) Variable Function
48(coord): 47(ptr) Variable Function
52(storeTemp): 40(ptr) Variable Function
30: 29(ptr) AccessChain 28(csb@count) 25
34: 6(int) AtomicIAdd 30 32 33 31
35: 6(int) IAdd 34 31
37: 36(ptr) AccessChain 23(csb) 25 35
38: 19(sb_t) Load 37
39: 14(fvec4) CompositeExtract 38 0
41: 40(ptr) AccessChain 18(data) 25
Store 41 39
42: 15(ivec2) CompositeExtract 38 1
45: 44(ptr) AccessChain 18(data) 43
Store 45 42
49: 44(ptr) AccessChain 18(data) 43
50: 15(ivec2) Load 49
51: 46(fvec2) ConvertUToF 50
Store 48(coord) 51
53: 40(ptr) AccessChain 18(data) 25
54: 14(fvec4) Load 53
Store 52(storeTemp) 54
58: 55 Load 57(outtx)
59: 46(fvec2) Load 48(coord)
60: 15(ivec2) ConvertFToU 59
61: 14(fvec4) Load 52(storeTemp)
ImageWrite 58 60 61
67: 66(ptr) AccessChain 48(coord) 33
68: 13(float) Load 67
69: 6(int) ConvertFToU 68
70: 66(ptr) AccessChain 48(coord) 32
71: 13(float) Load 70
72: 6(int) ConvertFToU 71
74: 73(ptr) AccessChain 65(rwsb) 25 72
75: 14(fvec4) Load 74
76: 73(ptr) AccessChain 65(rwsb) 25 69
Store 76 75
Return
FunctionEnd

View File

@ -0,0 +1,243 @@
hlsl.structbuffer.fn2.comp
Shader version: 500
local_size = (256, 1, 1)
0:? Sequence
0:5 Function Definition: testLoad(u1;block--u1[0]1; ( temp 2-component vector of uint)
0:5 Function Parameters:
0:5 'loc' ( in uint)
0:5 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:? Sequence
0:6 Sequence
0:6 move second child to first child ( temp 2-component vector of uint)
0:6 'result' ( temp 2-component vector of uint)
0:? Sequence
0:6 move second child to first child ( temp int)
0:6 'byteAddrTemp' ( temp int)
0:6 right-shift ( temp int)
0:6 'loc' ( in uint)
0:6 Constant:
0:6 2 (const int)
0:? Construct vec2 ( temp 2-component vector of uint)
0:6 indirect index ( temp float)
0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:6 Constant:
0:6 0 (const uint)
0:6 'byteAddrTemp' ( temp int)
0:6 indirect index ( temp float)
0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:6 Constant:
0:6 0 (const uint)
0:6 add ( temp int)
0:6 'byteAddrTemp' ( temp int)
0:6 Constant:
0:6 1 (const int)
0:7 Branch: Return with expression
0:7 'result' ( temp 2-component vector of uint)
0:12 Function Definition: @main(u1; ( temp void)
0:12 Function Parameters:
0:12 'dispatchId' ( in uint)
0:? Sequence
0:13 Sequence
0:13 move second child to first child ( temp 2-component vector of uint)
0:13 'result' ( temp 2-component vector of uint)
0:13 Function Call: testLoad(u1;block--u1[0]1; ( temp 2-component vector of uint)
0:13 'dispatchId' ( in uint)
0:13 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:14 Sequence
0:14 imageStore ( temp void)
0:14 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
0:14 'dispatchId' ( in uint)
0:14 'result' ( temp 2-component vector of uint)
0:14 'result' ( temp 2-component vector of uint)
0:12 Function Definition: main( ( temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child ( temp uint)
0:? 'dispatchId' ( temp uint)
0:? 'dispatchId' ( in uint GlobalInvocationID)
0:12 Function Call: @main(u1; ( temp void)
0:? 'dispatchId' ( temp uint)
0:? Linker Objects
0:? 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
0:? 'dispatchId' ( in uint GlobalInvocationID)
Linked compute stage:
Shader version: 500
local_size = (256, 1, 1)
0:? Sequence
0:5 Function Definition: testLoad(u1;block--u1[0]1; ( temp 2-component vector of uint)
0:5 Function Parameters:
0:5 'loc' ( in uint)
0:5 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:? Sequence
0:6 Sequence
0:6 move second child to first child ( temp 2-component vector of uint)
0:6 'result' ( temp 2-component vector of uint)
0:? Sequence
0:6 move second child to first child ( temp int)
0:6 'byteAddrTemp' ( temp int)
0:6 right-shift ( temp int)
0:6 'loc' ( in uint)
0:6 Constant:
0:6 2 (const int)
0:? Construct vec2 ( temp 2-component vector of uint)
0:6 indirect index ( temp float)
0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:6 Constant:
0:6 0 (const uint)
0:6 'byteAddrTemp' ( temp int)
0:6 indirect index ( temp float)
0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:6 Constant:
0:6 0 (const uint)
0:6 add ( temp int)
0:6 'byteAddrTemp' ( temp int)
0:6 Constant:
0:6 1 (const int)
0:7 Branch: Return with expression
0:7 'result' ( temp 2-component vector of uint)
0:12 Function Definition: @main(u1; ( temp void)
0:12 Function Parameters:
0:12 'dispatchId' ( in uint)
0:? Sequence
0:13 Sequence
0:13 move second child to first child ( temp 2-component vector of uint)
0:13 'result' ( temp 2-component vector of uint)
0:13 Function Call: testLoad(u1;block--u1[0]1; ( temp 2-component vector of uint)
0:13 'dispatchId' ( in uint)
0:13 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:14 Sequence
0:14 imageStore ( temp void)
0:14 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
0:14 'dispatchId' ( in uint)
0:14 'result' ( temp 2-component vector of uint)
0:14 'result' ( temp 2-component vector of uint)
0:12 Function Definition: main( ( temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child ( temp uint)
0:? 'dispatchId' ( temp uint)
0:? 'dispatchId' ( in uint GlobalInvocationID)
0:12 Function Call: @main(u1; ( temp void)
0:? 'dispatchId' ( temp uint)
0:? Linker Objects
0:? 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
0:? 'dispatchId' ( in uint GlobalInvocationID)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 61
Capability Shader
Capability SampledBuffer
Capability StorageImageExtendedFormats
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 56
ExecutionMode 4 LocalSize 256 1 1
Source HLSL 500
Name 4 "main"
Name 9 ""
MemberName 9 0 "@data"
Name 15 "testLoad(u1;block--u1[0]1;"
Name 13 "loc"
Name 14 "buffer"
Name 19 "@main(u1;"
Name 18 "dispatchId"
Name 22 "result"
Name 25 "byteAddrTemp"
Name 43 "result"
Name 44 "g_input"
Name 45 "param"
Name 50 "g_output"
Name 54 "dispatchId"
Name 56 "dispatchId"
Name 58 "param"
Decorate 8 ArrayStride 4
MemberDecorate 9 0 NonWritable
MemberDecorate 9 0 Offset 0
Decorate 9 BufferBlock
Decorate 44(g_input) DescriptorSet 0
Decorate 44(g_input) Binding 0
Decorate 50(g_output) DescriptorSet 0
Decorate 50(g_output) Binding 1
Decorate 56(dispatchId) BuiltIn GlobalInvocationId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeRuntimeArray 6(int)
9: TypeStruct 8
10: TypePointer Uniform 9(struct)
11: TypeVector 6(int) 2
12: TypeFunction 11(ivec2) 7(ptr) 10(ptr)
17: TypeFunction 2 7(ptr)
21: TypePointer Function 11(ivec2)
23: TypeInt 32 1
24: TypePointer Function 23(int)
27: 23(int) Constant 2
29: 23(int) Constant 0
31: TypePointer Uniform 6(int)
35: 23(int) Constant 1
44(g_input): 10(ptr) Variable Uniform
48: TypeImage 6(int) Buffer nonsampled format:Rg32ui
49: TypePointer UniformConstant 48
50(g_output): 49(ptr) Variable UniformConstant
55: TypePointer Input 6(int)
56(dispatchId): 55(ptr) Variable Input
4(main): 2 Function None 3
5: Label
54(dispatchId): 7(ptr) Variable Function
58(param): 7(ptr) Variable Function
57: 6(int) Load 56(dispatchId)
Store 54(dispatchId) 57
59: 6(int) Load 54(dispatchId)
Store 58(param) 59
60: 2 FunctionCall 19(@main(u1;) 58(param)
Return
FunctionEnd
15(testLoad(u1;block--u1[0]1;): 11(ivec2) Function None 12
13(loc): 7(ptr) FunctionParameter
14(buffer): 10(ptr) FunctionParameter
16: Label
22(result): 21(ptr) Variable Function
25(byteAddrTemp): 24(ptr) Variable Function
26: 6(int) Load 13(loc)
28: 23(int) ShiftRightLogical 26 27
Store 25(byteAddrTemp) 28
30: 23(int) Load 25(byteAddrTemp)
32: 31(ptr) AccessChain 14(buffer) 29 30
33: 6(int) Load 32
34: 23(int) Load 25(byteAddrTemp)
36: 23(int) IAdd 34 35
37: 31(ptr) AccessChain 14(buffer) 29 36
38: 6(int) Load 37
39: 11(ivec2) CompositeConstruct 33 38
Store 22(result) 39
40: 11(ivec2) Load 22(result)
ReturnValue 40
FunctionEnd
19(@main(u1;): 2 Function None 17
18(dispatchId): 7(ptr) FunctionParameter
20: Label
43(result): 21(ptr) Variable Function
45(param): 7(ptr) Variable Function
46: 6(int) Load 18(dispatchId)
Store 45(param) 46
47: 11(ivec2) FunctionCall 15(testLoad(u1;block--u1[0]1;) 45(param) 44(g_input)
Store 43(result) 47
51: 48 Load 50(g_output)
52: 6(int) Load 18(dispatchId)
53: 11(ivec2) Load 43(result)
ImageWrite 51 52 53
Return
FunctionEnd

View File

@ -0,0 +1,323 @@
hlsl.structbuffer.incdec.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: @main(u1; ( temp 4-component vector of float)
0:7 Function Parameters:
0:7 'pos' ( in uint)
0:? Sequence
0:8 Sequence
0:8 move second child to first child ( temp 4-component vector of uint)
0:8 'result' ( temp 4-component vector of uint)
0:8 Constant:
0:8 0 (const uint)
0:8 0 (const uint)
0:8 0 (const uint)
0:8 0 (const uint)
0:10 direct index (layout( row_major std430) buffer 4-component vector of uint)
0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint)
0:10 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:10 Constant:
0:10 0 (const uint)
0:10 Constant:
0:10 7 (const int)
0:11 direct index (layout( row_major std430) buffer 4-component vector of uint)
0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint)
0:11 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 Constant:
0:11 7 (const int)
0:13 move second child to first child ( temp 4-component vector of uint)
0:13 direct index (layout( row_major std430) buffer 4-component vector of uint)
0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint)
0:13 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:13 Constant:
0:13 0 (const uint)
0:13 Constant:
0:13 5 (const int)
0:13 Constant:
0:13 2 (const uint)
0:13 2 (const uint)
0:13 2 (const uint)
0:13 2 (const uint)
0:15 Sequence
0:15 move second child to first child ( temp uint)
0:15 'c1' ( temp uint)
0:15 AtomicAdd ( temp uint)
0:15 @count: direct index for structure ( temp int)
0:15 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:15 Constant:
0:15 0 (const int)
0:15 Constant:
0:15 1 (const int)
0:16 Sequence
0:16 move second child to first child ( temp uint)
0:16 'c2' ( temp uint)
0:16 add ( temp uint)
0:16 AtomicAdd ( temp uint)
0:16 @count: direct index for structure ( temp int)
0:16 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 -1 (const int)
0:16 Constant:
0:16 -1 (const int)
0:18 Branch: Return with expression
0:? Construct vec4 ( temp 4-component vector of float)
0:18 Convert uint to float ( temp float)
0:18 direct index ( temp uint)
0:18 'result' ( temp 4-component vector of uint)
0:18 Constant:
0:18 0 (const int)
0:18 Convert uint to float ( temp float)
0:18 direct index ( temp uint)
0:18 'result' ( temp 4-component vector of uint)
0:18 Constant:
0:18 1 (const int)
0:18 Convert uint to float ( temp float)
0:18 'c1' ( temp uint)
0:18 Convert uint to float ( temp float)
0:18 'c2' ( temp uint)
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp uint)
0:? 'pos' ( temp uint)
0:? 'pos' (layout( location=0) in uint)
0:7 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:7 Function Call: @main(u1; ( temp 4-component vector of float)
0:? 'pos' ( temp uint)
0:? Linker Objects
0:? 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:? 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:? 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'pos' (layout( location=0) in uint)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: @main(u1; ( temp 4-component vector of float)
0:7 Function Parameters:
0:7 'pos' ( in uint)
0:? Sequence
0:8 Sequence
0:8 move second child to first child ( temp 4-component vector of uint)
0:8 'result' ( temp 4-component vector of uint)
0:8 Constant:
0:8 0 (const uint)
0:8 0 (const uint)
0:8 0 (const uint)
0:8 0 (const uint)
0:10 direct index (layout( row_major std430) buffer 4-component vector of uint)
0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint)
0:10 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:10 Constant:
0:10 0 (const uint)
0:10 Constant:
0:10 7 (const int)
0:11 direct index (layout( row_major std430) buffer 4-component vector of uint)
0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint)
0:11 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 Constant:
0:11 7 (const int)
0:13 move second child to first child ( temp 4-component vector of uint)
0:13 direct index (layout( row_major std430) buffer 4-component vector of uint)
0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint)
0:13 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:13 Constant:
0:13 0 (const uint)
0:13 Constant:
0:13 5 (const int)
0:13 Constant:
0:13 2 (const uint)
0:13 2 (const uint)
0:13 2 (const uint)
0:13 2 (const uint)
0:15 Sequence
0:15 move second child to first child ( temp uint)
0:15 'c1' ( temp uint)
0:15 AtomicAdd ( temp uint)
0:15 @count: direct index for structure ( temp int)
0:15 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:15 Constant:
0:15 0 (const int)
0:15 Constant:
0:15 1 (const int)
0:16 Sequence
0:16 move second child to first child ( temp uint)
0:16 'c2' ( temp uint)
0:16 add ( temp uint)
0:16 AtomicAdd ( temp uint)
0:16 @count: direct index for structure ( temp int)
0:16 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 -1 (const int)
0:16 Constant:
0:16 -1 (const int)
0:18 Branch: Return with expression
0:? Construct vec4 ( temp 4-component vector of float)
0:18 Convert uint to float ( temp float)
0:18 direct index ( temp uint)
0:18 'result' ( temp 4-component vector of uint)
0:18 Constant:
0:18 0 (const int)
0:18 Convert uint to float ( temp float)
0:18 direct index ( temp uint)
0:18 'result' ( temp 4-component vector of uint)
0:18 Constant:
0:18 1 (const int)
0:18 Convert uint to float ( temp float)
0:18 'c1' ( temp uint)
0:18 Convert uint to float ( temp float)
0:18 'c2' ( temp uint)
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp uint)
0:? 'pos' ( temp uint)
0:? 'pos' (layout( location=0) in uint)
0:7 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:7 Function Call: @main(u1; ( temp 4-component vector of float)
0:? 'pos' ( temp uint)
0:? Linker Objects
0:? 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:? 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:? 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
0:? 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'pos' (layout( location=0) in uint)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 70
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 63 66
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 12 "@main(u1;"
Name 11 "pos"
Name 16 "result"
Name 20 "sbuf_rw_i"
MemberName 20(sbuf_rw_i) 0 "@data"
Name 22 "sbuf_rw_i"
Name 26 "sbuf_rw_d"
Name 27 "sbuf_rw_nocounter"
Name 33 "c1"
Name 34 "sbuf_rw_i@count"
MemberName 34(sbuf_rw_i@count) 0 "@count"
Name 36 "sbuf_rw_i@count"
Name 42 "c2"
Name 43 "sbuf_rw_d@count"
Name 61 "pos"
Name 63 "pos"
Name 66 "@entryPointOutput"
Name 67 "param"
Decorate 19 ArrayStride 16
MemberDecorate 20(sbuf_rw_i) 0 Offset 0
Decorate 20(sbuf_rw_i) BufferBlock
Decorate 22(sbuf_rw_i) DescriptorSet 0
Decorate 26(sbuf_rw_d) DescriptorSet 0
Decorate 27(sbuf_rw_nocounter) DescriptorSet 0
MemberDecorate 34(sbuf_rw_i@count) 0 Offset 0
Decorate 34(sbuf_rw_i@count) BufferBlock
Decorate 36(sbuf_rw_i@count) DescriptorSet 0
Decorate 43(sbuf_rw_d@count) DescriptorSet 0
Decorate 63(pos) Location 0
Decorate 66(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
14: TypeVector 6(int) 4
15: TypePointer Function 14(ivec4)
17: 6(int) Constant 0
18: 14(ivec4) ConstantComposite 17 17 17 17
19: TypeRuntimeArray 14(ivec4)
20(sbuf_rw_i): TypeStruct 19
21: TypePointer Uniform 20(sbuf_rw_i)
22(sbuf_rw_i): 21(ptr) Variable Uniform
23: TypeInt 32 1
24: 23(int) Constant 0
25: 23(int) Constant 7
26(sbuf_rw_d): 21(ptr) Variable Uniform
27(sbuf_rw_nocounter): 21(ptr) Variable Uniform
28: 23(int) Constant 5
29: 6(int) Constant 2
30: 14(ivec4) ConstantComposite 29 29 29 29
31: TypePointer Uniform 14(ivec4)
34(sbuf_rw_i@count): TypeStruct 23(int)
35: TypePointer Uniform 34(sbuf_rw_i@count)
36(sbuf_rw_i@count): 35(ptr) Variable Uniform
37: TypePointer Uniform 23(int)
39: 23(int) Constant 1
40: 6(int) Constant 1
43(sbuf_rw_d@count): 35(ptr) Variable Uniform
45: 23(int) Constant 4294967295
62: TypePointer Input 6(int)
63(pos): 62(ptr) Variable Input
65: TypePointer Output 9(fvec4)
66(@entryPointOutput): 65(ptr) Variable Output
4(main): 2 Function None 3
5: Label
61(pos): 7(ptr) Variable Function
67(param): 7(ptr) Variable Function
64: 6(int) Load 63(pos)
Store 61(pos) 64
68: 6(int) Load 61(pos)
Store 67(param) 68
69: 9(fvec4) FunctionCall 12(@main(u1;) 67(param)
Store 66(@entryPointOutput) 69
Return
FunctionEnd
12(@main(u1;): 9(fvec4) Function None 10
11(pos): 7(ptr) FunctionParameter
13: Label
16(result): 15(ptr) Variable Function
33(c1): 7(ptr) Variable Function
42(c2): 7(ptr) Variable Function
Store 16(result) 18
32: 31(ptr) AccessChain 27(sbuf_rw_nocounter) 24 28
Store 32 30
38: 37(ptr) AccessChain 36(sbuf_rw_i@count) 24
41: 6(int) AtomicIAdd 38 40 17 39
Store 33(c1) 41
44: 37(ptr) AccessChain 43(sbuf_rw_d@count) 24
46: 6(int) AtomicIAdd 44 40 17 45
47: 6(int) IAdd 46 45
Store 42(c2) 47
48: 7(ptr) AccessChain 16(result) 17
49: 6(int) Load 48
50: 8(float) ConvertUToF 49
51: 7(ptr) AccessChain 16(result) 40
52: 6(int) Load 51
53: 8(float) ConvertUToF 52
54: 6(int) Load 33(c1)
55: 8(float) ConvertUToF 54
56: 6(int) Load 42(c2)
57: 8(float) ConvertUToF 56
58: 9(fvec4) CompositeConstruct 50 53 55 57
ReturnValue 58
FunctionEnd

View File

@ -19,7 +19,7 @@ ERROR: 0:112: '#if' : unexpected tokens following directive
ERROR: 0:117: 'macro expansion' : End of line in macro substitution: FOOM
ERROR: 0:118: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:118: '#if' : unexpected tokens following directive
ERROR: 0:150: '' : syntax error
ERROR: 0:150: '' : syntax error, unexpected EQUAL
ERROR: 19 compilation errors. No code generated.

View File

@ -1,12 +1,12 @@
spv.ssbo.autoassign.frag
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 95
// Id's are bound by 99
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 88 91
EntryPoint Fragment 4 "main" 92 95
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@ -23,13 +23,13 @@ spv.ssbo.autoassign.frag
MemberName 26(TestCB) 0 "W"
MemberName 26(TestCB) 1 "H"
Name 28 ""
Name 55 "SB1"
MemberName 55(SB1) 0 "@data"
Name 57 "SB1"
Name 86 "pos"
Name 88 "pos"
Name 91 "@entryPointOutput"
Name 92 "param"
MemberName 57(SB1) 0 "@data"
Name 59 "SB1"
Name 90 "pos"
Name 92 "pos"
Name 95 "@entryPointOutput"
Name 96 "param"
MemberDecorate 14(BufType) 0 NonWritable
MemberDecorate 14(BufType) 0 Offset 0
MemberDecorate 14(BufType) 1 NonWritable
@ -45,13 +45,13 @@ spv.ssbo.autoassign.frag
Decorate 26(TestCB) Block
Decorate 28 DescriptorSet 0
Decorate 28 Binding 15
Decorate 54 ArrayStride 32
MemberDecorate 55(SB1) 0 Offset 0
Decorate 55(SB1) BufferBlock
Decorate 57(SB1) DescriptorSet 0
Decorate 57(SB1) Binding 31
Decorate 88(pos) Location 0
Decorate 91(@entryPointOutput) Location 0
Decorate 56 ArrayStride 32
MemberDecorate 57(SB1) 0 Offset 0
Decorate 57(SB1) BufferBlock
Decorate 59(SB1) DescriptorSet 0
Decorate 59(SB1) Binding 31
Decorate 92(pos) Location 0
Decorate 95(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -73,26 +73,26 @@ spv.ssbo.autoassign.frag
28: 27(ptr) Variable Uniform
29: TypePointer Uniform 21(int)
34: 21(int) Constant 0
38: TypePointer Uniform 7(fvec4)
50: 19(int) Constant 1
54: TypeRuntimeArray 14(BufType)
55(SB1): TypeStruct 54
56: TypePointer Uniform 55(SB1)
57(SB1): 56(ptr) Variable Uniform
87: TypePointer Input 7(fvec4)
88(pos): 87(ptr) Variable Input
90: TypePointer Output 7(fvec4)
91(@entryPointOutput): 90(ptr) Variable Output
39: TypePointer Uniform 7(fvec4)
52: 19(int) Constant 1
56: TypeRuntimeArray 14(BufType)
57(SB1): TypeStruct 56
58: TypePointer Uniform 57(SB1)
59(SB1): 58(ptr) Variable Uniform
91: TypePointer Input 7(fvec4)
92(pos): 91(ptr) Variable Input
94: TypePointer Output 7(fvec4)
95(@entryPointOutput): 94(ptr) Variable Output
4(main): 2 Function None 3
5: Label
86(pos): 8(ptr) Variable Function
92(param): 8(ptr) Variable Function
89: 7(fvec4) Load 88(pos)
Store 86(pos) 89
93: 7(fvec4) Load 86(pos)
Store 92(param) 93
94: 7(fvec4) FunctionCall 11(@main(vf4;) 92(param)
Store 91(@entryPointOutput) 94
90(pos): 8(ptr) Variable Function
96(param): 8(ptr) Variable Function
93: 7(fvec4) Load 92(pos)
Store 90(pos) 93
97: 7(fvec4) Load 90(pos)
Store 96(param) 97
98: 7(fvec4) FunctionCall 11(@main(vf4;) 96(param)
Store 95(@entryPointOutput) 98
Return
FunctionEnd
11(@main(vf4;): 7(fvec4) Function None 9
@ -108,47 +108,51 @@ spv.ssbo.autoassign.frag
35: 23(ptr) AccessChain 10(pos) 34
36: 6(float) Load 35
37: 6(float) FAdd 33 36
39: 38(ptr) AccessChain 18(SB0) 20 37 20
40: 7(fvec4) Load 39
41: 23(ptr) AccessChain 10(pos) 22
42: 6(float) Load 41
43: 29(ptr) AccessChain 28 20
44: 21(int) Load 43
45: 6(float) ConvertUToF 44
46: 6(float) FMul 42 45
47: 23(ptr) AccessChain 10(pos) 34
48: 6(float) Load 47
49: 6(float) FAdd 46 48
51: 38(ptr) AccessChain 18(SB0) 20 49 50
52: 7(fvec4) Load 51
53: 7(fvec4) FAdd 40 52
Store 13(vTmp) 53
58: 23(ptr) AccessChain 10(pos) 22
59: 6(float) Load 58
60: 29(ptr) AccessChain 28 20
61: 21(int) Load 60
62: 6(float) ConvertUToF 61
63: 6(float) FMul 59 62
64: 23(ptr) AccessChain 10(pos) 34
65: 6(float) Load 64
66: 6(float) FAdd 63 65
67: 38(ptr) AccessChain 57(SB1) 20 66 20
68: 7(fvec4) Load 67
69: 23(ptr) AccessChain 10(pos) 22
70: 6(float) Load 69
71: 29(ptr) AccessChain 28 20
72: 21(int) Load 71
73: 6(float) ConvertUToF 72
74: 6(float) FMul 70 73
75: 23(ptr) AccessChain 10(pos) 34
76: 6(float) Load 75
77: 6(float) FAdd 74 76
78: 38(ptr) AccessChain 57(SB1) 20 77 50
79: 7(fvec4) Load 78
80: 7(fvec4) FAdd 68 79
81: 7(fvec4) Load 13(vTmp)
82: 7(fvec4) FAdd 81 80
Store 13(vTmp) 82
83: 7(fvec4) Load 13(vTmp)
ReturnValue 83
38: 21(int) ConvertFToU 37
40: 39(ptr) AccessChain 18(SB0) 20 38 20
41: 7(fvec4) Load 40
42: 23(ptr) AccessChain 10(pos) 22
43: 6(float) Load 42
44: 29(ptr) AccessChain 28 20
45: 21(int) Load 44
46: 6(float) ConvertUToF 45
47: 6(float) FMul 43 46
48: 23(ptr) AccessChain 10(pos) 34
49: 6(float) Load 48
50: 6(float) FAdd 47 49
51: 21(int) ConvertFToU 50
53: 39(ptr) AccessChain 18(SB0) 20 51 52
54: 7(fvec4) Load 53
55: 7(fvec4) FAdd 41 54
Store 13(vTmp) 55
60: 23(ptr) AccessChain 10(pos) 22
61: 6(float) Load 60
62: 29(ptr) AccessChain 28 20
63: 21(int) Load 62
64: 6(float) ConvertUToF 63
65: 6(float) FMul 61 64
66: 23(ptr) AccessChain 10(pos) 34
67: 6(float) Load 66
68: 6(float) FAdd 65 67
69: 21(int) ConvertFToU 68
70: 39(ptr) AccessChain 59(SB1) 20 69 20
71: 7(fvec4) Load 70
72: 23(ptr) AccessChain 10(pos) 22
73: 6(float) Load 72
74: 29(ptr) AccessChain 28 20
75: 21(int) Load 74
76: 6(float) ConvertUToF 75
77: 6(float) FMul 73 76
78: 23(ptr) AccessChain 10(pos) 34
79: 6(float) Load 78
80: 6(float) FAdd 77 79
81: 21(int) ConvertFToU 80
82: 39(ptr) AccessChain 59(SB1) 20 81 52
83: 7(fvec4) Load 82
84: 7(fvec4) FAdd 71 83
85: 7(fvec4) Load 13(vTmp)
86: 7(fvec4) FAdd 85 84
Store 13(vTmp) 86
87: 7(fvec4) Load 13(vTmp)
ReturnValue 87
FunctionEnd

View File

@ -0,0 +1,68 @@
spv.storageBuffer.vert
Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 31
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 13
Source GLSL 450
Name 4 "main"
Name 11 "gl_PerVertex"
MemberName 11(gl_PerVertex) 0 "gl_Position"
MemberName 11(gl_PerVertex) 1 "gl_PointSize"
MemberName 11(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 11(gl_PerVertex) 3 "gl_CullDistance"
Name 13 ""
Name 16 "ub"
MemberName 16(ub) 0 "a"
Name 18 "ubi"
Name 22 "bb"
MemberName 22(bb) 0 "b"
Name 24 "bbi"
MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 11(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 11(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 11(gl_PerVertex) Block
MemberDecorate 16(ub) 0 Offset 0
Decorate 16(ub) Block
Decorate 18(ubi) DescriptorSet 0
MemberDecorate 22(bb) 0 Offset 0
Decorate 22(bb) Block
Decorate 24(bbi) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeInt 32 0
9: 8(int) Constant 1
10: TypeArray 6(float) 9
11(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 10 10
12: TypePointer Output 11(gl_PerVertex)
13: 12(ptr) Variable Output
14: TypeInt 32 1
15: 14(int) Constant 0
16(ub): TypeStruct 7(fvec4)
17: TypePointer Uniform 16(ub)
18(ubi): 17(ptr) Variable Uniform
19: TypePointer Uniform 7(fvec4)
22(bb): TypeStruct 7(fvec4)
23: TypePointer StorageBuffer 22(bb)
24(bbi): 23(ptr) Variable StorageBuffer
25: TypePointer StorageBuffer 7(fvec4)
29: TypePointer Output 7(fvec4)
4(main): 2 Function None 3
5: Label
20: 19(ptr) AccessChain 18(ubi) 15
21: 7(fvec4) Load 20
26: 25(ptr) AccessChain 24(bbi) 15
27: 7(fvec4) Load 26
28: 7(fvec4) FAdd 21 27
30: 29(ptr) AccessChain 13 15
Store 30 28
Return
FunctionEnd

View File

@ -1,6 +1,6 @@
syntaxError.frag
ERROR: 0:9: 'vec5' : undeclared identifier
ERROR: 0:9: '' : syntax error
ERROR: 0:9: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON
ERROR: 2 compilation errors. No code generated.

57
3rdparty/glslang/Test/hlsl.automap.frag vendored Normal file
View File

@ -0,0 +1,57 @@
// Test register class offsets for different resource types
SamplerState s1 : register(s1);
SamplerComparisonState s2 : register(s2);
Texture1D <float4> t1 : register(t1);
Texture2D <float4> t2 : register(t2);
Texture3D <float4> t3 : register(t3);
StructuredBuffer<float4> t4 : register(t4);
ByteAddressBuffer t5 : register(t5);
Buffer<float4> t6 : register(t6);
RWTexture1D <float4> u1 : register(u1);
RWTexture2D <float4> u2 : register(u2);
RWTexture3D <float4> u3 : register(u3);
RWBuffer <float> u4 : register(u4);
RWByteAddressBuffer u5 : register(u5);
RWStructuredBuffer<float> u6 : register(u6);
AppendStructuredBuffer<float> u7 : register(u7);
ConsumeStructuredBuffer<float> u8 : register(u8);
cbuffer cb : register(b1) {
int cb1;
};
tbuffer tb : register(t7) {
int tb1;
};
float4 main() : SV_Target0
{
t1;
t2;
t3;
t4[0];
t5.Load(0);
t6;
s1;
s2;
u1;
u2;
u3;
u4[0];
u5.Load(0);
u6[0];
u7;
u8;
cb1;
tb1;
return 0;
}

View File

@ -8,7 +8,14 @@ float4 vectorCond()
{
return (c4 ? t4 : f4) +
(c4 ? t : f ) +
(t4 < f4 ? t4 : f4);
(t4 < f4 ? t4 : f4) +
(c4 ? t : f4);
}
float4 scalarCond()
{
float4 ret = t != f ? t * f4 : 1;
return ret;
}
float2 fbSelect(bool2 cnd, float2 src0, float2 src1)
@ -30,6 +37,6 @@ float4 PixelShaderFunction(float4 input) : COLOR0
e = a = b ? c = d : 10, b = a ? d = c : 11;
float4 f;
f = ret.x < input.y ? c * input : d * input;
return e * ret + f + vectorCond() +
return e * ret + f + vectorCond() + scalarCond() +
float4(fbSelect(bool2(true, false), float2(1.0, 2.0), float2(3.0, 4.0)), 10.0, 10.0);
}

View File

@ -1,6 +1,9 @@
float4 PixelShaderFunction(float4 input) : COLOR0
float4 PixelShaderFunction(float input) : COLOR0
{
[unroll] do {} while (false);
[unroll] do {;} while (false);
do { return input; } while (all(input == input));
do { return (float4)input; } while (input > 2.0);
do ++input; while (input < 10.0);
do while (++input < 10.0); while (++input < 10.0); // nest while inside do-while
return (float4)input;
}

View File

@ -0,0 +1,12 @@
Texture2D g_shadowTex;
SamplerState g_shadowSampler;
SamplerComparisonState g_shadowSamplerComp;
float4 main() : SV_Target0
{
g_shadowTex.SampleCmp(g_shadowSamplerComp, float2(0,0), 0); // OK
g_shadowTex.SampleCmp(g_shadowSampler, float2(0,0), 0); // ERROR (should be comparison sampler)
return 0;
}

View File

@ -0,0 +1,10 @@
Texture2D g_shadowTex;
SamplerState g_shadowSampler;
float4 main() : SV_Target0
{
g_shadowTex.GatherCmpRed(g_shadowSampler, float2(0,0), 0, int2(0,0)); // ERROR (should be comparison sampler)
return 0;
}

View File

@ -30,5 +30,20 @@ float4 PixelShaderFunction(float4 input, float f) : COLOR0
const float4 f4 = 3.0;
uint ui;
uint3 ui3;
ui >> ui3;
ui3 >> ui;
v *= f1;
f1 *= v;
float3 mixed = u * v;
f = u;
f1 = u;
float sf = v;
float1 sf1 = v;
return input * f4;
}

View File

@ -0,0 +1,11 @@
AppendStructuredBuffer<float4> sbuf_a;
ConsumeStructuredBuffer<float4> sbuf_c;
AppendStructuredBuffer<float4> sbuf_unused;
float4 main(uint pos : FOO) : SV_Target0
{
sbuf_a.Append(float4(1,2,3,4));
return sbuf_c.Consume();
}

View File

@ -0,0 +1,19 @@
struct sb_t
{
float4 color;
uint2 threadId;
};
RWTexture2D<float4> outtx;
ConsumeStructuredBuffer<sb_t> csb : register(u1);
RWStructuredBuffer<float4> rwsb;
[numthreads(1, 1, 1)]
void main(uint3 nThreadId : SV_DispatchThreadID)
{
sb_t data = csb.Consume();
float2 coord = float2(data.threadId.xy);
outtx[coord] = data.color;
rwsb[coord.x] = rwsb.Load(coord.y);
}

View File

@ -0,0 +1,15 @@
ByteAddressBuffer g_input: register(t0);
RWBuffer<uint2> g_output : register(u1);
uint2 testLoad(uint loc, ByteAddressBuffer buffer)
{
uint2 result = buffer.Load2(loc);
return result;
}
[numthreads(256, 1, 1)]
void main(uint dispatchId : SV_DispatchThreadID)
{
uint2 result = testLoad(dispatchId, g_input);
g_output[dispatchId] = result;
}

View File

@ -0,0 +1,19 @@
RWStructuredBuffer<uint4> sbuf_rw_i;
RWStructuredBuffer<uint4> sbuf_rw_d;
RWStructuredBuffer<uint4> sbuf_rw_nocounter; // doesn't use inc or dec
float4 main(uint pos : FOO) : SV_Target0
{
uint4 result = 0;
sbuf_rw_i[7];
sbuf_rw_d[7];
sbuf_rw_nocounter[5] = 2;
uint c1 = sbuf_rw_i.IncrementCounter();
uint c2 = sbuf_rw_d.DecrementCounter();
return float4(result.x, result.y, c1, c2);
}

View File

@ -35,7 +35,8 @@ $EXE -D -e flizv -l -q -C -V hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.v
diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1
$EXE -D -e main -l -q -C -V hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out
diff -b $BASEDIR/hlsl.reflection.binding.frag.out $TARGETDIR/hlsl.reflection.binding.frag.out || HASERROR=1
$EXE -D -e main -l -q --hlsl-iomap --auto-map-bindings --stb 10 --sbb 20 --ssb 30 --suavb 40 --scb 50 -D -V -e main hlsl.automap.frag > $TARGETDIR/hlsl.automap.frag.out
diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASERROR=1
#
# multi-threaded test

View File

@ -0,0 +1,16 @@
#version 450
#pragma use_storage_buffer
uniform ub {
vec4 a;
} ubi;
buffer bb {
vec4 b;
} bbi;
void main()
{
gl_Position = ubi.a + bbi.b;
}

View File

@ -223,6 +223,13 @@ enum TBuiltInVariable {
EbvOutputPatch,
EbvInputPatch,
// structbuffer types
EbvAppendConsume, // no need to differentiate append and consume
EbvRWStructuredBuffer,
EbvStructuredBuffer,
EbvByteAddressBuffer,
EbvRWByteAddressBuffer,
EbvLast
};

View File

@ -633,6 +633,10 @@ enum TOperator {
EOpMethodStore2, // ...
EOpMethodStore3, // ...
EOpMethodStore4, // ...
EOpMethodIncrementCounter, // ...
EOpMethodDecrementCounter, // ...
// EOpMethodAppend is defined for geo shaders below
EOpMethodConsume,
// SM5 texture methods
EOpMethodGatherRed, // These are covered under the above EOpMethodSample comment about

View File

@ -130,8 +130,9 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
}
// Convert the children's type shape to be compatible.
right = addShapeConversion(op, left->getType(), right);
left = addShapeConversion(op, right->getType(), left);
addBiShapeConversion(op, left, right);
if (left == nullptr || right == nullptr)
return nullptr;
//
// Need a new node holding things together. Make
@ -238,7 +239,7 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
return nullptr;
// convert shape
right = addShapeConversion(op, left->getType(), right);
right = addUniShapeConversion(op, left->getType(), right);
// build the node
TIntermBinary* node = addBinaryNode(op, left, right, loc);
@ -788,7 +789,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
}
// Convert the node's shape of type for the given type, as allowed by the
// operation involved: 'op'.
// operation involved: 'op'. This is for situations where there is only one
// direction to consider doing the shape conversion.
//
// This implements policy, it call addShapeConversion() for the mechanism.
//
// Generally, the AST represents allowed GLSL shapes, so this isn't needed
// for GLSL. Bad shapes are caught in conversion or promotion.
@ -796,7 +800,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
// Return 'node' if no conversion was done. Promotion handles final shape
// checking.
//
TIntermTyped* TIntermediate::addShapeConversion(TOperator op, const TType& type, TIntermTyped* node)
TIntermTyped* TIntermediate::addUniShapeConversion(TOperator op, const TType& type, TIntermTyped* node)
{
// some source languages don't do this
switch (source) {
@ -809,23 +813,142 @@ TIntermTyped* TIntermediate::addShapeConversion(TOperator op, const TType& type,
// some operations don't do this
switch (op) {
case EOpFunctionCall:
case EOpReturn:
break;
case EOpMulAssign:
// want to support vector *= scalar native ops in AST and lower, not smear, similarly for
// matrix *= scalar, etc.
case EOpAddAssign:
case EOpSubAssign:
case EOpDivAssign:
case EOpAndAssign:
case EOpInclusiveOrAssign:
case EOpExclusiveOrAssign:
case EOpRightShiftAssign:
case EOpLeftShiftAssign:
if (node->getVectorSize() == 1)
return node;
break;
case EOpAssign:
break;
case EOpMix:
break;
default:
return node;
}
return addShapeConversion(type, node);
}
// Convert the nodes' shapes to be compatible for the operation 'op'.
//
// This implements policy, it call addShapeConversion() for the mechanism.
//
// Generally, the AST represents allowed GLSL shapes, so this isn't needed
// for GLSL. Bad shapes are caught in conversion or promotion.
//
void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode)
{
// some source languages don't do this
switch (source) {
case EShSourceHlsl:
break;
case EShSourceGlsl:
default:
return;
}
// some operations don't do this
// 'break' will mean attempt bidirectional conversion
switch (op) {
case EOpMulAssign:
case EOpAssign:
case EOpAddAssign:
case EOpSubAssign:
case EOpDivAssign:
case EOpAndAssign:
case EOpInclusiveOrAssign:
case EOpExclusiveOrAssign:
case EOpRightShiftAssign:
case EOpLeftShiftAssign:
// switch to unidirectional conversion (the lhs can't change)
rhsNode = addUniShapeConversion(op, lhsNode->getType(), rhsNode);
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.
if (lhsNode->getVectorSize() == 1 || rhsNode->getVectorSize() == 1)
return;
break;
case EOpRightShift:
case EOpLeftShift:
// can natively support the right operand being a scalar and the left a vector,
// but not the reverse
if (rhsNode->getVectorSize() == 1)
return;
break;
case EOpLessThan:
case EOpGreaterThan:
case EOpLessThanEqual:
case EOpGreaterThanEqual:
case EOpEqual:
case EOpNotEqual:
case EOpFunctionCall:
case EOpReturn:
case EOpLogicalAnd:
case EOpLogicalOr:
case EOpLogicalXor:
case EOpAnd:
case EOpInclusiveOr:
case EOpExclusiveOr:
case EOpMix:
break;
default:
return node;
return;
}
// Do bidirectional conversions
if (lhsNode->getType().isScalarOrVec1() || rhsNode->getType().isScalarOrVec1()) {
if (lhsNode->getType().isScalarOrVec1())
lhsNode = addShapeConversion(rhsNode->getType(), lhsNode);
else
rhsNode = addShapeConversion(lhsNode->getType(), rhsNode);
}
lhsNode = addShapeConversion(rhsNode->getType(), lhsNode);
rhsNode = addShapeConversion(lhsNode->getType(), rhsNode);
}
// Convert the node's shape of type for the given type. It's not necessarily
// an error if they are different and not converted, as some operations accept
// mixed types. Promotion will do final shape checking.
//
// If there is a chance of two nodes, with conversions possible in each direction,
// the policy for what to ask for must be in the caller; this will do what is asked.
//
// Return 'node' if no conversion was done. Promotion handles final shape
// checking.
//
TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped* node)
{
// no conversion needed
if (node->getType() == type)
return node;
// structures and arrays don't change shape, either to or from
if (node->getType().isStruct() || node->getType().isArray() ||
type.isStruct() || type.isArray())
@ -834,12 +957,12 @@ TIntermTyped* TIntermediate::addShapeConversion(TOperator op, const TType& type,
// The new node that handles the conversion
TOperator constructorOp = mapTypeToConstructorOp(type);
// scalar -> smeared -> vector, or
// vec1 -> scalar, or
// bigger vector -> smaller vector or scalar
if ((type.isVector() && node->getType().isScalar()) ||
(node->getType().isVector() && node->getVectorSize() == 1 && type.isScalar()) ||
(node->getVectorSize() > type.getVectorSize() && type.isVector()))
// scalar -> vector or vec1 -> vector or
// vector -> scalar or
// bigger vector -> smaller vector
if ((node->getType().isScalarOrVec1() && type.isVector()) ||
(node->getType().isVector() && type.isScalar()) ||
(node->isVector() && type.isVector() && node->getVectorSize() > type.getVectorSize()))
return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc());
return node;
@ -1304,19 +1427,17 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
return nullptr;
}
// After conversion, types have to match.
if (falseBlock->getType() != trueBlock->getType())
return nullptr;
// Handle a vector condition as a mix
if (!cond->getType().isScalarOrVec1()) {
TType targetVectorType(trueBlock->getType().getBasicType(), EvqTemporary,
cond->getType().getVectorSize());
// smear true/false operations if needed
if (trueBlock->getType().isScalarOrVec1())
trueBlock = addShapeConversion(EOpAssign, targetVectorType, trueBlock);
if (falseBlock->getType().isScalarOrVec1())
falseBlock = addShapeConversion(EOpAssign, targetVectorType, falseBlock);
// smear true/false operands as needed
trueBlock = addUniShapeConversion(EOpMix, targetVectorType, trueBlock);
falseBlock = addUniShapeConversion(EOpMix, targetVectorType, falseBlock);
// After conversion, types have to match.
if (falseBlock->getType() != trueBlock->getType())
return nullptr;
// make the mix operation
TIntermAggregate* mix = makeAggregate(loc);
@ -1331,6 +1452,13 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
// Now have a scalar condition...
// Convert true and false expressions to matching types
addBiShapeConversion(EOpMix, trueBlock, falseBlock);
// After conversion, types have to match.
if (falseBlock->getType() != trueBlock->getType())
return nullptr;
// Eliminate the selection when the condition is a scalar and all operands are constant.
if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
if (cond->getAsConstantUnion()->getConstArray()[0].getBConst())
@ -2139,8 +2267,6 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
case EOpLogicalXor:
return left->getType() == right->getType();
// no shifts: they can mix types (scalar int can shift a vector uint, etc.)
case EOpMod:
case EOpModAssign:
@ -2154,6 +2280,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
case EOpAdd:
case EOpSub:
case EOpDiv:
case EOpAddAssign:
case EOpSubAssign:
case EOpDivAssign:
@ -2178,7 +2305,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
return true;
// Finish handling the case, for all ops, where there are two vectors of different sizes
if (left->isVector() && right->isVector() && left->getVectorSize() != right->getVectorSize())
if (left->isVector() && right->isVector() && left->getVectorSize() != right->getVectorSize() && right->getVectorSize() > 1)
return false;
//

View File

@ -255,6 +255,10 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>&
error(loc, "\")\" expected to end 'debug' pragma", "#pragma", "");
return;
}
} else if (spvVersion.spv > 0 && tokens[0].compare("use_storage_buffer") == 0) {
if (tokens.size() != 1)
error(loc, "extra tokens", "#pragma", "");
intermediate.setUseStorageBuffer();
}
}

View File

@ -1555,12 +1555,24 @@ void TShader::setSourceEntryPoint(const char* name)
sourceEntryPointName = name;
}
// Set binding base for sampler types
void TShader::setShiftSamplerBinding(unsigned int base) { intermediate->setShiftSamplerBinding(base); }
// Set binding base for texture types (SRV)
void TShader::setShiftTextureBinding(unsigned int base) { intermediate->setShiftTextureBinding(base); }
// Set binding base for image types
void TShader::setShiftImageBinding(unsigned int base) { intermediate->setShiftImageBinding(base); }
// Set binding base for uniform buffer objects (CBV)
void TShader::setShiftUboBinding(unsigned int base) { intermediate->setShiftUboBinding(base); }
// Synonym for setShiftUboBinding, to match HLSL language.
void TShader::setShiftCbufferBinding(unsigned int base) { intermediate->setShiftUboBinding(base); }
// Set binding base for UAV (unordered access view)
void TShader::setShiftUavBinding(unsigned int base) { intermediate->setShiftUavBinding(base); }
// Set binding base for SSBOs
void TShader::setShiftSsboBinding(unsigned int base) { intermediate->setShiftSsboBinding(base); }
// Enables binding automapping using TIoMapper
void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); }
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }
void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
@ -1778,6 +1790,7 @@ const char* TProgram::getUniformBlockName(int index) const { return reflection
int TProgram::getUniformBlockSize(int index) const { return reflection->getUniformBlock(index).size; }
int TProgram::getUniformIndex(const char* name) const { return reflection->getIndex(name); }
int TProgram::getUniformBlockIndex(int index) const { return reflection->getUniform(index).index; }
int TProgram::getUniformBlockCounterIndex(int index) const { return reflection->getUniformBlock(index).counterIndex; }
int TProgram::getUniformType(int index) const { return reflection->getUniform(index).glDefineType; }
int TProgram::getUniformBufferOffset(int index) const { return reflection->getUniform(index).offset; }
int TProgram::getUniformArraySize(int index) const { return reflection->getUniform(index).size; }

View File

@ -63,6 +63,8 @@ using namespace glslang;
%}
%define parse.error verbose
%union {
struct {
glslang::TSourceLoc loc;

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 2.7. */
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,9 +30,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
/* Enabling traces. */
#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
@ -40,12 +40,11 @@
extern int yydebug;
#endif
/* Tokens. */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
enum yytokentype
{
ATTRIBUTE = 258,
VARYING = 259,
CONST = 260,
@ -334,12 +333,12 @@ extern int yydebug;
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
union YYSTYPE
{
/* Line 2058 of yacc.c */
#line 66 "glslang.y"
#line 68 "MachineIndependent/glslang.y" /* yacc.c:1909 */
struct {
glslang::TSourceLoc loc;
@ -373,28 +372,16 @@ typedef union YYSTYPE
};
} interm;
#line 376 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
};
/* Line 2058 of yacc.c */
#line 379 "glslang_tab.cpp.h"
} YYSTYPE;
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (glslang::TParseContext* pParseContext);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */
int yyparse (glslang::TParseContext* pParseContext);
#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */

View File

@ -1,5 +1,5 @@
//
// Copyright (C) 2016 LunarG, Inc.
// Copyright (C) 2016-2017 LunarG, Inc.
//
// All rights reserved.
//
@ -310,20 +310,15 @@ private:
TResolverInOutAdaptor& operator=(TResolverInOutAdaptor&);
};
/*
* Basic implementation of glslang::TIoMapResolver that replaces the
* previous offset behavior.
* It does the same, uses the offsets for the corresponding uniform
* types. Also respects the EOptionAutoMapBindings flag and binds
* them if needed.
*/
struct TDefaultIoResolver : public glslang::TIoMapResolver
// Base class for shared TIoMapResolver services, used by several derivations.
struct TDefaultIoResolverBase : public glslang::TIoMapResolver
{
int baseSamplerBinding;
int baseTextureBinding;
int baseImageBinding;
int baseUboBinding;
int baseSsboBinding;
int baseUavBinding;
bool doAutoMapping;
typedef std::vector<int> TSlotSet;
typedef std::unordered_map<int, TSlotSet> TSlotSetMap;
@ -360,83 +355,9 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
return reserveSlot(set, base);
}
bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
{
if (type.getQualifier().hasBinding()) {
int set;
if (type.getQualifier().hasSet())
set = type.getQualifier().layoutSet;
else
set = 0;
virtual bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override = 0;
if (type.getBasicType() == glslang::EbtSampler) {
const glslang::TSampler& sampler = type.getSampler();
if (sampler.isPureSampler())
return checkEmpty(set, baseSamplerBinding + type.getQualifier().layoutBinding);
if (sampler.isTexture())
return checkEmpty(set, baseTextureBinding + type.getQualifier().layoutBinding);
}
if (type.getQualifier().storage == EvqUniform)
return checkEmpty(set, baseUboBinding + type.getQualifier().layoutBinding);
if (type.getQualifier().storage == EvqBuffer)
return checkEmpty(set, baseSsboBinding + type.getQualifier().layoutBinding);
}
return true;
}
int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override
{
int set;
if (type.getQualifier().hasSet())
set = type.getQualifier().layoutSet;
else
set = 0;
if (type.getQualifier().hasBinding()) {
if (type.getBasicType() == glslang::EbtSampler) {
const glslang::TSampler& sampler = type.getSampler();
if (sampler.isImage())
return reserveSlot(set, baseImageBinding + type.getQualifier().layoutBinding);
if (sampler.isPureSampler())
return reserveSlot(set, baseSamplerBinding + type.getQualifier().layoutBinding);
if (sampler.isTexture())
return reserveSlot(set, baseTextureBinding + type.getQualifier().layoutBinding);
}
if (type.getQualifier().storage == EvqUniform)
return reserveSlot(set, baseUboBinding + type.getQualifier().layoutBinding);
if (type.getQualifier().storage == EvqBuffer)
return reserveSlot(set, baseSsboBinding + type.getQualifier().layoutBinding);
} else if (is_live && doAutoMapping) {
// find free slot, the caller did make sure it passes all vars with binding
// first and now all are passed that do not have a binding and needs one
if (type.getBasicType() == glslang::EbtSampler) {
const glslang::TSampler& sampler = type.getSampler();
if (sampler.isImage())
return getFreeSlot(set, baseImageBinding);
if (sampler.isPureSampler())
return getFreeSlot(set, baseSamplerBinding);
if (sampler.isTexture())
return getFreeSlot(set, baseTextureBinding);
}
if (type.getQualifier().storage == EvqUniform)
return getFreeSlot(set, baseUboBinding);
if (type.getQualifier().storage == EvqBuffer)
return getFreeSlot(set, baseSsboBinding);
}
return -1;
}
virtual int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override = 0;
int resolveSet(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
{
@ -461,8 +382,232 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
{
return -1;
}
protected:
static int getLayoutSet(const glslang::TType& type) {
if (type.getQualifier().hasSet())
return type.getQualifier().layoutSet;
else
return 0;
}
static bool isSamplerType(const glslang::TType& type) {
return type.getBasicType() == glslang::EbtSampler && type.getSampler().isPureSampler();
}
static bool isTextureType(const glslang::TType& type) {
return type.getBasicType() == glslang::EbtSampler && type.getSampler().isTexture();
}
static bool isUboType(const glslang::TType& type) {
return type.getQualifier().storage == EvqUniform;
}
};
/*
* Basic implementation of glslang::TIoMapResolver that replaces the
* previous offset behavior.
* It does the same, uses the offsets for the corresponding uniform
* types. Also respects the EOptionAutoMapBindings flag and binds
* them if needed.
*/
/*
* Default resolver
*/
struct TDefaultIoResolver : public TDefaultIoResolverBase
{
bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
{
if (type.getQualifier().hasBinding()) {
const int set = getLayoutSet(type);
if (isImageType(type))
return checkEmpty(set, baseImageBinding + type.getQualifier().layoutBinding);
if (isTextureType(type))
return checkEmpty(set, baseTextureBinding + type.getQualifier().layoutBinding);
if (isSsboType(type))
return checkEmpty(set, baseSsboBinding + type.getQualifier().layoutBinding);
if (isSamplerType(type))
return checkEmpty(set, baseSamplerBinding + type.getQualifier().layoutBinding);
if (isUboType(type))
return checkEmpty(set, baseUboBinding + type.getQualifier().layoutBinding);
}
return true;
}
int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override
{
const int set = getLayoutSet(type);
if (type.getQualifier().hasBinding()) {
if (isImageType(type))
return reserveSlot(set, baseImageBinding + type.getQualifier().layoutBinding);
if (isTextureType(type))
return reserveSlot(set, baseTextureBinding + type.getQualifier().layoutBinding);
if (isSsboType(type))
return reserveSlot(set, baseSsboBinding + type.getQualifier().layoutBinding);
if (isSamplerType(type))
return reserveSlot(set, baseSamplerBinding + type.getQualifier().layoutBinding);
if (isUboType(type))
return reserveSlot(set, baseUboBinding + type.getQualifier().layoutBinding);
} else if (is_live && doAutoMapping) {
// find free slot, the caller did make sure it passes all vars with binding
// first and now all are passed that do not have a binding and needs one
if (isImageType(type))
return getFreeSlot(set, baseImageBinding);
if (isTextureType(type))
return getFreeSlot(set, baseTextureBinding);
if (isSsboType(type))
return getFreeSlot(set, baseSsboBinding);
if (isSamplerType(type))
return getFreeSlot(set, baseSamplerBinding);
if (isUboType(type))
return getFreeSlot(set, baseUboBinding);
}
return -1;
}
protected:
static bool isImageType(const glslang::TType& type) {
return type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage();
}
static bool isSsboType(const glslang::TType& type) {
return type.getQualifier().storage == EvqBuffer;
}
};
/********************************************************************************
The following IO resolver maps types in HLSL register space, as follows:
t for shader resource views (SRV)
TEXTURE1D
TEXTURE1DARRAY
TEXTURE2D
TEXTURE2DARRAY
TEXTURE3D
TEXTURECUBE
TEXTURECUBEARRAY
TEXTURE2DMS
TEXTURE2DMSARRAY
STRUCTUREDBUFFER
BYTEADDRESSBUFFER
BUFFER
TBUFFER
s for samplers
SAMPLER
SAMPLER1D
SAMPLER2D
SAMPLER3D
SAMPLERCUBE
SAMPLERSTATE
SAMPLERCOMPARISONSTATE
u for unordered access views (UAV)
RWBYTEADDRESSBUFFER
RWSTRUCTUREDBUFFER
APPENDSTRUCTUREDBUFFER
CONSUMESTRUCTUREDBUFFER
RWBUFFER
RWTEXTURE1D
RWTEXTURE1DARRAY
RWTEXTURE2D
RWTEXTURE2DARRAY
RWTEXTURE3D
b for constant buffer views (CBV)
CBUFFER
********************************************************************************/
struct TDefaultHlslIoResolver : public TDefaultIoResolverBase
{
bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
{
if (type.getQualifier().hasBinding()) {
const int set = getLayoutSet(type);
if (isUavType(type))
return checkEmpty(set, baseUavBinding + type.getQualifier().layoutBinding);
if (isSrvType(type))
return checkEmpty(set, baseTextureBinding + type.getQualifier().layoutBinding);
if (isSamplerType(type))
return checkEmpty(set, baseSamplerBinding + type.getQualifier().layoutBinding);
if (isUboType(type))
return checkEmpty(set, baseUboBinding + type.getQualifier().layoutBinding);
}
return true;
}
int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override
{
const int set = getLayoutSet(type);
if (type.getQualifier().hasBinding()) {
if (isUavType(type))
return reserveSlot(set, baseUavBinding + type.getQualifier().layoutBinding);
if (isSrvType(type))
return reserveSlot(set, baseTextureBinding + type.getQualifier().layoutBinding);
if (isSamplerType(type))
return reserveSlot(set, baseSamplerBinding + type.getQualifier().layoutBinding);
if (isUboType(type))
return reserveSlot(set, baseUboBinding + type.getQualifier().layoutBinding);
} else if (is_live && doAutoMapping) {
// find free slot, the caller did make sure it passes all vars with binding
// first and now all are passed that do not have a binding and needs one
if (isUavType(type))
return getFreeSlot(set, baseUavBinding);
if (isSrvType(type))
return getFreeSlot(set, baseTextureBinding);
if (isSamplerType(type))
return getFreeSlot(set, baseSamplerBinding);
if (isUboType(type))
return getFreeSlot(set, baseUboBinding);
}
return -1;
}
protected:
// Return true if this is a SRV (shader resource view) type:
static bool isSrvType(const glslang::TType& type) {
return isTextureType(type) || type.getQualifier().storage == EvqBuffer;
}
// Return true if this is a UAV (unordered access view) type:
static bool isUavType(const glslang::TType& type) {
if (type.getQualifier().readonly)
return false;
return (type.getBasicType() == glslang::EbtSampler && type.getSampler().isImage()) ||
(type.getQualifier().storage == EvqBuffer);
}
};
// Map I/O variables to provided offsets, and make bindings for
// unbound but live variables.
//
@ -475,6 +620,7 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
intermediate.getShiftImageBinding() == 0 &&
intermediate.getShiftUboBinding() == 0 &&
intermediate.getShiftSsboBinding() == 0 &&
intermediate.getShiftUavBinding() == 0 &&
intermediate.getAutoMapBindings() == false &&
resolver == nullptr)
return true;
@ -488,15 +634,26 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
// if no resolver is provided, use the default resolver with the given shifts and auto map settings
TDefaultIoResolver defaultResolver;
if (resolver == nullptr) {
defaultResolver.baseSamplerBinding = intermediate.getShiftSamplerBinding();
defaultResolver.baseTextureBinding = intermediate.getShiftTextureBinding();
defaultResolver.baseImageBinding = intermediate.getShiftImageBinding();
defaultResolver.baseUboBinding = intermediate.getShiftUboBinding();
defaultResolver.baseSsboBinding = intermediate.getShiftSsboBinding();
defaultResolver.doAutoMapping = intermediate.getAutoMapBindings();
TDefaultHlslIoResolver defaultHlslResolver;
resolver = &defaultResolver;
if (resolver == nullptr) {
TDefaultIoResolverBase* resolverBase;
// TODO: use a passed in IO mapper for this
if (intermediate.usingHlslIoMapping())
resolverBase = &defaultHlslResolver;
else
resolverBase = &defaultResolver;
resolverBase->baseSamplerBinding = intermediate.getShiftSamplerBinding();
resolverBase->baseTextureBinding = intermediate.getShiftTextureBinding();
resolverBase->baseImageBinding = intermediate.getShiftImageBinding();
resolverBase->baseUboBinding = intermediate.getShiftUboBinding();
resolverBase->baseSsboBinding = intermediate.getShiftSsboBinding();
resolverBase->baseUavBinding = intermediate.getShiftUavBinding();
resolverBase->doAutoMapping = intermediate.getAutoMapBindings();
resolver = resolverBase;
}
TVarLiveMap inVarMap, outVarMap, uniformVarMap;

View File

@ -175,10 +175,13 @@ public:
shiftImageBinding(0),
shiftUboBinding(0),
shiftSsboBinding(0),
shiftUavBinding(0),
autoMapBindings(false),
flattenUniformArrays(false),
useUnknownFormat(false),
hlslOffsets(false)
hlslOffsets(false),
useStorageBuffer(false),
hlslIoMapping(false)
{
localSize[0] = 1;
localSize[1] = 1;
@ -211,6 +214,8 @@ public:
unsigned int getShiftUboBinding() const { return shiftUboBinding; }
void setShiftSsboBinding(unsigned int shift) { shiftSsboBinding = shift; }
unsigned int getShiftSsboBinding() const { return shiftSsboBinding; }
void setShiftUavBinding(unsigned int shift) { shiftUavBinding = shift; }
unsigned int getShiftUavBinding() const { return shiftUavBinding; }
void setAutoMapBindings(bool map) { autoMapBindings = map; }
bool getAutoMapBindings() const { return autoMapBindings; }
void setFlattenUniformArrays(bool flatten) { flattenUniformArrays = flatten; }
@ -219,6 +224,10 @@ public:
bool getNoStorageFormat() const { return useUnknownFormat; }
void setHlslOffsets() { hlslOffsets = true; }
bool usingHlslOFfsets() const { return hlslOffsets; }
void setUseStorageBuffer() { useStorageBuffer = true; }
bool usingStorageBuffer() const { return useStorageBuffer; }
void setHlslIoMapping(bool b) { hlslIoMapping = b; }
bool usingHlslIoMapping() { return hlslIoMapping; }
void setVersion(int v) { version = v; }
int getVersion() const { return version; }
@ -243,7 +252,9 @@ public:
TIntermSymbol* addSymbol(const TType&, const TSourceLoc&);
TIntermSymbol* addSymbol(const TIntermSymbol&);
TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*) const;
TIntermTyped* addShapeConversion(TOperator, const TType&, TIntermTyped*);
TIntermTyped* addUniShapeConversion(TOperator, const TType&, TIntermTyped*);
void addBiShapeConversion(TOperator, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode);
TIntermTyped* addShapeConversion(const TType&, TIntermTyped*);
TIntermTyped* addBinaryMath(TOperator, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc);
@ -500,10 +511,13 @@ protected:
unsigned int shiftImageBinding;
unsigned int shiftUboBinding;
unsigned int shiftSsboBinding;
unsigned int shiftUavBinding;
bool autoMapBindings;
bool flattenUniformArrays;
bool useUnknownFormat;
bool hlslOffsets;
bool useStorageBuffer;
bool hlslIoMapping;
typedef std::list<TCall> TGraph;
TGraph callGraph;

View File

@ -707,6 +707,19 @@ void TReflection::buildAttributeReflection(EShLanguage stage, const TIntermediat
}
}
// build counter block index associations for buffers
void TReflection::buildCounterIndices()
{
// search for ones that have counters
for (int i = 0; i < int(indexToUniformBlock.size()); ++i) {
const TString counterName(indexToUniformBlock[i].name + "@count");
const int index = getIndex(counterName);
if (index >= 0)
indexToUniformBlock[i].counterIndex = index;
}
}
// Merge live symbols from 'intermediate' into the existing reflection database.
//
// Returns false if the input is too malformed to do this.
@ -729,6 +742,8 @@ bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate)
function->traverse(&it);
}
buildCounterIndices();
return true;
}

View File

@ -57,11 +57,16 @@ class TObjectReflection {
public:
TObjectReflection(const TString& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex) :
name(pName), offset(pOffset),
glDefineType(pGLDefineType), size(pSize), index(pIndex), type(pType.clone()) { }
glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1), type(pType.clone()) { }
void dump() const {
printf("%s: offset %d, type %x, size %d, index %d, binding %d\n",
printf("%s: offset %d, type %x, size %d, index %d, binding %d",
name.c_str(), offset, glDefineType, size, index, getBinding() );
if (counterIndex != -1)
printf(", counter %d", counterIndex);
printf("\n");
}
const TType* const getType() const { return type; }
@ -71,6 +76,7 @@ public:
int glDefineType;
int size; // data size in bytes for a block, array size for a (non-block) object that's an array
int index;
int counterIndex;
static TObjectReflection badReflection() { return TObjectReflection(); }
@ -140,6 +146,9 @@ public:
return it->second;
}
// see getIndex(const char*)
int getIndex(const TString& name) const { return getIndex(name.c_str()); }
// Thread local size
unsigned getLocalSize(int dim) const { return dim <= 2 ? localSize[dim] : 0; }
@ -148,6 +157,7 @@ public:
protected:
friend class glslang::TReflectionTraverser;
void buildCounterIndices();
void buildAttributeReflection(EShLanguage, const TIntermediate&);
// Need a TString hash: typedef std::unordered_map<TString, int> TNameToIndex;

View File

@ -303,8 +303,11 @@ public:
void setShiftTextureBinding(unsigned int base);
void setShiftImageBinding(unsigned int base);
void setShiftUboBinding(unsigned int base);
void setShiftUavBinding(unsigned int base);
void setShiftCbufferBinding(unsigned int base); // synonym for setShiftUboBinding
void setShiftSsboBinding(unsigned int base);
void setAutoMapBindings(bool map);
void setHlslIoMapping(bool hlslIoMap);
void setFlattenUniformArrays(bool flatten);
void setNoStorageFormat(bool useUnknownFormat);
@ -518,6 +521,7 @@ public:
int getUniformBlockSize(int blockIndex) const; // can be used for glGetActiveUniformBlockiv(UNIFORM_BLOCK_DATA_SIZE)
int getUniformIndex(const char* name) const; // can be used for glGetUniformIndices()
int getUniformBlockIndex(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_BLOCK_INDEX)
int getUniformBlockCounterIndex(int index) const; // returns block index of associated counter.
int getUniformType(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_TYPE)
int getUniformBufferOffset(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_OFFSET)
int getUniformArraySize(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_SIZE)

View File

@ -212,6 +212,8 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.samplecmp.basic.dx10.frag", "main"},
{"hlsl.samplecmp.offset.dx10.frag", "main"},
{"hlsl.samplecmp.offsetarray.dx10.frag", "main"},
{"hlsl.samplecmp.negative.frag", "main"},
{"hlsl.samplecmp.negative2.frag", "main"},
{"hlsl.samplecmplevelzero.array.dx10.frag", "main"},
{"hlsl.samplecmplevelzero.basic.dx10.frag", "main"},
{"hlsl.samplecmplevelzero.offset.dx10.frag", "main"},
@ -245,10 +247,14 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.structarray.flatten.frag", "main"},
{"hlsl.structarray.flatten.geom", "main"},
{"hlsl.structbuffer.frag", "main"},
{"hlsl.structbuffer.append.frag", "main"},
{"hlsl.structbuffer.atomics.frag", "main"},
{"hlsl.structbuffer.byte.frag", "main"},
{"hlsl.structbuffer.coherent.frag", "main"},
{"hlsl.structbuffer.floatidx.comp", "main"},
{"hlsl.structbuffer.incdec.frag", "main"},
{"hlsl.structbuffer.fn.frag", "main"},
{"hlsl.structbuffer.fn2.comp", "main"},
{"hlsl.structbuffer.rw.frag", "main"},
{"hlsl.structbuffer.rwbyte.frag", "main"},
{"hlsl.structin.vert", "main"},

View File

@ -303,6 +303,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.specConstant.comp",
"spv.specConstantComposite.vert",
"spv.specConstantOperations.vert",
"spv.storageBuffer.vert",
"spv.precise.tese",
"spv.precise.tesc",
})),

View File

@ -475,9 +475,10 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
if (variableType.getBasicType() != EbtString && parseContext.getAnnotationNestingLevel() == 0) {
if (typedefDecl)
parseContext.declareTypedef(idToken.loc, *fullName, variableType);
else if (variableType.getBasicType() == EbtBlock)
else if (variableType.getBasicType() == EbtBlock) {
parseContext.declareBlock(idToken.loc, variableType, fullName);
else {
parseContext.declareStructBufferCounter(idToken.loc, variableType, *fullName);
} else {
if (variableType.getQualifier().storage == EvqUniform && ! variableType.containsOpaque()) {
// this isn't really an individual variable, but a member of the $Global buffer
parseContext.growGlobalUniformBlock(idToken.loc, variableType, *fullName);
@ -1845,13 +1846,16 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
// This storage qualifier will tell us whether it's an AST
// block type or just a generic structure type.
TStorageQualifier storageQualifier = EvqTemporary;
bool readonly = false;
// CBUFFER
if (acceptTokenClass(EHTokCBuffer))
if (acceptTokenClass(EHTokCBuffer)) {
storageQualifier = EvqUniform;
// TBUFFER
else if (acceptTokenClass(EHTokTBuffer))
} else if (acceptTokenClass(EHTokTBuffer)) {
storageQualifier = EvqBuffer;
readonly = true;
}
// CLASS
// STRUCT
else if (! acceptTokenClass(EHTokClass) && ! acceptTokenClass(EHTokStruct))
@ -1907,6 +1911,7 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
new(&type) TType(typeList, structName);
else {
postDeclQualifier.storage = storageQualifier;
postDeclQualifier.readonly = readonly;
new(&type) TType(typeList, structName, postDeclQualifier); // sets EbtBlock
}
@ -1955,24 +1960,29 @@ bool HlslGrammar::acceptStructBufferType(TType& type)
bool readonly = false;
TStorageQualifier storage = EvqBuffer;
TBuiltInVariable builtinType = EbvNone;
switch (structBuffType) {
case EHTokAppendStructuredBuffer:
unimplemented("AppendStructuredBuffer");
return false;
builtinType = EbvAppendConsume;
break;
case EHTokByteAddressBuffer:
hasTemplateType = false;
readonly = true;
builtinType = EbvByteAddressBuffer;
break;
case EHTokConsumeStructuredBuffer:
unimplemented("ConsumeStructuredBuffer");
return false;
builtinType = EbvAppendConsume;
break;
case EHTokRWByteAddressBuffer:
hasTemplateType = false;
builtinType = EbvRWByteAddressBuffer;
break;
case EHTokRWStructuredBuffer:
builtinType = EbvRWStructuredBuffer;
break;
case EHTokStructuredBuffer:
builtinType = EbvStructuredBuffer;
readonly = true;
break;
default:
@ -2014,8 +2024,6 @@ bool HlslGrammar::acceptStructBufferType(TType& type)
// field name is canonical for all structbuffers
templateType->setFieldName("@data");
// Create block type. TODO: hidden internal uint member when needed
TTypeList* blockStruct = new TTypeList;
TTypeLoc member = { templateType, token.loc };
blockStruct->push_back(member);
@ -2025,6 +2033,7 @@ bool HlslGrammar::acceptStructBufferType(TType& type)
blockType.getQualifier().storage = storage;
blockType.getQualifier().readonly = readonly;
blockType.getQualifier().builtIn = builtinType;
// We may have created an equivalent type before, in which case we should use its
// deep structure.
@ -2926,11 +2935,16 @@ bool HlslGrammar::acceptArguments(TFunction* function, TIntermTyped*& arguments)
if (! acceptTokenClass(EHTokLeftParen))
return false;
// RIGHT_PAREN
if (acceptTokenClass(EHTokRightParen))
return true;
// must now be at least one expression...
do {
// expression
TIntermTyped* arg;
if (! acceptAssignmentExpression(arg))
break;
return false;
// hook it up
parseContext.handleFunctionArgument(function, arguments, arg);
@ -3318,18 +3332,12 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement)
case EHTokDo:
parseContext.nestLooping();
if (! acceptTokenClass(EHTokLeftBrace))
expected("{");
// statement
if (! peekTokenClass(EHTokRightBrace) && ! acceptScopedStatement(statement)) {
if (! acceptScopedStatement(statement)) {
expected("do sub-statement");
return false;
}
if (! acceptTokenClass(EHTokRightBrace))
expected("}");
// WHILE
if (! acceptTokenClass(EHTokWhile)) {
expected("while");

View File

@ -712,28 +712,39 @@ TIntermTyped* HlslParseContext::handleBracketOperator(const TSourceLoc& loc, TIn
return nullptr;
}
//
// Cast index value to a uint if it isn't already (for operator[], load indexes, etc)
TIntermTyped* HlslParseContext::makeIntegerIndex(TIntermTyped* index)
{
const TBasicType indexBasicType = index->getType().getBasicType();
const int vecSize = index->getType().getVectorSize();
// We can use int types directly as the index
if (indexBasicType == EbtInt || indexBasicType == EbtUint ||
indexBasicType == EbtInt64 || indexBasicType == EbtUint64)
return index;
// Cast index to unsigned integer if it isn't one.
return intermediate.addConversion(EOpConstructUint, TType(EbtUint, EvqTemporary, vecSize), index);
}
//
// Handle seeing a base[index] dereference in the grammar.
//
TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc, TIntermTyped* base, TIntermTyped* index)
{
TIntermTyped* result = handleBracketOperator(loc, base, index);
if (result != nullptr)
return result; // it was handled as an operator[]
const TBasicType indexBasicType = index->getType().getBasicType();
// Cast index to unsigned integer if it isn't one.
if (indexBasicType != EbtInt && indexBasicType != EbtUint &&
indexBasicType != EbtInt64 && indexBasicType != EbtUint64)
index = intermediate.addConversion(EOpConstructUint, TType(EbtUint), index);
index = makeIntegerIndex(index);
if (index == nullptr) {
error(loc, " unknown undex type ", "", "");
return nullptr;
}
TIntermTyped* result = handleBracketOperator(loc, base, index);
if (result != nullptr)
return result; // it was handled as an operator[]
bool flattened = false;
int indexValue = 0;
if (index->getQualifier().storage == EvqConst) {
@ -842,7 +853,11 @@ bool HlslParseContext::isStructBufferMethod(const TString& name) const
name == "InterlockedMax" ||
name == "InterlockedMin" ||
name == "InterlockedOr" ||
name == "InterlockedXor";
name == "InterlockedXor" ||
name == "IncrementCounter" ||
name == "DecrementCounter" ||
name == "Append" ||
name == "Consume";
}
//
@ -1514,7 +1529,7 @@ void HlslParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunction
error(loc, "function name is redeclaration of existing name", function.getName().c_str(), "");
}
// Add interstage IO variables to the linkage in canonical order.
// Finalization step: Add interstage IO variables to the linkage in canonical order.
void HlslParseContext::addInterstageIoToLinkage()
{
TSourceLoc loc;
@ -1608,6 +1623,8 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
paramNodes = intermediate.growAggregate(paramNodes,
intermediate.addSymbol(*variable, loc),
loc);
// TODO: for struct buffers with counters, pass counter buffer as hidden parameter
} else
paramNodes = intermediate.growAggregate(paramNodes, intermediate.addSymbol(*param.type, loc), loc);
}
@ -2087,7 +2104,7 @@ TIntermNode* HlslParseContext::handleReturnValue(const TSourceLoc& loc, TIntermT
} else if (*currentFunctionType != value->getType()) {
value = intermediate.addConversion(EOpReturn, *currentFunctionType, value);
if (value && *currentFunctionType != value->getType())
value = intermediate.addShapeConversion(EOpReturn, *currentFunctionType, value);
value = intermediate.addUniShapeConversion(EOpReturn, *currentFunctionType, value);
if (value == nullptr) {
error(loc, "type does not match, or is not convertible to, the function's return type", "return", "");
return value;
@ -2438,24 +2455,119 @@ TIntermAggregate* HlslParseContext::handleSamplerTextureCombine(const TSourceLoc
return txcombine;
}
// Return true if this a buffer type that has an associated counter buffer.
bool HlslParseContext::hasStructBuffCounter(const TString& name) const
{
const auto bivIt = structBufferBuiltIn.find(name);
if (bivIt == structBufferBuiltIn.end())
return false;
switch (bivIt->second) {
case EbvAppendConsume: // fall through...
case EbvRWStructuredBuffer: // ...
return true;
default:
return false; // the other structuredbfufer types do not have a counter.
}
}
// declare counter for a structured buffer type
void HlslParseContext::declareStructBufferCounter(const TSourceLoc& loc, const TType& bufferType, const TString& name)
{
// Bail out if not a struct buffer
if (! isStructBufferType(bufferType))
return;
if (! hasStructBuffCounter(name))
return;
// Counter type
TType* counterType = new TType(EbtInt, EvqBuffer);
counterType->setFieldName("@count");
TTypeList* blockStruct = new TTypeList;
TTypeLoc member = { counterType, loc };
blockStruct->push_back(member);
TString* blockName = new TString(name);
*blockName += "@count";
structBufferCounter[*blockName] = false;
TType blockType(blockStruct, "", counterType->getQualifier());
blockType.getQualifier().storage = EvqBuffer;
shareStructBufferType(blockType);
declareBlock(loc, blockType, blockName);
}
// return the counter that goes with a given structuredbuffer
TIntermTyped* HlslParseContext::getStructBufferCounter(const TSourceLoc& loc, TIntermTyped* buffer)
{
// Bail out if not a struct buffer
if (buffer == nullptr || ! isStructBufferType(buffer->getType()))
return nullptr;
TString blockName(buffer->getAsSymbolNode()->getName());
blockName += "@count";
// Mark the counter as being used
structBufferCounter[blockName] = true;
TIntermTyped* counterVar = handleVariable(loc, &blockName); // find the block structure
TIntermTyped* index = intermediate.addConstantUnion(0, loc); // index to counter inside block struct
TIntermTyped* counterMember = intermediate.addIndex(EOpIndexDirectStruct, counterVar, index, loc);
counterMember->setType(TType(EbtInt));
return counterMember;
}
//
// Decompose structure buffer methods into AST
//
void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TIntermTyped*& node, TIntermNode* arguments)
{
if (!node || !node->getAsOperator())
if (node == nullptr || node->getAsOperator() == nullptr || arguments == nullptr)
return;
const TOperator op = node->getAsOperator()->getOp();
TIntermAggregate* argAggregate = arguments ? arguments->getAsAggregate() : nullptr;
if (argAggregate == nullptr)
return;
if (argAggregate->getSequence().empty())
return;
TIntermAggregate* argAggregate = arguments->getAsAggregate();
// Buffer is the object upon which method is called, so always arg 0
TIntermTyped* bufferObj = argAggregate->getSequence()[0]->getAsTyped();
TIntermTyped* bufferObj = nullptr;
// The parameters can be an aggregate, or just a the object as a symbol if there are no fn params.
if (argAggregate) {
if (argAggregate->getSequence().empty())
return;
bufferObj = argAggregate->getSequence()[0]->getAsTyped();
} else {
bufferObj = arguments->getAsSymbolNode();
}
if (bufferObj == nullptr || bufferObj->getAsSymbolNode() == nullptr)
return;
const TString bufferName(bufferObj->getAsSymbolNode()->getName());
// Some methods require a hidden internal counter, obtained via getStructBufferCounter().
// This lambda adds something to it and returns the old value.
const auto incDecCounter = [&](int incval) -> TIntermTyped* {
TIntermTyped* incrementValue = intermediate.addConstantUnion(incval, loc, true);
TIntermTyped* counter = getStructBufferCounter(loc, bufferObj); // obtain the counter member
if (counter == nullptr)
return nullptr;
TIntermAggregate* counterIncrement = new TIntermAggregate(EOpAtomicAdd);
counterIncrement->setType(TType(EbtUint, EvqTemporary));
counterIncrement->setLoc(loc);
counterIncrement->getSequence().push_back(counter);
counterIncrement->getSequence().push_back(incrementValue);
return counterIncrement;
};
// Index to obtain the runtime sized array out of the buffer.
TIntermTyped* argArray = indexStructBufferContent(loc, bufferObj);
@ -2465,11 +2577,24 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
switch (op) {
case EOpMethodLoad:
{
TIntermTyped* argIndex = argAggregate->getSequence()[1]->getAsTyped(); // index
TIntermTyped* argIndex = makeIntegerIndex(argAggregate->getSequence()[1]->getAsTyped()); // index
const auto bivIt = structBufferBuiltIn.find(bufferName);
const TBuiltInVariable builtInType = (bivIt != structBufferBuiltIn.end()) ? bivIt->second : EbvNone;
const TType& bufferType = bufferObj->getType();
// Byte address buffers index in bytes (only multiples of 4 permitted... not so much a byte address
// buffer then, but that's what it calls itself.
const bool isByteAddressBuffer = (argArray->getBasicType() == EbtUint);
// TODO: it would be easier to track the declared (pre-sanitized) builtInType in the TType.
// If/when that happens, this should be simplified to look *only* at the builtin type.
const bool isByteAddressBuffer = (builtInType == EbvByteAddressBuffer ||
builtInType == EbvRWByteAddressBuffer ||
(builtInType == EbvNone && !bufferType.isVector() &&
bufferType.getBasicType() == EbtUint));
if (isByteAddressBuffer)
argIndex = intermediate.addBinaryNode(EOpRightShift, argIndex, intermediate.addConstantUnion(2, loc, true),
loc, TType(EbtInt));
@ -2489,7 +2614,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
case EOpMethodLoad3:
case EOpMethodLoad4:
{
TIntermTyped* argIndex = argAggregate->getSequence()[1]->getAsTyped(); // index
TIntermTyped* argIndex = makeIntegerIndex(argAggregate->getSequence()[1]->getAsTyped()); // index
TOperator constructOp = EOpNull;
int size = 0;
@ -2547,7 +2672,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
case EOpMethodStore3:
case EOpMethodStore4:
{
TIntermTyped* argIndex = argAggregate->getSequence()[1]->getAsTyped(); // address
TIntermTyped* argIndex = makeIntegerIndex(argAggregate->getSequence()[1]->getAsTyped()); // index
TIntermTyped* argValue = argAggregate->getSequence()[2]->getAsTyped(); // value
// Index into the array to find the item being loaded.
@ -2654,7 +2779,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
TIntermSequence& sequence = argAggregate->getSequence();
TIntermTyped* argIndex = sequence[1]->getAsTyped(); // index
TIntermTyped* argIndex = makeIntegerIndex(sequence[1]->getAsTyped()); // index
argIndex = intermediate.addBinaryNode(EOpRightShift, argIndex, intermediate.addConstantUnion(2, loc, true),
loc, TType(EbtInt));
@ -2670,6 +2795,50 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
}
break;
case EOpMethodIncrementCounter:
{
node = incDecCounter(1);
break;
}
case EOpMethodDecrementCounter:
{
TIntermTyped* preIncValue = incDecCounter(-1); // result is original value
node = intermediate.addBinaryNode(EOpAdd, preIncValue, intermediate.addConstantUnion(-1, loc, true), loc,
preIncValue->getType());
break;
}
case EOpMethodAppend:
{
TIntermTyped* oldCounter = incDecCounter(1);
TIntermTyped* lValue = intermediate.addIndex(EOpIndexIndirect, argArray, oldCounter, loc);
TIntermTyped* rValue = argAggregate->getSequence()[1]->getAsTyped();
const TType derefType(argArray->getType(), 0);
lValue->setType(derefType);
node = intermediate.addAssign(EOpAssign, lValue, rValue, loc);
break;
}
case EOpMethodConsume:
{
TIntermTyped* oldCounter = incDecCounter(-1);
TIntermTyped* newCounter = intermediate.addBinaryNode(EOpAdd, oldCounter, intermediate.addConstantUnion(-1, loc, true), loc,
oldCounter->getType());
node = intermediate.addIndex(EOpIndexIndirect, argArray, newCounter, loc);
const TType derefType(argArray->getType(), 0);
node->setType(derefType);
break;
}
default:
break; // most pass through unchanged
}
@ -2975,6 +3144,18 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
TIntermTyped* argCmpVal = argAggregate->getSequence()[3]->getAsTyped();
TIntermTyped* argOffset = nullptr;
// Sampler argument should be a sampler.
if (argSamp->getType().getBasicType() != EbtSampler) {
error(loc, "expected: sampler type", "", "");
return;
}
// Sampler should be a SamplerComparisonState
if (! argSamp->getType().getSampler().isShadow()) {
error(loc, "expected: SamplerComparisonState", "", "");
return;
}
// optional offset value
if (argAggregate->getSequence().size() > 4)
argOffset = argAggregate->getSequence()[4]->getAsTyped();
@ -3212,6 +3393,18 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
bool hasOffset1 = false;
bool hasOffset4 = false;
// Sampler argument should be a sampler.
if (argSamp->getType().getBasicType() != EbtSampler) {
error(loc, "expected: sampler type", "", "");
return;
}
// Cmp forms require SamplerComparisonState
if (cmpValues > 0 && ! argSamp->getType().getSampler().isShadow()) {
error(loc, "expected: SamplerComparisonState", "", "");
return;
}
// Only 2D forms can have offsets. Discover if we have 0, 1 or 4 offsets.
if (dim == Esd2D) {
hasOffset1 = (argSize == (4+cmpValues) || argSize == (5+cmpValues));
@ -3978,10 +4171,20 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
// TODO: this needs improvement: there's no way at present to look up a signature in
// the symbol table for an arbitrary type. This is a temporary hack until that ability exists.
// It will have false positives, since it doesn't check arg counts or types.
if (arguments && arguments->getAsAggregate()) {
const TIntermSequence& sequence = arguments->getAsAggregate()->getSequence();
if (arguments) {
// Check if first argument is struct buffer type. It may be an aggregate or a symbol, so we
// look for either case.
TIntermTyped* arg0 = nullptr;
if (arguments->getAsAggregate() && arguments->getAsAggregate()->getSequence().size() > 0)
arg0 = arguments->getAsAggregate()->getSequence()[0]->getAsTyped();
else if (arguments->getAsSymbolNode())
arg0 = arguments->getAsSymbolNode();
if (arg0 != nullptr && isStructBufferType(arg0->getType())) {
// TODO: for struct buffers with counters, pass counter buffer as hidden parameter
if (!sequence.empty() && isStructBufferType(sequence[0]->getAsTyped()->getType())) {
static const int methodPrefixSize = sizeof(BUILTIN_PREFIX)-1;
if (function->getName().length() > methodPrefixSize &&
@ -4105,7 +4308,7 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
// convert to the correct type.
TIntermTyped* convArg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg);
if (convArg != nullptr)
convArg = intermediate.addShapeConversion(EOpFunctionCall, *function[i].type, convArg);
convArg = intermediate.addUniShapeConversion(EOpFunctionCall, *function[i].type, convArg);
if (convArg != nullptr)
setArg(i, convArg);
else
@ -5845,8 +6048,11 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
// These builtin ops can accept any type, so we bypass the argument selection
if (candidateList.size() == 1 && builtIn &&
(candidateList[0]->getBuiltInOp() == EOpMethodAppend ||
candidateList[0]->getBuiltInOp() == EOpMethodRestartStrip)) {
candidateList[0]->getBuiltInOp() == EOpMethodRestartStrip ||
candidateList[0]->getBuiltInOp() == EOpMethodIncrementCounter ||
candidateList[0]->getBuiltInOp() == EOpMethodDecrementCounter ||
candidateList[0]->getBuiltInOp() == EOpMethodAppend ||
candidateList[0]->getBuiltInOp() == EOpMethodConsume)) {
return candidateList[0];
}
@ -6439,7 +6645,7 @@ TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TInterm
initializer = intermediate.addConversion(EOpAssign, variable->getType(), initializer);
if (initializer != nullptr && variable->getType() != initializer->getType())
initializer = intermediate.addShapeConversion(EOpAssign, variable->getType(), initializer);
initializer = intermediate.addUniShapeConversion(EOpAssign, variable->getType(), initializer);
if (initializer == nullptr || !initializer->getAsConstantUnion() ||
variable->getType() != initializer->getType()) {
error(loc, "non-matching or non-convertible constant type for const initializer",
@ -6856,6 +7062,10 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS
switch (type.getQualifier().storage) {
case EvqUniform:
case EvqBuffer:
// remember pre-sanitized builtin type
if (type.getQualifier().storage == EvqBuffer && instanceName != nullptr)
structBufferBuiltIn[*instanceName] = type.getQualifier().builtIn;
correctUniform(type.getQualifier());
break;
case EvqVaryingIn:
@ -7670,7 +7880,7 @@ TIntermSymbol* HlslParseContext::findLinkageSymbol(TBuiltInVariable biType) cons
return intermediate.addSymbol(*it->second->getAsVariable());
}
// Add patch constant function invocation
// Finalization step: Add patch constant function invocation
void HlslParseContext::addPatchConstantInvocation()
{
TSourceLoc loc;
@ -8039,9 +8249,23 @@ void HlslParseContext::addPatchConstantInvocation()
epBodySeq.insert(epBodySeq.end(), invocationIdTest);
}
// Finalization step: remove unused buffer blocks from linkage (we don't know until the
// shader is entirely compiled)
void HlslParseContext::removeUnusedStructBufferCounters()
{
const auto endIt = std::remove_if(linkageSymbols.begin(), linkageSymbols.end(),
[this](const TSymbol* sym) {
const auto sbcIt = structBufferCounter.find(sym->getName());
return sbcIt != structBufferCounter.end() && !sbcIt->second;
});
linkageSymbols.erase(endIt, linkageSymbols.end());
}
// post-processing
void HlslParseContext::finish()
{
removeUnusedStructBufferCounters();
addPatchConstantInvocation();
addInterstageIoToLinkage();

View File

@ -146,6 +146,7 @@ public:
TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&);
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset);
void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = 0, TArraySizes* arraySizes = 0);
void declareStructBufferCounter(const TSourceLoc& loc, const TType& bufferType, const TString& name);
void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation);
void fixBlockXfbOffsets(TQualifier&, TTypeList&);
void fixBlockUniformOffsets(const TQualifier&, TTypeList&);
@ -249,6 +250,7 @@ protected:
TVariable* getSplitIoVar(int id) const;
void addInterstageIoToLinkage();
void addPatchConstantInvocation();
TIntermTyped* makeIntegerIndex(TIntermTyped*);
void fixBuiltInIoType(TType&);
@ -274,11 +276,19 @@ protected:
TType* getStructBufferContentType(const TType& type) const;
bool isStructBufferType(const TType& type) const { return getStructBufferContentType(type) != nullptr; }
TIntermTyped* indexStructBufferContent(const TSourceLoc& loc, TIntermTyped* buffer) const;
TIntermTyped* getStructBufferCounter(const TSourceLoc& loc, TIntermTyped* buffer);
// Return true if this type is a reference. This is not currently a type method in case that's
// a language specific answer.
bool isReference(const TType& type) const { return isStructBufferType(type); }
// Return true if this a buffer type that has an associated counter buffer.
bool hasStructBuffCounter(const TString& name) const;
// Finalization step: remove unused buffer blocks from linkage (we don't know until the
// shader is entirely compiled)
void removeUnusedStructBufferCounters();
// Pass through to base class after remembering builtin mappings.
using TParseContextBase::trackLinkage;
void trackLinkage(TSymbol& variable) override;
@ -367,6 +377,9 @@ protected:
// Structuredbuffer shared types. Typically there are only a few.
TVector<TType*> structBufferTypes;
TMap<TString, TBuiltInVariable> structBufferBuiltIn;
TMap<TString, bool> structBufferCounter;
// The builtin interstage IO map considers e.g, EvqPosition on input and output separately, so that we
// can build the linkage correctly if position appears on both sides. Otherwise, multiple positions
// are considered identical.

View File

@ -871,6 +871,9 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
{ "InterlockedMin", nullptr, nullptr, "-", "-", EShLangAll, true },
{ "InterlockedOr", nullptr, nullptr, "-", "-", EShLangAll, true },
{ "InterlockedXor", nullptr, nullptr, "-", "-", EShLangAll, true },
{ "IncrementCounter", nullptr, nullptr, "-", "-", EShLangAll, true },
{ "DecrementCounter", nullptr, nullptr, "-", "-", EShLangAll, true },
{ "Consume", nullptr, nullptr, "-", "-", EShLangAll, true },
// Mark end of list, since we want to avoid a range-based for, as some compilers don't handle it yet.
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0, false },
@ -1180,6 +1183,10 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
symbolTable.relateToOperator(BUILTIN_PREFIX "Store2", EOpMethodStore2);
symbolTable.relateToOperator(BUILTIN_PREFIX "Store3", EOpMethodStore3);
symbolTable.relateToOperator(BUILTIN_PREFIX "Store4", EOpMethodStore4);
symbolTable.relateToOperator(BUILTIN_PREFIX "IncrementCounter", EOpMethodIncrementCounter);
symbolTable.relateToOperator(BUILTIN_PREFIX "DecrementCounter", EOpMethodDecrementCounter);
// Append is also a GS method: we don't add it twice
symbolTable.relateToOperator(BUILTIN_PREFIX "Consume", EOpMethodConsume);
symbolTable.relateToOperator(BUILTIN_PREFIX "InterlockedAdd", EOpInterlockedAdd);
symbolTable.relateToOperator(BUILTIN_PREFIX "InterlockedAnd", EOpInterlockedAnd);