Skip to content

Commit

Permalink
Stub out API on other backends
Browse files Browse the repository at this point in the history
  • Loading branch information
tangmi committed Dec 28, 2020
1 parent 79ffbe6 commit 720e91a
Show file tree
Hide file tree
Showing 16 changed files with 543 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/backend/dx11/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,9 @@ impl device::Device<Backend> for Device {
}
}
pso::Descriptor::TexelBuffer(_buffer_view) => unimplemented!(),
pso::Descriptor::AccelerationStructure(_accel_struct) => {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}
};

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

unsafe fn create_acceleration_structure(
&self,
_desc: &hal::acceleration_structure::CreateDesc<Backend>,
) -> Result<(), device::OutOfMemory> {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn destroy_acceleration_structure(&self, _accel_struct: ()) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn get_acceleration_structure_build_requirements(
&self,
_build_info: &hal::acceleration_structure::GeometryDesc<Backend>,
_max_primitives_counts: &[u32],
) -> hal::acceleration_structure::SizeRequirements {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn get_acceleration_structure_address(
&self,
_accel_struct: &(),
) -> hal::acceleration_structure::DeviceAddress {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn destroy_shader_module(&self, _shader_lib: ShaderModule) {}

unsafe fn destroy_render_pass(&self, _rp: RenderPass) {
Expand Down Expand Up @@ -2451,4 +2480,8 @@ impl device::Device<Backend> for Device {
unsafe fn set_pipeline_layout_name(&self, _pipeline_layout: &mut PipelineLayout, _name: &str) {
// TODO
}

unsafe fn set_acceleration_structure_name(&self, _accel_struct: &mut (), _name: &str) {
todo!()
}
}
80 changes: 79 additions & 1 deletion src/backend/dx11/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,9 @@ impl window::PresentationSurface<Backend> for Surface {
// We must also delete the image data.
//
// This should not panic as all images must be deleted before
let mut present_image = Arc::try_unwrap(present.image).expect("Not all acquired images were deleted before the swapchain was reconfigured.");
let mut present_image = Arc::try_unwrap(present.image).expect(
"Not all acquired images were deleted before the swapchain was reconfigured.",
);
present_image.internal.release_resources();

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

unsafe fn build_acceleration_structures<'a, I>(&self, _descs: I)
where
I: IntoIterator<
Item = &'a (
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
&'a [hal::acceleration_structure::BuildRangeDesc],
),
>,
I::IntoIter: ExactSizeIterator,
{
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn build_acceleration_structures_indirect<'a, I>(&self, _descs: I)
where
I: IntoIterator<
Item = &'a (
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
&'a Buffer,
buffer::Offset,
buffer::Stride,
&'a [u32],
),
>,
I::IntoIter: ExactSizeIterator,
{
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn copy_acceleration_structure(
&self,
_src: &(),
_dst: &(),
_mode: hal::acceleration_structure::CopyMode,
) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn copy_acceleration_structure_to_memory(
&self,
_src: &(),
_dst_buffer: &Buffer,
_dst_offset: buffer::Offset,
_mode: hal::acceleration_structure::CopyMode,
) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn copy_memory_to_acceleration_structure(
&self,
_src_buffer: &Buffer,
_src_offset: buffer::Offset,
_dst: &(),
_mode: hal::acceleration_structure::CopyMode,
) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn write_acceleration_structures_properties(
&self,
_accel_structs: &[&()],
_query_type: query::Type,
_pool: &QueryPool,
_first_query: u32,
) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}

unsafe fn push_graphics_constants(
&mut self,
_layout: &PipelineLayout,
Expand Down Expand Up @@ -4097,6 +4167,12 @@ impl From<pso::DescriptorType> for DescriptorContent {
ty: Bdt::Storage { read_only: false },
..
} => DescriptorContent::UAV,
Dt::InputAttachment => {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}
Dt::AccelerationStructure => {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on DX11.")
}
}
}
}
Expand Down Expand Up @@ -4276,6 +4352,8 @@ impl hal::Backend for Backend {
type Semaphore = Semaphore;
type Event = ();
type QueryPool = QueryPool;

type AccelerationStructure = ();
}

fn validate_line_width(width: f32) {
Expand Down
69 changes: 69 additions & 0 deletions src/backend/dx12/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2829,6 +2829,75 @@ impl com::CommandBuffer<Backend> for CommandBuffer {
);
}

unsafe fn build_acceleration_structures<'a, I>(&self, _descs: I)
where
I: IntoIterator<
Item = &'a (
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
// BuildRangeDesc array len must equal BuildDesc.geometry.geometries' len
&'a [hal::acceleration_structure::BuildRangeDesc],
),
>,
I::IntoIter: ExactSizeIterator,
{
todo!()
}

unsafe fn build_acceleration_structures_indirect<'a, I>(&self, _descs: I)
where
I: IntoIterator<
Item = &'a (
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
&'a r::Buffer,
buffer::Offset,
buffer::Stride,
&'a [u32],
),
>,
I::IntoIter: ExactSizeIterator,
{
todo!()
}

unsafe fn copy_acceleration_structure(
&self,
_src: &(),
_dst: &(),
_mode: hal::acceleration_structure::CopyMode,
) {
todo!()
}

unsafe fn copy_acceleration_structure_to_memory(
&self,
_src: &(),
_dst_buffer: &r::Buffer,
_dst_offset: buffer::Offset,
_mode: hal::acceleration_structure::CopyMode,
) {
todo!()
}

unsafe fn copy_memory_to_acceleration_structure(
&self,
_src_buffer: &r::Buffer,
_src_offset: buffer::Offset,
_dst: &(),
_mode: hal::acceleration_structure::CopyMode,
) {
todo!()
}

unsafe fn write_acceleration_structures_properties(
&self,
_accel_structs: &[&()],
_query_type: query::Type,
_pool: &r::QueryPool,
_first_query: u32,
) {
todo!()
}

unsafe fn push_graphics_constants(
&mut self,
_layout: &r::PipelineLayout,
Expand Down
35 changes: 35 additions & 0 deletions src/backend/dx12/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3142,6 +3142,9 @@ impl d::Device<B> for Device {
src_uav = Some(handle.raw);
}
}
pso::Descriptor::AccelerationStructure(_) => {
todo!()
}
}

if let Some(handle) = src_cbv {
Expand Down Expand Up @@ -3456,6 +3459,8 @@ impl d::Device<B> for Device {
query::Type::Occlusion => native::QueryHeapType::Occlusion,
query::Type::PipelineStatistics(_) => native::QueryHeapType::PipelineStatistics,
query::Type::Timestamp => native::QueryHeapType::Timestamp,
query::Type::AccelerationStructureCompactedSize => todo!(),
query::Type::AccelerationStructureSerializationSize => todo!(),
};

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

unsafe fn create_acceleration_structure(
&self,
_desc: &hal::acceleration_structure::CreateDesc<B>,
) -> Result<(), d::OutOfMemory> {
todo!()
}

unsafe fn destroy_acceleration_structure(&self, accel_struct: ()) {
todo!()
}

unsafe fn get_acceleration_structure_build_requirements(
&self,
_build_info: &hal::acceleration_structure::GeometryDesc<B>,
_max_primitives_counts: &[u32],
) -> hal::acceleration_structure::SizeRequirements {
todo!()
}

unsafe fn get_acceleration_structure_address(
&self,
_accel_struct: &(),
) -> hal::acceleration_structure::DeviceAddress {
todo!()
}

unsafe fn destroy_shader_module(&self, shader_lib: r::ShaderModule) {
if let r::ShaderModule::Compiled(shaders) = shader_lib {
for (_, blob) in shaders {
Expand Down Expand Up @@ -3665,6 +3696,10 @@ impl d::Device<B> for Device {
let cwstr = wide_cstr(name);
pipeline_layout.shared.signature.SetName(cwstr.as_ptr());
}

unsafe fn set_acceleration_structure_name(&self, _accel_struct: &mut (), _name: &str) {
todo!()
}
}

#[test]
Expand Down
2 changes: 2 additions & 0 deletions src/backend/dx12/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,8 @@ impl hal::Backend for Backend {
type Semaphore = resource::Semaphore;
type Event = ();
type QueryPool = resource::QueryPool;

type AccelerationStructure = ();
}

fn validate_line_width(width: f32) {
Expand Down
2 changes: 2 additions & 0 deletions src/backend/dx12/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ impl From<pso::DescriptorType> for DescriptorContent {
},
},
Dt::InputAttachment => Dc::SRV,
Dt::InputAttachment => todo!(),
Dt::AccelerationStructure => todo!(),
}
}
}
Expand Down
69 changes: 69 additions & 0 deletions src/backend/gl/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,75 @@ impl command::CommandBuffer<Backend> for CommandBuffer {
unimplemented!()
}

unsafe fn build_acceleration_structures<'a, I>(&self, _descs: I)
where
I: IntoIterator<
Item = &'a (
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
// BuildRangeDesc array len must equal BuildDesc.geometry.geometries' len
&'a [hal::acceleration_structure::BuildRangeDesc],
),
>,
I::IntoIter: ExactSizeIterator,
{
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
}

unsafe fn build_acceleration_structures_indirect<'a, I>(&self, _descs: I)
where
I: IntoIterator<
Item = &'a (
&'a hal::acceleration_structure::BuildDesc<'a, Backend>,
&'a n::Buffer,
buffer::Offset,
buffer::Stride,
&'a [u32],
),
>,
I::IntoIter: ExactSizeIterator,
{
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
}

unsafe fn copy_acceleration_structure(
&self,
_src: &(),
_dst: &(),
_mode: hal::acceleration_structure::CopyMode,
) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
}

unsafe fn copy_acceleration_structure_to_memory(
&self,
_src: &(),
_dst_buffer: &n::Buffer,
_dst_offset: buffer::Offset,
_mode: hal::acceleration_structure::CopyMode,
) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
}

unsafe fn copy_memory_to_acceleration_structure(
&self,
_src_buffer: &n::Buffer,
_src_offset: buffer::Offset,
_dst: &(),
_mode: hal::acceleration_structure::CopyMode,
) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
}

unsafe fn write_acceleration_structures_properties(
&self,
_accel_structs: &[&()],
_query_type: query::Type,
_pool: &(),
_first_query: u32,
) {
unimplemented!("Feature::ACCELERATION_STRUCTURE not supported on GL.")
}

unsafe fn push_graphics_constants(
&mut self,
_layout: &n::PipelineLayout,
Expand Down
Loading

0 comments on commit 720e91a

Please sign in to comment.