Skip to content

Allow specifying register when declaring uniform/constant #36

@syelan34

Description

@syelan34

Feature Request

What feature are you suggesting?

Overview:

  • Include some syntax to specify the register to use when declaring a uniform, similar to the register() keyword in HLSL or layout() in GLSL.

Smaller Details:

  • This could be implemented as the same syntax as is done for inputs/outputs, e.g.:
  • .fvec foo c4
  • .consti bar[2] i0
  • etc...
  • Any uniform which doesn't specify would default back to the existing behaviour (uniforms go from 0->95 and constants from 95->0)
  • If unspecified uniform blocked by another uniform which has its location specified, then skip past it (this is consistent with behaviour from Microsoft's fxc compiler among others)
  • If two specified uniforms overlap, this is a compilation error.

Nature of Request:

  • Addition

Why would this feature be useful?

This would allow more control over uniform allocation, for example allowing for uniforms such as a projection matrix to be guaranteed to always be in the same location, reducing the need to constantly reset all the uniforms.
This would also allow easier conversion from other shader bytecode such as DXBC, making tools to do so much more feasible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions