/ appendices / VK_NV_glsl_shader.txt
VK_NV_glsl_shader.txt
1 include::meta/VK_NV_glsl_shader.txt[] 2 3 *Last Modified Date*:: 4 2016-02-14 5 *IP Status*:: 6 No known IP claims. 7 *Contributors*:: 8 - Piers Daniell, NVIDIA 9 10 This extension allows GLSL shaders written to the `GL_KHR_vulkan_glsl` 11 extension specification to be used instead of SPIR-V. 12 The implementation will automatically detect whether the shader is SPIR-V or 13 GLSL, and compile it appropriately. 14 15 === New Object Types 16 17 === New Enum Constants 18 19 * Extending elink:VkResult: 20 ** ename:VK_ERROR_INVALID_SHADER_NV 21 22 === New Enums 23 24 === New Structures 25 26 === New Functions 27 28 === Issues 29 30 === Examples 31 32 *Example 1* 33 34 Passing in GLSL code 35 36 [source,c++] 37 ---------------------------------------- 38 char const vss[] = 39 "#version 450 core\n" 40 "layout(location = 0) in vec2 aVertex;\n" 41 "layout(location = 1) in vec4 aColor;\n" 42 "out vec4 vColor;\n" 43 "void main()\n" 44 "{\n" 45 " vColor = aColor;\n" 46 " gl_Position = vec4(aVertex, 0, 1);\n" 47 "}\n" 48 ; 49 VkShaderModuleCreateInfo vertexShaderInfo = { VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO }; 50 vertexShaderInfo.codeSize = sizeof vss; 51 vertexShaderInfo.pCode = vss; 52 VkShaderModule vertexShader; 53 vkCreateShaderModule(device, &vertexShaderInfo, 0, &vertexShader); 54 ---------------------------------------- 55 56 === Version History 57 58 * Revision 1, 2016-02-14 (Piers Daniell) 59 - Initial draft