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

Function TEST_F

test/opt/instruction_test.cpp:318–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316}
317
318TEST_F(DescriptorTypeTest, StorageImage) {
319 const std::string text = R"(
320 OpCapability Shader
321 %1 = OpExtInstImport "GLSL.std.450"
322 OpMemoryModel Logical GLSL450
323 OpEntryPoint Fragment %2 "main"
324 OpExecutionMode %2 OriginUpperLeft
325 OpSource GLSL 430
326 OpName %3 "myStorageImage"
327 OpDecorate %3 DescriptorSet 0
328 OpDecorate %3 Binding 0
329 %4 = OpTypeVoid
330 %5 = OpTypeFunction %4
331 %6 = OpTypeFloat 32
332 %7 = OpTypeImage %6 2D 0 0 0 2 R32f
333 %8 = OpTypePointer UniformConstant %7
334 %3 = OpVariable %8 UniformConstant
335 %2 = OpFunction %4 None %5
336 %9 = OpLabel
337 %10 = OpCopyObject %8 %3
338 OpReturn
339 OpFunctionEnd
340)";
341
342 std::unique_ptr<IRContext> context =
343 BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text);
344 Instruction* type = context->get_def_use_mgr()->GetDef(8);
345 EXPECT_TRUE(type->IsVulkanStorageImage());
346 EXPECT_FALSE(type->IsVulkanSampledImage());
347 EXPECT_FALSE(type->IsVulkanStorageTexelBuffer());
348 EXPECT_FALSE(type->IsVulkanStorageBuffer());
349 EXPECT_FALSE(type->IsVulkanUniformBuffer());
350
351 Instruction* variable = context->get_def_use_mgr()->GetDef(3);
352 EXPECT_FALSE(variable->IsReadOnlyPointer());
353
354 Instruction* object_copy = context->get_def_use_mgr()->GetDef(10);
355 EXPECT_FALSE(object_copy->IsReadOnlyPointer());
356}
357
358TEST_F(DescriptorTypeTest, SampledImage) {
359 const std::string text = R"(

Callers

nothing calls this directly

Calls 15

IsVulkanStorageImageMethod · 0.80
IsVulkanSampledImageMethod · 0.80
IsVulkanStorageBufferMethod · 0.80
IsVulkanUniformBufferMethod · 0.80
IsReadOnlyPointerMethod · 0.80
GetBaseAddressMethod · 0.80
IsValidBasePointerMethod · 0.80
GetShaderDebugOpcodeMethod · 0.80
getMethod · 0.80
SetInOperandMethod · 0.80
BuildModuleFunction · 0.70

Tested by

no test coverage detected