using std::tuple;
using std::vector;
using testing::Combine;
+using testing::HasSubstr;
using testing::Values;
using testing::ValuesIn;
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt RelaxedPrecision\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Block\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt BufferBlock\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt RowMajor\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
MatrixDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt ColMajor\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
MatrixDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt ArrayStride 1\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt MatrixStride 1\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
MatrixDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt GLSLShared\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt GLSLPacked\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n"
"OpDecorate %intt CPacked\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt NoPerspective\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Flat\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Patch\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
TessellationDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Centroid\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Sample\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"SampleRateShading"}),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Invariant\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Restrict\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Aliased\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Volatile\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n"
"OpDecorate %intt Constant\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Coherent\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt NonWritable\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt NonReadable\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Uniform\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n"
"OpDecorate %intt SaturatedConversion\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Stream 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"GeometryStreams"}),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Location 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Component 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Index 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Binding 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt DescriptorSet 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt Offset 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt XfbBuffer 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"TransformFeedback"}),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt XfbStride 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"TransformFeedback"}),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n"
"OpDecorate %intt FuncParamAttr Zext\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n"
"OpDecorate %intt FPRoundingMode RTE\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n"
"OpDecorate %intt FPFastMathMode Fast\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt LinkageAttributes \"other\" Import\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"Linkage"}),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt NoContraction\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt InputAttachmentIndex 0\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"InputAttachment"}),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n"
"OpDecorate %intt Alignment 4\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies())
)),);
Values(make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt SpecId 1\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()))), );
INSTANTIATE_TEST_CASE_P(
Values(make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %p MaxByteOffset 0 "
- "%i32 = OpTypeInt 32 1 "
+ "%i32 = OpTypeInt 32 0 "
"%pi32 = OpTypePointer Workgroup %i32 "
"%p = OpVariable %pi32 Workgroup " +
string(kVoidFVoid),
make_pair(string("OpMemoryModel Logical OpenCL "
"OpEntryPoint Kernel %func \"compute\" \n"
"OpDecorate %intt SpecId 1 "
- "%intt = OpTypeInt 32 1 ") +
+ "%intt = OpTypeInt 32 0 ") +
string(kVoidFVoid),
KernelDependencies()),
make_pair(string("OpMemoryModel Logical Simple "
"OpEntryPoint Vertex %func \"shader\" \n"
"OpDecorate %intt SpecId 1 "
- "%intt = OpTypeInt 32 1 ") +
+ "%intt = OpTypeInt 32 0 ") +
string(kVoidFVoid),
ShaderDependencies()))), );
// clang-format off
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn Position\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
// Just mentioning PointSize, ClipDistance, or CullDistance as a BuiltIn does
// not trigger the requirement for the associated capability.
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn PointSize\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn ClipDistance\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn CullDistance\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn VertexId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn InstanceId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn PrimitiveId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
GeometryTessellationDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn InvocationId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
GeometryTessellationDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn Layer\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
GeometryDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn ViewportIndex\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"MultiViewport"}),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn TessLevelOuter\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
TessellationDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn TessLevelInner\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
TessellationDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn TessCoord\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
TessellationDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn PatchVertices\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
TessellationDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn FragCoord\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn PointCoord\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn FrontFacing\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn SampleId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"SampleRateShading"}),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn SamplePosition\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"SampleRateShading"}),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn SampleMask\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
vector<string>{"SampleRateShading"}),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn FragDepth\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn HelperInvocation\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn VertexIndex\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn InstanceIndex\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn NumWorkgroups\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn WorkgroupSize\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn WorkgroupId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn LocalInvocationId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn GlobalInvocationId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn LocalInvocationIndex\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllCapabilities()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn WorkDim\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn GlobalSize\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn EnqueuedWorkgroupSize\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn GlobalOffset\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn GlobalLinearId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn SubgroupSize\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn SubgroupMaxSize\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn NumSubgroups\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn NumEnqueuedSubgroups\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn SubgroupId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn SubgroupLocalInvocationId\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
KernelDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn VertexIndex\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies()),
make_pair(string(kOpenCLMemoryModel) +
"OpEntryPoint Kernel %func \"compute\" \n" +
"OpDecorate %intt BuiltIn InstanceIndex\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
ShaderDependencies())
)),);
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn PointSize\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllV10Capabilities()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn ClipDistance\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllV10Capabilities()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn CullDistance\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllV10Capabilities())
)),);
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn PointSize\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllV10Capabilities()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn ClipDistance\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllV10Capabilities()),
make_pair(string(kGLSL450MemoryModel) +
"OpEntryPoint Vertex %func \"shader\" \n" +
"OpDecorate %intt BuiltIn CullDistance\n"
- "%intt = OpTypeInt 32 1\n" + string(kVoidFVoid),
+ "%intt = OpTypeInt 32 0\n" + string(kVoidFVoid),
AllV10Capabilities())
)),);
OpCapability Linkage
OpMemoryModel Logical OpenCL
-%i32 = OpTypeInt 32 1
+%i32 = OpTypeInt 32 0
%f32 = OpTypeFloat 32
%v4i32 = OpTypeVector %i32 4
%timg = OpTypeImage %i32 2D 0 0 0 0 Unknown
OpMemoryModel Logical OpenCL
; %i32 has ID 1
-%i32 = OpTypeInt 32 1
+%i32 = OpTypeInt 32 0
%tf = OpTypeFunction %i32
%pi32 = OpTypePointer CrossWorkgroup %i32
%var = OpVariable %pi32 CrossWorkgroup
ASSERT_EQ(SPV_SUCCESS, ValidateInstructions());
}
+TEST_F(ValidateCapability, IntSignednessKernelGood) {
+ const std::string spirv = R"(
+OpCapability Kernel
+OpCapability Linkage
+OpMemoryModel Logical OpenCL
+%i32 = OpTypeInt 32 0
+)";
+ CompileSuccessfully(spirv);
+ EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
+}
+
+TEST_F(ValidateCapability, IntSignednessKernelBad) {
+ const std::string spirv = R"(
+OpCapability Kernel
+OpCapability Linkage
+OpMemoryModel Logical OpenCL
+%i32 = OpTypeInt 32 1
+)";
+ CompileSuccessfully(spirv);
+ EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions());
+ EXPECT_THAT(getDiagnosticString(),
+ HasSubstr("The Signedness in OpTypeInt must always be 0 when "
+ "Kernel capability is used."));
+}
+
+TEST_F(ValidateCapability, IntSignednessShaderGood) {
+ const std::string spirv = R"(
+OpCapability Shader
+OpCapability Linkage
+OpMemoryModel Logical GLSL450
+%u32 = OpTypeInt 32 0
+%i32 = OpTypeInt 32 1
+)";
+ CompileSuccessfully(spirv);
+ EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
+}
+
} // namespace anonymous
TEST_F(ValidateIdWithMessage, OpTypeVectorInt) {
string spirv = kGLSL450MemoryModel + R"(
-%1 = OpTypeInt 32 1
+%1 = OpTypeInt 32 0
%2 = OpTypeVector %1 4)";
CompileSuccessfully(spirv.c_str());
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
// Creates an assembly snippet declaring OpTypeArray with the given length.
string MakeArrayLength(const string& len, Signed isSigned, int width) {
ostringstream ss;
- ss << kGLSL450MemoryModel;
- ss << " %t = OpTypeInt " << width << (isSigned == kSigned ? " 1" : " 0")
- << " %l = OpConstant %t " << len << " %a = OpTypeArray %t %l";
+ ss << R"(
+ OpCapability Shader
+ OpCapability Linkage
+ OpCapability Int16
+ OpCapability Int64
+ )";
+ ss << "OpMemoryModel Logical GLSL450\n";
+ ss << " %t = OpTypeInt " << width << (isSigned == kSigned ? " 1" : " 0");
+ ss << " %l = OpConstant %t " << len;
+ ss << " %a = OpTypeArray %t %l";
return ss.str();
}
}
// The only valid widths for integers are 8, 16, 32, and 64.
+// Since the Int8 capability requires the Kernel capability, and the Kernel
+// capability prohibits usage of signed integers, we can skip 8-bit integers
+// here since the purpose of these tests is to check the validity of
+// OpTypeArray, not OpTypeInt.
INSTANTIATE_TEST_CASE_P(Widths, OpTypeArrayLengthTest,
- ValuesIn(vector<int>{8, 16, 32, 64}));
+ ValuesIn(vector<int>{16, 32, 64}));
TEST_F(ValidateIdWithMessage, OpTypeArrayLengthNull) {
string spirv = kGLSL450MemoryModel + R"(
-%i32 = OpTypeInt 32 1
+%i32 = OpTypeInt 32 0
%len = OpConstantNull %i32
%ary = OpTypeArray %i32 %len)";
CompileSuccessfully(spirv.c_str());
TEST_F(ValidateIdWithMessage, OpTypeArrayLengthSpecConst) {
string spirv = kGLSL450MemoryModel + R"(
-%i32 = OpTypeInt 32 1
+%i32 = OpTypeInt 32 0
%len = OpSpecConstant %i32 2
%ary = OpTypeArray %i32 %len)";
CompileSuccessfully(spirv.c_str());
TEST_F(ValidateIdWithMessage, OpTypeArrayLengthSpecConstOp) {
string spirv = kGLSL450MemoryModel + R"(
-%i32 = OpTypeInt 32 1
+%i32 = OpTypeInt 32 0
%c1 = OpConstant %i32 1
%c2 = OpConstant %i32 2
%len = OpSpecConstantOp %i32 IAdd %c1 %c2
TEST_F(ValidateIdWithMessage, OpConstantCompositeStructGood) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpConstant %1 42
%5 = OpConstant %2 4300000000
TEST_F(ValidateIdWithMessage, OpConstantCompositeStructUndefGood) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpConstant %1 42
%5 = OpUndef %2
TEST_F(ValidateIdWithMessage, OpConstantCompositeStructMemberTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpConstant %1 42
%5 = OpConstant %2 4300000000
TEST_F(ValidateIdWithMessage, OpConstantCompositeStructMemberUndefTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpConstant %1 42
%5 = OpUndef %2
TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructGood) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpConstant %1 42
%5 = OpSpecConstant %2 4300000000
TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructUndefGood) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpSpecConstant %1 42
%5 = OpUndef %2
TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructNonConstBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpSpecConstant %1 42
%5 = OpUndef %2
TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructMemberTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpConstant %1 42
%5 = OpSpecConstant %2 4300000000
TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructMemberUndefTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeInt 32 0
-%2 = OpTypeInt 64 1
+%2 = OpTypeInt 64 0
%3 = OpTypeStruct %1 %1 %2
%4 = OpSpecConstant %1 42
%5 = OpUndef %2
TEST_F(ValidateIdWithMessage, OpVariableGood) {
string spirv = kGLSL450MemoryModel + R"(
-%1 = OpTypeInt 32 1
+%1 = OpTypeInt 32 0
%2 = OpTypePointer Input %1
%3 = OpVariable %2 Input)";
CompileSuccessfully(spirv.c_str());
}
TEST_F(ValidateIdWithMessage, OpVariableInitializerConstantGood) {
string spirv = kGLSL450MemoryModel + R"(
-%1 = OpTypeInt 32 1
+%1 = OpTypeInt 32 0
%2 = OpTypePointer Input %1
%3 = OpConstant %1 42
%4 = OpVariable %2 Input %3)";
}
TEST_F(ValidateIdWithMessage, OpVariableInitializerGlobalVariableGood) {
string spirv = kGLSL450MemoryModel + R"(
-%1 = OpTypeInt 32 1
+%1 = OpTypeInt 32 0
%2 = OpTypePointer Uniform %1
%3 = OpVariable %2 Uniform
%4 = OpTypePointer Uniform %2 ; pointer to pointer
// TODO: Positive test OpVariable with OpConstantNull of OpTypePointer
TEST_F(ValidateIdWithMessage, OpVariableResultTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
-%1 = OpTypeInt 32 1
+%1 = OpTypeInt 32 0
%2 = OpVariable %1 Input)";
CompileSuccessfully(spirv.c_str());
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions());
}
TEST_F(ValidateIdWithMessage, OpVariableInitializerIsTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
-%1 = OpTypeInt 32 1
+%1 = OpTypeInt 32 0
%2 = OpTypePointer Input %1
%3 = OpVariable %2 Input %2)";
CompileSuccessfully(spirv.c_str());
TEST_F(ValidateIdWithMessage, OpVariableInitializerIsFunctionVarBad) {
string spirv = kGLSL450MemoryModel + R"(
-%int = OpTypeInt 32 1
+%int = OpTypeInt 32 0
%ptrint = OpTypePointer Function %int
%ptrptrint = OpTypePointer Function %ptrint
%void = OpTypeVoid
TEST_F(ValidateIdWithMessage, OpVariableInitializerIsModuleVarGood) {
string spirv = kGLSL450MemoryModel + R"(
-%int = OpTypeInt 32 1
+%int = OpTypeInt 32 0
%ptrint = OpTypePointer Uniform %int
%mvar = OpVariable %ptrint Uniform
%ptrptrint = OpTypePointer Function %ptrint
TEST_F(ValidateIdWithMessage, OpLoadGood) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
- %2 = OpTypeInt 32 1
+ %2 = OpTypeInt 32 0
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
%5 = OpVariable %3 UniformConstant
TEST_F(ValidateIdWithMessage, OpLoadResultTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
%5 = OpVariable %3 UniformConstant
TEST_F(ValidateIdWithMessage, OpLoadPointerBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%9 = OpTypeFloat 32
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
TEST_F(ValidateIdWithMessage, OpStoreGood) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
%5 = OpConstant %2 42
TEST_F(ValidateIdWithMessage, OpStorePointerBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
%5 = OpConstant %2 42
TEST_F(ValidateIdWithMessage, OpStoreObjectGood) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
%5 = OpConstant %2 42
TEST_F(ValidateIdWithMessage, OpStoreTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%9 = OpTypeFloat 32
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
TEST_F(ValidateIdWithMessage, OpStoreVoid) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
%6 = OpVariable %3 UniformConstant
TEST_F(ValidateIdWithMessage, OpStoreLabel) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %1
%6 = OpVariable %3 UniformConstant
// https://cvs.khronos.org/bugzilla/show_bug.cgi?id=15404
TEST_F(ValidateIdWithMessage, DISABLED_OpStoreFunction) {
string spirv = kGLSL450MemoryModel + R"(
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%3 = OpTypePointer UniformConstant %2
%4 = OpTypeFunction %2
%5 = OpConstant %2 123
TEST_F(ValidateIdWithMessage, OpFunctionGood) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%3 = OpTypeFunction %1 %2 %2
%4 = OpFunction %1 None %3
OpFunctionEnd)";
TEST_F(ValidateIdWithMessage, OpFunctionResultTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%5 = OpConstant %2 42
%3 = OpTypeFunction %1 %2 %2
%4 = OpFunction %2 None %3
TEST_F(ValidateIdWithMessage, OpFunctionFunctionTypeBad) {
string spirv = kGLSL450MemoryModel + R"(
%1 = OpTypeVoid
-%2 = OpTypeInt 32 1
+%2 = OpTypeInt 32 0
%4 = OpFunction %1 None %2
OpFunctionEnd)";
CompileSuccessfully(spirv.c_str());
TEST_F(ValidateIdWithMessage, OpLoadBitcastPointerGood) {
string spirv = kOpenCLMemoryModel64 + R"(
%2 = OpTypeVoid
-%3 = OpTypeInt 32 1
+%3 = OpTypeInt 32 0
%4 = OpTypeFloat 32
%5 = OpTypePointer UniformConstant %3
%6 = OpTypePointer UniformConstant %4
TEST_F(ValidateIdWithMessage, OpLoadBitcastNonPointerBad) {
string spirv = kOpenCLMemoryModel64 + R"(
%2 = OpTypeVoid
-%3 = OpTypeInt 32 1
+%3 = OpTypeInt 32 0
%4 = OpTypeFloat 32
%5 = OpTypePointer UniformConstant %3
%6 = OpTypeFunction %2
TEST_F(ValidateIdWithMessage, OpStoreBitcastPointerGood) {
string spirv = kOpenCLMemoryModel64 + R"(
%2 = OpTypeVoid
-%3 = OpTypeInt 32 1
+%3 = OpTypeInt 32 0
%4 = OpTypeFloat 32
%5 = OpTypePointer Function %3
%6 = OpTypePointer Function %4
TEST_F(ValidateIdWithMessage, OpStoreBitcastNonPointerBad) {
string spirv = kOpenCLMemoryModel64 + R"(
%2 = OpTypeVoid
-%3 = OpTypeInt 32 1
+%3 = OpTypeInt 32 0
%4 = OpTypeFloat 32
%5 = OpTypePointer Function %4
%6 = OpTypeFunction %2
EXPECT_THAT(getDiagnosticString(), HasSubstr("missing"));
}
+// Since Int8 requires the Kernel capability, the signedness of int types may
+// not be "1".
const string kHeader = R"(
OpCapability Int8
OpCapability DeviceEnqueue
%voidt = OpTypeVoid
%boolt = OpTypeBool
%int8t = OpTypeInt 8 0
-%intt = OpTypeInt 32 1
%uintt = OpTypeInt 32 0
%vfunct = OpTypeFunction %voidt
-%intptrt = OpTypePointer UniformConstant %intt
-%zero = OpConstant %intt 0
-%one = OpConstant %intt 1
-%ten = OpConstant %intt 10
+%intptrt = OpTypePointer UniformConstant %uintt
+%zero = OpConstant %uintt 0
+%one = OpConstant %uintt 1
+%ten = OpConstant %uintt 10
%false = OpConstantFalse %boolt
)";
%queuet = OpTypeQueue
%three = OpConstant %uintt 3
-%arr3t = OpTypeArray %intt %three
-%ndt = OpTypeStruct %intt %arr3t %arr3t %arr3t
+%arr3t = OpTypeArray %uintt %three
+%ndt = OpTypeStruct %uintt %arr3t %arr3t %arr3t
%eventt = OpTypeEvent
-%offset = OpConstant %intt 0
-%local = OpConstant %intt 1
-%gl = OpConstant %intt 1
+%offset = OpConstant %uintt 0
+%local = OpConstant %uintt 1
+%gl = OpConstant %uintt 1
-%nevent = OpConstant %intt 0
+%nevent = OpConstant %uintt 0
%event = OpConstantNull %eventt
%firstp = OpConstant %int8t 0
-%psize = OpConstant %intt 0
-%palign = OpConstant %intt 32
-%lsize = OpConstant %intt 1
-%flags = OpConstant %intt 0 ; NoWait
+%psize = OpConstant %uintt 0
+%palign = OpConstant %uintt 32
+%lsize = OpConstant %uintt 1
+%flags = OpConstant %uintt 0 ; NoWait
%kfunct = OpTypeFunction %voidt %intptrt
)";
%err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent2
%event %revent %kfunc %firstp %psize
%palign %lsize
- %nevent2 = OpCopyObject %intt %nevent
+ %nevent2 = OpCopyObject %uintt %nevent
OpReturn
OpFunctionEnd
)";
%err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent
%event %revent %kfunc %firstp %psize2
%palign %lsize
- %psize2 = OpCopyObject %intt %psize
+ %psize2 = OpCopyObject %uintt %psize
OpReturn
OpFunctionEnd
)";
%err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent
%event %revent %kfunc %firstp %psize
%palign2 %lsize
- %palign2 = OpCopyObject %intt %palign
+ %palign2 = OpCopyObject %uintt %palign
OpReturn
OpFunctionEnd
)";
%err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent
%event %revent %kfunc %firstp %psize
%palign %lsize2
- %lsize2 = OpCopyObject %intt %lsize
+ %lsize2 = OpCopyObject %uintt %lsize
OpReturn
OpFunctionEnd
)";
// clang-format off
ss << forwardKernelNonDominantParameterBaseCode("psize2") + " %numsg = "
<< instruction + " %uintt" + ndrange_param + "%kfunc %firstp %psize2 %palign"
- << "\n %psize2 = OpCopyObject %intt %psize"
+ << "\n %psize2 = OpCopyObject %uintt %psize"
<< return_instructions;
// clang-format on
// clang-format off
ss << forwardKernelNonDominantParameterBaseCode("palign2") + " %numsg = "
<< instruction + " %uintt" + ndrange_param + "%kfunc %firstp %psize %palign2"
- << "\n %palign2 = OpCopyObject %intt %palign"
+ << "\n %palign2 = OpCopyObject %uintt %palign"
<< return_instructions;
// clang-format on
R"(
%func = OpFunction %voidt None %vfunct
%preheader = OpLabel
-%init = OpCopyObject %intt %zero
+%init = OpCopyObject %uintt %zero
OpBranch %loop
%loop = OpLabel
-%i = OpPhi %intt %init %preheader %loopi %loop
-%loopi = OpIAdd %intt %i %one
+%i = OpPhi %uintt %init %preheader %loopi %loop
+%loopi = OpIAdd %uintt %i %one
OpNop
%cond = OpSLessThan %boolt %i %ten
OpLoopMerge %endl %loop None
R"(
%func = OpFunction %voidt None %vfunct
%preheader = OpLabel
-%init = OpCopyObject %intt %zero
+%init = OpCopyObject %uintt %zero
OpBranch %loop
%loop = OpLabel
%i = OpPhi %missing %init %preheader %loopi %loop
-%loopi = OpIAdd %intt %i %one
+%loopi = OpIAdd %uintt %i %one
OpNop
%cond = OpSLessThan %boolt %i %ten
OpLoopMerge %endl %loop None
R"(
%func = OpFunction %voidt None %vfunct
%preheader = OpLabel
-%init = OpCopyObject %intt %zero
+%init = OpCopyObject %uintt %zero
OpBranch %loop
%loop = OpLabel
-%i = OpPhi %intt %missing %preheader %loopi %loop
-%loopi = OpIAdd %intt %i %one
+%i = OpPhi %uintt %missing %preheader %loopi %loop
+%loopi = OpIAdd %uintt %i %one
OpNop
%cond = OpSLessThan %boolt %i %ten
OpLoopMerge %endl %loop None
R"(
%func = OpFunction %voidt None %vfunct
%preheader = OpLabel
-%init = OpCopyObject %intt %zero
+%init = OpCopyObject %uintt %zero
OpBranch %loop
%loop = OpLabel
-%i = OpPhi %intt %init %missing %loopi %loop
-%loopi = OpIAdd %intt %i %one
+%i = OpPhi %uintt %init %missing %loopi %loop
+%loopi = OpIAdd %uintt %i %one
OpNop
%cond = OpSLessThan %boolt %i %ten
OpLoopMerge %endl %loop None
R"(
%func = OpFunction %voidt None %vfunct
%entry = OpLabel
-%cond = OpSLessThan %intt %one %ten
-%eleven = OpIAdd %intt %one %ten
+%cond = OpSLessThan %uintt %one %ten
+%eleven = OpIAdd %uintt %one %ten
OpSelectionMerge %merge None
OpBranchConditional %cond %t %f
%t = OpLabel
-%twelve = OpIAdd %intt %eleven %one
+%twelve = OpIAdd %uintt %eleven %one
OpBranch %merge
%f = OpLabel
-%twentytwo = OpIAdd %intt %eleven %ten
+%twentytwo = OpIAdd %uintt %eleven %ten
OpBranch %merge
%merge = OpLabel
OpReturn
R"(
%func = OpFunction %voidt None %vfunct
%entry = OpLabel
-%cond = OpSLessThan %intt %one %ten
+%cond = OpSLessThan %uintt %one %ten
OpSelectionMerge %merge None
OpBranchConditional %cond %true_block %false_block
%true_block = OpLabel
-%eleven = OpIAdd %intt %one %ten
-%twelve = OpIAdd %intt %eleven %one
+%eleven = OpIAdd %uintt %one %ten
+%twelve = OpIAdd %uintt %eleven %one
OpBranch %merge
%false_block = OpLabel
-%twentytwo = OpIAdd %intt %eleven %ten
+%twentytwo = OpIAdd %uintt %eleven %ten
OpBranch %merge
%merge = OpLabel
OpReturn
%func = OpFunction %voidt None %vfunct
%entry = OpLabel
%var_one = OpVariable %intptrt Function %one
-%one_val = OpLoad %intt %var_one
+%one_val = OpLoad %uintt %var_one
OpBranch %loop
%loop = OpLabel
-%i = OpPhi %intt %one_val %entry %inew %cont
-%cond = OpSLessThan %intt %one %ten
+%i = OpPhi %uintt %one_val %entry %inew %cont
+%cond = OpSLessThan %uintt %one %ten
OpLoopMerge %merge %cont None
OpBranchConditional %cond %body %merge
%body = OpLabel
OpBranch %cont
%cont = OpLabel
-%inew = OpIAdd %intt %i %one
+%inew = OpIAdd %uintt %i %one
OpBranch %loop
%merge = OpLabel
OpReturn
%func = OpFunction %voidt None %vfunct
%entry = OpLabel
%var_one = OpVariable %intptrt Function %one
-%one_val = OpLoad %intt %var_one
+%one_val = OpLoad %uintt %var_one
OpBranch %loop
%loop = OpLabel
-%i = OpPhi %intt %one_val %entry %inew %cont
-%bad = OpIAdd %intt %inew %one
-%cond = OpSLessThan %intt %one %ten
+%i = OpPhi %uintt %one_val %entry %inew %cont
+%bad = OpIAdd %uintt %inew %one
+%cond = OpSLessThan %uintt %one %ten
OpLoopMerge %merge %cont None
OpBranchConditional %cond %body %merge
%body = OpLabel
OpBranch %cont
%cont = OpLabel
-%inew = OpIAdd %intt %i %one
+%inew = OpIAdd %uintt %i %one
OpBranch %loop
%merge = OpLabel
OpReturn
DominanceCheckIgnoresUsesInUnreachableBlocksDefIsParamGood) {
string str = kHeader + kBasicTypes +
R"(
-%void_fn_int = OpTypeFunction %voidt %intt
+%void_fn_int = OpTypeFunction %voidt %uintt
%func = OpFunction %voidt None %void_fn_int
-%int_param = OpFunctionParameter %intt
+%int_param = OpFunctionParameter %uintt
%entry = OpLabel
OpReturn
%unreach = OpLabel
-%use = OpCopyObject %intt %int_param
+%use = OpCopyObject %uintt %int_param
OpReturn
OpFunctionEnd
)";
"OpName %func \"func\"\n" +
"OpName %func2 \"func2\"\n" + kBasicTypes +
R"(
-%viifunct = OpTypeFunction %voidt %intt %intt
+%viifunct = OpTypeFunction %voidt %uintt %uintt
%func = OpFunction %voidt None %viifunct
-%first = OpFunctionParameter %intt
-%second = OpFunctionParameter %intt
+%first = OpFunctionParameter %uintt
+%second = OpFunctionParameter %uintt
OpFunctionEnd
%func2 = OpFunction %voidt None %viifunct
-%first2 = OpFunctionParameter %intt
-%second2 = OpFunctionParameter %intt
+%first2 = OpFunctionParameter %uintt
+%second2 = OpFunctionParameter %uintt
%entry2 = OpLabel
-%baduse = OpIAdd %intt %first %first2
+%baduse = OpIAdd %uintt %first %first2
OpReturn
OpFunctionEnd
)";