use std::ffi::c_void; use eonacat_xsbox_gpu::hwrt::{ XboxBatchedBuildDesc2, XboxBuildDesc, XboxBuildInputs, XboxPostbuildDesc, XboxPrebuildInfo, }; use eonacat_xsbox_gpu::object::{HRESULT, Object, S_OK}; type This = *const Object; use crate::hle::{HleExport, HleModule}; extern "system" fn ctor( this: *mut [usize; 3], _device: This, rehydrate_only: bool, ) -> *mut [usize; 3] { if !this.is_null() { unsafe { *this = [0, 0, 0] }; } tracing::info!(rehydrate_only, "HLE XboxBvhBuilder constructed (hardware DXR 1.1)"); this } extern "system" fn dtor(this: *mut [usize; 3]) { if !this.is_null() { unsafe { *this = [0, 0, 0] }; } } extern "system" fn set_64bit_morton(_this: *mut c_void, _enable: bool) {} extern "system" fn get_prebuild_info( _this: *mut c_void, inputs: *const XboxBuildInputs, stream_desc: *const u8, out: *mut XboxPrebuildInfo, ) { eonacat_xsbox_gpu::hwrt::prebuild_info(inputs, stream_desc, out); } extern "system" fn build_single( _this: *mut c_void, list: This, desc: *const XboxBuildDesc, num_postbuild: u32, postbuild: *const XboxPostbuildDesc, ) { eonacat_xsbox_gpu::hwrt::build_single(list, desc, num_postbuild, postbuild); } extern "system" fn build_batched2( _this: *mut c_void, list: This, num_descs: u32, descs: *const XboxBatchedBuildDesc2, ) { eonacat_xsbox_gpu::hwrt::build_batched2(list, num_descs, descs); } extern "system" fn copy_as( _this: *mut c_void, list: This, dest_va: u64, src_va: u64, mode: u32, ) { eonacat_xsbox_gpu::hwrt::copy_as(list, dest_va, src_va, mode); } extern "system" fn rehydrate_batched2( _this: *mut c_void, list: This, num_descs: u32, descs: *const XboxBuildDesc, src_vas: *const u64, ) -> HRESULT { eonacat_xsbox_gpu::hwrt::rehydrate_batched2(list, num_descs, descs, src_vas) } extern "system" fn rehydrate_batched( _this: *mut c_void, list: This, num_descs: u32, descs: *const XboxBuildDesc, ) -> HRESULT { eonacat_xsbox_gpu::hwrt::rehydrate_batched2(list, num_descs, descs, std::ptr::null()) } extern "system" fn rehydrate_cpu( _this: *mut c_void, _device: This, _desc: *const XboxBuildDesc, ) -> HRESULT { S_OK } extern "system" fn validate_rehydrate(_this: *mut c_void, _desc: *const XboxBuildDesc) -> HRESULT { S_OK } extern "system" fn cpu_validate(_this: *mut c_void, _list: This, _desc: *const XboxBuildDesc) {} pub(crate) fn module() -> HleModule { HleModule { name: "xboxbvh", dlls: &["xboxbvhbuilder.dll"], exports: vec![ HleExport { name: "??0XboxBvhBuilder@@QEAA@PEAUID3D12Device11@@_N@Z", address: ctor as *const () as usize, }, HleExport { name: "??1XboxBvhBuilder@@QEAA@XZ", address: dtor as *const () as usize, }, HleExport { name: "?Set64BitMortonCodes@XboxBvhBuilder@@QEAAX_N@Z", address: set_64bit_morton as *const () as usize, }, HleExport { name: "?GetRaytracingAccelerationStructurePrebuildInfo@XboxBvhBuilder@@QEAAXPEBUD3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS@@PEBUD3D12XBOX_XDXR_STREAM_DESC@@PEAUD3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO@@@Z", address: get_prebuild_info as *const () as usize, }, HleExport { name: "?BuildRaytracingAccelerationStructure@XboxBvhBuilder@@QEAAXPEAUID3D12GraphicsCommandList4@@PEBUD3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC@@IPEBUD3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC@@@Z", address: build_single as *const () as usize, }, HleExport { name: "?BuildRaytracingAccelerationStructureBatched2X@XboxBvhBuilder@@QEAAXPEAUID3D12GraphicsCommandList6@@IPEBUD3D12XBOX_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_BATCHED_DESC2@@@Z", address: build_batched2 as *const () as usize, }, HleExport { name: "?CopyRaytracingAccelerationStructure@XboxBvhBuilder@@QEAAXPEAUID3D12GraphicsCommandList4@@_K1W4D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE@@@Z", address: copy_as as *const () as usize, }, HleExport { name: "?RehydrateRaytracingAccelerationStructureBatched2X@XboxBvhBuilder@@QEAAJPEAUID3D12GraphicsCommandList8@@IPEBUD3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC@@PEB_K@Z", address: rehydrate_batched2 as *const () as usize, }, HleExport { name: "?RehydrateRaytracingAccelerationStructureBatchedX@XboxBvhBuilder@@QEAAJPEAUID3D12GraphicsCommandList8@@IPEBUD3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC@@@Z", address: rehydrate_batched as *const () as usize, }, HleExport { name: "?RehydrateRaytracingAccelerationStructureX@XboxBvhBuilder@@QEAAJPEAUID3D12Device11@@PEBUD3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC@@@Z", address: rehydrate_cpu as *const () as usize, }, HleExport { name: "?ValidateRehydrateAccelerationStructureBuildDesc@XboxBvhBuilder@@QEAAJPEBUD3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC@@@Z", address: validate_rehydrate as *const () as usize, }, HleExport { name: "?CpuValidateResultX@XboxBvhBuilder@@QEAAXPEAUID3D12GraphicsCommandList4@@PEBUD3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC@@@Z", address: cpu_validate as *const () as usize, }, ], } }