Skip to content

Conversation

@luciechoi
Copy link
Collaborator

@luciechoi luciechoi commented Jan 16, 2026

Part of #7979

Implement methods for vk::SampledTexture2D:

float CalculateLevelOfDetailUnclamped(float2 location);
<Template Type>4 Gather(float2 location, [int2 offset], [uint status]);

@luciechoi
Copy link
Collaborator Author

@s-perron
(I've separated into different PRs as discussed, please see the last two commits)

Copy link
Collaborator

@s-perron s-perron left a comment

Choose a reason for hiding this comment

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

This looks good. Nothing too different than what I said on the first PR.

Comment on lines 5857 to 5881
if (isSample) {
if (numArgs > 2) {
clamp = doExpr(expr->getArg(2));
}
if (numArgs > 3) {
status = doExpr(expr->getArg(3));
}
return createImageSample(
retType, imageType, sampledImage, /*sampler*/ nullptr, coordinate,
/*compareVal*/ nullptr, /*bias*/ nullptr,
/*lod*/ nullptr, {nullptr, nullptr}, constOffset, varOffset,
/*constOffsets*/ nullptr, /*sample*/ nullptr,
/*minLod*/ clamp, status, loc, range);
} else {
if (numArgs > 2) {
status = doExpr(expr->getArg(2));
}
return spvBuilder.createImageGather(
retType, imageType, sampledImage, /*sampler*/ nullptr, coordinate,
// .Gather() doc says we return four components of red data.
spvBuilder.getConstantInt(astContext.IntTy, llvm::APInt(32, 0)),
/*compareVal*/ nullptr, constOffset, varOffset,
/*constOffsets*/ nullptr, /*sampleNumber*/ nullptr, status, loc,
range);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

See my comment in the other PR. As I mentioned there, you will eventually recreate all of the logic for the non-sampled image case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It became much better, thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Jan 23, 2026

✅ With the latest revision this PR passed the C/C++ code formatter.

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

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants