Skip to content

Commit

Permalink
fixes for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbaug authored and Beanavil committed Nov 12, 2024
1 parent cf13626 commit 5ca6f4c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions samples/extensions/khr/externalmemory/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,11 @@ int main(int argc, char* argv[])

// Create OpenCL buffers from Vulkan external memory file descriptors.
cl_mem_properties ext_mem_props_x[] = {
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
#ifdef _WIN32
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR,
(cl_mem_properties)handle_x,
#else
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
(cl_mem_properties)fd_x,
#endif
(cl_mem_properties)CL_MEM_DEVICE_HANDLE_LIST_KHR,
Expand All @@ -587,10 +588,11 @@ int main(int argc, char* argv[])
0
};
cl_mem_properties ext_mem_props_y[] = {
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
#ifdef _WIN32
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR,
(cl_mem_properties)handle_y,
#else
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
(cl_mem_properties)fd_y,
#endif
(cl_mem_properties)CL_MEM_DEVICE_HANDLE_LIST_KHR,
Expand Down
6 changes: 4 additions & 2 deletions samples/extensions/khr/externalmemory/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,11 @@ int main(int argc, char* argv[])

// Create OpenCL buffers from Vulkan external memory file descriptors.
std::vector<cl_mem_properties> ext_mem_props_x = {
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
#ifdef _WIN32
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR,
(cl_mem_properties)handle_x,
#else
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
(cl_mem_properties)fd_x,
#endif
(cl_mem_properties)CL_MEM_DEVICE_HANDLE_LIST_KHR,
Expand All @@ -495,10 +496,11 @@ int main(int argc, char* argv[])
0
};
std::vector<cl_mem_properties> ext_mem_props_y = {
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
#ifdef _WIN32
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR,
(cl_mem_properties)handle_y,
#else
(cl_mem_properties)CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR,
(cl_mem_properties)fd_y,
#endif
(cl_mem_properties)CL_MEM_DEVICE_HANDLE_LIST_KHR,
Expand Down
10 changes: 6 additions & 4 deletions samples/extensions/khr/externalmemory/vulkan_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,12 @@ find_suitable_device(VkInstance instance,
++platform_id)
{
cl_uint cl_platform_devices_count = 0;
OCLERROR_RET(clGetDeviceIDs(platforms[platform_id],
CL_DEVICE_TYPE_ALL, 0, NULL,
&cl_platform_devices_count),
error, candidates);
error = clGetDeviceIDs(platforms[platform_id], CL_DEVICE_TYPE_ALL, 0,
NULL, &cl_platform_devices_count);
if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND)
{
goto candidates;
}

for (cl_uint cl_candidate_id = 0;
cl_candidate_id < cl_platform_devices_count;
Expand Down

0 comments on commit 5ca6f4c

Please sign in to comment.