-
Notifications
You must be signed in to change notification settings - Fork 162
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
Fix examples #162
Changes from all commits
b935463
fdcea86
8377048
ddd2598
d8c9807
512174d
105d451
2fd24f6
16344c0
22e66a0
31a1b03
76e60a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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); | ||
|
@@ -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, | ||
|
@@ -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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 If clippy is complaining about this, we'll need to ignore them here. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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, | ||
|
@@ -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()); | ||
|
@@ -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, | ||
|
@@ -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); | ||
|
@@ -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, | ||
|
@@ -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"))] { | ||
|
@@ -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"))] { | ||
|
@@ -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( | ||
|
@@ -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( | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.