MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ImageOperandsTemplate

Function ImageOperandsTemplate

test/val/val_capability_test.cpp:2326–2354  ·  view source on GitHub ↗

TODO(atgoo@github.com) The following test is not valid as it generates invalid combinations of images, instructions and image operands. Creates assembly containing an OpImageFetch instruction using operands for the image-operands part. The assembly defines constants %fzero and %izero that can be used for operands where IDs are required. The assembly is valid, apart from not declaring any capabi

Source from the content-addressed store, hash-verified

2324// that can be used for operands where IDs are required. The assembly is valid,
2325// apart from not declaring any capabilities required by the operands.
2326string ImageOperandsTemplate(const std::string& operands) {
2327 ostringstream ss;
2328 // clang-format off
2329 ss << R"(
2330OpCapability Kernel
2331OpCapability Linkage
2332OpMemoryModel Logical OpenCL
2333
2334%i32 = OpTypeInt 32 0
2335%f32 = OpTypeFloat 32
2336%v4i32 = OpTypeVector %i32 4
2337%timg = OpTypeImage %i32 2D 0 0 0 0 Unknown
2338%pimg = OpTypePointer UniformConstant %timg
2339%tfun = OpTypeFunction %i32
2340
2341%vimg = OpVariable %pimg UniformConstant
2342%izero = OpConstant %i32 0
2343%fzero = OpConstant %f32 0.
2344
2345%main = OpFunction %i32 None %tfun
2346%lbl = OpLabel
2347%img = OpLoad %timg %vimg
2348%r1 = OpImageFetch %v4i32 %img %izero )" << operands << R"(
2349OpReturnValue %izero
2350OpFunctionEnd
2351)";
2352 // clang-format on
2353 return ss.str();
2354}
2355
2356INSTANTIATE_TEST_SUITE_P(
2357 TwoImageOperandsMask, ValidateCapability,

Callers 1

Calls 1

strMethod · 0.45

Tested by

no test coverage detected