Skip to content

Commit

Permalink
build: properly set blocklist to avoid generating os-specific bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
chyyran committed Feb 7, 2024
1 parent 0418e33 commit d5cd78b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 269 deletions.
7 changes: 7 additions & 0 deletions bindings_generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ fn main() {
.clang_arg(format!("-I{}", header_dst.display()))
.clang_arg(format!("-I{}", header_compiler_dst.display()))
.parse_callbacks(Box::new(callbacks::SpirvToDxilCallbacks))
.allowlist_var("DXIL_SPIRV_MAX_VIEWPORT")
.allowlist_type("dxil_spirv_.*")
.allowlist_type("dxil_shader_model")
.allowlist_type("dxil_validator_version")
.allowlist_function("spirv_to_dxil")
.allowlist_function("spirv_to_dxil_free")
.allowlist_function("spirv_to_dxil_get_version")
.rustified_enum("dxil_spirv_shader_stage")
.rustified_non_exhaustive_enum("dxil_shader_model")
.rustified_non_exhaustive_enum("dxil_validator_version")
Expand Down
269 changes: 0 additions & 269 deletions spirv-to-dxil-sys/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,41 +1,5 @@
/* automatically generated by rust-bindgen 0.64.0 */

pub const __bool_true_false_are_defined: u32 = 1;
pub const false_: u32 = 0;
pub const true_: u32 = 1;
pub const _VCRT_COMPILER_PREPROCESSOR: u32 = 1;
pub const _SAL_VERSION: u32 = 20;
pub const __SAL_H_VERSION: u32 = 180000000;
pub const _USE_DECLSPECS_FOR_SAL: u32 = 0;
pub const _USE_ATTRIBUTES_FOR_SAL: u32 = 0;
pub const _CRT_PACKING: u32 = 8;
pub const _HAS_EXCEPTIONS: u32 = 1;
pub const _STL_LANG: u32 = 0;
pub const _HAS_CXX17: u32 = 0;
pub const _HAS_CXX20: u32 = 0;
pub const _HAS_CXX23: u32 = 0;
pub const _HAS_NODISCARD: u32 = 0;
pub const _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE: u32 = 1;
pub const _CRT_BUILD_DESKTOP_APP: u32 = 1;
pub const _ARGMAX: u32 = 100;
pub const _CRT_INT_MAX: u32 = 2147483647;
pub const _CRT_FUNCTIONS_REQUIRED: u32 = 1;
pub const _CRT_HAS_CXX17: u32 = 0;
pub const _CRT_HAS_C11: u32 = 1;
pub const _CRT_INTERNAL_NONSTDC_NAMES: u32 = 1;
pub const __STDC_SECURE_LIB__: u32 = 200411;
pub const __GOT_SECURE_LIB__: u32 = 200411;
pub const __STDC_WANT_SECURE_LIB__: u32 = 1;
pub const _SECURECRT_FILL_BUFFER_PATTERN: u32 = 254;
pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES: u32 = 0;
pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT: u32 = 0;
pub const _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES: u32 = 1;
pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY: u32 = 0;
pub const _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY: u32 = 0;
pub const WCHAR_MIN: u32 = 0;
pub const WCHAR_MAX: u32 = 65535;
pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 65535;
pub const DXIL_SPIRV_MAX_VIEWPORT: u32 = 16;
#[repr(i32)]
#[non_exhaustive]
Expand Down Expand Up @@ -66,229 +30,6 @@ pub enum dxil_validator_version {
Validator1_7 = 65543,
Validator1_8 = 65544,
}
pub type va_list = *mut ::std::os::raw::c_char;
extern "C" {
pub fn __va_start(arg1: *mut *mut ::std::os::raw::c_char, ...);
}
pub type __vcrt_bool = bool;
pub type wchar_t = ::std::os::raw::c_ushort;
extern "C" {
pub fn __security_init_cookie();
}
extern "C" {
pub fn __security_check_cookie(_StackCookie: usize);
}
extern "C" {
pub fn __report_gsfailure(_StackCookie: usize) -> !;
}
extern "C" {
pub static mut __security_cookie: usize;
}
pub type __crt_bool = bool;
extern "C" {
pub fn _invalid_parameter_noinfo();
}
extern "C" {
pub fn _invalid_parameter_noinfo_noreturn() -> !;
}
extern "C" {
pub fn _invoke_watson(
_Expression: *const wchar_t,
_FunctionName: *const wchar_t,
_FileName: *const wchar_t,
_LineNo: ::std::os::raw::c_uint,
_Reserved: usize,
) -> !;
}
pub type errno_t = ::std::os::raw::c_int;
pub type wint_t = ::std::os::raw::c_ushort;
pub type wctype_t = ::std::os::raw::c_ushort;
pub type __time32_t = ::std::os::raw::c_long;
pub type __time64_t = ::std::os::raw::c_longlong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __crt_locale_data_public {
pub _locale_pctype: *const ::std::os::raw::c_ushort,
pub _locale_mb_cur_max: ::std::os::raw::c_int,
pub _locale_lc_codepage: ::std::os::raw::c_uint,
}
#[test]
fn bindgen_test_layout___crt_locale_data_public() {
const UNINIT: ::std::mem::MaybeUninit<__crt_locale_data_public> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<__crt_locale_data_public>(),
16usize,
concat!("Size of: ", stringify!(__crt_locale_data_public))
);
assert_eq!(
::std::mem::align_of::<__crt_locale_data_public>(),
8usize,
concat!("Alignment of ", stringify!(__crt_locale_data_public))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr)._locale_pctype) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(__crt_locale_data_public),
"::",
stringify!(_locale_pctype)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr)._locale_mb_cur_max) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(__crt_locale_data_public),
"::",
stringify!(_locale_mb_cur_max)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr)._locale_lc_codepage) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(__crt_locale_data_public),
"::",
stringify!(_locale_lc_codepage)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __crt_locale_pointers {
pub locinfo: *mut __crt_locale_data,
pub mbcinfo: *mut __crt_multibyte_data,
}
#[test]
fn bindgen_test_layout___crt_locale_pointers() {
const UNINIT: ::std::mem::MaybeUninit<__crt_locale_pointers> =
::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<__crt_locale_pointers>(),
16usize,
concat!("Size of: ", stringify!(__crt_locale_pointers))
);
assert_eq!(
::std::mem::align_of::<__crt_locale_pointers>(),
8usize,
concat!("Alignment of ", stringify!(__crt_locale_pointers))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).locinfo) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(__crt_locale_pointers),
"::",
stringify!(locinfo)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).mbcinfo) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(__crt_locale_pointers),
"::",
stringify!(mbcinfo)
)
);
}
pub type _locale_t = *mut __crt_locale_pointers;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _Mbstatet {
pub _Wchar: ::std::os::raw::c_ulong,
pub _Byte: ::std::os::raw::c_ushort,
pub _State: ::std::os::raw::c_ushort,
}
#[test]
fn bindgen_test_layout__Mbstatet() {
const UNINIT: ::std::mem::MaybeUninit<_Mbstatet> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<_Mbstatet>(),
8usize,
concat!("Size of: ", stringify!(_Mbstatet))
);
assert_eq!(
::std::mem::align_of::<_Mbstatet>(),
4usize,
concat!("Alignment of ", stringify!(_Mbstatet))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr)._Wchar) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_Mbstatet),
"::",
stringify!(_Wchar)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr)._Byte) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(_Mbstatet),
"::",
stringify!(_Byte)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr)._State) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(_Mbstatet),
"::",
stringify!(_State)
)
);
}
pub type mbstate_t = _Mbstatet;
pub type time_t = __time64_t;
pub type rsize_t = usize;
extern "C" {
pub fn _errno() -> *mut ::std::os::raw::c_int;
}
extern "C" {
pub fn _set_errno(_Value: ::std::os::raw::c_int) -> errno_t;
}
extern "C" {
pub fn _get_errno(_Value: *mut ::std::os::raw::c_int) -> errno_t;
}
extern "C" {
pub fn __threadid() -> ::std::os::raw::c_ulong;
}
extern "C" {
pub fn __threadhandle() -> usize;
}
pub type int_least8_t = ::std::os::raw::c_schar;
pub type int_least16_t = ::std::os::raw::c_short;
pub type int_least32_t = ::std::os::raw::c_int;
pub type int_least64_t = ::std::os::raw::c_longlong;
pub type uint_least8_t = ::std::os::raw::c_uchar;
pub type uint_least16_t = ::std::os::raw::c_ushort;
pub type uint_least32_t = ::std::os::raw::c_uint;
pub type uint_least64_t = ::std::os::raw::c_ulonglong;
pub type int_fast8_t = ::std::os::raw::c_schar;
pub type int_fast16_t = ::std::os::raw::c_int;
pub type int_fast32_t = ::std::os::raw::c_int;
pub type int_fast64_t = ::std::os::raw::c_longlong;
pub type uint_fast8_t = ::std::os::raw::c_uchar;
pub type uint_fast16_t = ::std::os::raw::c_uint;
pub type uint_fast32_t = ::std::os::raw::c_uint;
pub type uint_fast64_t = ::std::os::raw::c_ulonglong;
pub type intmax_t = ::std::os::raw::c_longlong;
pub type uintmax_t = ::std::os::raw::c_ulonglong;
#[repr(i32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum dxil_spirv_shader_stage {
Expand Down Expand Up @@ -1346,13 +1087,3 @@ extern "C" {
extern "C" {
pub fn spirv_to_dxil_get_version() -> u64;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __crt_locale_data {
pub _address: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __crt_multibyte_data {
pub _address: u8,
}

0 comments on commit d5cd78b

Please sign in to comment.