Skip to content

Commit

Permalink
Enable OpenCL optional functions with dynamic feature
Browse files Browse the repository at this point in the history
  • Loading branch information
kenba committed Dec 4, 2024
1 parent 91cc8cd commit 03db6cb
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 94 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ opencl-sys = { git = "https://github.com/kenba/opencl-sys-rs", branch = "develop
thiserror = "2.0"

[dev-dependencies]
cl3 = { path = ".", features = ["static", "CL_VERSION_1_1", "CL_VERSION_1_2", "CL_VERSION_2_0"] }
# cl3 = { path = ".", features = ["dynamic"] }
# cl3 = { path = ".", features = ["static", "CL_VERSION_1_1", "CL_VERSION_1_2", "CL_VERSION_2_0"] }
cl3 = { path = ".", features = ["dynamic"] }

[[example]]
name = "clinfo"
Expand Down
2 changes: 1 addition & 1 deletion src/d3d10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use libc::c_void;
#[allow(unused_imports)]
use std::ptr;

#[cfg(feature = "cl_khr_d3d10_sharing")]
#[cfg(any(feature = "cl_khr_d3d10_sharing", feature = "dynamic"))]
pub unsafe fn get_supported_d3d10_texture_formats_intel(
context: cl_context,
flags: cl_mem_flags,
Expand Down
2 changes: 1 addition & 1 deletion src/d3d11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use libc::c_void;
#[allow(unused_imports)]
use std::ptr;

#[cfg(feature = "cl_khr_d3d11_sharing")]
#[cfg(any(feature = "cl_khr_d3d11_sharing", feature = "dynamic"))]
pub unsafe fn get_supported_d3d11_texture_formats_intel(
context: cl_context,
flags: cl_mem_flags,
Expand Down
11 changes: 6 additions & 5 deletions src/dx9_media_sharing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use libc::c_void;
#[allow(unused_imports)]
use std::ptr;

#[cfg(feature = "cl_intel_dx9_media_sharing")]
#[cfg(any(feature = "cl_intel_dx9_media_sharing", feature = "dynamic"))]
pub unsafe fn get_device_ids_from_dx9_intel(
platform: cl_platform_id,
dx9_device_source: cl_dx9_device_source_intel,
Expand Down Expand Up @@ -72,7 +72,7 @@ pub unsafe fn get_device_ids_from_dx9_intel(
}
}

#[cfg(feature = "cl_intel_dx9_media_sharing")]
#[cfg(any(feature = "cl_intel_dx9_media_sharing", feature = "dynamic"))]
pub unsafe fn create_from_dx9_media_surface_intel(
context: cl_context,
flags: cl_mem_flags,
Expand All @@ -96,7 +96,7 @@ pub unsafe fn create_from_dx9_media_surface_intel(
}
}

#[cfg(feature = "cl_intel_dx9_media_sharing")]
#[cfg(any(feature = "cl_intel_dx9_media_sharing", feature = "dynamic"))]
pub unsafe fn enqueue_acquire_dx9_objects_intel(
command_queue: cl_command_queue,
num_objects: cl_uint,
Expand All @@ -120,7 +120,7 @@ pub unsafe fn enqueue_acquire_dx9_objects_intel(
}
}

#[cfg(feature = "cl_intel_dx9_media_sharing")]
#[cfg(any(feature = "cl_intel_dx9_media_sharing", feature = "dynamic"))]
pub unsafe fn enqueue_release_dx9_objects_intel(
command_queue: cl_command_queue,
num_objects: cl_uint,
Expand All @@ -146,7 +146,8 @@ pub unsafe fn enqueue_release_dx9_objects_intel(

#[cfg(any(
feature = "cl_khr_dx9_media_sharing",
feature = "cl_intel_dx9_media_sharing"
feature = "cl_intel_dx9_media_sharing",
feature = "dynamic"
))]
pub unsafe fn get_supported_dx9_media_surface_formats_intel(
context: cl_context,
Expand Down
8 changes: 4 additions & 4 deletions src/egl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use std::ptr;
/// # Safety
///
/// This is unsafe because `cl_context` is a raw pointer.
#[cfg(feature = "cl_khr_egl_image")]
#[cfg(any(feature = "cl_khr_egl_image", feature = "dynamic"))]
#[inline]
pub unsafe fn create_from_egl_image(
context: cl_context,
Expand Down Expand Up @@ -82,7 +82,7 @@ pub unsafe fn create_from_egl_image(
/// # Safety
///
/// This is unsafe because `command_queue` is a raw pointer.
#[cfg(feature = "cl_khr_egl_image")]
#[cfg(any(feature = "cl_khr_egl_image", feature = "dynamic"))]
#[inline]
pub unsafe fn enqueue_acquire_egl_objects(
command_queue: cl_command_queue,
Expand Down Expand Up @@ -123,7 +123,7 @@ pub unsafe fn enqueue_acquire_egl_objects(
/// # Safety
///
/// This is unsafe because `command_queue` is a raw pointer.
#[cfg(feature = "cl_khr_egl_image")]
#[cfg(any(feature = "cl_khr_egl_image", feature = "dynamic"))]
#[inline]
pub unsafe fn enqueue_release_egl_objects(
command_queue: cl_command_queue,
Expand Down Expand Up @@ -162,7 +162,7 @@ pub unsafe fn enqueue_release_egl_objects(
/// # Safety
///
/// This is unsafe because context is a raw pointer.
#[cfg(feature = "cl_khr_egl_event")]
#[cfg(any(feature = "cl_khr_egl_event", feature = "dynamic"))]
#[inline]
pub unsafe fn create_event_from_egl_sync_khr(
context: cl_context,
Expand Down
Loading

0 comments on commit 03db6cb

Please sign in to comment.