| 1 |
void main() { |
| 2 |
// Initialize the vertex shader inputs to sensible default values. |
| 3 |
PostProcessVertexInputs inputs; |
| 4 |
initPostProcessMaterialVertex(inputs); |
| 5 |
|
| 6 |
inputs.normalizedUV = position.xy * 0.5 + 0.5; |
| 7 |
inputs.texelCoords = inputs.normalizedUV * frameUniforms.resolution.xy; |
| 8 |
|
| 9 |
// In Vulkan and Metal, texture coords are Y-down. In OpenGL, texture coords are Y-up. |
| 10 |
#if defined(TARGET_METAL_ENVIRONMENT) || defined(TARGET_VULKAN_ENVIRONMENT) |
| 11 |
inputs.texelCoords.y = frameUniforms.resolution.y - inputs.texelCoords.y; |
| 12 |
inputs.normalizedUV.y = 1.0 - inputs.normalizedUV.y; |
| 13 |
#endif |
| 14 |
|
| 15 |
gl_Position = getPosition(); |
| 16 |
|
| 17 |
// Adjust clip-space |
| 18 |
gl_Position.z = dot(gl_Position.zw, frameUniforms.clipControl.xy); |
| 19 |
|
| 20 |
// Invoke user code |
| 21 |
postProcessVertex(inputs); |
| 22 |
|
| 23 |
vertex_uv = inputs.texelCoords; |
| 24 |
|
| 25 |
// Handle user-defined interpolated attributes |
| 26 |
#if defined(VARIABLE_CUSTOM0) |
| 27 |
VARIABLE_CUSTOM_AT0 = inputs.VARIABLE_CUSTOM0; |
| 28 |
#endif |
| 29 |
#if defined(VARIABLE_CUSTOM1) |
| 30 |
VARIABLE_CUSTOM_AT1 = inputs.VARIABLE_CUSTOM1; |
| 31 |
#endif |
| 32 |
#if defined(VARIABLE_CUSTOM2) |
| 33 |
VARIABLE_CUSTOM_AT2 = inputs.VARIABLE_CUSTOM2; |
| 34 |
#endif |
| 35 |
#if defined(VARIABLE_CUSTOM3) |
| 36 |
VARIABLE_CUSTOM_AT3 = inputs.VARIABLE_CUSTOM3; |
| 37 |
#endif |
| 38 |
} |