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

Function GenerateShader

test/val/val_function_test.cpp:32–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30using ValidateFunctionCall = spvtest::ValidateBase<std::string>;
31
32std::string GenerateShader(const std::string& storage_class,
33 const std::string& capabilities,
34 const std::string& extensions) {
35 std::string spirv = R"(
36OpCapability Shader
37OpCapability Linkage
38OpCapability AtomicStorage
39)" + capabilities + R"(
40OpExtension "SPV_KHR_storage_buffer_storage_class"
41)" +
42 extensions + R"(
43OpMemoryModel Logical GLSL450
44OpName %var "var"
45%void = OpTypeVoid
46%int = OpTypeInt 32 0
47%ptr = OpTypePointer )" + storage_class + R"( %int
48%caller_ty = OpTypeFunction %void
49%callee_ty = OpTypeFunction %void %ptr
50)";
51
52 if (storage_class != "Function") {
53 spirv += "%var = OpVariable %ptr " + storage_class;
54 }
55
56 spirv += R"(
57%caller = OpFunction %void None %caller_ty
58%1 = OpLabel
59)";
60
61 if (storage_class == "Function") {
62 spirv += "%var = OpVariable %ptr Function";
63 }
64
65 spirv += R"(
66%call = OpFunctionCall %void %callee %var
67OpReturn
68OpFunctionEnd
69%callee = OpFunction %void None %callee_ty
70%param = OpFunctionParameter %ptr
71%2 = OpLabel
72OpReturn
73OpFunctionEnd
74)";
75
76 return spirv;
77}
78
79std::string GenerateShaderParameter(const std::string& storage_class,
80 const std::string& capabilities,

Callers 1

TEST_PFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected