Skip to content

Commit b284a0d

Browse files
committed
[SYCL][Bindless][UR] moving srgb check to pupulate_ur_structs
1 parent 3d89061 commit b284a0d

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

sycl/include/sycl/ext/oneapi/bindless_images_descriptor.hpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,6 @@ struct image_descriptor {
132132
throw sycl::exception(sycl::errc::invalid,
133133
"Images must have 1, 2, 3, or 4 channels.");
134134
}
135-
if (color_space == image_color_space::srgb) {
136-
if (num_channels != 4) {
137-
throw sycl::exception(sycl::errc::invalid,
138-
"sRGB color space requires num_channels == 4");
139-
}
140-
if (channel_type != image_channel_type::unorm_int8) {
141-
throw sycl::exception(
142-
sycl::errc::invalid,
143-
"sRGB color space requires unorm_int8 channel type");
144-
}
145-
}
146135
switch (this->type) {
147136
case image_type::standard:
148137
if (this->array_size > 1) {

sycl/source/detail/bindless_images.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ namespace ext::oneapi::experimental {
2323

2424
void populate_ur_structs(const image_descriptor &desc, ur_image_desc_t &urDesc,
2525
ur_image_format_t &urFormat, size_t pitch = 0) {
26+
27+
// check for sRGB
28+
if (desc.color_space == image_color_space::srgb) {
29+
if (desc.num_channels != 4) {
30+
throw sycl::exception(sycl::errc::invalid,
31+
"sRGB color space requires num_channels == 4");
32+
}
33+
if (desc.channel_type != image_channel_type::unorm_int8) {
34+
throw sycl::exception(
35+
sycl::errc::invalid,
36+
"sRGB color space requires unorm_int8 channel type");
37+
}
38+
}
2639
urDesc = {};
2740
urDesc.stype = UR_STRUCTURE_TYPE_IMAGE_DESC;
2841
urDesc.width = desc.width;

0 commit comments

Comments
 (0)