Vulkan-Docs/doc/specs/vulkan/appendices/VK_NV_glsl_shader.txt

67 lines
1.7 KiB
Plaintext

== VK_NV_glsl_shader
*Name String*:: VK_NV_glsl_shader
*Extension Type*:: Device extension
*Registered Extension Number*:: 13
*Status*:: Draft.
*Last Modified Date*:: 14/02/2016
*Revision*:: 1
*IP Status*:: No known IP claims.
*Dependencies*::
- This extension is written against version 1.0. of the Vulkan API.
*Contributors*::
- Piers Daniell, NVIDIA
*Contacts*::
- Piers Daniell (pdaniell 'at' nvidia.com)
This extension allows GLSL shaders written to the GL_KHR_vulkan_glsl
extension specification to be used instead of SPIR-V. The implementation
will automatically detect which the shader is SPIR-V or GLSL and
compile it appropriatly.
=== New Object Types
=== New Enum Constants
* Extending ename:VkResult:
** ename:VK_ERROR_INVALID_SHADER_NV
=== New Enums
=== New Structures
=== New Functions
=== Issues
=== Examples
**Example 1**
Passing in GLSL code
[source,{basebackend@docbook:C++:cpp}]
----------------------------------------
char const vss[] =
"#version 450 core\n"
"layout(location = 0) in vec2 aVertex;\n"
"layout(location = 1) in vec4 aColor;\n"
"out vec4 vColor;\n"
"void main()\n"
"{\n"
" vColor = aColor;\n"
" gl_Position = vec4(aVertex, 0, 1);\n"
"}\n"
;
VkShaderModuleCreateInfo vertexShaderInfo = { VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO };
vertexShaderInfo.codeSize = sizeof vss;
vertexShaderInfo.pCode = vss;
VkShaderModule vertexShader;
vkCreateShaderModule(device, &vertexShaderInfo, 0, &vertexShader);
----------------------------------------
=== Version History
* Revision 1, 2016-02-14 (Piers Daniell)
- Initial draft