Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix examples #162

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use cuda_std::kernel;
use optix_device::{
closesthit, get_launch_index,
glam::*,
misc::*,
payload,
trace::TraversableHandle,
trace::{trace, RayFlags},
Expand Down
56 changes: 28 additions & 28 deletions crates/optix/optix_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ impl OptixResult {
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OptixResult(pub ::std::os::raw::c_int);
pub struct OptixResult(pub ::std::os::raw::c_uint);
pub mod OptixDeviceProperty {
pub type Type = ::std::os::raw::c_int;
pub type Type = ::std::os::raw::c_uint;
pub const OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRACE_DEPTH: Type = 8193;
pub const OPTIX_DEVICE_PROPERTY_LIMIT_MAX_TRAVERSABLE_GRAPH_DEPTH: Type = 8194;
pub const OPTIX_DEVICE_PROPERTY_LIMIT_MAX_PRIMITIVES_PER_GAS: Type = 8195;
Expand All @@ -212,8 +212,8 @@ pub type OptixLogCallback = ::std::option::Option<
pub const OptixDeviceContextValidationMode_OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_OFF:
OptixDeviceContextValidationMode = 0;
pub const OptixDeviceContextValidationMode_OPTIX_DEVICE_CONTEXT_VALIDATION_MODE_ALL:
OptixDeviceContextValidationMode = -1;
pub type OptixDeviceContextValidationMode = ::std::os::raw::c_int;
OptixDeviceContextValidationMode = 4294967295;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still haven't explained why this is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this seems to be something that changed on build. looking into

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole file is generated through bindgen, and its values are going to differ when building on linux vs windows. The build seems to suggest this file was only written there for debugging, as it also writes it to the output directory, and that one is ultimately included in sys.rs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it automatically converts -1 to 4294967295 on my machine on compilation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr is it should be safe to ignore this file in your changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add to gitignore?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove it and update build.rs so it only writes to the output dir. We can do that in another PR and ignore the file for now.

pub type OptixDeviceContextValidationMode = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct OptixDeviceContextOptions {
Expand All @@ -233,22 +233,22 @@ impl Default for OptixDeviceContextOptions {
}
pub const OptixHitKind_OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE: OptixHitKind = 254;
pub const OptixHitKind_OPTIX_HIT_KIND_TRIANGLE_BACK_FACE: OptixHitKind = 255;
pub type OptixHitKind = ::std::os::raw::c_int;
pub type OptixHitKind = ::std::os::raw::c_uint;
pub const OptixIndicesFormat_OPTIX_INDICES_FORMAT_NONE: OptixIndicesFormat = 0;
pub const OptixIndicesFormat_OPTIX_INDICES_FORMAT_UNSIGNED_SHORT3: OptixIndicesFormat = 8450;
pub const OptixIndicesFormat_OPTIX_INDICES_FORMAT_UNSIGNED_INT3: OptixIndicesFormat = 8451;
pub type OptixIndicesFormat = ::std::os::raw::c_int;
pub type OptixIndicesFormat = ::std::os::raw::c_uint;
pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_NONE: OptixVertexFormat = 0;
pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT3: OptixVertexFormat = 8481;
pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT2: OptixVertexFormat = 8482;
pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF3: OptixVertexFormat = 8483;
pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF2: OptixVertexFormat = 8484;
pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_3: OptixVertexFormat = 8485;
pub const OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_2: OptixVertexFormat = 8486;
pub type OptixVertexFormat = ::std::os::raw::c_int;
pub type OptixVertexFormat = ::std::os::raw::c_uint;
pub const OptixTransformFormat_OPTIX_TRANSFORM_FORMAT_NONE: OptixTransformFormat = 0;
pub const OptixTransformFormat_OPTIX_TRANSFORM_FORMAT_MATRIX_FLOAT12: OptixTransformFormat = 8673;
pub type OptixTransformFormat = ::std::os::raw::c_int;
pub type OptixTransformFormat = ::std::os::raw::c_uint;
#[repr(C)]
pub struct OptixBuildInputTriangleArray {
pub vertexBuffers: *const CUdeviceptr,
Expand Down Expand Up @@ -283,7 +283,7 @@ pub const OptixPrimitiveType_OPTIX_PRIMITIVE_TYPE_ROUND_QUADRATIC_BSPLINE: Optix
pub const OptixPrimitiveType_OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE: OptixPrimitiveType = 9474;
pub const OptixPrimitiveType_OPTIX_PRIMITIVE_TYPE_ROUND_LINEAR: OptixPrimitiveType = 9475;
pub const OptixPrimitiveType_OPTIX_PRIMITIVE_TYPE_TRIANGLE: OptixPrimitiveType = 9521;
pub type OptixPrimitiveType = ::std::os::raw::c_int;
pub type OptixPrimitiveType = ::std::os::raw::c_uint;
pub const OptixPrimitiveTypeFlags_OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM: OptixPrimitiveTypeFlags = 1;
pub const OptixPrimitiveTypeFlags_OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_QUADRATIC_BSPLINE:
OptixPrimitiveTypeFlags = 2;
Expand Down Expand Up @@ -369,7 +369,7 @@ pub const OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES: OptixBui
pub const OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_INSTANCES: OptixBuildInputType = 8515;
pub const OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_INSTANCE_POINTERS: OptixBuildInputType = 8516;
pub const OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_CURVES: OptixBuildInputType = 8517;
pub type OptixBuildInputType = ::std::os::raw::c_int;
pub type OptixBuildInputType = ::std::os::raw::c_uint;
#[repr(C)]
pub struct OptixBuildInput__bindgen_ty_1 {
pub triangleArray: __BindgenUnionField<OptixBuildInputTriangleArray>,
Expand All @@ -395,7 +395,7 @@ pub const OptixInstanceFlags_OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING: OptixInst
pub const OptixInstanceFlags_OPTIX_INSTANCE_FLAG_DISABLE_ANYHIT: OptixInstanceFlags = 4;
pub const OptixInstanceFlags_OPTIX_INSTANCE_FLAG_ENFORCE_ANYHIT: OptixInstanceFlags = 8;
pub const OptixInstanceFlags_OPTIX_INSTANCE_FLAG_DISABLE_TRANSFORM: OptixInstanceFlags = 64;
pub type OptixInstanceFlags = ::std::os::raw::c_int;
pub type OptixInstanceFlags = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct OptixInstance {
Expand All @@ -414,14 +414,14 @@ pub const OptixBuildFlags_OPTIX_BUILD_FLAG_PREFER_FAST_TRACE: OptixBuildFlags =
pub const OptixBuildFlags_OPTIX_BUILD_FLAG_PREFER_FAST_BUILD: OptixBuildFlags = 8;
pub const OptixBuildFlags_OPTIX_BUILD_FLAG_ALLOW_RANDOM_VERTEX_ACCESS: OptixBuildFlags = 16;
pub const OptixBuildFlags_OPTIX_BUILD_FLAG_ALLOW_RANDOM_INSTANCE_ACCESS: OptixBuildFlags = 32;
pub type OptixBuildFlags = ::std::os::raw::c_int;
pub type OptixBuildFlags = ::std::os::raw::c_uint;
pub const OptixBuildOperation_OPTIX_BUILD_OPERATION_BUILD: OptixBuildOperation = 8545;
pub const OptixBuildOperation_OPTIX_BUILD_OPERATION_UPDATE: OptixBuildOperation = 8546;
pub type OptixBuildOperation = ::std::os::raw::c_int;
pub type OptixBuildOperation = ::std::os::raw::c_uint;
pub const OptixMotionFlags_OPTIX_MOTION_FLAG_NONE: OptixMotionFlags = 0;
pub const OptixMotionFlags_OPTIX_MOTION_FLAG_START_VANISH: OptixMotionFlags = 1;
pub const OptixMotionFlags_OPTIX_MOTION_FLAG_END_VANISH: OptixMotionFlags = 2;
pub type OptixMotionFlags = ::std::os::raw::c_int;
pub type OptixMotionFlags = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct OptixMotionOptions {
Expand Down Expand Up @@ -455,7 +455,7 @@ pub struct OptixAccelBufferSizes {
}
pub const OptixAccelPropertyType_OPTIX_PROPERTY_TYPE_COMPACTED_SIZE: OptixAccelPropertyType = 8577;
pub const OptixAccelPropertyType_OPTIX_PROPERTY_TYPE_AABBS: OptixAccelPropertyType = 8578;
pub type OptixAccelPropertyType = ::std::os::raw::c_int;
pub type OptixAccelPropertyType = ::std::os::raw::c_uint;
#[repr(C)]
pub struct OptixAccelEmitDesc {
pub result: CUdeviceptr,
Expand Down Expand Up @@ -524,9 +524,9 @@ pub const OptixTraversableType_OPTIX_TRAVERSABLE_TYPE_MATRIX_MOTION_TRANSFORM:
OptixTraversableType = 8642;
pub const OptixTraversableType_OPTIX_TRAVERSABLE_TYPE_SRT_MOTION_TRANSFORM: OptixTraversableType =
8643;
pub type OptixTraversableType = ::std::os::raw::c_int;
pub type OptixTraversableType = ::std::os::raw::c_uint;
pub mod OptixPixelFormat {
pub type Type = ::std::os::raw::c_int;
pub type Type = ::std::os::raw::c_uint;
pub const OPTIX_PIXEL_FORMAT_HALF2: Type = 8711;
pub const OPTIX_PIXEL_FORMAT_HALF3: Type = 8705;
pub const OPTIX_PIXEL_FORMAT_HALF4: Type = 8706;
Expand Down Expand Up @@ -555,7 +555,7 @@ impl Default for OptixImage2D {
}
}
pub mod OptixDenoiserModelKind {
pub type Type = ::std::os::raw::c_int;
pub type Type = ::std::os::raw::c_uint;
pub const OPTIX_DENOISER_MODEL_KIND_LDR: Type = 8994;
pub const OPTIX_DENOISER_MODEL_KIND_HDR: Type = 8995;
pub const OPTIX_DENOISER_MODEL_KIND_AOV: Type = 8996;
Expand Down Expand Up @@ -630,29 +630,29 @@ pub const OptixRayFlags_OPTIX_RAY_FLAG_CULL_BACK_FACING_TRIANGLES: OptixRayFlags
pub const OptixRayFlags_OPTIX_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES: OptixRayFlags = 32;
pub const OptixRayFlags_OPTIX_RAY_FLAG_CULL_DISABLED_ANYHIT: OptixRayFlags = 64;
pub const OptixRayFlags_OPTIX_RAY_FLAG_CULL_ENFORCED_ANYHIT: OptixRayFlags = 128;
pub type OptixRayFlags = ::std::os::raw::c_int;
pub type OptixRayFlags = ::std::os::raw::c_uint;
pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_NONE: OptixTransformType = 0;
pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_STATIC_TRANSFORM: OptixTransformType = 1;
pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_MATRIX_MOTION_TRANSFORM: OptixTransformType = 2;
pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_SRT_MOTION_TRANSFORM: OptixTransformType = 3;
pub const OptixTransformType_OPTIX_TRANSFORM_TYPE_INSTANCE: OptixTransformType = 4;
pub type OptixTransformType = ::std::os::raw::c_int;
pub type OptixTransformType = ::std::os::raw::c_uint;
pub mod OptixTraversableGraphFlags {
pub type Type = ::std::os::raw::c_int;
pub type Type = ::std::os::raw::c_uint;
pub const OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY: Type = 0;
pub const OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS: Type = 1;
pub const OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_LEVEL_INSTANCING: Type = 2;
}
pub mod OptixCompileOptimizationLevel {
pub type Type = ::std::os::raw::c_int;
pub type Type = ::std::os::raw::c_uint;
pub const OPTIX_COMPILE_OPTIMIZATION_DEFAULT: Type = 0;
pub const OPTIX_COMPILE_OPTIMIZATION_LEVEL_0: Type = 9024;
pub const OPTIX_COMPILE_OPTIMIZATION_LEVEL_1: Type = 9025;
pub const OPTIX_COMPILE_OPTIMIZATION_LEVEL_2: Type = 9026;
pub const OPTIX_COMPILE_OPTIMIZATION_LEVEL_3: Type = 9027;
}
pub mod OptixCompileDebugLevel {
pub type Type = ::std::os::raw::c_int;
pub type Type = ::std::os::raw::c_uint;
pub const OPTIX_COMPILE_DEBUG_LEVEL_DEFAULT: Type = 0;
pub const OPTIX_COMPILE_DEBUG_LEVEL_NONE: Type = 9040;
pub const OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO: Type = 9041;
Expand Down Expand Up @@ -694,15 +694,15 @@ impl Default for OptixModuleCompileOptions {
}
}
pub mod OptixProgramGroupKind {
pub type Type = ::std::os::raw::c_int;
pub type Type = ::std::os::raw::c_uint;
pub const OPTIX_PROGRAM_GROUP_KIND_RAYGEN: Type = 9249;
pub const OPTIX_PROGRAM_GROUP_KIND_MISS: Type = 9250;
pub const OPTIX_PROGRAM_GROUP_KIND_EXCEPTION: Type = 9251;
pub const OPTIX_PROGRAM_GROUP_KIND_HITGROUP: Type = 9252;
pub const OPTIX_PROGRAM_GROUP_KIND_CALLABLES: Type = 9253;
}
pub const OptixProgramGroupFlags_OPTIX_PROGRAM_GROUP_FLAGS_NONE: OptixProgramGroupFlags = 0;
pub type OptixProgramGroupFlags = ::std::os::raw::c_int;
pub type OptixProgramGroupFlags = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct OptixProgramGroupSingleModule {
Expand Down Expand Up @@ -826,7 +826,7 @@ pub const OptixExceptionCodes_OPTIX_EXCEPTION_CODE_UNSUPPORTED_DATA_ACCESS: Opti
-32;
pub type OptixExceptionCodes = ::std::os::raw::c_int;
pub mod OptixExceptionFlags {
pub type Type = ::std::os::raw::c_int;
pub type Type = ::std::os::raw::c_uint;
pub const OPTIX_EXCEPTION_FLAG_NONE: Type = 0;
pub const OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW: Type = 1;
pub const OPTIX_EXCEPTION_FLAG_TRACE_DEPTH: Type = 2;
Expand Down Expand Up @@ -906,7 +906,7 @@ pub struct OptixStackSizes {
}
pub const OptixQueryFunctionTableOptions_OPTIX_QUERY_FUNCTION_TABLE_OPTION_DUMMY:
OptixQueryFunctionTableOptions = 0;
pub type OptixQueryFunctionTableOptions = ::std::os::raw::c_int;
pub type OptixQueryFunctionTableOptions = ::std::os::raw::c_uint;
pub type OptixQueryFunctionTable_t = ::std::option::Option<
unsafe extern "C" fn(
abiId: ::std::os::raw::c_int,
Expand Down Expand Up @@ -1543,7 +1543,7 @@ pub const OptixTransformByteAlignment: usize = 64;
pub const OptixVersion: usize = 70300;
pub const OptixBuildInputSize: usize = 1032;
pub const OptixShaderBindingTableSize: usize = 64;
#[repr(i32)]
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum OptixGeometryFlags {
None = 0,
Expand Down
51 changes: 23 additions & 28 deletions crates/optix/src/acceleration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,18 +702,13 @@ bitflags::bitflags! {
/// Select which operation to perform with [`accel_build()`].
#[cfg_attr(windows, repr(i32))]
#[cfg_attr(unix, repr(u32))]
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Default)]
pub enum BuildOperation {
#[default]
Build = sys::OptixBuildOperation_OPTIX_BUILD_OPERATION_BUILD,
Update = sys::OptixBuildOperation_OPTIX_BUILD_OPERATION_UPDATE,
}

impl Default for BuildOperation {
fn default() -> Self {
BuildOperation::Build
}
}

/// Configure how to handle ray times that are outside of the provided motion keys.
///
/// By default, the object will appear static (clamped) to the nearest motion
Expand Down Expand Up @@ -983,7 +978,7 @@ pub struct CurveArray<'v, 'w, 'i> {
primitive_index_offset: u32,
}

impl<'v, 'w, 'i> Hash for CurveArray<'v, 'w, 'i> {
impl Hash for CurveArray<'_, '_, '_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.curve_type.hash(state);
state.write_u32(self.num_primitives);
Expand Down Expand Up @@ -1088,7 +1083,7 @@ impl<'v, 'w, 'i> CurveArray<'v, 'w, 'i> {
}
}

impl<'v, 'w, 'i> BuildInput for CurveArray<'v, 'w, 'i> {
impl BuildInput for CurveArray<'_, '_, '_> {
fn to_sys(&self) -> sys::OptixBuildInput {
sys::OptixBuildInput {
type_: sys::OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_CURVES,
Expand Down Expand Up @@ -1139,13 +1134,13 @@ impl From<CurveType> for sys::OptixPrimitiveType {
#[repr(u32)]
#[derive(Copy, Clone, PartialEq)]
pub enum VertexFormat {
None = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_NONE as u32,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the cast will break on windows. The enum type in the generated bindings are c_int on windows (thus the u32 cast) but c_uint on linux. See rust-lang/rust-bindgen#1361

If clippy is complaining about this, we'll need to ignore them here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was a clippy change. I'll make these changes tomorrow.

Float3 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT3 as u32,
Float2 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT2 as u32,
Half3 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF3 as u32,
Half2 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF2 as u32,
SNorm16 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_3 as u32,
SNorm32 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_2 as u32,
None = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_NONE,
Float3 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT3,
Float2 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_FLOAT2,
Half3 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF3,
Half2 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_HALF2,
SNorm16 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_3,
SNorm32 = sys::OptixVertexFormat_OPTIX_VERTEX_FORMAT_SNORM16_2,
}

/// Specifies the type of index data
Expand Down Expand Up @@ -1299,15 +1294,15 @@ impl<'v, 'g, V: Vertex> TriangleArray<'v, 'g, V> {
}
}

impl<'v, 'g, V: Vertex> Hash for TriangleArray<'v, 'g, V> {
impl<V: Vertex> Hash for TriangleArray<'_, '_, V> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
state.write_u32(self.num_vertices);
state.write_usize(self.d_vertex_buffers.len());
self.geometry_flags.hash(state);
}
}

impl<'v, 'g, V: Vertex> BuildInput for TriangleArray<'v, 'g, V> {
impl<V: Vertex> BuildInput for TriangleArray<'_, '_, V> {
fn to_sys(&self) -> sys::OptixBuildInput {
sys::OptixBuildInput {
type_: sys::OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_TRIANGLES,
Expand Down Expand Up @@ -1382,7 +1377,7 @@ impl<'v, 'i, V: Vertex, I: IndexTriple> IndexedTriangleArray<'v, 'i, V, I> {
}
}

impl<'v, 'i, V: Vertex, I: IndexTriple> Hash for IndexedTriangleArray<'v, 'i, V, I> {
impl<V: Vertex, I: IndexTriple> Hash for IndexedTriangleArray<'_, '_, V, I> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
state.write_u32(self.num_vertices);
state.write_usize(self.d_vertex_buffers.len());
Expand All @@ -1391,7 +1386,7 @@ impl<'v, 'i, V: Vertex, I: IndexTriple> Hash for IndexedTriangleArray<'v, 'i, V,
}
}

impl<'v, 'i, V: Vertex, I: IndexTriple> BuildInput for IndexedTriangleArray<'v, 'i, V, I> {
impl<V: Vertex, I: IndexTriple> BuildInput for IndexedTriangleArray<'_, '_, V, I> {
fn to_sys(&self) -> sys::OptixBuildInput {
sys::OptixBuildInput {
type_: sys::OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_TRIANGLES,
Expand Down Expand Up @@ -1439,7 +1434,7 @@ pub struct CustomPrimitiveArray<'a, 's> {
primitive_index_offset: u32,
}

impl<'a, 'g, 's> Hash for CustomPrimitiveArray<'a, 's> {
impl<'g> Hash for CustomPrimitiveArray<'_, '_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
state.write_usize(self.aabb_buffers.len());
state.write_u32(self.num_primitives);
Expand Down Expand Up @@ -1509,7 +1504,7 @@ impl<'a, 's> CustomPrimitiveArray<'a, 's> {
}
}

impl<'a, 's> BuildInput for CustomPrimitiveArray<'a, 's> {
impl BuildInput for CustomPrimitiveArray<'_, '_> {
fn to_sys(&self) -> sys::OptixBuildInput {
sys::OptixBuildInput {
type_: sys::OptixBuildInputType_OPTIX_BUILD_INPUT_TYPE_CUSTOM_PRIMITIVES,
Expand Down Expand Up @@ -1646,13 +1641,13 @@ impl<'i, 'a> InstanceArray<'i, 'a> {
}
}

impl<'i, 'a> Hash for InstanceArray<'i, 'a> {
impl Hash for InstanceArray<'_, '_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
state.write_usize(self.instances.len());
}
}

impl<'i, 'a> BuildInput for InstanceArray<'i, 'a> {
impl BuildInput for InstanceArray<'_, '_> {
fn to_sys(&self) -> sys::OptixBuildInput {
cfg_if::cfg_if! {
if #[cfg(any(feature="optix72", feature="optix73"))] {
Expand Down Expand Up @@ -1692,13 +1687,13 @@ impl<'i> InstancePointerArray<'i> {
}
}

impl<'i> Hash for InstancePointerArray<'i> {
impl Hash for InstancePointerArray<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
state.write_usize(self.instances.len());
}
}

impl<'i> BuildInput for InstancePointerArray<'i> {
impl BuildInput for InstancePointerArray<'_> {
fn to_sys(&self) -> sys::OptixBuildInput {
cfg_if::cfg_if! {
if #[cfg(any(feature="optix72", feature="optix73"))] {
Expand Down Expand Up @@ -1865,7 +1860,7 @@ impl MatrixMotionTransform {
cust::memory::memcpy_htod(
transform_ptr.as_raw(),
transforms.as_ptr() as *const c_void,
std::mem::size_of::<RowMatrix3x4<f32>>() * num_keys,
std::mem::size_of_val(transforms),
)?;

let hnd = convert_pointer_to_traversable_handle(
Expand Down Expand Up @@ -2014,7 +2009,7 @@ impl SrtMotionTransform {
cust::memory::memcpy_htod(
transform_ptr.as_raw(),
srt_data.as_ptr() as *const c_void,
std::mem::size_of::<SrtData>() * num_keys,
std::mem::size_of_val(srt_data),
)?;

let hnd = convert_pointer_to_traversable_handle(
Expand Down
2 changes: 1 addition & 1 deletion crates/optix/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl DeviceContext {
Ok(optix_call!(optixDeviceContextGetCacheDatabaseSizes(
self.raw, &mut low, &mut high,
))
.map(|_| (low as usize, high as usize))?)
.map(|_| (low, high))?)
}
}

Expand Down
Loading