Advertisement
Guest User

Untitled

a guest
Mar 17th, 2023
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 460 core
  2. #extension GL_ARB_bindless_texture : require
  3.  
  4. #define INSTANCE_COUNT 65536
  5.  
  6. layout(location = 0) in vec2 a_position;
  7. layout(location = 1) in vec2 a_uv;
  8.  
  9. out Varying
  10. {
  11.     vec2 Position;
  12.     vec2 UV;
  13.     flat sampler2D TextureID;
  14. } VS_OUT;
  15.  
  16. layout(std140, binding = 0) uniform InstanceData
  17. {
  18.     mat4 Transforms[INSTANCE_COUNT];
  19.     sampler2D TextureIDs[INSTANCE_COUNT];
  20. } u_instanceData;
  21.  
  22. void main()
  23. {
  24.     vec4 pos = u_instanceData.Transforms[gl_InstanceID] * vec4(a_position, 0.0, 1.0);
  25.  
  26.     VS_OUT.Position = pos.xy;
  27.     VS_OUT.UV = a_uv;
  28.     VS_OUT.TextureID = u_instanceData.TextureIDs[gl_InstanceID];
  29.  
  30.     gl_Position = pos;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement