Skip to content

Conversation

@tarcila
Copy link
Collaborator

@tarcila tarcila commented Oct 15, 2025

As discussed, here is a proposal to add support for clampToBorder to ImageXD samplers.

Default wrapping mode is still clampToEdge.
Default borderColor is transparent black.

Note that the feature seems to be widely available:

  • CUDA (documented as early as 6.5)
  • OpenGL, DirectX
  • OpenGL ES 3.2 or through the GL_EXT_texture_border_clamp
  • Vulkan needs VK_EXT_custom_border_color, seems to be supported by many devices, but it is a transition-layer extension
  • Metal (it seems to be missing on older iOS platforms)

Worst case, this is something that should be implementable using programmable hardware.

@tarcila
Copy link
Collaborator Author

tarcila commented Oct 22, 2025

@johguenther I've been adding a new KHR_SAMPLER_CLAMP_TO_BORDER extension to expose this new wrapMode value.

To be more specific about it applying only to image samplers.
Also fix emphasis on parameter names.
@tarcila
Copy link
Collaborator Author

tarcila commented Oct 23, 2025

Actually, went through another extension rename, being more specific about it applying to image samplers.

@johguenther
Copy link
Collaborator

How about KHR_SAMPLER_IMAGExD_CLAMP_TO_BORDER?

Copy link
Collaborator

@johguenther johguenther left a comment

Choose a reason for hiding this comment

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

looks good, only the usual nitpicking...

* <<extension_sampler_clamp_to_border_image2d, `KHR_SAMPLER_CLAMP_TO_BORDER`>>: `image2D` sampler wrapMode1, wrapMode2 support clampToBorder
* <<object_types_sampler_image3D, `KHR_SAMPLER_IMAGE3D`>>: `image3D` sampler subtype is supported
* <<extension_sampler_clamp_to_border_image3d, `KHR_SAMPLER_CLAMP_TO_BORDER`>>: `image3D` sampler wrapMode1, wrapMode2, wrapMode3 support clampToBorder
* <<extension_sampler_image_clamp_to_border, `KHR_SAMPLER_IMAGE_CLAMP_TO_BORDER`>>:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see what you mean, this is indeed tricky as we have one extension for multiple samplers. I'd just keep this entry and primarily link to image1d, then link the bullets to the specific one.
I can simply make those changes if fine with you.

@tarcila
Copy link
Collaborator Author

tarcila commented Nov 5, 2025

@johguenther I should have been addressing all your comments. Feel free to re-review when you have time. Thanks!

@johguenther johguenther merged commit 13a9676 into KhronosGroup:next_release Nov 12, 2025
3 checks passed
@tarcila tarcila deleted the add-clamp-to-border branch November 12, 2025 12:10
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