Skip to content

Commit d65f3aa

Browse files
authored
[SYCL][Bindless] Add default constructor to bindless sampler (#11895)
- Add default constructor to bindless sampler - Add by-value semantics to bindless sampler - Modify existing test to show this - Add these to the bindless spec
1 parent 5a5dff6 commit d65f3aa

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -652,18 +652,24 @@ struct bindless_image_sampler {
652652
float minMipmapLevelClamp, float maxMipmapLevelClamp,
653653
float maxAnisotropy);
654654

655-
sycl::addressing_mode addressing;
656-
sycl::coordinate_normalization_mode coordinate;
657-
sycl::filtering_mode filtering;
658-
sycl::filtering_mode mipmap_filtering;
659-
float min_mipmap_level_clamp;
660-
float max_mipmap_level_clamp;
661-
float max_anisotropy;
655+
sycl::addressing_mode addressing = sycl::addressing_mode::none;
656+
sycl::coordinate_normalization_mode coordinate =
657+
sycl::coordinate_normalization_mode::unnormalized;
658+
sycl::filtering_mode filtering = sycl::filtering_mode::nearest;
659+
sycl::filtering_mode mipmap_filtering = sycl::filtering_mode::nearest;
660+
float min_mipmap_level_clamp = 0.f;
661+
float max_mipmap_level_clamp = 0.f;
662+
float max_anisotropy = 0.f;
662663
};
663664

664665
}
665666
```
666667

668+
The `bindless_image_sampler` shall be default constructible and follow by-value
669+
semantics. The value for the addressing mode, `addressing_mode::none`,
670+
represents the backend's default addressing mode. On CUDA this is `Wrap`, i.e.
671+
`addressing_mode::repeat`.
672+
667673
`mipmap_filtering` dictates the method in which sampling between mipmap
668674
levels is performed.
669675

@@ -1997,4 +2003,6 @@ These features still need to be handled:
19972003
restrictions on image types
19982004
|4.8|2023-10-25| - Change the name of `map_external_memory_array` to
19992005
`map_external_image_memory` to avoid CUDA terminology
2006+
|4.9|2023-11-13| - Add that the bindless sampler is default constructible
2007+
and follows by-value semantics
20002008
|======================

sycl/include/sycl/ext/oneapi/bindless_images_sampler.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ struct bindless_image_sampler {
3333
max_mipmap_level_clamp(maxMipmapLevelClamp),
3434
max_anisotropy(maxAnisotropy) {}
3535

36-
sycl::addressing_mode addressing;
37-
sycl::coordinate_normalization_mode coordinate;
38-
sycl::filtering_mode filtering;
39-
sycl::filtering_mode mipmap_filtering;
36+
bindless_image_sampler() = default;
37+
38+
sycl::addressing_mode addressing = sycl::addressing_mode::none;
39+
sycl::coordinate_normalization_mode coordinate =
40+
sycl::coordinate_normalization_mode::unnormalized;
41+
sycl::filtering_mode filtering = sycl::filtering_mode::nearest;
42+
sycl::filtering_mode mipmap_filtering = sycl::filtering_mode::nearest;
4043
float min_mipmap_level_clamp = 0.f;
4144
float max_mipmap_level_clamp = 0.f;
4245
float max_anisotropy = 0.f;

sycl/test-e2e/bindless_images/sampling_2D.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,18 @@ int main() {
3535
}
3636

3737
try {
38-
sycl::ext::oneapi::experimental::bindless_image_sampler samp(
38+
sycl::ext::oneapi::experimental::bindless_image_sampler tempSamp(
3939
sycl::addressing_mode::repeat,
4040
sycl::coordinate_normalization_mode::normalized,
4141
sycl::filtering_mode::linear);
4242

43+
// Default constructible sampler
44+
sycl::ext::oneapi::experimental::bindless_image_sampler samp;
45+
46+
// Sampler follows by-value semantics
47+
sycl::ext::oneapi::experimental::bindless_image_sampler tempSamp2(tempSamp);
48+
samp = tempSamp2;
49+
4350
// Extension: image descriptor -- can use the same for both images
4451
sycl::ext::oneapi::experimental::image_descriptor desc(
4552
{width, height}, sycl::image_channel_order::rgba,

0 commit comments

Comments
 (0)