Пример #1
0
VkShaderModule CompileAndCreateComputeShader(const std::string& source_code)
{
  ShaderCompiler::SPIRVCodeVector code;
  if (!ShaderCompiler::CompileComputeShader(&code, source_code.c_str(), source_code.length()))
    return VK_NULL_HANDLE;

  return CreateShaderModule(code.data(), code.size());
}
Пример #2
0
VkShaderModule CompileAndCreateFragmentShader(const std::string& source_code, bool prepend_header)
{
  ShaderCompiler::SPIRVCodeVector code;
  if (!ShaderCompiler::CompileFragmentShader(&code, source_code.c_str(), source_code.length(),
                                             prepend_header))
  {
    return VK_NULL_HANDLE;
  }

  return CreateShaderModule(code.data(), code.size());
}