MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / InitFromGLSLTry

Method InitFromGLSLTry

tests/framework/shader_helper.cpp:514–528  ·  view source on GitHub ↗

Because shaders are currently validated at pipeline creation time, there are test cases that might fail shader module creation due to supplying an invalid/unknown SPIR-V capability/operation. This is called after VkShaderObj creation when tests are found to crash on a CI device

Source from the content-addressed store, hash-verified

512// creation due to supplying an invalid/unknown SPIR-V capability/operation. This is called after VkShaderObj creation when
513// tests are found to crash on a CI device
514VkResult VkShaderObj::InitFromGLSLTry(const vkt::Device* custom_device) {
515 std::vector<uint32_t> spv;
516 // 99% of tests just use the framework's VkDevice, but this allows for tests to use custom device object
517 // Can't set at contructor time since all reference members need to be initialized then.
518 VkPhysicalDeviceLimits limits = (custom_device) ? custom_device->Physical().limits_ : m_device->Physical().limits_;
519 GLSLtoSPV(limits, m_stage_info.stage, m_source, spv, m_spv_env);
520
521 VkShaderModuleCreateInfo moduleCreateInfo = vku::InitStructHelper();
522 moduleCreateInfo.codeSize = spv.size() * sizeof(uint32_t);
523 moduleCreateInfo.pCode = spv.data();
524
525 const auto result = InitTry(((custom_device) ? *custom_device : *m_device), moduleCreateInfo);
526 m_stage_info.module = handle();
527 return result;
528}
529
530bool VkShaderObj::InitFromASM() {
531 std::vector<uint32_t> spv;

Callers 7

CreateFromGLSLMethod · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80

Calls 3

GLSLtoSPVFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected