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

Use Offset instead of ConstOffset for GLSL function textureGatherOffset #5426

Conversation

jkwak-work
Copy link
Collaborator

Closes #5339

This commit changes to use Offset option on OpImageGather instruction when translating textureGatherOffset to SPIR-V code.

Interestingly GLSL allows the offset value to be a variable not constant just for the function textureGatherOffset while all other offset variants of texture sampling functions require the offset to be a constant value.

From a few experiments, I found that the spirv-optimizer changes Offset to ConstOffset if the offset is a compile-time value. I also found that when the offset value is zero, it changes to None with no offset value.

@jkwak-work jkwak-work added the pr: non-breaking PRs without breaking changes label Oct 28, 2024
@jkwak-work jkwak-work self-assigned this Oct 28, 2024
@jkwak-work jkwak-work force-pushed the fix/incorrect_use_of_const_offset_on_spirv_OpImageGather branch from 3c1514d to 69f949e Compare October 28, 2024 23:47
expipiplus1
expipiplus1 previously approved these changes Oct 29, 2024
This commit changes to use `Offset` option on OpImageGather instruction
when translating `textureGatherOffset` to SPIR-V code.

Interestingly GLSL allows the offset value to be a variable not
constant just for the function `textureGatherOffset` while all other
offset variants of texture sampling functions require the offset to be a
constant value.

From a few experiments, I found that the spirv-optimizer changes
`Offset` to `ConstOffset` if the offset is a compile-time value. I also
found that when the offset value is zero, it changes to `None` with no
offset value.
@jkwak-work jkwak-work force-pushed the fix/incorrect_use_of_const_offset_on_spirv_OpImageGather branch from 534d8f6 to 44a7523 Compare October 29, 2024 16:22
@jkwak-work jkwak-work merged commit 8b3f904 into shader-slang:master Oct 29, 2024
14 checks passed
@jkwak-work jkwak-work deleted the fix/incorrect_use_of_const_offset_on_spirv_OpImageGather branch October 29, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CTS] SPIR-V Validation failure, "Expected Image Operand ConstOffset to be a const object"
2 participants