KhronosGroup / KhronosGroup/Vulkan-Docs

VK_KHR_shader_untyped_pointers / SPV_KHR_untyped pointers should work on any storage class allowing non-uniform array indexing.

Open
#2,684 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.3k
Forks
549
Avg merge
5d 5h
Merged PRs (30d)
2

Description

As presented at the Shading Language Symposium the opt-in way that Untyped Pointers work prevents nice codegen for Unions and Variants (tagged unions) which are not in SSBOs/BDA/UBO or Workgroup memory.

[Francisco-Letterio-DevSH_SPIRV-1.pdf](https://github.com/user-attachments/files/25479763/Francisco-Letterio-DevSH_SPIRV-1.pdf)

Video recording https://www.youtube.com/watch?v=L-oRcQ1NU58

Manually packing and unpacking from a bunch of `uint16_t` or `uint32_t` feels like going back to pre-SPIR-V 1.4 ages when we didn't have OpLogicalCopy

I actually have an excellent use-case for unions in Private / Function Storage / Callable class in Path Tracing where I want to forward my BxDF parameters between an importance sampling routine and a routine which evaluates the BxDF value divided by the PDF and the PDF-derived MIS-weight.

Rationale?

For a Cook Torrance conductor (Metallic=1.0 for the game engine folks) I don't need to load the fresnel (F0) yet because without an underlying substrate of transmission it can't influence the VNDF sampling, only roughnesses and normal maps can.

Similarly for a Diffuse material, albedo doesn't play a role.

But I do need to load the roughnesses when generating samples, and its useful to pass the already loaded data to the shading evaluation function which calculates the throughput to continue my path with.

Since I may have Path Guiding or Resampling inbetween, or the sample generated can just be invalid (VNDF isn't a silver bullet), its useful to decouple my sample generation from evaluation and path continuation.

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked Francisco-Letterio-DevSH_SPIRV-1.pdf and watching the referenced symposium recording, then compare the requested behavior with VK_KHR_shader_untyped_pointers and SPV_KHR_untyped pointers. No source files or tests are named; done would require a decided specification change allowing the requested storage classes and corresponding validation or conformance coverage.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.