Skip to content
Merged
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
2 changes: 2 additions & 0 deletions crates/cuda_std/src/warp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//! thread blocks and execute in SIMT fashion.

use crate::gpu_only;
#[cfg(target_os = "cuda")]
use core::arch::asm;
use half::{bf16, f16};

/// Synchronizes all of the threads inside of this warp according to `mask`.
Expand Down
2 changes: 1 addition & 1 deletion crates/optix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl_half=["cust/impl_half", "half"]
cust = { version = "0.3", path = "../cust", features=["impl_mint"] }
cust_raw = { version = "0.11.2", path = "../cust_raw" }
cfg-if = "1.0.0"
bitflags = "2.8"
bitflags = "2.9.0"
glam = { version = "0.29", features=["cuda", "libm"], default-features=false, optional=true }
half = { version = "2.4.1", optional = true }
memoffset = "0.9.1"
Expand Down
31 changes: 17 additions & 14 deletions crates/optix/src/acceleration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ bitflags::bitflags! {
/// an AH programs on the device. May affect the performance of the accel (seems to be larger).
///
/// Note that `PREFER_FAST_TRACE` and `PREFER_FAST_BUILD` are mutually exclusive.
#[derive(Default)]
#[derive(Default, Clone, Copy, PartialEq, Eq, Debug)]
pub struct BuildFlags: OptixEnumBaseType {
const NONE = sys::OptixBuildFlags_OPTIX_BUILD_FLAG_NONE;
const ALLOW_UPDATE = sys::OptixBuildFlags_OPTIX_BUILD_FLAG_ALLOW_UPDATE;
Expand All @@ -714,18 +714,20 @@ impl Default for BuildOperation {
}
}

/// 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
/// key for rays outside of the range of key times.
///
/// * `START_VANISH` - The object will be invisible to rays with a time less
/// than the first provided motion key
/// * `END_VANISH` - The object will be invisible to rays with a time less
/// than the first provided motion key
#[derive(DeviceCopy, Clone, Copy, PartialEq, Eq, Debug)]
pub struct MotionFlags(u16);

bitflags::bitflags! {
/// 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
/// key for rays outside of the range of key times.
///
/// * `START_VANISH` - The object will be invisible to rays with a time less
/// than the first provided motion key
/// * `END_VANISH` - The object will be invisible to rays with a time less
/// than the first provided motion key
#[derive(DeviceCopy)]
pub struct MotionFlags: u16 {
impl MotionFlags: u16 {
const NONE = sys::OptixMotionFlags_OPTIX_MOTION_FLAG_NONE as u16;
const START_VANISH = sys::OptixMotionFlags_OPTIX_MOTION_FLAG_START_VANISH as u16;
const END_VANISH = sys::OptixMotionFlags_OPTIX_MOTION_FLAG_END_VANISH as u16;
Expand Down Expand Up @@ -1558,9 +1560,10 @@ const_assert_eq!(
std::mem::size_of::<sys::OptixInstance>()
);

#[derive(DeviceCopy, Clone, Copy, PartialEq, Eq, Debug)]
pub struct InstanceFlags(OptixEnumBaseType);
bitflags::bitflags! {
#[derive(DeviceCopy)]
pub struct InstanceFlags: OptixEnumBaseType {
impl InstanceFlags: OptixEnumBaseType {
const NONE = sys::OptixInstanceFlags_OPTIX_INSTANCE_FLAG_NONE;
const DISABLE_TRIANGLE_FACE_CULLING = sys::OptixInstanceFlags_OPTIX_INSTANCE_FLAG_DISABLE_TRIANGLE_FACE_CULLING;
const FLIP_TRIANGLE_FACING = sys::OptixInstanceFlags_OPTIX_INSTANCE_FLAG_FLIP_TRIANGLE_FACING;
Expand Down
6 changes: 3 additions & 3 deletions crates/optix/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ cfg_if::cfg_if! {
}

bitflags::bitflags! {
#[derive(Default)]
#[derive(Default, Hash, Clone, Copy, PartialEq, Eq, Debug)]
pub struct TraversableGraphFlags: OptixEnumBaseType {
const ALLOW_ANY = sys::OptixTraversableGraphFlags::OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_ANY;
const ALLOW_SINGLE_GAS = sys::OptixTraversableGraphFlags::OPTIX_TRAVERSABLE_GRAPH_FLAG_ALLOW_SINGLE_GAS;
Expand All @@ -217,7 +217,7 @@ bitflags::bitflags! {
}

bitflags::bitflags! {
#[derive(Default)]
#[derive(Default, Hash, Clone, Copy, PartialEq, Eq, Debug)]
pub struct ExceptionFlags: OptixEnumBaseType {
const NONE = sys::OptixExceptionFlags::OPTIX_EXCEPTION_FLAG_NONE;
const STACK_OVERFLOW = sys::OptixExceptionFlags::OPTIX_EXCEPTION_FLAG_STACK_OVERFLOW;
Expand All @@ -228,7 +228,7 @@ bitflags::bitflags! {
}

bitflags::bitflags! {
#[derive(Default)]
#[derive(Default, Hash, Clone, Copy, PartialEq, Eq, Debug)]
pub struct PrimitiveTypeFlags: i32 {
const DEFAULT = 0;
const CUSTOM = sys::OptixPrimitiveTypeFlags_OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM;
Expand Down
3 changes: 2 additions & 1 deletion crates/optix_device/src/hit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[cfg(target_os = "cuda")]
use core::arch::asm;
use cuda_std::gpu_only;
use glam::Vec3;

/// The type of primitive that a ray hit.
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
Expand Down
2 changes: 2 additions & 0 deletions crates/optix_device/src/intersect.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[cfg(target_os = "cuda")]
use core::arch::asm;
use cuda_std::gpu_only;
use paste::paste;
use seq_macro::seq;
Expand Down
8 changes: 2 additions & 6 deletions crates/optix_device/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#![cfg_attr(
target_arch = "nvptx64",
no_std,
feature(asm_experimental_arch),
register_attr(nvvm_internal)
)]
#[cfg(target_os = "cuda")]
use core::arch::asm;

extern crate alloc;

Expand Down
2 changes: 2 additions & 0 deletions crates/optix_device/src/misc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[cfg(target_os = "cuda")]
use core::arch::asm;
use cuda_std::gpu_only;

/// Retrieves the data past the SBT header for this particular program
Expand Down
2 changes: 2 additions & 0 deletions crates/optix_device/src/payload.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::sys;
#[cfg(target_os = "cuda")]
use core::arch::asm;
use cuda_std::gpu_only;

/// Overrides the payload for the given register to a value.
Expand Down
2 changes: 2 additions & 0 deletions crates/optix_device/src/ray.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::trace::*;
#[cfg(target_os = "cuda")]
use core::arch::asm;
use cuda_std::gpu_only;
use glam::Vec3;

Expand Down
2 changes: 2 additions & 0 deletions crates/optix_device/src/sys.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![allow(clippy::missing_safety_doc)]

use crate::trace::{RayFlags, TraversableHandle};
#[cfg(target_os = "cuda")]
use core::arch::asm;
use cuda_std::gpu_only;
use glam::Vec3;
use paste::paste;
Expand Down
2 changes: 2 additions & 0 deletions crates/optix_device/src/transform.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// use std::hint::unreachable_unchecked;
#[cfg(target_os = "cuda")]
use core::arch::asm;
use cuda_std::gpu_only;
use glam::{Vec3, Vec4};

Expand Down
4 changes: 2 additions & 2 deletions examples/optix/denoiser/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cust::memory::DeviceBuffer;
use cust::prelude::{Stream, StreamFlags};
use cust::util::SliceExt;
use image::io::Reader;
use image::ImageReader;
use optix::context::DeviceContext;
use optix::denoiser::{Denoiser, DenoiserModelKind, DenoiserParams, Image, ImageFormat};
use std::error::Error;
Expand All @@ -28,7 +28,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.expect("input was not a file")
.to_string_lossy()
.to_string();
let img = Reader::open(opt.input)?.decode()?;
let img = ImageReader::open(opt.input)?.decode()?;

let mut rgb = img.into_rgb8();
let mut linear = vec![Vec3::<f32>::zero(); rgb.as_raw().len()];
Expand Down
Loading