axmol/core/renderer/shaders/positionTextureInstance.vert

30 lines
665 B
GLSL
Raw Normal View History

#version 310 es
layout (location = POSITION) in vec4 a_position;
layout (location = TEXCOORD0) in vec2 a_texCoord;
2023-07-31 10:03:24 +08:00
#if !defined(METAL)
layout (location = TEXCOORD1) in mat4 a_instance;
2023-07-31 10:03:24 +08:00
#endif
layout (location = TEXCOORD0) out vec2 v_texCoord;
2023-07-31 10:03:24 +08:00
layout(std140, binding = 0) uniform vs_ub {
mat4 u_MVPMatrix;
};
2023-07-31 10:03:24 +08:00
#if defined(METAL)
layout(std140, binding = 1) buffer vs_inst {
mat4 u_instance[];
};
#endif
void main(void)
{
2023-07-31 10:03:24 +08:00
#if defined(METAL)
gl_Position = u_MVPMatrix * u_instance[gl_InstanceIndex] * a_position;
#else
gl_Position = u_MVPMatrix * a_instance * a_position;
2023-07-31 10:03:24 +08:00
#endif
v_texCoord = a_texCoord;
v_texCoord.y = 1.0 - v_texCoord.y;
}