text: /*
   * Vulkan Samples
   *
   * Copyright (C) 2015-2020 Valve Corporation
   * Copyright (C) 2015-2020 LunarG, Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /*
  VULKAN_SAMPLE_SHORT_DESCRIPTION
  Initialize Vertex and Fragment Shaders
  */
  
  /* This is part of the draw cube progression */
  
  #include <util_init.hpp>
  #include <assert.h>
  #include <string.h>
  #include <cstdlib>
  
  int sample_main(int argc, char *argv[]) {
      VkResult U_ASSERT_ONLY res;
      struct sample_info info = {};
      char sample_title[] = "Initialize Shaders Sample";
  
      init_global_layer_properties(info);
      init_instance(info, sample_title);
      init_enumerate_device(info);
      init_queue_family_index(info);
      init_device(info);
  
      /* We've setup cmake to process 11-init_shaders.vert and 11-init_shaders.frag             */
      /* files containing the glsl shader code for this sample.  The generate-spirv script uses */
      /* glslangValidator to compile the glsl into spir-v and places the spir-v into a struct   */
      /* into a generated header file                                                           */
  
      /* VULKAN_KEY_START */
  
      std::vector<unsigned int> vtx_spv;
      info.shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
      info.shaderStages[0].pNext = NULL;
      info.shaderStages[0].pSpecializationInfo = NULL;
      info.shaderStages[0].flags = 0;
      info.shaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
      info.shaderStages[0].pName = "main";
  #include "11-init_shaders.vert.h"
      VkShaderModuleCreateInfo moduleCreateInfo;
      moduleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
      moduleCreateInfo.pNext = NULL;
      moduleCreateInfo.flags = 0;
      moduleCreateInfo.codeSize = sizeof(__init_shaders_vert);
      moduleCreateInfo.pCode = __init_shaders_vert;
      res = vkCreateShaderModule(info.device, &moduleCreateInfo, NULL, &info.shaderStages[0].module);
      assert(res == VK_SUCCESS);
  
      std::vector<unsigned int> frag_spv;
      info.shaderStages[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
      info.shaderStages[1].pNext = NULL;
      info.shaderStages[1].pSpecializationInfo = NULL;
      info.shaderStages[1].flags = 0;
      info.shaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
      info.shaderStages[1].pName = "main";
  
  #include "11-init_shaders.frag.h"
      moduleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
      moduleCreateInfo.pNext = NULL;
      moduleCreateInfo.flags = 0;
      moduleCreateInfo.codeSize = sizeof(__init_shaders_frag);
      moduleCreateInfo.pCode = __init_shaders_frag;
      res = vkCreateShaderModule(info.device, &moduleCreateInfo, NULL, &info.shaderStages[1].module);
      assert(res == VK_SUCCESS);
  
      /* VULKAN_KEY_END */
  
      vkDestroyShaderModule(info.device, info.shaderStages[0].module, NULL);
      vkDestroyShaderModule(info.device, info.shaderStages[1].module, NULL);
      destroy_device(info);
      destroy_instance(info);
      return 0;
  }
  