• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2016-2020 NVIDIA Corporation
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5include::{generated}/meta/{refprefix}VK_NV_glsl_shader.adoc[]
6
7=== Other Extension Metadata
8
9*Last Modified Date*::
10    2016-02-14
11*IP Status*::
12    No known IP claims.
13*Contributors*::
14  - Piers Daniell, NVIDIA
15
16=== Description
17
18This extension allows GLSL shaders written to the `GL_KHR_vulkan_glsl`
19extension specification to be used instead of SPIR-V.
20The implementation will automatically detect whether the shader is SPIR-V or
21GLSL, and compile it appropriately.
22
23=== Deprecation
24
25Functionality in this extension is outside of the scope of Vulkan and is
26better served by a compiler library such as
27https://github.com/KhronosGroup/glslang[glslang].
28No new implementations will support this extension, so applications should:
29not use it.
30
31include::{generated}/interfaces/VK_NV_glsl_shader.adoc[]
32
33=== Examples
34
35*Example 1*
36
37Passing in GLSL code
38
39[source,c++]
40----------------------------------------
41    char const vss[] =
42        "#version 450 core\n"
43        "layout(location = 0) in vec2 aVertex;\n"
44        "layout(location = 1) in vec4 aColor;\n"
45        "out vec4 vColor;\n"
46        "void main()\n"
47        "{\n"
48        "    vColor = aColor;\n"
49        "    gl_Position = vec4(aVertex, 0, 1);\n"
50        "}\n"
51    ;
52    VkShaderModuleCreateInfo vertexShaderInfo = { VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO };
53    vertexShaderInfo.codeSize = sizeof vss;
54    vertexShaderInfo.pCode = vss;
55    VkShaderModule vertexShader;
56    vkCreateShaderModule(device, &vertexShaderInfo, 0, &vertexShader);
57----------------------------------------
58
59=== Version History
60
61  * Revision 1, 2016-02-14 (Piers Daniell)
62  ** Initial draft
63