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

bugfix(prevent building a slice from a null pointer) #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ impl Default for CommonSettings {

#[repr(u32)]
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ResourceType {
//=============================================================================================================================
// COMMON INPUTS
Expand Down Expand Up @@ -774,6 +774,9 @@ pub struct DispatchDesc {
}
impl DispatchDesc {
pub fn constant_buffer(&self) -> &[u8] {
if self.constant_buffer_data.is_null() {
return &[];
}
unsafe {
std::slice::from_raw_parts(
self.constant_buffer_data,
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::ffi::c_void;

mod ffi;
pub mod ffi;

pub use ffi::{
AccumulationMode, CheckerboardMode, CommonSettings, Denoiser, DenoiserDesc, DescriptorType,
Expand Down