Skip to content

Commit 720e91a

Browse files
committed
Stub out API on other backends
1 parent 79ffbe6 commit 720e91a

File tree

16 files changed

+543
-1
lines changed

16 files changed

+543
-1
lines changed

src/backend/dx11/src/device.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,6 +2057,9 @@ impl device::Device<Backend> for Device {
20572057
}
20582058
}
20592059
pso::Descriptor::TexelBuffer(_buffer_view) => unimplemented!(),
2060+
pso::Descriptor::AccelerationStructure(_accel_struct) => {
2061+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
2062+
}
20602063
};
20612064

20622065
let content = DescriptorContent::from(binding.ty);
@@ -2319,6 +2322,32 @@ impl device::Device<Backend> for Device {
23192322
unimplemented!()
23202323
}
23212324

2325+
unsafe fn create_acceleration_structure(
2326+
&self,
2327+
_desc: &hal::acceleration_structure::CreateDesc<Backend>,
2328+
) -> Result<(), device::OutOfMemory> {
2329+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
2330+
}
2331+
2332+
unsafe fn destroy_acceleration_structure(&self, _accel_struct: ()) {
2333+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
2334+
}
2335+
2336+
unsafe fn get_acceleration_structure_build_requirements(
2337+
&self,
2338+
_build_info: &hal::acceleration_structure::GeometryDesc<Backend>,
2339+
_max_primitives_counts: &[u32],
2340+
) -> hal::acceleration_structure::SizeRequirements {
2341+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
2342+
}
2343+
2344+
unsafe fn get_acceleration_structure_address(
2345+
&self,
2346+
_accel_struct: &(),
2347+
) -> hal::acceleration_structure::DeviceAddress {
2348+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
2349+
}
2350+
23222351
unsafe fn destroy_shader_module(&self, _shader_lib: ShaderModule) {}
23232352

23242353
unsafe fn destroy_render_pass(&self, _rp: RenderPass) {
@@ -2451,4 +2480,8 @@ impl device::Device<Backend> for Device {
24512480
unsafe fn set_pipeline_layout_name(&self, _pipeline_layout: &mut PipelineLayout, _name: &str) {
24522481
// TODO
24532482
}
2483+
2484+
unsafe fn set_acceleration_structure_name(&self, _accel_struct: &mut (), _name: &str) {
2485+
todo!()
2486+
}
24542487
}

src/backend/dx11/src/lib.rs

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,9 @@ impl window::PresentationSurface<Backend> for Surface {
971971
// We must also delete the image data.
972972
//
973973
// This should not panic as all images must be deleted before
974-
let mut present_image = Arc::try_unwrap(present.image).expect("Not all acquired images were deleted before the swapchain was reconfigured.");
974+
let mut present_image = Arc::try_unwrap(present.image).expect(
975+
"Not all acquired images were deleted before the swapchain was reconfigured.",
976+
);
975977
present_image.internal.release_resources();
976978

977979
let result = present.swapchain.ResizeBuffers(
@@ -2982,6 +2984,74 @@ impl command::CommandBuffer<Backend> for CommandBuffer {
29822984
unimplemented!()
29832985
}
29842986

2987+
unsafe fn build_acceleration_structures<'a, I>(&self, _descs: I)
2988+
where
2989+
I: IntoIterator<
2990+
Item = &'a (
2991+
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
2992+
&'a [hal::acceleration_structure::BuildRangeDesc],
2993+
),
2994+
>,
2995+
I::IntoIter: ExactSizeIterator,
2996+
{
2997+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
2998+
}
2999+
3000+
unsafe fn build_acceleration_structures_indirect<'a, I>(&self, _descs: I)
3001+
where
3002+
I: IntoIterator<
3003+
Item = &'a (
3004+
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
3005+
&'a Buffer,
3006+
buffer::Offset,
3007+
buffer::Stride,
3008+
&'a [u32],
3009+
),
3010+
>,
3011+
I::IntoIter: ExactSizeIterator,
3012+
{
3013+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
3014+
}
3015+
3016+
unsafe fn copy_acceleration_structure(
3017+
&self,
3018+
_src: &(),
3019+
_dst: &(),
3020+
_mode: hal::acceleration_structure::CopyMode,
3021+
) {
3022+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
3023+
}
3024+
3025+
unsafe fn copy_acceleration_structure_to_memory(
3026+
&self,
3027+
_src: &(),
3028+
_dst_buffer: &Buffer,
3029+
_dst_offset: buffer::Offset,
3030+
_mode: hal::acceleration_structure::CopyMode,
3031+
) {
3032+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
3033+
}
3034+
3035+
unsafe fn copy_memory_to_acceleration_structure(
3036+
&self,
3037+
_src_buffer: &Buffer,
3038+
_src_offset: buffer::Offset,
3039+
_dst: &(),
3040+
_mode: hal::acceleration_structure::CopyMode,
3041+
) {
3042+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
3043+
}
3044+
3045+
unsafe fn write_acceleration_structures_properties(
3046+
&self,
3047+
_accel_structs: &[&()],
3048+
_query_type: query::Type,
3049+
_pool: &QueryPool,
3050+
_first_query: u32,
3051+
) {
3052+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
3053+
}
3054+
29853055
unsafe fn push_graphics_constants(
29863056
&mut self,
29873057
_layout: &PipelineLayout,
@@ -4097,6 +4167,12 @@ impl From<pso::DescriptorType> for DescriptorContent {
40974167
ty: Bdt::Storage { read_only: false },
40984168
..
40994169
} => DescriptorContent::UAV,
4170+
Dt::InputAttachment => {
4171+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
4172+
}
4173+
Dt::AccelerationStructure => {
4174+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
4175+
}
41004176
}
41014177
}
41024178
}
@@ -4276,6 +4352,8 @@ impl hal::Backend for Backend {
42764352
type Semaphore = Semaphore;
42774353
type Event = ();
42784354
type QueryPool = QueryPool;
4355+
4356+
type AccelerationStructure = ();
42794357
}
42804358

42814359
fn validate_line_width(width: f32) {

src/backend/dx12/src/command.rs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,6 +2829,75 @@ impl com::CommandBuffer<Backend> for CommandBuffer {
28292829
);
28302830
}
28312831

2832+
unsafe fn build_acceleration_structures<'a, I>(&self, _descs: I)
2833+
where
2834+
I: IntoIterator<
2835+
Item = &'a (
2836+
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
2837+
// BuildRangeDesc array len must equal BuildDesc.geometry.geometries' len
2838+
&'a [hal::acceleration_structure::BuildRangeDesc],
2839+
),
2840+
>,
2841+
I::IntoIter: ExactSizeIterator,
2842+
{
2843+
todo!()
2844+
}
2845+
2846+
unsafe fn build_acceleration_structures_indirect<'a, I>(&self, _descs: I)
2847+
where
2848+
I: IntoIterator<
2849+
Item = &'a (
2850+
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
2851+
&'a r::Buffer,
2852+
buffer::Offset,
2853+
buffer::Stride,
2854+
&'a [u32],
2855+
),
2856+
>,
2857+
I::IntoIter: ExactSizeIterator,
2858+
{
2859+
todo!()
2860+
}
2861+
2862+
unsafe fn copy_acceleration_structure(
2863+
&self,
2864+
_src: &(),
2865+
_dst: &(),
2866+
_mode: hal::acceleration_structure::CopyMode,
2867+
) {
2868+
todo!()
2869+
}
2870+
2871+
unsafe fn copy_acceleration_structure_to_memory(
2872+
&self,
2873+
_src: &(),
2874+
_dst_buffer: &r::Buffer,
2875+
_dst_offset: buffer::Offset,
2876+
_mode: hal::acceleration_structure::CopyMode,
2877+
) {
2878+
todo!()
2879+
}
2880+
2881+
unsafe fn copy_memory_to_acceleration_structure(
2882+
&self,
2883+
_src_buffer: &r::Buffer,
2884+
_src_offset: buffer::Offset,
2885+
_dst: &(),
2886+
_mode: hal::acceleration_structure::CopyMode,
2887+
) {
2888+
todo!()
2889+
}
2890+
2891+
unsafe fn write_acceleration_structures_properties(
2892+
&self,
2893+
_accel_structs: &[&()],
2894+
_query_type: query::Type,
2895+
_pool: &r::QueryPool,
2896+
_first_query: u32,
2897+
) {
2898+
todo!()
2899+
}
2900+
28322901
unsafe fn push_graphics_constants(
28332902
&mut self,
28342903
_layout: &r::PipelineLayout,

src/backend/dx12/src/device.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,6 +3142,9 @@ impl d::Device<B> for Device {
31423142
src_uav = Some(handle.raw);
31433143
}
31443144
}
3145+
pso::Descriptor::AccelerationStructure(_) => {
3146+
todo!()
3147+
}
31453148
}
31463149

31473150
if let Some(handle) = src_cbv {
@@ -3456,6 +3459,8 @@ impl d::Device<B> for Device {
34563459
query::Type::Occlusion => native::QueryHeapType::Occlusion,
34573460
query::Type::PipelineStatistics(_) => native::QueryHeapType::PipelineStatistics,
34583461
query::Type::Timestamp => native::QueryHeapType::Timestamp,
3462+
query::Type::AccelerationStructureCompactedSize => todo!(),
3463+
query::Type::AccelerationStructureSerializationSize => todo!(),
34593464
};
34603465

34613466
let (query_heap, hr) = self.raw.create_query_heap(heap_ty, count, 0);
@@ -3482,6 +3487,32 @@ impl d::Device<B> for Device {
34823487
unimplemented!()
34833488
}
34843489

3490+
unsafe fn create_acceleration_structure(
3491+
&self,
3492+
_desc: &hal::acceleration_structure::CreateDesc<B>,
3493+
) -> Result<(), d::OutOfMemory> {
3494+
todo!()
3495+
}
3496+
3497+
unsafe fn destroy_acceleration_structure(&self, accel_struct: ()) {
3498+
todo!()
3499+
}
3500+
3501+
unsafe fn get_acceleration_structure_build_requirements(
3502+
&self,
3503+
_build_info: &hal::acceleration_structure::GeometryDesc<B>,
3504+
_max_primitives_counts: &[u32],
3505+
) -> hal::acceleration_structure::SizeRequirements {
3506+
todo!()
3507+
}
3508+
3509+
unsafe fn get_acceleration_structure_address(
3510+
&self,
3511+
_accel_struct: &(),
3512+
) -> hal::acceleration_structure::DeviceAddress {
3513+
todo!()
3514+
}
3515+
34853516
unsafe fn destroy_shader_module(&self, shader_lib: r::ShaderModule) {
34863517
if let r::ShaderModule::Compiled(shaders) = shader_lib {
34873518
for (_, blob) in shaders {
@@ -3665,6 +3696,10 @@ impl d::Device<B> for Device {
36653696
let cwstr = wide_cstr(name);
36663697
pipeline_layout.shared.signature.SetName(cwstr.as_ptr());
36673698
}
3699+
3700+
unsafe fn set_acceleration_structure_name(&self, _accel_struct: &mut (), _name: &str) {
3701+
todo!()
3702+
}
36683703
}
36693704

36703705
#[test]

src/backend/dx12/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,8 @@ impl hal::Backend for Backend {
13261326
type Semaphore = resource::Semaphore;
13271327
type Event = ();
13281328
type QueryPool = resource::QueryPool;
1329+
1330+
type AccelerationStructure = ();
13291331
}
13301332

13311333
fn validate_line_width(width: f32) {

src/backend/dx12/src/resource.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ impl From<pso::DescriptorType> for DescriptorContent {
530530
},
531531
},
532532
Dt::InputAttachment => Dc::SRV,
533+
Dt::InputAttachment => todo!(),
534+
Dt::AccelerationStructure => todo!(),
533535
}
534536
}
535537
}

src/backend/gl/src/command.rs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,75 @@ impl command::CommandBuffer<Backend> for CommandBuffer {
16331633
unimplemented!()
16341634
}
16351635

1636+
unsafe fn build_acceleration_structures<'a, I>(&self, _descs: I)
1637+
where
1638+
I: IntoIterator<
1639+
Item = &'a (
1640+
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
1641+
// BuildRangeDesc array len must equal BuildDesc.geometry.geometries' len
1642+
&'a [hal::acceleration_structure::BuildRangeDesc],
1643+
),
1644+
>,
1645+
I::IntoIter: ExactSizeIterator,
1646+
{
1647+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
1648+
}
1649+
1650+
unsafe fn build_acceleration_structures_indirect<'a, I>(&self, _descs: I)
1651+
where
1652+
I: IntoIterator<
1653+
Item = &'a (
1654+
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
1655+
&'a n::Buffer,
1656+
buffer::Offset,
1657+
buffer::Stride,
1658+
&'a [u32],
1659+
),
1660+
>,
1661+
I::IntoIter: ExactSizeIterator,
1662+
{
1663+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
1664+
}
1665+
1666+
unsafe fn copy_acceleration_structure(
1667+
&self,
1668+
_src: &(),
1669+
_dst: &(),
1670+
_mode: hal::acceleration_structure::CopyMode,
1671+
) {
1672+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
1673+
}
1674+
1675+
unsafe fn copy_acceleration_structure_to_memory(
1676+
&self,
1677+
_src: &(),
1678+
_dst_buffer: &n::Buffer,
1679+
_dst_offset: buffer::Offset,
1680+
_mode: hal::acceleration_structure::CopyMode,
1681+
) {
1682+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
1683+
}
1684+
1685+
unsafe fn copy_memory_to_acceleration_structure(
1686+
&self,
1687+
_src_buffer: &n::Buffer,
1688+
_src_offset: buffer::Offset,
1689+
_dst: &(),
1690+
_mode: hal::acceleration_structure::CopyMode,
1691+
) {
1692+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
1693+
}
1694+
1695+
unsafe fn write_acceleration_structures_properties(
1696+
&self,
1697+
_accel_structs: &[&()],
1698+
_query_type: query::Type,
1699+
_pool: &(),
1700+
_first_query: u32,
1701+
) {
1702+
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
1703+
}
1704+
16361705
unsafe fn push_graphics_constants(
16371706
&mut self,
16381707
_layout: &n::PipelineLayout,

0 commit comments

Comments
 (0)