Updated glslang.

This commit is contained in:
Branimir Karadžić
2017-06-30 19:37:56 -07:00
parent c86c04be10
commit 9fed9e41be
43 changed files with 1875 additions and 131 deletions

View File

@@ -520,6 +520,10 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
builder.addCapability(spv::CapabilityGeometry);
return spv::BuiltInPrimitiveId;
case glslang::EbvFragStencilRef:
logger->missingFunctionality("shader stencil export");
return spv::BuiltInMax;
case glslang::EbvInvocationId: return spv::BuiltInInvocationId;
case glslang::EbvTessLevelInner: return spv::BuiltInTessLevelInner;
case glslang::EbvTessLevelOuter: return spv::BuiltInTessLevelOuter;

View File

@@ -148,6 +148,10 @@ const char* sourceEntryPointName = nullptr;
const char* shaderStageName = nullptr;
const char* variableName = nullptr;
std::vector<std::string> IncludeDirectoryList;
int ClientInputSemanticsVersion = 100; // maps to, say, #define VULKAN 100
int VulkanClientVersion = 100; // would map to, say, Vulkan 1.0
int OpenGLClientVersion = 450; // doesn't influence anything yet, but maps to OpenGL 4.50
unsigned int TargetVersion = 0x00001000; // maps to, say, SPIR-V 1.0
std::array<unsigned int, EShLangCount> baseSamplerBinding;
std::array<unsigned int, EShLangCount> baseTextureBinding;
@@ -157,7 +161,6 @@ std::array<unsigned int, EShLangCount> baseSsboBinding;
std::array<unsigned int, EShLangCount> baseUavBinding;
std::array<std::vector<std::string>, EShLangCount> baseResourceSetBinding;
// Add things like "#define ..." to a preamble to use in the beginning of the shader.
class TPreamble {
public:
@@ -295,15 +298,15 @@ void ProcessResourceSetBindingBase(int& argc, char**& argv, std::array<std::vect
base[lang].push_back(argv[2]);
base[lang].push_back(argv[3]);
base[lang].push_back(argv[4]);
argc-= 4;
argv+= 4;
argc -= 4;
argv += 4;
while(argv[1] != NULL) {
if(argv[1][0] != '-') {
base[lang].push_back(argv[1]);
base[lang].push_back(argv[2]);
base[lang].push_back(argv[3]);
argc-= 3;
argv+= 3;
argc -= 3;
argv += 3;
}
else {
break;
@@ -337,6 +340,14 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
ExecutableName = argv[0];
workItems.reserve(argc);
const auto bumpArg = [&]() {
if (argc > 0) {
argc--;
argv++;
}
};
// read a string directly attached to a single-letter option
const auto getStringOperand = [&](const char* desc) {
if (argv[0][2] == 0) {
printf("%s must immediately follow option (no spaces)\n", desc);
@@ -345,9 +356,32 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
return argv[0] + 2;
};
argc--;
argv++;
for (; argc >= 1; argc--, argv++) {
// read a number attached to a single-letter option
const auto getAttachedNumber = [&](const char* desc) {
int num = atoi(argv[0] + 2);
if (num == 0) {
printf("%s: expected attached non-0 number\n", desc);
exit(EFailUsage);
}
return num;
};
// minimum needed (without overriding something else) to target Vulkan SPIR-V
const auto setVulkanSpv = []() {
Options |= EOptionSpv;
Options |= EOptionVulkanRules;
Options |= EOptionLinkProgram;
};
// minimum needed (without overriding something else) to target OpenGL SPIR-V
const auto setOpenGlSpv = []() {
Options |= EOptionSpv;
Options |= EOptionLinkProgram;
// undo a -H default to Vulkan
Options &= ~EOptionVulkanRules;
};
for (bumpArg(); argc >= 1; bumpArg()) {
if (argv[0][0] == '-') {
switch (argv[0][1]) {
case '-':
@@ -357,12 +391,22 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
// handle --word style options
if (lowerword == "auto-map-bindings" || // synonyms
lowerword == "auto-map-binding" ||
lowerword == "amb") {
lowerword == "auto-map-binding" ||
lowerword == "amb") {
Options |= EOptionAutoMapBindings;
} else if (lowerword == "auto-map-locations" || // synonyms
lowerword == "aml") {
Options |= EOptionAutoMapLocations;
} else if (lowerword == "client") {
if (argc > 1) {
if (strcmp(argv[1], "vulkan100") == 0)
setVulkanSpv();
else if (strcmp(argv[1], "opengl100") == 0)
setOpenGlSpv();
else
Error("--client expects vulkan100 or opengl100");
}
bumpArg();
} else if (lowerword == "flatten-uniform-arrays" || // synonyms
lowerword == "flatten-uniform-array" ||
lowerword == "fua") {
@@ -412,22 +456,30 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
ProcessBindingBase(argc, argv, baseSsboBinding);
} else if (lowerword == "source-entrypoint" || // synonyms
lowerword == "sep") {
sourceEntryPointName = argv[1];
if (argc > 0) {
argc--;
argv++;
} else
if (argc <= 1)
Error("no <entry-point> provided for --source-entrypoint");
sourceEntryPointName = argv[1];
bumpArg();
break;
} else if (lowerword == "target-env") {
if (argc > 1) {
if (strcmp(argv[1], "vulkan1.0") == 0) {
setVulkanSpv();
VulkanClientVersion = 100;
} else if (strcmp(argv[1], "opengl") == 0) {
setOpenGlSpv();
OpenGLClientVersion = 450;
} else
Error("--target-env expected vulkan1.0 or opengl");
}
bumpArg();
} else if (lowerword == "variable-name" || // synonyms
lowerword == "vn") {
Options |= EOptionOutputHexadecimal;
variableName = argv[1];
if (argc > 0) {
argc--;
argv++;
} else
if (argc <= 1)
Error("no <C-variable-name> provided for --variable-name");
variableName = argv[1];
bumpArg();
break;
} else {
usage();
@@ -447,38 +499,34 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Options |= EOptionOutputPreprocessed;
break;
case 'G':
Options |= EOptionSpv;
Options |= EOptionLinkProgram;
// undo a -H default to Vulkan
Options &= ~EOptionVulkanRules;
// OpenGL Client
setOpenGlSpv();
if (argv[0][2] != 0)
ClientInputSemanticsVersion = getAttachedNumber("-G<num> client input semantics");
break;
case 'H':
Options |= EOptionHumanReadableSpv;
if ((Options & EOptionSpv) == 0) {
// default to Vulkan
Options |= EOptionSpv;
Options |= EOptionVulkanRules;
Options |= EOptionLinkProgram;
setVulkanSpv();
}
break;
case 'I':
IncludeDirectoryList.push_back(getStringOperand("-I<dir> include path"));
break;
case 'S':
shaderStageName = argv[1];
if (argc > 0) {
argc--;
argv++;
} else
if (argc <= 1)
Error("no <stage> specified for -S");
shaderStageName = argv[1];
bumpArg();
break;
case 'U':
UserPreamble.addUndef(getStringOperand("-U<macro>: macro name"));
break;
case 'V':
Options |= EOptionSpv;
Options |= EOptionVulkanRules;
Options |= EOptionLinkProgram;
setVulkanSpv();
if (argv[0][2] != 0)
ClientInputSemanticsVersion = getAttachedNumber("-G<num> client input semantics");
break;
case 'c':
Options |= EOptionDumpConfig;
@@ -490,11 +538,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
// HLSL todo: entry point handle needs much more sophistication.
// This is okay for one compilation unit with one entry point.
entryPointName = argv[1];
if (argc > 0) {
argc--;
argv++;
} else
if (argc <= 1)
Error("no <entry-point> provided for -e");
bumpArg();
break;
case 'g':
Options |= EOptionDebug;
@@ -512,12 +558,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Options |= EOptionMemoryLeakMode;
break;
case 'o':
binaryFileName = argv[1];
if (argc > 0) {
argc--;
argv++;
} else
if (argc <= 1)
Error("no <file> provided for -o");
binaryFileName = argv[1];
bumpArg();
break;
case 'q':
Options |= EOptionDumpReflection;
@@ -715,9 +759,27 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
if (Options & EOptionAutoMapLocations)
shader->setAutoMapLocations(true);
// Set up the environment, some subsettings take precedence over earlier
// ways of setting things.
if (Options & EOptionSpv) {
if (Options & EOptionVulkanRules) {
shader->setEnvInput((Options & EOptionReadHlsl) ? glslang::EShSourceHlsl
: glslang::EShSourceGlsl,
compUnit.stage, glslang::EShClientVulkan, ClientInputSemanticsVersion);
shader->setEnvClient(glslang::EShClientVulkan, VulkanClientVersion);
shader->setEnvTarget(glslang::EshTargetSpv, TargetVersion);
} else {
shader->setEnvInput((Options & EOptionReadHlsl) ? glslang::EShSourceHlsl
: glslang::EShSourceGlsl,
compUnit.stage, glslang::EShClientOpenGL, ClientInputSemanticsVersion);
shader->setEnvClient(glslang::EShClientOpenGL, OpenGLClientVersion);
shader->setEnvTarget(glslang::EshTargetSpv, TargetVersion);
}
}
shaders.push_back(shader);
const int defaultVersion = Options & EOptionDefaultDesktop? 110: 100;
const int defaultVersion = Options & EOptionDefaultDesktop ? 110 : 100;
DirStackFileIncluder includer;
std::for_each(IncludeDirectoryList.rbegin(), IncludeDirectoryList.rend(), [&includer](const std::string& dir) {
@@ -1072,16 +1134,24 @@ void usage()
" -D<macro> define a pre-processor macro\n"
" -E print pre-processed GLSL; cannot be used with -l;\n"
" errors will appear on stderr.\n"
" -G create SPIR-V binary, under OpenGL semantics; turns on -l;\n"
" -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;\n"
" default file name is <stage>.spv (-o overrides this)\n"
" 'ver', when present, is the version of the input semantics,\n"
" which will appear in #define GL_SPIRV ver\n"
" '--client opengl100' is the same as -G100\n"
" a '--target-env' for OpenGL will also imply '-G'\n"
" -H print human readable form of SPIR-V; turns on -V\n"
" -I<dir> add dir to the include search path; includer's directory\n"
" is searched first, followed by left-to-right order of -I\n"
" -S <stage> uses specified stage rather than parsing the file extension\n"
" choices for <stage> are vert, tesc, tese, geom, frag, or comp\n"
" -U<macro> undefine a pre-precossor macro\n"
" -V create SPIR-V binary, under Vulkan semantics; turns on -l;\n"
" -U<macro> undefine a pre-processor macro\n"
" -V[ver] create SPIR-V binary, under Vulkan semantics; turns on -l;\n"
" default file name is <stage>.spv (-o overrides this)\n"
" 'ver', when present, is the version of the input semantics,\n"
" which will appear in #define VULKAN ver\n"
" '--client vulkan100' is the same as -V100\n"
" a '--target-env' for Vulkan will also imply '-V'\n"
" -c configuration dump;\n"
" creates the default configuration file (redirect to a .conf file)\n"
" -d default to desktop (#version 110) when there is no shader #version\n"
@@ -1104,12 +1174,12 @@ void usage()
" without explicit bindings.\n"
" --amb synonym for --auto-map-bindings\n"
" --auto-map-locations automatically locate input/output lacking\n"
" 'location'\n (fragile, not cross stage)\n"
" 'location' (fragile, not cross stage)\n"
" --aml synonym for --auto-map-locations\n"
" --client {vulkan<ver>|opengl<ver>} see -V and -G\n"
" --flatten-uniform-arrays flatten uniform texture/sampler arrays to\n"
" scalars\n"
" --fua synonym for --flatten-uniform-arrays\n"
"\n"
" --hlsl-offsets Allow block offsets to follow HLSL rules\n"
" Works independently of source language\n"
" --hlsl-iomap Perform IO mapping in HLSL register space\n"
@@ -1135,6 +1205,11 @@ void usage()
" --source-entrypoint name the given shader source function is\n"
" renamed to be the entry point given in -e\n"
" --sep synonym for --source-entrypoint\n"
" --target-env {vulkan1.0|opengl} set the execution environment the generated\n"
" code will execute in (as opposed to language\n"
" semantics selected by --client)\n"
" default is 'vulkan1.0' under '--client vulkan'\n"
" default is 'opengl' under '--client opengl'\n"
" --variable-name <name> Creates a C header file that contains a\n"
" uint32_t array named <name>\n"
" initialized with the shader binary code.\n"

View File

@@ -184,4 +184,16 @@ void fooDeeparray()
yp = y;
xp = y; // ERROR, wrong size
yp = x; // ERROR, wrong size
}
void mwErr()
{
gl_ViewID_OVR; // ERROR, no extension
}
#extension GL_OVR_multiview : enable
void mwOk()
{
gl_ViewID_OVR;
}

View File

@@ -64,3 +64,5 @@ layout(location = 12) in bName2 {
float f;
layout(location = 13) float g; // ERROR, location on array
} bInst2[3];
layout(early_fragment_tests) in float f; // ERROR, must be standalone

View File

@@ -15,3 +15,5 @@ void main()
gl_in[3].gl_Position; // ERROR, out of range
gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}
layout(points) in float f[3]; // ERROR, must be standalone

View File

@@ -12,3 +12,10 @@ void main()
{
gl_CullDistance[2] = gl_in[1].gl_CullDistance[2];
}
layout(equal_spacing) in float f1[]; // ERROR, must be standalone
layout(fractional_even_spacing) in float f2[]; // ERROR, must be standalone
layout(fractional_odd_spacing) in float f3[]; // ERROR, must be standalone
layout(cw) in float f4[]; // ERROR, must be standalone
layout(ccw) in float f5[]; // ERROR, must be standalone
layout(point_mode) in float f6[]; // ERROR, must be standalone

View File

@@ -43,10 +43,14 @@ ERROR: 0:172: 'std430' : requires the 'buffer' storage qualifier
ERROR: 0:175: '' : array size required
ERROR: 0:185: 'assign' : cannot convert from ' temp 4-element array of highp float' to ' temp 3-element array of highp float'
ERROR: 0:186: 'assign' : cannot convert from ' temp 3-element array of highp float' to ' temp 4-element array of highp float'
ERROR: 44 compilation errors. No code generated.
ERROR: 0:191: 'gl_ViewID_OVR' : required extension not requested: Possible extensions include:
GL_OVR_multiview
GL_OVR_multiview2
ERROR: 45 compilation errors. No code generated.
Shader version: 300
Requested GL_OVR_multiview
ERROR: node is still EOpNull!
0:27 Function Definition: main( ( global void)
0:27 Function Parameters:
@@ -289,6 +293,14 @@ ERROR: node is still EOpNull!
0:184 'y' ( temp 4-element array of highp float)
0:185 'xp' ( temp 3-element array of highp float)
0:186 'yp' ( temp 4-element array of highp float)
0:189 Function Definition: mwErr( ( global void)
0:189 Function Parameters:
0:191 Sequence
0:191 'gl_ViewID_OVR' ( in highp uint ViewIndex)
0:196 Function Definition: mwOk( ( global void)
0:196 Function Parameters:
0:198 Sequence
0:198 'gl_ViewID_OVR' ( in highp uint ViewIndex)
0:? Linker Objects
0:? 'm43' ( uniform highp 4X3 matrix of float)
0:? 'm33' ( uniform highp 3X3 matrix of float)
@@ -331,6 +343,7 @@ Linked vertex stage:
Shader version: 300
Requested GL_OVR_multiview
ERROR: node is still EOpNull!
0:27 Function Definition: main( ( global void)
0:27 Function Parameters:

View File

@@ -1,6 +1,7 @@
450.frag
ERROR: 0:63: 'location' : cannot use in a block array where new locations are needed for each block element
ERROR: 1 compilation errors. No code generated.
ERROR: 0:68: 'early_fragment_tests' : can only apply to a standalone qualifier
ERROR: 2 compilation errors. No code generated.
Shader version: 450
@@ -164,6 +165,7 @@ ERROR: node is still EOpNull!
0:? 'i2dmsa' (layout( rgba32f) uniform image2DMSArray)
0:? 'bInst1' ( in block{layout( location=6) in float f, layout( location=7) in float g, layout( location=8) in 4X4 matrix of float m})
0:? 'bInst2' ( in 3-element array of block{layout( location=12) in float f, layout( location=13) in float g})
0:? 'f' ( smooth in float)
Linked fragment stage:
@@ -279,4 +281,5 @@ ERROR: node is still EOpNull!
0:? 'i2dmsa' (layout( rgba32f) uniform image2DMSArray)
0:? 'bInst1' ( in block{layout( location=6) in float f, layout( location=7) in float g, layout( location=8) in 4X4 matrix of float m})
0:? 'bInst2' ( in 3-element array of block{layout( location=12) in float f, layout( location=13) in float g})
0:? 'f' ( smooth in float)

View File

@@ -1,7 +1,8 @@
450.geom
ERROR: 0:15: '[' : array index out of range '3'
ERROR: 0:15: 'gl_Position' : no such field in structure
ERROR: 2 compilation errors. No code generated.
ERROR: 0:19: 'points' : can only apply to a standalone qualifier
ERROR: 3 compilation errors. No code generated.
Shader version: 450
@@ -38,6 +39,7 @@ ERROR: node is still EOpNull!
0:? Linker Objects
0:? 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:? 'f' ( in 3-element array of float)
Linked geometry stage:
@@ -79,4 +81,5 @@ ERROR: node is still EOpNull!
0:? Linker Objects
0:? 'gl_in' ( in 3-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-element array of float CullDistance gl_CullDistance})
0:? 'f' ( in 3-element array of float)

View File

@@ -1,9 +1,18 @@
450.tese
ERROR: 0:16: 'equal_spacing' : can only apply to a standalone qualifier
ERROR: 0:17: 'fractional_even_spacing' : can only apply to a standalone qualifier
ERROR: 0:18: 'fractional_odd_spacing' : can only apply to a standalone qualifier
ERROR: 0:19: 'cw' : can only apply to a standalone qualifier
ERROR: 0:20: 'ccw' : can only apply to a standalone qualifier
ERROR: 0:21: 'point_mode' : can only apply to a standalone qualifier
ERROR: 6 compilation errors. No code generated.
Shader version: 450
input primitive = none
vertex spacing = none
triangle order = none
0:? Sequence
ERROR: node is still EOpNull!
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:13 Sequence
@@ -28,6 +37,12 @@ triangle order = none
0:? Linker Objects
0:? 'gl_in' ( in 32-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' ( out block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'f1' ( in 32-element array of float)
0:? 'f2' ( in 32-element array of float)
0:? 'f3' ( in 32-element array of float)
0:? 'f4' ( in 32-element array of float)
0:? 'f5' ( in 32-element array of float)
0:? 'f6' ( in 32-element array of float)
Linked tessellation evaluation stage:
@@ -38,7 +53,7 @@ Shader version: 450
input primitive = none
vertex spacing = equal_spacing
triangle order = ccw
0:? Sequence
ERROR: node is still EOpNull!
0:11 Function Definition: main( ( global void)
0:11 Function Parameters:
0:13 Sequence
@@ -63,4 +78,10 @@ triangle order = ccw
0:? Linker Objects
0:? 'gl_in' ( in 32-element array of block{ in 3-element array of float CullDistance gl_CullDistance})
0:? 'anon@0' ( out block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'f1' ( in 32-element array of float)
0:? 'f2' ( in 32-element array of float)
0:? 'f3' ( in 32-element array of float)
0:? 'f4' ( in 32-element array of float)
0:? 'f5' ( in 32-element array of float)
0:? 'f6' ( in 32-element array of float)

View File

@@ -0,0 +1,382 @@
hlsl.hull.3.tesc
Shader version: 500
vertices = 4
vertex spacing = equal_spacing
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' ( in 4-element array of structure{ temp 3-component vector of float cpoint})
0:? Sequence
0:28 move second child to first child ( temp 3-component vector of float)
0:28 cpoint: direct index for structure ( temp 3-component vector of float)
0:28 'output' ( temp structure{ temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure ( temp 3-component vector of float)
0:28 direct index ( temp structure{ temp 3-component vector of float cpoint})
0:28 'ip' ( in 4-element array of structure{ temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' ( temp structure{ temp 3-component vector of float cpoint})
0:26 Function Definition: main( ( temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
0:26 move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
0:26 indirect index ( temp structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
0:26 Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
0:? 'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
0:? Barrier ( temp void)
0:? Test condition and select ( temp void)
0:? Condition
0:? Compare Equal ( temp bool)
0:? 'InvocationId' ( in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Sequence
0:? move second child to first child ( temp structure{ temp 2-element array of float edges})
0:? '@patchConstantResult' ( temp structure{ temp 2-element array of float edges})
0:? Function Call: PCF(u1;vf4; ( temp structure{ temp 2-element array of float edges})
0:? 'pid' ( in uint PrimitiveID)
0:? 'pos' ( in 4-component vector of float Position)
0:? Sequence
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 0 (const int)
0:? direct index ( temp float)
0:? edges: direct index for structure ( temp 2-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 0 (const int)
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 1 (const int)
0:? direct index ( temp float)
0:? edges: direct index for structure ( temp 2-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 1 (const int)
0:33 Function Definition: PCF(u1;vf4; ( temp structure{ temp 2-element array of float edges})
0:33 Function Parameters:
0:33 'pid' ( in uint)
0:33 'pos' ( in 4-component vector of float)
0:? Sequence
0:36 move second child to first child ( temp float)
0:36 direct index ( temp float)
0:36 edges: direct index for structure ( temp 2-element array of float)
0:36 'output' ( temp structure{ temp 2-element array of float edges})
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 2.000000
0:37 move second child to first child ( temp float)
0:37 direct index ( temp float)
0:37 edges: direct index for structure ( temp 2-element array of float)
0:37 'output' ( temp structure{ temp 2-element array of float edges})
0:37 Constant:
0:37 0 (const int)
0:37 Constant:
0:37 1 (const int)
0:37 Constant:
0:37 8.000000
0:38 Branch: Return with expression
0:38 'output' ( temp structure{ temp 2-element array of float edges})
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
0:? 'pid' ( in uint PrimitiveID)
0:? 'pos' ( in 4-component vector of float Position)
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
Linked tessellation control stage:
Shader version: 500
vertices = 4
vertex spacing = equal_spacing
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' ( in 4-element array of structure{ temp 3-component vector of float cpoint})
0:? Sequence
0:28 move second child to first child ( temp 3-component vector of float)
0:28 cpoint: direct index for structure ( temp 3-component vector of float)
0:28 'output' ( temp structure{ temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure ( temp 3-component vector of float)
0:28 direct index ( temp structure{ temp 3-component vector of float cpoint})
0:28 'ip' ( in 4-element array of structure{ temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' ( temp structure{ temp 3-component vector of float cpoint})
0:26 Function Definition: main( ( temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
0:26 move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
0:26 indirect index ( temp structure{ temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
0:26 Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
0:? 'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
0:? Barrier ( temp void)
0:? Test condition and select ( temp void)
0:? Condition
0:? Compare Equal ( temp bool)
0:? 'InvocationId' ( in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Sequence
0:? move second child to first child ( temp structure{ temp 2-element array of float edges})
0:? '@patchConstantResult' ( temp structure{ temp 2-element array of float edges})
0:? Function Call: PCF(u1;vf4; ( temp structure{ temp 2-element array of float edges})
0:? 'pid' ( in uint PrimitiveID)
0:? 'pos' ( in 4-component vector of float Position)
0:? Sequence
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 0 (const int)
0:? direct index ( temp float)
0:? edges: direct index for structure ( temp 2-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 0 (const int)
0:? move second child to first child ( temp float)
0:? direct index ( patch out float TessLevelOuter)
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
0:? Constant:
0:? 1 (const int)
0:? direct index ( temp float)
0:? edges: direct index for structure ( temp 2-element array of float)
0:? '@patchConstantResult' ( temp structure{ temp 2-element array of float edges})
0:? Constant:
0:? 0 (const int)
0:? Constant:
0:? 1 (const int)
0:33 Function Definition: PCF(u1;vf4; ( temp structure{ temp 2-element array of float edges})
0:33 Function Parameters:
0:33 'pid' ( in uint)
0:33 'pos' ( in 4-component vector of float)
0:? Sequence
0:36 move second child to first child ( temp float)
0:36 direct index ( temp float)
0:36 edges: direct index for structure ( temp 2-element array of float)
0:36 'output' ( temp structure{ temp 2-element array of float edges})
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 0 (const int)
0:36 Constant:
0:36 2.000000
0:37 move second child to first child ( temp float)
0:37 direct index ( temp float)
0:37 edges: direct index for structure ( temp 2-element array of float)
0:37 'output' ( temp structure{ temp 2-element array of float edges})
0:37 Constant:
0:37 0 (const int)
0:37 Constant:
0:37 1 (const int)
0:37 Constant:
0:37 8.000000
0:38 Branch: Return with expression
0:38 'output' ( temp structure{ temp 2-element array of float edges})
0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
0:? 'InvocationId' ( in uint InvocationID)
0:? 'pid' ( in uint PrimitiveID)
0:? 'pos' ( in 4-component vector of float Position)
0:? '@patchConstantOutput' (layout( location=1) patch out structure{})
0:? '@patchConstantOutput_edges' ( patch out 4-element array of float TessLevelOuter)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 95
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 42 46 48 64 66 74 94
ExecutionMode 4 OutputVertices 4
ExecutionMode 4 Triangles
ExecutionMode 4 SpacingEqual
ExecutionMode 4 PointMode
Source HLSL 500
Name 4 "main"
Name 8 "VS_OUT"
MemberName 8(VS_OUT) 0 "cpoint"
Name 13 "HS_OUT"
MemberName 13(HS_OUT) 0 "cpoint"
Name 16 "@main(struct-VS_OUT-vf31[4];"
Name 15 "ip"
Name 23 "HS_CONSTANT_OUT"
MemberName 23(HS_CONSTANT_OUT) 0 "edges"
Name 27 "PCF(u1;vf4;"
Name 25 "pid"
Name 26 "pos"
Name 30 "output"
Name 40 "ip"
Name 42 "ip"
Name 46 "@entryPointOutput"
Name 48 "InvocationId"
Name 50 "param"
Name 63 "@patchConstantResult"
Name 64 "pid"
Name 66 "pos"
Name 67 "param"
Name 69 "param"
Name 74 "@patchConstantOutput_edges"
Name 84 "output"
Name 92 "HS_CONSTANT_OUT"
Name 94 "@patchConstantOutput"
Decorate 42(ip) Location 0
Decorate 46(@entryPointOutput) Location 0
Decorate 48(InvocationId) BuiltIn InvocationId
Decorate 64(pid) BuiltIn PrimitiveId
Decorate 66(pos) BuiltIn Position
Decorate 74(@patchConstantOutput_edges) Patch
Decorate 74(@patchConstantOutput_edges) BuiltIn TessLevelOuter
Decorate 94(@patchConstantOutput) Patch
Decorate 94(@patchConstantOutput) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 3
8(VS_OUT): TypeStruct 7(fvec3)
9: TypeInt 32 0
10: 9(int) Constant 4
11: TypeArray 8(VS_OUT) 10
12: TypePointer Function 11
13(HS_OUT): TypeStruct 7(fvec3)
14: TypeFunction 13(HS_OUT) 12(ptr)
18: TypePointer Function 9(int)
19: TypeVector 6(float) 4
20: TypePointer Function 19(fvec4)
21: 9(int) Constant 2
22: TypeArray 6(float) 21
23(HS_CONSTANT_OUT): TypeStruct 22
24: TypeFunction 23(HS_CONSTANT_OUT) 18(ptr) 20(ptr)
29: TypePointer Function 13(HS_OUT)
31: TypeInt 32 1
32: 31(int) Constant 0
33: TypePointer Function 7(fvec3)
41: TypePointer Input 11
42(ip): 41(ptr) Variable Input
44: TypeArray 13(HS_OUT) 10
45: TypePointer Output 44
46(@entryPointOutput): 45(ptr) Variable Output
47: TypePointer Input 9(int)
48(InvocationId): 47(ptr) Variable Input
53: TypePointer Output 13(HS_OUT)
55: 9(int) Constant 1
56: 9(int) Constant 0
58: TypeBool
62: TypePointer Function 23(HS_CONSTANT_OUT)
64(pid): 47(ptr) Variable Input
65: TypePointer Input 19(fvec4)
66(pos): 65(ptr) Variable Input
72: TypeArray 6(float) 10
73: TypePointer Output 72
74(@patchConstantOutput_edges): 73(ptr) Variable Output
75: TypePointer Function 6(float)
78: TypePointer Output 6(float)
80: 31(int) Constant 1
85: 6(float) Constant 1073741824
87: 6(float) Constant 1090519040
92(HS_CONSTANT_OUT): TypeStruct
93: TypePointer Output 92(HS_CONSTANT_OUT)
94(@patchConstantOutput): 93(ptr) Variable Output
4(main): 2 Function None 3
5: Label
40(ip): 12(ptr) Variable Function
50(param): 12(ptr) Variable Function
63(@patchConstantResult): 62(ptr) Variable Function
67(param): 18(ptr) Variable Function
69(param): 20(ptr) Variable Function
43: 11 Load 42(ip)
Store 40(ip) 43
49: 9(int) Load 48(InvocationId)
51: 11 Load 40(ip)
Store 50(param) 51
52: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 50(param)
54: 53(ptr) AccessChain 46(@entryPointOutput) 49
Store 54 52
ControlBarrier 21 55 56
57: 9(int) Load 48(InvocationId)
59: 58(bool) IEqual 57 32
SelectionMerge 61 None
BranchConditional 59 60 61
60: Label
68: 9(int) Load 64(pid)
Store 67(param) 68
70: 19(fvec4) Load 66(pos)
Store 69(param) 70
71:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 67(param) 69(param)
Store 63(@patchConstantResult) 71
76: 75(ptr) AccessChain 63(@patchConstantResult) 32 32
77: 6(float) Load 76
79: 78(ptr) AccessChain 74(@patchConstantOutput_edges) 32
Store 79 77
81: 75(ptr) AccessChain 63(@patchConstantResult) 32 80
82: 6(float) Load 81
83: 78(ptr) AccessChain 74(@patchConstantOutput_edges) 80
Store 83 82
Branch 61
61: Label
Return
FunctionEnd
16(@main(struct-VS_OUT-vf31[4];): 13(HS_OUT) Function None 14
15(ip): 12(ptr) FunctionParameter
17: Label
30(output): 29(ptr) Variable Function
34: 33(ptr) AccessChain 15(ip) 32 32
35: 7(fvec3) Load 34
36: 33(ptr) AccessChain 30(output) 32
Store 36 35
37: 13(HS_OUT) Load 30(output)
ReturnValue 37
FunctionEnd
27(PCF(u1;vf4;):23(HS_CONSTANT_OUT) Function None 24
25(pid): 18(ptr) FunctionParameter
26(pos): 20(ptr) FunctionParameter
28: Label
84(output): 62(ptr) Variable Function
86: 75(ptr) AccessChain 84(output) 32 32
Store 86 85
88: 75(ptr) AccessChain 84(output) 32 80
Store 88 87
89:23(HS_CONSTANT_OUT) Load 84(output)
ReturnValue 89
FunctionEnd

View File

@@ -2,6 +2,7 @@ hlsl.hull.void.tesc
Shader version: 500
vertices = 3
vertex spacing = fractional_even_spacing
triangle order = ccw
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
0:26 Function Parameters:
@@ -57,6 +58,7 @@ Linked tessellation control stage:
Shader version: 500
vertices = 3
vertex spacing = fractional_even_spacing
triangle order = ccw
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
0:26 Function Parameters:
@@ -116,6 +118,7 @@ vertex spacing = fractional_even_spacing
ExecutionMode 4 OutputVertices 3
ExecutionMode 4 Triangles
ExecutionMode 4 SpacingFractionalEven
ExecutionMode 4 VertexOrderCcw
Source HLSL 500
Name 4 "main"
Name 8 "VS_OUT"

View File

@@ -0,0 +1,188 @@
hlsl.target.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: @main(struct-PSInput-f1-u11;vf4;vf4; ( temp void)
0:7 Function Parameters:
0:7 'input' ( in structure{ temp float interp, temp uint no_interp})
0:7 'out1' ( out 4-component vector of float)
0:7 'out2' ( out 4-component vector of float)
0:? Sequence
0:8 move second child to first child ( temp 4-component vector of float)
0:8 'out1' ( out 4-component vector of float)
0:8 Constant:
0:8 1.000000
0:8 1.000000
0:8 1.000000
0:8 1.000000
0:9 move second child to first child ( temp 4-component vector of float)
0:9 'out2' ( out 4-component vector of float)
0:9 Constant:
0:9 0.000000
0:9 0.000000
0:9 0.000000
0:9 0.000000
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:7 Function Call: @main(struct-PSInput-f1-u11;vf4;vf4; ( temp void)
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'out1' ( temp 4-component vector of float)
0:? 'out2' ( temp 4-component vector of float)
0:7 move second child to first child ( temp 4-component vector of float)
0:? 'out1' (layout( location=1) out 4-component vector of float)
0:? 'out1' ( temp 4-component vector of float)
0:7 move second child to first child ( temp 4-component vector of float)
0:? 'out2' (layout( location=3) out 4-component vector of float)
0:? 'out2' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:? 'out1' (layout( location=1) out 4-component vector of float)
0:? 'out2' (layout( location=3) out 4-component vector of float)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:7 Function Definition: @main(struct-PSInput-f1-u11;vf4;vf4; ( temp void)
0:7 Function Parameters:
0:7 'input' ( in structure{ temp float interp, temp uint no_interp})
0:7 'out1' ( out 4-component vector of float)
0:7 'out2' ( out 4-component vector of float)
0:? Sequence
0:8 move second child to first child ( temp 4-component vector of float)
0:8 'out1' ( out 4-component vector of float)
0:8 Constant:
0:8 1.000000
0:8 1.000000
0:8 1.000000
0:8 1.000000
0:9 move second child to first child ( temp 4-component vector of float)
0:9 'out2' ( out 4-component vector of float)
0:9 Constant:
0:9 0.000000
0:9 0.000000
0:9 0.000000
0:9 0.000000
0:7 Function Definition: main( ( temp void)
0:7 Function Parameters:
0:? Sequence
0:7 move second child to first child ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:7 Function Call: @main(struct-PSInput-f1-u11;vf4;vf4; ( temp void)
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'out1' ( temp 4-component vector of float)
0:? 'out2' ( temp 4-component vector of float)
0:7 move second child to first child ( temp 4-component vector of float)
0:? 'out1' (layout( location=1) out 4-component vector of float)
0:? 'out1' ( temp 4-component vector of float)
0:7 move second child to first child ( temp 4-component vector of float)
0:? 'out2' (layout( location=3) out 4-component vector of float)
0:? 'out2' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:? 'out1' (layout( location=1) out 4-component vector of float)
0:? 'out2' (layout( location=3) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 50
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 25 46 48
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 8 "PSInput"
MemberName 8(PSInput) 0 "interp"
MemberName 8(PSInput) 1 "no_interp"
Name 16 "@main(struct-PSInput-f1-u11;vf4;vf4;"
Name 13 "input"
Name 14 "out1"
Name 15 "out2"
Name 22 "input"
Name 23 "PSInput"
MemberName 23(PSInput) 0 "interp"
MemberName 23(PSInput) 1 "no_interp"
Name 25 "input"
Name 36 "out1"
Name 37 "out2"
Name 38 "param"
Name 40 "param"
Name 41 "param"
Name 46 "out1"
Name 48 "out2"
MemberDecorate 23(PSInput) 1 Flat
Decorate 25(input) Location 0
Decorate 46(out1) Location 1
Decorate 48(out2) Location 3
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeInt 32 0
8(PSInput): TypeStruct 6(float) 7(int)
9: TypePointer Function 8(PSInput)
10: TypeVector 6(float) 4
11: TypePointer Function 10(fvec4)
12: TypeFunction 2 9(ptr) 11(ptr) 11(ptr)
18: 6(float) Constant 1065353216
19: 10(fvec4) ConstantComposite 18 18 18 18
20: 6(float) Constant 0
21: 10(fvec4) ConstantComposite 20 20 20 20
23(PSInput): TypeStruct 6(float) 7(int)
24: TypePointer Input 23(PSInput)
25(input): 24(ptr) Variable Input
28: TypeInt 32 1
29: 28(int) Constant 0
30: TypePointer Function 6(float)
33: 28(int) Constant 1
34: TypePointer Function 7(int)
45: TypePointer Output 10(fvec4)
46(out1): 45(ptr) Variable Output
48(out2): 45(ptr) Variable Output
4(main): 2 Function None 3
5: Label
22(input): 9(ptr) Variable Function
36(out1): 11(ptr) Variable Function
37(out2): 11(ptr) Variable Function
38(param): 9(ptr) Variable Function
40(param): 11(ptr) Variable Function
41(param): 11(ptr) Variable Function
26: 23(PSInput) Load 25(input)
27: 6(float) CompositeExtract 26 0
31: 30(ptr) AccessChain 22(input) 29
Store 31 27
32: 7(int) CompositeExtract 26 1
35: 34(ptr) AccessChain 22(input) 33
Store 35 32
39: 8(PSInput) Load 22(input)
Store 38(param) 39
42: 2 FunctionCall 16(@main(struct-PSInput-f1-u11;vf4;vf4;) 38(param) 40(param) 41(param)
43: 10(fvec4) Load 40(param)
Store 36(out1) 43
44: 10(fvec4) Load 41(param)
Store 37(out2) 44
47: 10(fvec4) Load 36(out1)
Store 46(out1) 47
49: 10(fvec4) Load 37(out2)
Store 48(out2) 49
Return
FunctionEnd
16(@main(struct-PSInput-f1-u11;vf4;vf4;): 2 Function None 12
13(input): 9(ptr) FunctionParameter
14(out1): 11(ptr) FunctionParameter
15(out2): 11(ptr) FunctionParameter
17: Label
Store 14(out1) 19
Store 15(out2) 21
Return
FunctionEnd

View File

@@ -0,0 +1,277 @@
hlsl.targetStruct1.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(struct-PSInput-f1-u11;vf4; ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Parameters:
0:12 'input' ( in structure{ temp float interp, temp uint no_interp})
0:12 'po' ( out 4-component vector of float)
0:? Sequence
0:14 move second child to first child ( temp 4-component vector of float)
0:14 o1: direct index for structure ( temp 4-component vector of float)
0:14 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:14 Constant:
0:14 0 (const int)
0:? Construct vec4 ( temp 4-component vector of float)
0:14 Convert uint to float ( temp float)
0:14 no_interp: direct index for structure ( temp uint)
0:14 'input' ( in structure{ temp float interp, temp uint no_interp})
0:14 Constant:
0:14 1 (const int)
0:14 interp: direct index for structure ( temp float)
0:14 'input' ( in structure{ temp float interp, temp uint no_interp})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 0.000000
0:14 Constant:
0:14 1.000000
0:15 move second child to first child ( temp 4-component vector of float)
0:15 o2: direct index for structure ( temp 4-component vector of float)
0:15 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:15 Constant:
0:15 1 (const int)
0:15 Constant:
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:16 move second child to first child ( temp 4-component vector of float)
0:16 'po' ( out 4-component vector of float)
0:16 Constant:
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:18 Branch: Return with expression
0:18 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Definition: main( ( temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:12 Sequence
0:12 move second child to first child ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Call: @main(struct-PSInput-f1-u11;vf4; ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'po' ( temp 4-component vector of float)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'o1' (layout( location=2) out 4-component vector of float)
0:12 o1: direct index for structure ( temp 4-component vector of float)
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Constant:
0:12 0 (const int)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'o2' (layout( location=1) out 4-component vector of float)
0:12 o2: direct index for structure ( temp 4-component vector of float)
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Constant:
0:12 1 (const int)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'po' (layout( location=0) out 4-component vector of float)
0:? 'po' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'o1' (layout( location=2) out 4-component vector of float)
0:? 'o2' (layout( location=1) out 4-component vector of float)
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:? 'po' (layout( location=0) out 4-component vector of float)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(struct-PSInput-f1-u11;vf4; ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Parameters:
0:12 'input' ( in structure{ temp float interp, temp uint no_interp})
0:12 'po' ( out 4-component vector of float)
0:? Sequence
0:14 move second child to first child ( temp 4-component vector of float)
0:14 o1: direct index for structure ( temp 4-component vector of float)
0:14 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:14 Constant:
0:14 0 (const int)
0:? Construct vec4 ( temp 4-component vector of float)
0:14 Convert uint to float ( temp float)
0:14 no_interp: direct index for structure ( temp uint)
0:14 'input' ( in structure{ temp float interp, temp uint no_interp})
0:14 Constant:
0:14 1 (const int)
0:14 interp: direct index for structure ( temp float)
0:14 'input' ( in structure{ temp float interp, temp uint no_interp})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 0.000000
0:14 Constant:
0:14 1.000000
0:15 move second child to first child ( temp 4-component vector of float)
0:15 o2: direct index for structure ( temp 4-component vector of float)
0:15 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:15 Constant:
0:15 1 (const int)
0:15 Constant:
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:16 move second child to first child ( temp 4-component vector of float)
0:16 'po' ( out 4-component vector of float)
0:16 Constant:
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:18 Branch: Return with expression
0:18 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Definition: main( ( temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:12 Sequence
0:12 move second child to first child ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Call: @main(struct-PSInput-f1-u11;vf4; ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'po' ( temp 4-component vector of float)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'o1' (layout( location=2) out 4-component vector of float)
0:12 o1: direct index for structure ( temp 4-component vector of float)
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Constant:
0:12 0 (const int)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'o2' (layout( location=1) out 4-component vector of float)
0:12 o2: direct index for structure ( temp 4-component vector of float)
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Constant:
0:12 1 (const int)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'po' (layout( location=0) out 4-component vector of float)
0:? 'po' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'o1' (layout( location=2) out 4-component vector of float)
0:? 'o2' (layout( location=1) out 4-component vector of float)
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:? 'po' (layout( location=0) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 65
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 43 57 60 63
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 8 "PSInput"
MemberName 8(PSInput) 0 "interp"
MemberName 8(PSInput) 1 "no_interp"
Name 12 "PSOutput"
MemberName 12(PSOutput) 0 "o1"
MemberName 12(PSOutput) 1 "o2"
Name 16 "@main(struct-PSInput-f1-u11;vf4;"
Name 14 "input"
Name 15 "po"
Name 19 "pso"
Name 40 "input"
Name 41 "PSInput"
MemberName 41(PSInput) 0 "interp"
MemberName 41(PSInput) 1 "no_interp"
Name 43 "input"
Name 49 "flattenTemp"
Name 50 "po"
Name 51 "param"
Name 53 "param"
Name 57 "o1"
Name 60 "o2"
Name 63 "po"
MemberDecorate 41(PSInput) 1 Flat
Decorate 43(input) Location 0
Decorate 57(o1) Location 2
Decorate 60(o2) Location 1
Decorate 63(po) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeInt 32 0
8(PSInput): TypeStruct 6(float) 7(int)
9: TypePointer Function 8(PSInput)
10: TypeVector 6(float) 4
11: TypePointer Function 10(fvec4)
12(PSOutput): TypeStruct 10(fvec4) 10(fvec4)
13: TypeFunction 12(PSOutput) 9(ptr) 11(ptr)
18: TypePointer Function 12(PSOutput)
20: TypeInt 32 1
21: 20(int) Constant 0
22: 20(int) Constant 1
23: TypePointer Function 7(int)
27: TypePointer Function 6(float)
30: 6(float) Constant 0
31: 6(float) Constant 1065353216
34: 10(fvec4) ConstantComposite 31 31 31 31
36: 10(fvec4) ConstantComposite 30 30 30 30
41(PSInput): TypeStruct 6(float) 7(int)
42: TypePointer Input 41(PSInput)
43(input): 42(ptr) Variable Input
56: TypePointer Output 10(fvec4)
57(o1): 56(ptr) Variable Output
60(o2): 56(ptr) Variable Output
63(po): 56(ptr) Variable Output
4(main): 2 Function None 3
5: Label
40(input): 9(ptr) Variable Function
49(flattenTemp): 18(ptr) Variable Function
50(po): 11(ptr) Variable Function
51(param): 9(ptr) Variable Function
53(param): 11(ptr) Variable Function
44: 41(PSInput) Load 43(input)
45: 6(float) CompositeExtract 44 0
46: 27(ptr) AccessChain 40(input) 21
Store 46 45
47: 7(int) CompositeExtract 44 1
48: 23(ptr) AccessChain 40(input) 22
Store 48 47
52: 8(PSInput) Load 40(input)
Store 51(param) 52
54:12(PSOutput) FunctionCall 16(@main(struct-PSInput-f1-u11;vf4;) 51(param) 53(param)
55: 10(fvec4) Load 53(param)
Store 50(po) 55
Store 49(flattenTemp) 54
58: 11(ptr) AccessChain 49(flattenTemp) 21
59: 10(fvec4) Load 58
Store 57(o1) 59
61: 11(ptr) AccessChain 49(flattenTemp) 22
62: 10(fvec4) Load 61
Store 60(o2) 62
64: 10(fvec4) Load 50(po)
Store 63(po) 64
Return
FunctionEnd
16(@main(struct-PSInput-f1-u11;vf4;):12(PSOutput) Function None 13
14(input): 9(ptr) FunctionParameter
15(po): 11(ptr) FunctionParameter
17: Label
19(pso): 18(ptr) Variable Function
24: 23(ptr) AccessChain 14(input) 22
25: 7(int) Load 24
26: 6(float) ConvertUToF 25
28: 27(ptr) AccessChain 14(input) 21
29: 6(float) Load 28
32: 10(fvec4) CompositeConstruct 26 29 30 31
33: 11(ptr) AccessChain 19(pso) 21
Store 33 32
35: 11(ptr) AccessChain 19(pso) 22
Store 35 34
Store 15(po) 36
37:12(PSOutput) Load 19(pso)
ReturnValue 37
FunctionEnd

View File

@@ -0,0 +1,277 @@
hlsl.targetStruct2.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(struct-PSInput-f1-u11;vf4; ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Parameters:
0:12 'input' ( in structure{ temp float interp, temp uint no_interp})
0:12 'po' ( out 4-component vector of float)
0:? Sequence
0:14 move second child to first child ( temp 4-component vector of float)
0:14 o1: direct index for structure ( temp 4-component vector of float)
0:14 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:14 Constant:
0:14 0 (const int)
0:? Construct vec4 ( temp 4-component vector of float)
0:14 Convert uint to float ( temp float)
0:14 no_interp: direct index for structure ( temp uint)
0:14 'input' ( in structure{ temp float interp, temp uint no_interp})
0:14 Constant:
0:14 1 (const int)
0:14 interp: direct index for structure ( temp float)
0:14 'input' ( in structure{ temp float interp, temp uint no_interp})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 0.000000
0:14 Constant:
0:14 1.000000
0:15 move second child to first child ( temp 4-component vector of float)
0:15 o2: direct index for structure ( temp 4-component vector of float)
0:15 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:15 Constant:
0:15 1 (const int)
0:15 Constant:
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:16 move second child to first child ( temp 4-component vector of float)
0:16 'po' ( out 4-component vector of float)
0:16 Constant:
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:18 Branch: Return with expression
0:18 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Definition: main( ( temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:12 Sequence
0:12 move second child to first child ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Call: @main(struct-PSInput-f1-u11;vf4; ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'po' ( temp 4-component vector of float)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'o1' (layout( location=2) out 4-component vector of float)
0:12 o1: direct index for structure ( temp 4-component vector of float)
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Constant:
0:12 0 (const int)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'o2' (layout( location=3) out 4-component vector of float)
0:12 o2: direct index for structure ( temp 4-component vector of float)
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Constant:
0:12 1 (const int)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'po' (layout( location=0) out 4-component vector of float)
0:? 'po' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'o1' (layout( location=2) out 4-component vector of float)
0:? 'o2' (layout( location=3) out 4-component vector of float)
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:? 'po' (layout( location=0) out 4-component vector of float)
Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: @main(struct-PSInput-f1-u11;vf4; ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Parameters:
0:12 'input' ( in structure{ temp float interp, temp uint no_interp})
0:12 'po' ( out 4-component vector of float)
0:? Sequence
0:14 move second child to first child ( temp 4-component vector of float)
0:14 o1: direct index for structure ( temp 4-component vector of float)
0:14 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:14 Constant:
0:14 0 (const int)
0:? Construct vec4 ( temp 4-component vector of float)
0:14 Convert uint to float ( temp float)
0:14 no_interp: direct index for structure ( temp uint)
0:14 'input' ( in structure{ temp float interp, temp uint no_interp})
0:14 Constant:
0:14 1 (const int)
0:14 interp: direct index for structure ( temp float)
0:14 'input' ( in structure{ temp float interp, temp uint no_interp})
0:14 Constant:
0:14 0 (const int)
0:14 Constant:
0:14 0.000000
0:14 Constant:
0:14 1.000000
0:15 move second child to first child ( temp 4-component vector of float)
0:15 o2: direct index for structure ( temp 4-component vector of float)
0:15 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:15 Constant:
0:15 1 (const int)
0:15 Constant:
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:15 1.000000
0:16 move second child to first child ( temp 4-component vector of float)
0:16 'po' ( out 4-component vector of float)
0:16 Constant:
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:16 0.000000
0:18 Branch: Return with expression
0:18 'pso' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Definition: main( ( temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:12 Sequence
0:12 move second child to first child ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Function Call: @main(struct-PSInput-f1-u11;vf4; ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:? 'input' ( temp structure{ temp float interp, temp uint no_interp})
0:? 'po' ( temp 4-component vector of float)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'o1' (layout( location=2) out 4-component vector of float)
0:12 o1: direct index for structure ( temp 4-component vector of float)
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Constant:
0:12 0 (const int)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'o2' (layout( location=3) out 4-component vector of float)
0:12 o2: direct index for structure ( temp 4-component vector of float)
0:12 'flattenTemp' ( temp structure{ temp 4-component vector of float o1, temp 4-component vector of float o2})
0:12 Constant:
0:12 1 (const int)
0:12 move second child to first child ( temp 4-component vector of float)
0:? 'po' (layout( location=0) out 4-component vector of float)
0:? 'po' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'o1' (layout( location=2) out 4-component vector of float)
0:? 'o2' (layout( location=3) out 4-component vector of float)
0:? 'input' (layout( location=0) in structure{ temp float interp, flat temp uint no_interp})
0:? 'po' (layout( location=0) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 65
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 43 57 60 63
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 8 "PSInput"
MemberName 8(PSInput) 0 "interp"
MemberName 8(PSInput) 1 "no_interp"
Name 12 "PSOutput"
MemberName 12(PSOutput) 0 "o1"
MemberName 12(PSOutput) 1 "o2"
Name 16 "@main(struct-PSInput-f1-u11;vf4;"
Name 14 "input"
Name 15 "po"
Name 19 "pso"
Name 40 "input"
Name 41 "PSInput"
MemberName 41(PSInput) 0 "interp"
MemberName 41(PSInput) 1 "no_interp"
Name 43 "input"
Name 49 "flattenTemp"
Name 50 "po"
Name 51 "param"
Name 53 "param"
Name 57 "o1"
Name 60 "o2"
Name 63 "po"
MemberDecorate 41(PSInput) 1 Flat
Decorate 43(input) Location 0
Decorate 57(o1) Location 2
Decorate 60(o2) Location 3
Decorate 63(po) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeInt 32 0
8(PSInput): TypeStruct 6(float) 7(int)
9: TypePointer Function 8(PSInput)
10: TypeVector 6(float) 4
11: TypePointer Function 10(fvec4)
12(PSOutput): TypeStruct 10(fvec4) 10(fvec4)
13: TypeFunction 12(PSOutput) 9(ptr) 11(ptr)
18: TypePointer Function 12(PSOutput)
20: TypeInt 32 1
21: 20(int) Constant 0
22: 20(int) Constant 1
23: TypePointer Function 7(int)
27: TypePointer Function 6(float)
30: 6(float) Constant 0
31: 6(float) Constant 1065353216
34: 10(fvec4) ConstantComposite 31 31 31 31
36: 10(fvec4) ConstantComposite 30 30 30 30
41(PSInput): TypeStruct 6(float) 7(int)
42: TypePointer Input 41(PSInput)
43(input): 42(ptr) Variable Input
56: TypePointer Output 10(fvec4)
57(o1): 56(ptr) Variable Output
60(o2): 56(ptr) Variable Output
63(po): 56(ptr) Variable Output
4(main): 2 Function None 3
5: Label
40(input): 9(ptr) Variable Function
49(flattenTemp): 18(ptr) Variable Function
50(po): 11(ptr) Variable Function
51(param): 9(ptr) Variable Function
53(param): 11(ptr) Variable Function
44: 41(PSInput) Load 43(input)
45: 6(float) CompositeExtract 44 0
46: 27(ptr) AccessChain 40(input) 21
Store 46 45
47: 7(int) CompositeExtract 44 1
48: 23(ptr) AccessChain 40(input) 22
Store 48 47
52: 8(PSInput) Load 40(input)
Store 51(param) 52
54:12(PSOutput) FunctionCall 16(@main(struct-PSInput-f1-u11;vf4;) 51(param) 53(param)
55: 10(fvec4) Load 53(param)
Store 50(po) 55
Store 49(flattenTemp) 54
58: 11(ptr) AccessChain 49(flattenTemp) 21
59: 10(fvec4) Load 58
Store 57(o1) 59
61: 11(ptr) AccessChain 49(flattenTemp) 22
62: 10(fvec4) Load 61
Store 60(o2) 62
64: 10(fvec4) Load 50(po)
Store 63(po) 64
Return
FunctionEnd
16(@main(struct-PSInput-f1-u11;vf4;):12(PSOutput) Function None 13
14(input): 9(ptr) FunctionParameter
15(po): 11(ptr) FunctionParameter
17: Label
19(pso): 18(ptr) Variable Function
24: 23(ptr) AccessChain 14(input) 22
25: 7(int) Load 24
26: 6(float) ConvertUToF 25
28: 27(ptr) AccessChain 14(input) 21
29: 6(float) Load 28
32: 10(fvec4) CompositeConstruct 26 29 30 31
33: 11(ptr) AccessChain 19(pso) 21
Store 33 32
35: 11(ptr) AccessChain 19(pso) 22
Store 35 34
Store 15(po) 36
37:12(PSOutput) Load 19(pso)
ReturnValue 37
FunctionEnd

View File

@@ -0,0 +1,57 @@
spv.OVR_multiview.vert
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 27
Capability Shader
Capability MultiView
Extension "SPV_KHR_multiview"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 13 17 25 26
Source GLSL 330
SourceExtension "GL_OVR_multiview"
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"
Name 13 ""
Name 17 "gl_ViewID_OVR"
Name 25 "gl_VertexID"
Name 26 "gl_InstanceID"
MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 11(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance
Decorate 11(gl_PerVertex) Block
Decorate 17(gl_ViewID_OVR) BuiltIn ViewIndex
Decorate 25(gl_VertexID) BuiltIn VertexId
Decorate 26(gl_InstanceID) BuiltIn InstanceId
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
12: TypePointer Output 11(gl_PerVertex)
13: 12(ptr) Variable Output
14: TypeInt 32 1
15: 14(int) Constant 0
16: TypePointer Input 8(int)
17(gl_ViewID_OVR): 16(ptr) Variable Input
20: 6(float) Constant 0
22: TypePointer Output 7(fvec4)
24: TypePointer Input 14(int)
25(gl_VertexID): 24(ptr) Variable Input
26(gl_InstanceID): 24(ptr) Variable Input
4(main): 2 Function None 3
5: Label
18: 8(int) Load 17(gl_ViewID_OVR)
19: 6(float) ConvertUToF 18
21: 7(fvec4) CompositeConstruct 19 20 20 20
23: 22(ptr) AccessChain 13 15
Store 23 21
Return
FunctionEnd

View File

@@ -0,0 +1,26 @@
spv.shaderStencilExport.frag
Missing functionality: shader stencil export
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 10
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_ARB_shader_stencil_export"
Name 4 "main"
Name 8 "gl_FragStencilRefARB"
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Output 6(int)
8(gl_FragStencilRefARB): 7(ptr) Variable Output
9: 6(int) Constant 100
4(main): 2 Function None 3
5: Label
Store 8(gl_FragStencilRefARB) 9
Return
FunctionEnd

View File

@@ -11,7 +11,7 @@ spv.specConstant.vert
Source GLSL 400
Name 4 "main"
Name 9 "arraySize"
Name 14 "foo(vf4[s1521];"
Name 14 "foo(vf4[s1522];"
Name 13 "p"
Name 17 "builtin_spec_constant("
Name 20 "color"
@@ -102,10 +102,10 @@ spv.specConstant.vert
Store 20(color) 46
48: 10 Load 22(ucol)
Store 47(param) 48
49: 2 FunctionCall 14(foo(vf4[s1521];) 47(param)
49: 2 FunctionCall 14(foo(vf4[s1522];) 47(param)
Return
FunctionEnd
14(foo(vf4[s1521];): 2 Function None 12
14(foo(vf4[s1522];): 2 Function None 12
13(p): 11(ptr) FunctionParameter
15: Label
54: 24(ptr) AccessChain 53(dupUcol) 23

39
3rdparty/glslang/Test/hlsl.hull.3.tesc vendored Normal file
View File

@@ -0,0 +1,39 @@
// ***
// invocation ID coming from synthesized variable
// ***
struct VS_OUT
{
float3 cpoint : CPOINT;
};
struct HS_CONSTANT_OUT
{
float edges[2] : SV_TessFactor;
};
struct HS_OUT
{
float3 cpoint : CPOINT;
};
[domain("tri")]
[partitioning("integer")]
[outputtopology("point")]
[outputcontrolpoints(4)]
[patchconstantfunc("PCF")]
HS_OUT main(InputPatch<VS_OUT, 4> ip)
{
HS_OUT output;
output.cpoint = ip[0].cpoint;
return output;
}
HS_CONSTANT_OUT PCF(uint pid : SV_PrimitiveId, float4 pos : SV_Position)
{
HS_CONSTANT_OUT output;
output.edges[0] = 2.0f;
output.edges[1] = 8.0f;
return output;
}

View File

@@ -19,7 +19,7 @@ struct HS_OUT
[domain("tri")]
[partitioning("fractional_even")]
[outputtopology("line")]
[outputtopology("triangle_ccw")]
[outputcontrolpoints(3)]
[patchconstantfunc("PCF")]
HS_OUT main(InputPatch<VS_OUT, 3> ip)

10
3rdparty/glslang/Test/hlsl.target.frag vendored Normal file
View File

@@ -0,0 +1,10 @@
struct PSInput {
float interp;
uint no_interp;
};
void main(PSInput input : INPUT, out float4 out1 : SV_TARGET1, out float4 out2 : SV_TARGET3)
{
out1 = 1;
out2 = 0;
}

View File

@@ -0,0 +1,19 @@
struct PSInput {
float interp;
uint no_interp;
};
struct PSOutput {
float4 o1 : SV_TARGET2;
float4 o2 : SV_TARGET1;
};
PSOutput main(PSInput input : INPUT, out float4 po : SV_TARGET0)
{
PSOutput pso;
pso.o1 = float4(float(input.no_interp), input.interp, 0, 1);
pso.o2 = 1;
po = 0;
return pso;
}

View File

@@ -0,0 +1,19 @@
struct PSInput {
float interp;
uint no_interp;
};
struct PSOutput {
float4 o1 : SV_TARGET1;
float4 o2 : SV_TARGET0;
};
PSOutput main(PSInput input : INPUT, out float4 po : SV_TARGET0) : SV_TARGET2
{
PSOutput pso;
pso.o1 = float4(float(input.no_interp), input.interp, 0, 1);
pso.o2 = 1;
po = 0;
return pso;
}

View File

@@ -127,6 +127,16 @@ diff -b $BASEDIR/glsl.-D-U.frag.out $TARGETDIR/glsl.-D-U.frag.out || HASERROR=1
$EXE -D -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out
diff -b $BASEDIR/hlsl.-D-U.frag.out $TARGETDIR/hlsl.-D-U.frag.out || HASERROR=1
#
# Test --client and --target-env
#
$EXE --client vulkan100 spv.targetVulkan.vert || HASERROR=1
$EXE --client opengl100 spv.targetOpenGL.vert || HASERROR=1
$EXE --target-env vulkan1.0 spv.targetVulkan.vert || HASERROR=1
$EXE --target-env opengl spv.targetOpenGL.vert || HASERROR=1
$EXE -V100 spv.targetVulkan.vert || HASERROR=1
$EXE -G100 spv.targetOpenGL.vert || HASERROR=1
#
# Final checking
#

View File

@@ -0,0 +1,7 @@
#version 330
#extension GL_OVR_multiview : enable
void main() {
gl_Position = vec4(gl_ViewID_OVR, 0, 0, 0);
}

View File

@@ -0,0 +1,8 @@
#version 450 core
#extension GL_ARB_shader_stencil_export: enable
void main()
{
gl_FragStencilRefARB = 100;
}

9
3rdparty/glslang/Test/spv.targetOpenGL.vert vendored Executable file
View File

@@ -0,0 +1,9 @@
#version 450
layout(constant_id = 3) const int a = 2;
uniform float f;
void main()
{
}

9
3rdparty/glslang/Test/spv.targetVulkan.vert vendored Executable file
View File

@@ -0,0 +1,9 @@
#version 450
layout(constant_id = 3) const int a = 2;
layout(push_constant) uniform pc { float f; };
void main()
{
}

View File

@@ -193,6 +193,7 @@ enum TBuiltInVariable {
EbvFragColor,
EbvFragData,
EbvFragDepth,
EbvFragStencilRef,
EbvSampleId,
EbvSamplePosition,
EbvSampleMask,
@@ -222,7 +223,6 @@ enum TBuiltInVariable {
// to one of the above.
EbvFragDepthGreater,
EbvFragDepthLesser,
EbvStencilRef,
EbvGsOutputStream,
EbvOutputPatch,
EbvInputPatch,
@@ -329,6 +329,7 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case EbvFragColor: return "FragColor";
case EbvFragData: return "FragData";
case EbvFragDepth: return "FragDepth";
case EbvFragStencilRef: return "FragStencilRef";
case EbvSampleId: return "SampleId";
case EbvSamplePosition: return "SamplePosition";
case EbvSampleMask: return "SampleMaskIn";

View File

@@ -1333,6 +1333,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod
"vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod
"float shadow2DEXT(sampler2DShadow, vec3);" // GL_EXT_shadow_samplers
"float shadow2DProjEXT(sampler2DShadow, vec4);" // GL_EXT_shadow_samplers
"\n");
}
}
@@ -3454,6 +3457,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if (version >= 300 /* both ES and non-ES */) {
stageBuiltins[EShLangVertex].append(
"in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2
"\n");
}
//============================================================================
//
@@ -3750,6 +3759,10 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins[EShLangFragment].append(
"vec2 gl_PointCoord;" // needs qualifier fixed later
);
if (version >= 140)
stageBuiltins[EShLangFragment].append(
"out int gl_FragStencilRefARB;"
);
if (IncludeLegacy(version, profile, spvVersion) || (! ForwardCompatibility && version < 420))
stageBuiltins[EShLangFragment].append(
"vec4 gl_FragColor;" // needs qualifier fixed later
@@ -3898,6 +3911,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if (version >= 300 /* both ES and non-ES */) {
stageBuiltins[EShLangFragment].append(
"flat in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2
"\n");
}
// printf("%s\n", commonBuiltins.c_str());
// printf("%s\n", stageBuiltins[EShLangFragment].c_str());
}
@@ -5324,6 +5343,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);
}
if (version >= 300 /* both ES and non-ES */) {
symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);
BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);
}
if (profile == EEsProfile) {
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
}
// Fall through
case EShLangTessControl:
@@ -5465,6 +5494,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_CullDistance", EbvCullDistance, symbolTable);
BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable);
if (profile != EEsProfile && version >= 140) {
symbolTable.setVariableExtensions("gl_FragStencilRefARB", 1, &E_GL_ARB_shader_stencil_export);
BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable);
}
if ((profile != EEsProfile && version >= 400) ||
(profile == EEsProfile && version >= 310)) {
BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable);
@@ -5661,6 +5695,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
if (version >= 300 /* both ES and non-ES */) {
symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);
BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);
}
if (profile == EEsProfile) {
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
}
break;
case EShLangCompute:
@@ -6048,6 +6091,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("sparseTextureGatherLodOffsetsAMD", EOpSparseTextureGatherLodOffsets);
#endif
}
if (profile == EEsProfile) {
symbolTable.relateToOperator("shadow2DEXT", EOpTexture);
symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj);
}
}
switch(language) {

View File

@@ -50,7 +50,8 @@ namespace glslang {
TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, bool parsingBuiltins,
int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
TInfoSink& infoSink, bool forwardCompatible, EShMessages messages) :
TParseContextBase(symbolTable, interm, parsingBuiltins, version, profile, spvVersion, language, infoSink, forwardCompatible, messages),
TParseContextBase(symbolTable, interm, parsingBuiltins, version, profile, spvVersion, language,
infoSink, forwardCompatible, messages),
inMain(false),
blockName(nullptr),
limits(resources.limits),
@@ -4777,8 +4778,22 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
if (shaderQualifiers.geometry != ElgNone)
error(loc, message, TQualifier::getGeometryString(shaderQualifiers.geometry), "");
if (shaderQualifiers.spacing != EvsNone)
error(loc, message, TQualifier::getVertexSpacingString(shaderQualifiers.spacing), "");
if (shaderQualifiers.order != EvoNone)
error(loc, message, TQualifier::getVertexOrderString(shaderQualifiers.order), "");
if (shaderQualifiers.pointMode)
error(loc, message, "point_mode", "");
if (shaderQualifiers.invocations != TQualifier::layoutNotSet)
error(loc, message, "invocations", "");
if (shaderQualifiers.earlyFragmentTests)
error(loc, message, "early_fragment_tests", "");
for (int i = 0; i < 3; ++i) {
if (shaderQualifiers.localSize[i] > 1)
error(loc, message, "local_size", "");
if (shaderQualifiers.localSizeSpecId[i] != TQualifier::layoutNotSet)
error(loc, message, "local_size id", "");
}
if (shaderQualifiers.vertices != TQualifier::layoutNotSet) {
if (language == EShLangGeometry)
error(loc, message, "max_vertices", "");
@@ -4787,15 +4802,8 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
else
assert(0);
}
for (int i = 0; i < 3; ++i) {
if (shaderQualifiers.localSize[i] > 1)
error(loc, message, "local_size", "");
if (shaderQualifiers.localSizeSpecId[i] != TQualifier::layoutNotSet)
error(loc, message, "local_size id", "");
}
if (shaderQualifiers.blendEquation)
error(loc, message, "blend equation", "");
// TBD: correctness: are any of these missing? pixelCenterInteger, originUpperLeft, spacing, order, pointmode, earlyfragment, depth
}
// Correct and/or advance an object's offset layout qualifier.

View File

@@ -80,8 +80,8 @@ public:
statementNestingLevel(0), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0),
postEntryPointReturn(false),
contextPragma(true, false),
limits(resources.limits),
parsingBuiltins(parsingBuiltins), scanContext(nullptr), ppContext(nullptr),
limits(resources.limits),
globalUniformBlock(nullptr)
{ }
virtual ~TParseContextBase() { }

View File

@@ -1113,8 +1113,10 @@ int TScanContext::tokenizeIdentifier()
case SAMPLER2DSHADOW:
afterType = true;
if (parseContext.profile == EEsProfile && parseContext.version < 300)
reservedWord();
if (parseContext.profile == EEsProfile && parseContext.version < 300) {
if (!parseContext.extensionTurnedOn(E_GL_EXT_shadow_samplers))
reservedWord();
}
return keyword;
case SAMPLER2DRECT:

View File

@@ -569,6 +569,73 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
return correct;
}
// There are multiple paths in for setting environment stuff.
// TEnvironment takes precedence, for what it sets, so sort all this out.
// Ideally, the internal code could be made to use TEnvironment, but for
// now, translate it to the historically used parameters.
void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages, EShSource& source,
EShLanguage& stage, SpvVersion& spvVersion)
{
// Set up environmental defaults, first ignoring 'environment'.
if (messages & EShMsgSpvRules)
spvVersion.spv = 0x00010000;
if (messages & EShMsgVulkanRules) {
spvVersion.vulkan = 100;
spvVersion.vulkanGlsl = 100;
} else if (spvVersion.spv != 0)
spvVersion.openGl = 100;
// Now, override, based on any content set in 'environment'.
// 'environment' must be cleared to ESh*None settings when items
// are not being set.
if (environment != nullptr) {
// input language
if (environment->input.languageFamily != EShSourceNone) {
stage = environment->input.stage;
switch (environment->input.dialect) {
case EShClientNone:
break;
case EShClientVulkan:
spvVersion.vulkanGlsl = environment->input.dialectVersion;
break;
case EShClientOpenGL:
spvVersion.openGl = environment->input.dialectVersion;
break;
}
switch (environment->input.languageFamily) {
case EShSourceNone:
break;
case EShSourceGlsl:
source = EShSourceGlsl;
messages = static_cast<EShMessages>(messages & ~EShMsgReadHlsl);
break;
case EShSourceHlsl:
source = EShSourceHlsl;
messages = static_cast<EShMessages>(messages | EShMsgReadHlsl);
break;
}
}
// client
switch (environment->client.client) {
case EShClientVulkan:
spvVersion.vulkan = environment->client.version;
break;
default:
break;
}
// generated code
switch (environment->target.language) {
case EshTargetSpv:
spvVersion.spv = environment->target.version;
break;
default:
break;
}
}
}
// This is the common setup and cleanup code for PreprocessDeferred and
// CompileDeferred.
// It takes any callable with a signature of
@@ -599,8 +666,8 @@ bool ProcessDeferred(
ProcessingContext& processingContext,
bool requireNonempty,
TShader::Includer& includer,
const std::string sourceEntryPointName = ""
)
const std::string sourceEntryPointName = "",
const TEnvironment* environment = nullptr) // optional way of fully setting all versions, overriding the above
{
if (! InitThread())
return false;
@@ -641,6 +708,13 @@ bool ProcessDeferred(
names[s + numPre] = nullptr;
}
// Get all the stages, languages, clients, and other environment
// stuff sorted out.
EShSource source = (messages & EShMsgReadHlsl) != 0 ? EShSourceHlsl : EShSourceGlsl;
SpvVersion spvVersion;
EShLanguage stage = compiler->getLanguage();
TranslateEnvironment(environment, messages, source, stage, spvVersion);
// First, without using the preprocessor or parser, find the #version, so we know what
// symbol tables, processing rules, etc. to set up. This does not need the extra strings
// outlined above, just the user shader, after the system and user preambles.
@@ -648,11 +722,11 @@ bool ProcessDeferred(
int version = 0;
EProfile profile = ENoProfile;
bool versionNotFirstToken = false;
bool versionNotFirst = (messages & EShMsgReadHlsl) ?
true :
userInput.scanVersion(version, profile, versionNotFirstToken);
bool versionNotFirst = (source == EShSourceHlsl)
? true
: userInput.scanVersion(version, profile, versionNotFirstToken);
bool versionNotFound = version == 0;
if (forceDefaultVersionAndProfile && (messages & EShMsgReadHlsl) == 0) {
if (forceDefaultVersionAndProfile && source == EShSourceGlsl) {
if (! (messages & EShMsgSuppressWarnings) && ! versionNotFound &&
(version != defaultVersion || profile != defaultProfile)) {
compiler->infoSink.info << "Warning, (version, profile) forced to be ("
@@ -669,15 +743,8 @@ bool ProcessDeferred(
version = defaultVersion;
profile = defaultProfile;
}
SpvVersion spvVersion;
if (messages & EShMsgSpvRules)
spvVersion.spv = 0x00010000; // TODO: eventually have this come from the outside
EShSource source = (messages & EShMsgReadHlsl) ? EShSourceHlsl : EShSourceGlsl;
if (messages & EShMsgVulkanRules)
spvVersion.vulkan = 100; // TODO: eventually have this come from the outside
else if (spvVersion.spv != 0)
spvVersion.openGl = 100; // TODO: eventually have this come from the outside
bool goodVersion = DeduceVersionProfile(compiler->infoSink, compiler->getLanguage(),
bool goodVersion = DeduceVersionProfile(compiler->infoSink, stage,
versionNotFirst, defaultVersion, source, version, profile, spvVersion);
bool versionWillBeError = (versionNotFound || (profile == EEsProfile && version >= 300 && versionNotFirst));
bool warnVersionNotFirst = false;
@@ -694,7 +761,7 @@ bool ProcessDeferred(
intermediate.setSpv(spvVersion);
if (spvVersion.vulkan >= 100)
intermediate.setOriginUpperLeft();
if ((messages & EShMsgHlslOffsets) || (messages & EShMsgReadHlsl))
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
intermediate.setHlslOffsets();
if (messages & EShMsgDebugInfo) {
intermediate.setSourceFile(names[numPre]);
@@ -707,7 +774,7 @@ bool ProcessDeferred(
[MapSpvVersionToIndex(spvVersion)]
[MapProfileToIndex(profile)]
[MapSourceToIndex(source)]
[compiler->getLanguage()];
[stage];
// Dynamically allocate the symbol table so we can control when it is deallocated WRT the pool.
TSymbolTable* symbolTableMemory = new TSymbolTable;
@@ -718,7 +785,7 @@ bool ProcessDeferred(
// Add built-in symbols that are potentially context dependent;
// they get popped again further down.
if (! AddContextSpecificSymbols(resources, compiler->infoSink, symbolTable, version, profile, spvVersion,
compiler->getLanguage(), source))
stage, source))
return false;
//
@@ -726,14 +793,14 @@ bool ProcessDeferred(
//
TParseContextBase* parseContext = CreateParseContext(symbolTable, intermediate, version, profile, source,
compiler->getLanguage(), compiler->infoSink,
stage, compiler->infoSink,
spvVersion, forwardCompatible, messages, false, sourceEntryPointName);
TPpContext ppContext(*parseContext, names[numPre] ? names[numPre] : "", includer);
// only GLSL (bison triggered, really) needs an externally set scan context
glslang::TScanContext scanContext(*parseContext);
if ((messages & EShMsgReadHlsl) == 0)
if (source == EShSourceGlsl)
parseContext->setScanContext(&scanContext);
parseContext->setPpContext(&ppContext);
@@ -1052,14 +1119,15 @@ bool CompileDeferred(
EShMessages messages, // warnings/errors/AST; things to print out
TIntermediate& intermediate,// returned tree, etc.
TShader::Includer& includer,
const std::string sourceEntryPointName = "")
const std::string sourceEntryPointName = "",
TEnvironment* environment = nullptr)
{
DoFullParse parser;
return ProcessDeferred(compiler, shaderStrings, numStrings, inputLengths, stringNames,
preamble, optLevel, resources, defaultVersion,
defaultProfile, forceDefaultVersionAndProfile,
forwardCompatible, messages, intermediate, parser,
true, includer, sourceEntryPointName);
true, includer, sourceEntryPointName, environment);
}
} // end anonymous namespace for local functions
@@ -1485,6 +1553,12 @@ TShader::TShader(EShLanguage s)
infoSink = new TInfoSink;
compiler = new TDeferredCompiler(stage, *infoSink);
intermediate = new TIntermediate(s);
// clear environment (avoid constructors in them for use in a C interface)
environment.input.languageFamily = EShSourceNone;
environment.input.dialect = EShClientNone;
environment.client.client = EShClientNone;
environment.target.language = EShTargetNone;
}
TShader::~TShader()
@@ -1572,7 +1646,8 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
return CompileDeferred(compiler, strings, numStrings, lengths, stringNames,
preamble, EShOptNone, builtInResources, defaultVersion,
defaultProfile, forceDefaultVersionAndProfile,
forwardCompatible, messages, *intermediate, includer, sourceEntryPointName);
forwardCompatible, messages, *intermediate, includer, sourceEntryPointName,
&environment);
}
// Fill in a string with the result of preprocessing ShaderStrings

View File

@@ -155,7 +155,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_frag_depth] = EBhDisable;
extensionBehavior[E_GL_OES_EGL_image_external] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_texture_lod] = EBhDisable;
extensionBehavior[E_GL_EXT_shadow_samplers] = EBhDisable;
extensionBehavior[E_GL_ARB_texture_rectangle] = EBhDisable;
extensionBehavior[E_GL_3DL_array_objects] = EBhDisable;
extensionBehavior[E_GL_ARB_shading_language_420pack] = EBhDisable;
@@ -179,6 +179,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_shader_ballot] = EBhDisable;
extensionBehavior[E_GL_ARB_sparse_texture2] = EBhDisable;
extensionBehavior[E_GL_ARB_sparse_texture_clamp] = EBhDisable;
extensionBehavior[E_GL_ARB_shader_stencil_export] = EBhDisable;
// extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable;
@@ -238,6 +239,10 @@ void TParseVersions::initializeExtensionBehavior()
// EXT extensions
extensionBehavior[E_GL_EXT_device_group] = EBhDisable;
extensionBehavior[E_GL_EXT_multiview] = EBhDisable;
// OVR extensions
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;
extensionBehavior[E_GL_OVR_multiview2] = EBhDisable;
}
// Get code that is not part of a shared symbol table, is specific to this shader,
@@ -253,6 +258,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_frag_depth 1\n"
"#define GL_OES_EGL_image_external 1\n"
"#define GL_EXT_shader_texture_lod 1\n"
"#define GL_EXT_shadow_samplers 1\n"
// AEP
"#define GL_ANDROID_extension_pack_es31a 1\n"
@@ -308,6 +314,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_shader_ballot 1\n"
"#define GL_ARB_sparse_texture2 1\n"
"#define GL_ARB_sparse_texture_clamp 1\n"
"#define GL_ARB_shader_stencil_export 1\n"
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
"#define GL_EXT_shader_image_load_formatted 1\n"
@@ -340,12 +347,19 @@ void TParseVersions::getPreamble(std::string& preamble)
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
preamble +=
preamble +=
"#define GL_EXT_device_group 1\n"
"#define GL_EXT_multiview 1\n"
;
}
if (version >= 300 /* both ES and non-ES */) {
preamble +=
"#define GL_OVR_multiview 1\n"
"#define GL_OVR_multiview2 1\n"
;
}
// #line and #include
preamble +=
"#define GL_GOOGLE_cpp_style_line_directive 1\n"
@@ -355,9 +369,9 @@ void TParseVersions::getPreamble(std::string& preamble)
// #define VULKAN XXXX
const int numberBufSize = 12;
char numberBuf[numberBufSize];
if (spvVersion.vulkan > 0) {
if (spvVersion.vulkanGlsl > 0) {
preamble += "#define VULKAN ";
snprintf(numberBuf, numberBufSize, "%d", spvVersion.vulkan);
snprintf(numberBuf, numberBufSize, "%d", spvVersion.vulkanGlsl);
preamble += numberBuf;
preamble += "\n";
}

View File

@@ -72,14 +72,19 @@ inline const char* ProfileName(EProfile profile)
}
//
// SPIR-V has versions for multiple things; tie them together.
// 0 means a target or rule set is not enabled.
// What source rules, validation rules, target language, etc. are needed
// desired for SPIR-V?
//
// 0 means a target or rule set is not enabled (ignore rules from that entity).
// Non-0 means to apply semantic rules arising from that version of its rule set.
// The union of all requested rule sets will be applied.
//
struct SpvVersion {
SpvVersion() : spv(0), vulkan(0), openGl(0) {}
unsigned int spv; // the version of the targeted SPIR-V, as defined by SPIR-V in word 1 of the SPIR-V binary header
int vulkan; // the version of semantics for Vulkan; e.g., for GLSL from KHR_vulkan_glsl "#define VULKAN"
int openGl; // the version of semantics for OpenGL; e.g., for GLSL from KHR_vulkan_glsl "#define GL_SPIRV"
SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0) {}
unsigned int spv; // the version of SPIR-V to target, as defined by "word 1" of the SPIR-V binary header
int vulkanGlsl; // the version of GLSL semantics for Vulkan, from GL_KHR_vulkan_glsl, for "#define VULKAN XXX"
int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use (100 means 1.0)
int openGl; // the version of GLSL semantics for OpenGL, from GL_ARB_gl_spirv, for "#define GL_SPIRV XXX"
};
//
@@ -103,6 +108,7 @@ const char* const E_GL_OES_standard_derivatives = "GL_OES_standard_deriv
const char* const E_GL_EXT_frag_depth = "GL_EXT_frag_depth";
const char* const E_GL_OES_EGL_image_external = "GL_OES_EGL_image_external";
const char* const E_GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod";
const char* const E_GL_EXT_shadow_samplers = "GL_EXT_shadow_samplers";
const char* const E_GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle";
const char* const E_GL_3DL_array_objects = "GL_3DL_array_objects";
@@ -127,6 +133,7 @@ const char* const E_GL_ARB_gpu_shader_int64 = "GL_ARB_gpu_shader_int
const char* const E_GL_ARB_shader_ballot = "GL_ARB_shader_ballot";
const char* const E_GL_ARB_sparse_texture2 = "GL_ARB_sparse_texture2";
const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture_clamp";
const char* const E_GL_ARB_shader_stencil_export = "GL_ARB_shader_stencil_export";
// const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers";
@@ -136,6 +143,13 @@ const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_lo
const char* const E_GL_EXT_device_group = "GL_EXT_device_group";
const char* const E_GL_EXT_multiview = "GL_EXT_multiview";
// OVR extensions
const char* const E_GL_OVR_multiview = "GL_OVR_multiview";
const char* const E_GL_OVR_multiview2 = "GL_OVR_multiview2";
const char* const OVR_multiview_EXTs[] = { E_GL_OVR_multiview, E_GL_OVR_multiview2 };
const int Num_OVR_multiview_EXTs = sizeof(OVR_multiview_EXTs) / sizeof(OVR_multiview_EXTs[0]);
// #line and #include
const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive";
const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive";

View File

@@ -459,9 +459,9 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
error(infoSink, "At least one shader must specify an output layout(vertices=...)");
break;
case EShLangTessEvaluation:
if (inputPrimitive == ElgNone)
error(infoSink, "At least one shader must specify an input layout primitive");
if (source == EShSourceGlsl) {
if (inputPrimitive == ElgNone)
error(infoSink, "At least one shader must specify an input layout primitive");
if (vertexSpacing == EvsNone)
vertexSpacing = EvsEqual;
if (vertexOrder == EvoNone)

View File

@@ -110,7 +110,44 @@ typedef enum {
EShSourceNone,
EShSourceGlsl,
EShSourceHlsl,
} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead
} EShSource; // if EShLanguage were EShStage, this could be EShLanguage instead
typedef enum {
EShClientNone,
EShClientVulkan,
EShClientOpenGL,
} EShClient;
typedef enum {
EShTargetNone,
EshTargetSpv,
} EShTargetLanguage;
struct TInputLanguage {
EShSource languageFamily; // redundant information with other input, this one overrides when not EShSourceNone
EShLanguage stage; // redundant information with other input, this one overrides when not EShSourceNone
EShClient dialect;
int dialectVersion; // version of client's language definition, not the client (when not EShClientNone)
};
struct TClient {
EShClient client;
int version; // version of client itself (not the client's input dialect)
};
struct TTarget {
EShTargetLanguage language;
unsigned int version; // the version to target, if SPIR-V, defined by "word 1" of the SPIR-V binary header
};
// All source/client/target versions and settings.
// Can override previous methods of setting, when items are set here.
// Expected to grow, as more are added, rather than growing parameter lists.
struct TEnvironment {
TInputLanguage input; // definition of the input language
TClient client; // what client is the overall compilation being done for?
TTarget target; // what to generate
};
const char* StageName(EShLanguage);
@@ -324,6 +361,25 @@ public:
void setNoStorageFormat(bool useUnknownFormat);
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode);
// For setting up the environment (initialized in the constructor):
void setEnvInput(EShSource lang, EShLanguage stage, EShClient client, int version)
{
environment.input.languageFamily = lang;
environment.input.stage = stage;
environment.input.dialect = client;
environment.input.dialectVersion = version;
}
void setEnvClient(EShClient client, int version)
{
environment.client.client = client;
environment.client.version = version;
}
void setEnvTarget(EShTargetLanguage lang, unsigned int version)
{
environment.target.language = lang;
environment.target.version = version;
}
// Interface to #include handlers.
//
// To support #include, a client of Glslang does the following:
@@ -463,6 +519,8 @@ protected:
// a function in the source string can be renamed FROM this TO the name given in setEntryPoint.
std::string sourceEntryPointName;
TEnvironment environment;
friend class TProgram;
private:

View File

@@ -143,6 +143,7 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.function.frag", "main"},
{"hlsl.hull.1.tesc", "main"},
{"hlsl.hull.2.tesc", "main"},
{"hlsl.hull.3.tesc", "main"},
{"hlsl.hull.void.tesc", "main"},
{"hlsl.hull.ctrlpt-1.tesc", "main"},
{"hlsl.hull.ctrlpt-2.tesc", "main"},
@@ -299,6 +300,9 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.struct.frag", "PixelShaderFunction"},
{"hlsl.switch.frag", "PixelShaderFunction"},
{"hlsl.swizzle.frag", "PixelShaderFunction"},
{"hlsl.target.frag", "main"},
{"hlsl.targetStruct1.frag", "main"},
{"hlsl.targetStruct2.frag", "main"},
{"hlsl.templatetypes.frag", "PixelShaderFunction"},
{"hlsl.tx.bracket.frag", "main"},
{"hlsl.tx.overload.frag", "main"},

View File

@@ -278,6 +278,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.shaderBallot.comp",
"spv.shaderDrawParams.vert",
"spv.shaderGroupVote.comp",
"spv.shaderStencilExport.frag",
"spv.shiftOps.frag",
"spv.simpleFunctionCall.frag",
"spv.simpleMat.vert",
@@ -332,7 +333,7 @@ INSTANTIATE_TEST_CASE_P(
{ "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
{ "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
{ "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
{ "spv.register.autoassign.rangetest.frag", "main",
{ "spv.register.autoassign.rangetest.frag", "main",
glslang::TQualifier::layoutBindingEnd-2,
glslang::TQualifier::layoutBindingEnd+5,
20, 30, true, false },
@@ -357,6 +358,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.atomic.comp",
"spv.glFragColor.frag",
"spv.specConst.vert",
"spv.OVR_multiview.vert",
})),
FileNameAsCustomTestSuffix
);

View File

@@ -1174,7 +1174,8 @@ void HlslParseContext::flatten(const TSourceLoc& loc, const TVariable& variable)
const TType& type = variable.getType();
auto entry = flattenMap.insert(std::make_pair(variable.getUniqueId(),
TFlattenData(type.getQualifier().layoutBinding)));
TFlattenData(type.getQualifier().layoutBinding,
type.getQualifier().layoutLocation)));
// the item is a map pair, so first->second is the TFlattenData itself.
flatten(loc, variable, type, entry.first->second, "");
@@ -1236,6 +1237,19 @@ int HlslParseContext::addFlattenedMember(const TSourceLoc& loc,
if (flattenData.nextBinding != TQualifier::layoutBindingEnd)
memberVariable->getWritableType().getQualifier().layoutBinding = flattenData.nextBinding++;
if (memberVariable->getType().getQualifier().builtIn == EbvNone) {
// inherited locations must be auto bumped, not replicated
if (flattenData.nextLocation != TQualifier::layoutLocationEnd &&
memberVariable->getType().getQualifier().builtIn == EbvNone) {
memberVariable->getWritableType().getQualifier().layoutLocation = flattenData.nextLocation;
flattenData.nextLocation += intermediate.computeTypeLocationSize(memberVariable->getType());
nextOutLocation = std::max(nextOutLocation, flattenData.nextLocation);
}
} else {
// inherited locations are nonsensical for built-ins
memberVariable->getWritableType().getQualifier().layoutLocation = TQualifier::layoutLocationEnd;
}
flattenData.offsets.push_back(static_cast<int>(flattenData.members.size()));
flattenData.members.push_back(memberVariable);
@@ -1551,7 +1565,7 @@ void HlslParseContext::assignToInterface(TVariable& variable)
TType& type = variable.getWritableType();
TQualifier& qualifier = type.getQualifier();
if (qualifier.storage == EvqVaryingIn || qualifier.storage == EvqVaryingOut) {
if (qualifier.builtIn == EbvNone) {
if (qualifier.builtIn == EbvNone && !qualifier.hasLocation()) {
// Strip off the outer array dimension for those having an extra one.
int size;
if (type.isArray() && qualifier.isArrayedIo(language)) {
@@ -1833,35 +1847,41 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
}
}
// Handle [outputtoplogy("...")]
// Handle [outputtopology("...")]
const TIntermAggregate* topologyAttr = attributes[EatOutputTopology];
if (topologyAttr != nullptr) {
const TConstUnion& topoType = topologyAttr->getSequence()[0]->getAsConstantUnion()->getConstArray()[0];
if (topoType.getType() != EbtString) {
error(loc, "invalid outputtoplogy", "", "");
error(loc, "invalid outputtopology", "", "");
} else {
TString topologyStr = *topoType.getSConst();
std::transform(topologyStr.begin(), topologyStr.end(), topologyStr.begin(), ::tolower);
TVertexOrder topology = EvoNone;
TVertexOrder vertexOrder = EvoNone;
TLayoutGeometry primitive = ElgNone;
if (topologyStr == "point") {
topology = EvoNone;
intermediate.setPointMode();
} else if (topologyStr == "line") {
topology = EvoNone;
primitive = ElgIsolines;
} else if (topologyStr == "triangle_cw") {
topology = EvoCw;
vertexOrder = EvoCw;
primitive = ElgTriangles;
} else if (topologyStr == "triangle_ccw") {
topology = EvoCcw;
vertexOrder = EvoCcw;
primitive = ElgTriangles;
} else {
error(loc, "unsupported outputtoplogy type", topologyStr.c_str(), "");
error(loc, "unsupported outputtopology type", topologyStr.c_str(), "");
}
if (topology != EvoNone) {
if (! intermediate.setVertexOrder(topology)) {
error(loc, "cannot change previously set outputtopology", TQualifier::getVertexOrderString(topology), "");
if (vertexOrder != EvoNone) {
if (! intermediate.setVertexOrder(vertexOrder)) {
error(loc, "cannot change previously set outputtopology",
TQualifier::getVertexOrderString(vertexOrder), "");
}
}
if (primitive != ElgNone)
intermediate.setOutputPrimitive(primitive);
}
}
@@ -1985,7 +2005,7 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
assignToInterface(variable);
};
if (entryPointOutput)
if (entryPointOutput != nullptr)
makeVariableInOut(*entryPointOutput);
for (auto it = inputs.begin(); it != inputs.end(); ++it)
if (!isDsPcfInput((*it)->getType())) // skip domain shader PCF input (see comment below)
@@ -5205,16 +5225,31 @@ TFunction* HlslParseContext::makeConstructorCall(const TSourceLoc& loc, const TT
// Handle seeing a "COLON semantic" at the end of a type declaration,
// by updating the type according to the semantic.
//
void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBuiltInVariable builtIn, const TString& upperCase)
void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBuiltInVariable builtIn,
const TString& upperCase)
{
// adjust for stage in/out
const auto getSemanticNumber = [](const TString& semantic) -> unsigned int {
size_t pos = semantic.find_last_not_of("0123456789");
if (pos == std::string::npos)
return 0u;
return (unsigned int)atoi(semantic.c_str() + pos + 1);
};
switch(builtIn) {
case EbvNone:
// Get location numbers from fragment outputs, instead of
// auto-assigning them.
if (language == EShLangFragment && upperCase.compare(0, 9, "SV_TARGET") == 0) {
qualifier.layoutLocation = getSemanticNumber(upperCase);
nextOutLocation = std::max(nextOutLocation, qualifier.layoutLocation + 1u);
}
break;
case EbvPosition:
// adjust for stage in/out
if (language == EShLangFragment)
builtIn = EbvFragCoord;
break;
case EbvStencilRef:
case EbvFragStencilRef:
error(loc, "unimplemented; need ARB_shader_stencil_export", "SV_STENCILREF", "");
break;
case EbvTessLevelInner:

View File

@@ -213,12 +213,14 @@ public:
protected:
struct TFlattenData {
TFlattenData() : nextBinding(TQualifier::layoutBindingEnd) { }
TFlattenData(int nb) : nextBinding(nb) { }
TFlattenData() : nextBinding(TQualifier::layoutBindingEnd),
nextLocation(TQualifier::layoutLocationEnd) { }
TFlattenData(int nb, int nl) : nextBinding(nb), nextLocation(nl) { }
TVector<TVariable*> members; // individual flattened variables
TVector<int> offsets; // offset to next tree level
int nextBinding; // next binding to use.
TVector<int> offsets; // offset to next tree level
unsigned int nextBinding; // next binding to use.
unsigned int nextLocation; // next location to use
};
void fixConstInit(const TSourceLoc&, const TString& identifier, TType& type, TIntermTyped*& initializer);

View File

@@ -466,7 +466,7 @@ void HlslScanContext::fillInKeywordMap()
(*SemanticMap)["SV_COVERAGE"] = EbvSampleMask;
(*SemanticMap)["SV_DEPTHGREATEREQUAL"] = EbvFragDepthGreater;
(*SemanticMap)["SV_DEPTHLESSEQUAL"] = EbvFragDepthLesser;
(*SemanticMap)["SV_STENCILREF"] = EbvStencilRef;
(*SemanticMap)["SV_STENCILREF"] = EbvFragStencilRef;
}
void HlslScanContext::deleteKeywordMap()