Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Support non-constant offset dereferences, part 1

Merged Francisco Casas requested to merge fcasas/vkd3d:nonconst-offsets-part into master

Indexing with non-constants offsets requires relative addressing in SM4. In assembly, this is written like in the following example:

x1[r1.x + 3]

The first part of this patch series only includes support for indexing vectors with non-constant indexes.

Following patches in https://gitlab.winehq.org/fcasas/vkd3d/-/commits/nonconst-offsets-3.


Non-constant indexing of vectors cannot be implemented with relative addressing in SM4 because this indexation cannot be performed at the level of register-components, only whole registers.

Mathematical operations must be used instead.

For floats, the native compiler seems to index an identity matrix, to get the i-th column, and then proceedes to compute the dot product between that column and the vector. For ints, bit operations seem to be performed.

While probably less efficient, this implementation complies with the type-checking at the IR level and when writing bytecode.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading