From 776d28fb5e1281d8c94a9809b08c164660feade3 Mon Sep 17 00:00:00 2001 From: "Stirling, Sean" Date: Thu, 13 Aug 2026 12:35:19 +0100 Subject: [PATCH] [Bindless] Fix fetch_image on sampled handles to use sampled image path (#86) fetch_image on a sampled_image_handle was incorrectly going through FETCH_UNSAMPLED_IMAGE + CONVERT_HANDLE_TO_IMAGE. Correct to FETCH_SAMPLED_IMAGE + CONVERT_HANDLE_TO_SAMPLED_IMAGE. --- sycl/include/sycl/ext/oneapi/bindless_images.hpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sycl/include/sycl/ext/oneapi/bindless_images.hpp b/sycl/include/sycl/ext/oneapi/bindless_images.hpp index c0249d04903dc..cd86e32bc66e8 100644 --- a/sycl/include/sycl/ext/oneapi/bindless_images.hpp +++ b/sycl/include/sycl/ext/oneapi/bindless_images.hpp @@ -1036,19 +1036,15 @@ DataT fetch_image(const sampled_image_handle &imageHandle [[maybe_unused]], "HintT must always be a recognized standard type"); #ifdef __SYCL_DEVICE_ONLY__ - // Convert the raw handle to an image and use FETCH_UNSAMPLED_IMAGE since - // fetch_image should not use the sampler if constexpr (detail::is_recognized_standard_type()) { - return FETCH_UNSAMPLED_IMAGE( + return FETCH_SAMPLED_IMAGE( DataT, - CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle, - detail::OCLImageTyRead), + CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize), coords); } else { - return sycl::bit_cast(FETCH_UNSAMPLED_IMAGE( + return sycl::bit_cast(FETCH_SAMPLED_IMAGE( HintT, - CONVERT_HANDLE_TO_IMAGE(imageHandle.raw_handle, - detail::OCLImageTyRead), + CONVERT_HANDLE_TO_SAMPLED_IMAGE(imageHandle.raw_handle, coordSize), coords)); } #else