Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan GLSL: uniform block with push_constant allocation #12

Closed
tangent-vector opened this issue Jun 15, 2017 · 0 comments
Closed

Vulkan GLSL: uniform block with push_constant allocation #12

tangent-vector opened this issue Jun 15, 2017 · 0 comments
Labels
kind:enhancement a desirable new feature, option, or behavior

Comments

@tangent-vector
Copy link
Contributor

Both Vulkan and D3D12 share the idea that "push constants" ("root constants") are exposed to the shading language as ordinary uniform blocks (cbuffers). In D3D12 the actual assignment of a buffer to root constant resources is handled at the API level, while in Vulkan all of the binding to API-level resources is handled in layout modifiers.

A GLSL uniform block decorated with layout(push_constant):

layout(push_constant) uniform MyStuff { ... };

consumes different resources from an ordinary uniform block. This needs to be accounted for in a few places:

  • We need to parse the push_constant layout modifier into a form visible to semantics
  • The ParameterBinding.cpp and/or TypeLayout.cpp logic needs to allocate resources differently for these blocks
    • Don't allocate a descriptor table slot for the block
    • Allocate a new resource kind (PushConstant) for members of the block

The existing reflection API should be able to handle this case.

Actually, one parting shot: it might be worthwhile to go ahead and detect this modifier during parsing, so that we can break out a distinct type for the push_constant block like what we do for in and out blocks already. That would probably simplify a lot of the logic because the block would no longer surface as an "ordinary" uniform block.

@tangent-vector tangent-vector added kind:enhancement a desirable new feature, option, or behavior GLSL labels Jun 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:enhancement a desirable new feature, option, or behavior
Projects
None yet
Development

No branches or pull requests

1 participant