Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 460 core
- #extension GL_ARB_bindless_texture : require
- #define INSTANCE_COUNT 65536
- layout(location = 0) in vec2 a_position;
- layout(location = 1) in vec2 a_uv;
- out Varying
- {
- vec2 Position;
- vec2 UV;
- flat sampler2D TextureID;
- } VS_OUT;
- layout(std140, binding = 0) uniform InstanceData
- {
- mat4 Transforms[INSTANCE_COUNT];
- sampler2D TextureIDs[INSTANCE_COUNT];
- } u_instanceData;
- void main()
- {
- vec4 pos = u_instanceData.Transforms[gl_InstanceID] * vec4(a_position, 0.0, 1.0);
- VS_OUT.Position = pos.xy;
- VS_OUT.UV = a_uv;
- VS_OUT.TextureID = u_instanceData.TextureIDs[gl_InstanceID];
- gl_Position = pos;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement