Skip to content

SPIR-V integer image sampling restriction - #1594

Open
bashbaug wants to merge 3 commits into
KhronosGroup:mainfrom
bashbaug:spirv-integer-image-sampling
Open

SPIR-V integer image sampling restriction#1594
bashbaug wants to merge 3 commits into
KhronosGroup:mainfrom
bashbaug:spirv-integer-image-sampling

Conversation

@bashbaug

Copy link
Copy Markdown
Contributor

The main purpose of this change is to add a missing restriction to the SPIR-V environment spec when reading from an image with a sampler: If the image is an integer image, then the sampler must be using nearest filtering or behavior is undefined. This restriction is present in OpenCL C, e.g.:

The read_image{i|ui} calls support a nearest filter only. The filter_mode specified in sampler must be set to CLK_FILTER_NEAREST; otherwise the values returned are undefined.

It is also consistent with restrictions in the graphics APIs, so I do not believe this was ever intended to work via SPIR-V.

Additionally:

  • Switch to describing the restrictions in terms of defined and undefined behavior rather than valid and invalid behavior. Defined and undefined behavior is more accurate, since these conditions cannot be statically verified.
  • Editorial updates to improve table appearance.

I'd like to make similar changes to the OpenCL C spec eventually. Right now, we're describing these rules for each of the image read and write overloads, which is redundant and error-prone. We should be able to describe these restrictions in one place instead, which would shorten the spec and improve understanding.

@bashbaug bashbaug changed the title Spirv integer image sampling SPIR-V integer image sampling restriction Jul 29, 2026
Comment on lines 1518 to +1519

For the integer image data types, when reading from an image with a sampler,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in the August 4th teleconference. Need to use a more precise term here than "integer image data types".

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant