Skip to content

[SPIR-V] Support vk::SampledTexture2D in offload test suite.#748

Open
luciechoi wants to merge 5 commits intollvm:mainfrom
luciechoi:sampledtexture
Open

[SPIR-V] Support vk::SampledTexture2D in offload test suite.#748
luciechoi wants to merge 5 commits intollvm:mainfrom
luciechoi:sampledtexture

Conversation

@luciechoi
Copy link
Contributor

  • Support CombinedImageSampler resource type.
  • Add test for .Sample() for vk::SampledTexture2D.

The test is exactly the same as Texture2D.Sample.test.yaml.

Part of microsoft/DirectXShaderCompiler#7979

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)) {
Copy link
Contributor

@Keenuts Keenuts Feb 19, 2026

Choose a reason for hiding this comment

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

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);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

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.

2 participants

Comments