Courtney Goeltzenleuchter | 21c58b0 | 2014-10-30 10:07:20 -0600 | [diff] [blame] | 1 | /* |
Karl Schultz | 481756e | 2016-02-02 15:37:51 -0700 | [diff] [blame] | 2 | * Copyright (c) 2015-2016 The Khronos Group Inc. |
| 3 | * Copyright (c) 2015-2016 Valve Corporation |
| 4 | * Copyright (c) 2015-2016 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and/or associated documentation files (the "Materials"), to |
| 8 | * deal in the Materials without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Materials, and to permit persons to whom the Materials are |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice(s) and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Materials. |
| 15 | * |
Karl Schultz | 481756e | 2016-02-02 15:37:51 -0700 | [diff] [blame] | 16 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 19 | * |
| 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 21 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 22 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 23 | * USE OR OTHER DEALINGS IN THE MATERIALS. |
| 24 | */ |
| 25 | /* |
Courtney Goeltzenleuchter | 21c58b0 | 2014-10-30 10:07:20 -0600 | [diff] [blame] | 26 | * Vertex shader used by Cube demo. |
| 27 | */ |
GregF | 54dc378 | 2015-12-15 11:23:43 -0700 | [diff] [blame] | 28 | #version 400 |
Courtney Goeltzenleuchter | 21c58b0 | 2014-10-30 10:07:20 -0600 | [diff] [blame] | 29 | #extension GL_ARB_separate_shader_objects : enable |
| 30 | #extension GL_ARB_shading_language_420pack : enable |
Jason Ekstrand | 9b439f3 | 2015-10-15 17:16:32 -0700 | [diff] [blame] | 31 | layout(std140, binding = 0) uniform buf { |
Courtney Goeltzenleuchter | 21c58b0 | 2014-10-30 10:07:20 -0600 | [diff] [blame] | 32 | mat4 MVP; |
| 33 | vec4 position[12*3]; |
| 34 | vec4 attr[12*3]; |
| 35 | } ubuf; |
| 36 | |
| 37 | layout (location = 0) out vec4 texcoord; |
GregF | 54dc378 | 2015-12-15 11:23:43 -0700 | [diff] [blame] | 38 | |
| 39 | out gl_PerVertex { |
| 40 | vec4 gl_Position; |
| 41 | }; |
| 42 | |
Courtney Goeltzenleuchter | 21c58b0 | 2014-10-30 10:07:20 -0600 | [diff] [blame] | 43 | void main() |
| 44 | { |
GregF | fcfe34c | 2016-01-20 16:37:18 -0700 | [diff] [blame] | 45 | texcoord = ubuf.attr[gl_VertexIndex]; |
| 46 | gl_Position = ubuf.MVP * ubuf.position[gl_VertexIndex]; |
Chia-I Wu | c3487c2 | 2015-04-22 14:56:17 +0800 | [diff] [blame] | 47 | |
| 48 | // GL->VK conventions |
| 49 | gl_Position.y = -gl_Position.y; |
Chia-I Wu | e2504cb | 2015-04-22 14:20:52 +0800 | [diff] [blame] | 50 | gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0; |
Courtney Goeltzenleuchter | 21c58b0 | 2014-10-30 10:07:20 -0600 | [diff] [blame] | 51 | } |