[SPIR-V] Support vk::SampledTexture2D in offload test suite.#748
Open
[SPIR-V] Support vk::SampledTexture2D in offload test suite.#748
vk::SampledTexture2D in offload test suite.#748Conversation
Keenuts
reviewed
Feb 19, 2026
| float2 uv_min = BaseUV + offset * 2.0; | ||
|
|
||
| // Only check the first thread in the quad where UV is exactly (0.5, 0.5). | ||
| if (all(GTid.xy == 0)) { |
Contributor
There was a problem hiding this comment.
nit: it would IMO be clearer to early return on this condition to clarify the shader:
float4 main(float4 Pos : SV_POSITION) {
uint2 GTid = (uint2)Pos;
if (!all(GTid == 0))
return float4(0, 0, 0, 0);
Contributor
Author
There was a problem hiding this comment.
Sorry I didn't quite get your comment (and above)..!
it's intentional that we do not early return before this if condition to correctly calculate the gradient. Although the threads that do not meet the if condition do not execute, their coordinate will be used to calculate the correct mip level for the first pixel.
PLMK if I'm misunderstanding anything.
cc: @s-perron (original author)
Comment on lines
+28
to
+32
| // 1. Magnification UVs: Small delta (0.0001). LOD < 0. GPU selects MagFilter. | ||
| float2 uv_mag = BaseUV + offset * 0.0001; | ||
|
|
||
| // 2. Minification UVs: Large delta (2.0). LOD > 0. GPU selects MinFilter. | ||
| float2 uv_min = BaseUV + offset * 2.0; |
Contributor
There was a problem hiding this comment.
Given the condition below all(GTid.xy == 0), offset is essentially trunc(float2(0, 0)), to uv_mag and uv_min are the same value BaseUV no?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CombinedImageSamplerresource type..Sample()forvk::SampledTexture2D.The test is exactly the same as Texture2D.Sample.test.yaml.
Part of microsoft/DirectXShaderCompiler#7979