Skip to content

Instantly share code, notes, and snippets.

@sortofsleepy
Last active August 20, 2024 13:27
Show Gist options
  • Save sortofsleepy/d83e605977ad4ddac457eaa829d5b762 to your computer and use it in GitHub Desktop.
Save sortofsleepy/d83e605977ad4ddac457eaa829d5b762 to your computer and use it in GitHub Desktop.
Vulkan Buffer Reference basics
// ... version, etc
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
struct SceneDataTable {
uint64_t vertices;
};
layout(buffer_reference, scalar) buffer Vertices { vec4 v[]; };
layout(push_constant) uniform PushConsts {
SceneDataTable data;
} env;
// When using
Vertices verts = Vertices(env.data.vertices);
@sortofsleepy
Copy link
Author

sortofsleepy commented Aug 20, 2024

Basic reference for how to use buffer references.

Here

  • sending push constant of buffer address
  • To get at the data, initialize Vertices with the push constant data
  • This will let you then access the buffer information by calling verts.v[index]

Note that you will have to enable Int64 support when initializing your logical device by querying and enabling the shaderInt64 feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment