diff --git a/crates/optix/examples/common/gdt/gdt/gdt.h b/crates/optix/examples/common/gdt/gdt/gdt.h index b4eaa48d..2a613e65 100644 --- a/crates/optix/examples/common/gdt/gdt/gdt.h +++ b/crates/optix/examples/common/gdt/gdt/gdt.h @@ -107,7 +107,7 @@ #define GDT_TERMINAL_RESET "\033[0m" #define GDT_TERMINAL_DEFAULT GDT_TERMINAL_RESET #define GDT_TERMINAL_BOLD "\033[1;1m" - + @@ -118,15 +118,7 @@ namespace gdt { #ifdef __CUDACC__ using ::min; using ::max; - // inline __both__ float abs(float f) { return fabsf(f); } - // inline __both__ double abs(double f) { return fabs(f); } using std::abs; - // inline __both__ float sin(float f) { return ::sinf(f); } - // inline __both__ double sin(double f) { return ::sin(f); } - // inline __both__ float cos(float f) { return ::cosf(f); } - // inline __both__ double cos(double f) { return ::cos(f); } - - using ::saturate; #else using std::min; using std::max; @@ -139,12 +131,12 @@ namespace gdt { // inline __both__ double abs(double f) { return fabs(f); } inline __both__ float rcp(float f) { return 1.f/f; } inline __both__ double rcp(double d) { return 1./d; } - + inline __both__ int32_t divRoundUp(int32_t a, int32_t b) { return (a+b-1)/b; } inline __both__ uint32_t divRoundUp(uint32_t a, uint32_t b) { return (a+b-1)/b; } inline __both__ int64_t divRoundUp(int64_t a, int64_t b) { return (a+b-1)/b; } inline __both__ uint64_t divRoundUp(uint64_t a, uint64_t b) { return (a+b-1)/b; } - + #ifdef __CUDACC__ using ::sin; // this is the double version // inline __both__ float sin(float f) { return ::sinf(f); } @@ -174,7 +166,7 @@ namespace gdt { #else # define osp_snprintf snprintf #endif - + /*! added pretty-print function for large numbers, printing 10000000 as "10M" instead */ inline std::string prettyDouble(const double val) { const double absVal = abs(val); @@ -195,7 +187,7 @@ namespace gdt { return result; } - + inline std::string prettyNumber(const size_t s) @@ -214,7 +206,7 @@ namespace gdt { } return buf; } - + inline double getCurrentTime() { #ifdef _WIN32 diff --git a/crates/optix/examples/ex02_pipeline/device/src/lib.rs b/crates/optix/examples/ex02_pipeline/device/src/lib.rs index 268ba6db..9fee238f 100644 --- a/crates/optix/examples/ex02_pipeline/device/src/lib.rs +++ b/crates/optix/examples/ex02_pipeline/device/src/lib.rs @@ -1,15 +1,8 @@ -#![cfg_attr( - target_os = "cuda", - no_std, - feature(register_attr), - register_attr(nvvm_internal) -)] // #![deny(warnings)] #![allow(clippy::missing_safety_doc)] use cuda_std::*; use cust_core::DeviceCopy; - use optix_device as optix; extern crate alloc; @@ -54,7 +47,7 @@ pub unsafe fn __raygen__renderFrame() { if idx[0] == 3 && idx[1] == 4 { vprintf( c"Hello from Rust kernel!\n".as_ptr().cast(), - std::ptr::null::(), + core::ptr::null::(), ); #[repr(C)] @@ -63,7 +56,7 @@ pub unsafe fn __raygen__renderFrame() { vprintf( c"frame id is %d\n".as_ptr().cast(), &PrintArgs(core::ptr::read_volatile(&PARAMS.frame_id)) as *const PrintArgs - as *const std::ffi::c_void, + as *const core::ffi::c_void, ); } } diff --git a/crates/optix/examples/ex02_pipeline/src/renderer.rs b/crates/optix/examples/ex02_pipeline/src/renderer.rs index 1abd3358..ddc5d530 100644 --- a/crates/optix/examples/ex02_pipeline/src/renderer.rs +++ b/crates/optix/examples/ex02_pipeline/src/renderer.rs @@ -1,5 +1,5 @@ use anyhow::{Context, Result}; -use cust::context::{Context as CuContext, ContextFlags}; +use cust::context::Context as CuContext; use cust::device::{Device, DeviceAttribute}; use cust::memory::{CopyDestination, DeviceBox, DeviceBuffer, DevicePointer, DeviceVariable}; use cust::stream::{Stream, StreamFlags}; @@ -40,8 +40,7 @@ impl Renderer { let srf_align = device.get_attribute(DeviceAttribute::SurfaceAlignment)?; println!("tex align: {}\nsrf align: {}", tex_align, srf_align); - let cuda_context = - CuContext::create_and_push(ContextFlags::SCHED_AUTO | ContextFlags::MAP_HOST, device)?; + let cuda_context = CuContext::new(device)?; let stream = Stream::new(StreamFlags::DEFAULT, None)?; let mut ctx = DeviceContext::new(&cuda_context, false)?; @@ -149,7 +148,7 @@ impl Renderer { let launch_params = DeviceVariable::new(LaunchParams { frame_id: 17, fb_size: [width as u32, height as u32], - color_buffer: color_buffer.as_device_ptr(), + color_buffer: color_buffer.as_device_ptr().as_raw(), })?; Ok(Renderer { @@ -174,7 +173,7 @@ impl Renderer { self.color_buffer = unsafe { DeviceBuffer::uninitialized(width * height)? }; self.launch_params.fb_size[0] = width as u32; self.launch_params.fb_size[1] = height as u32; - self.launch_params.color_buffer = self.color_buffer.as_device_ptr(); + self.launch_params.color_buffer = self.color_buffer.as_device_ptr().as_raw(); Ok(()) } diff --git a/crates/optix/examples/ex04_mesh/Cargo.toml b/crates/optix/examples/ex04_mesh/Cargo.toml index ffaa1c0b..190a06b6 100644 --- a/crates/optix/examples/ex04_mesh/Cargo.toml +++ b/crates/optix/examples/ex04_mesh/Cargo.toml @@ -12,7 +12,7 @@ anyhow = "1.0.44" glfw = "0.42.0" gl = "0.14.0" num-traits = "0.2.14" -glam = { version = "0.20", features=["cuda"] } +glam = { version = "0.29.2", features=["cuda"] } [build-dependencies] find_cuda_helper = { version = "0.2", path = "../../../find_cuda_helper" } diff --git a/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs b/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs index cd12a24b..4a82a710 100644 --- a/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs +++ b/crates/optix/examples/rust/ex04_mesh_gpu/src/lib.rs @@ -1,4 +1,3 @@ -#![cfg_attr(target_os = "cuda", no_std, register_attr(nvvm_internal))] #![allow(non_snake_case, clippy::missing_safety_doc)] use cuda_std::kernel; @@ -76,7 +75,7 @@ pub unsafe fn __miss__radiance() { } extern "C" { - #[cfg_attr(target_os = "cuda", nvvm_internal(addrspace(4)))] + #[cfg_attr(target_os = "cuda", nvvm_internal::addrspace(4))] static PARAMS: LaunchParams; } diff --git a/crates/optix/src/acceleration.rs b/crates/optix/src/acceleration.rs index 45ec6803..377e0f09 100644 --- a/crates/optix/src/acceleration.rs +++ b/crates/optix/src/acceleration.rs @@ -1687,7 +1687,7 @@ pub struct InstancePointerArray<'i> { } impl<'i> InstancePointerArray<'i> { - pub fn new(instances: &'i DeviceSlice) -> InstancePointerArray { + pub fn new(instances: &'i DeviceSlice) -> InstancePointerArray<'i> { InstancePointerArray { instances } } } diff --git a/crates/optix_device/src/lib.rs b/crates/optix_device/src/lib.rs index 886a6049..6471f0cc 100644 --- a/crates/optix_device/src/lib.rs +++ b/crates/optix_device/src/lib.rs @@ -1,3 +1,4 @@ +#![cfg_attr(target_os = "cuda", feature(asm_experimental_arch))] #[cfg(target_os = "cuda")] use core::arch::asm;