From ee0802133b7d205a8fc0428be1f6fc414895cbda Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Sun, 16 May 2021 10:25:07 -0700 Subject: [PATCH] Add new types and methods This brings the signature current so it compiles, but the implementations are just stubs for now. --- piet-gpu-hal/src/dx12.rs | 84 +++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 19 deletions(-) diff --git a/piet-gpu-hal/src/dx12.rs b/piet-gpu-hal/src/dx12.rs index 158c415..4e58a77 100644 --- a/piet-gpu-hal/src/dx12.rs +++ b/piet-gpu-hal/src/dx12.rs @@ -59,6 +59,12 @@ pub struct Fence { pub struct Semaphore; +// TODO +pub struct PipelineBuilder; + +// TODO +pub struct DescriptorSetBuilder; + impl Dx12Instance { /// Create a new instance. /// @@ -120,6 +126,12 @@ impl crate::Device for Dx12Device { type Semaphore = Semaphore; + type PipelineBuilder = PipelineBuilder; + + type DescriptorSetBuilder = DescriptorSetBuilder; + + type Sampler = (); + fn create_buffer(&self, size: u64, mem_flags: Self::MemFlags) -> Result { unsafe { let resource = match mem_flags { @@ -152,24 +164,6 @@ impl crate::Device for Dx12Device { todo!() } - unsafe fn create_simple_compute_pipeline( - &self, - code: &[u8], - n_buffers: u32, - n_images: u32, - ) -> Result { - todo!() - } - - unsafe fn create_descriptor_set( - &self, - pipeline: &Self::Pipeline, - bufs: &[&Self::Buffer], - images: &[&Self::Image], - ) -> Result { - todo!() - } - fn create_cmd_buf(&self) -> Result { let list_type = d3d12::D3D12_COMMAND_LIST_TYPE_DIRECT; let node_mask = 0; @@ -258,6 +252,22 @@ impl crate::Device for Dx12Device { let fence_val = fence.fence.get_value(); Ok(fence_val == fence.val.get()) } + + fn query_gpu_info(&self) -> crate::GpuInfo { + todo!() + } + + unsafe fn pipeline_builder(&self) -> Self::PipelineBuilder { + todo!() + } + + unsafe fn descriptor_set_builder(&self) -> Self::DescriptorSetBuilder { + todo!() + } + + unsafe fn create_sampler(&self, params: crate::SamplerParams) -> Result { + todo!() + } } impl crate::CmdBuf for CmdBuf { @@ -293,7 +303,7 @@ impl crate::CmdBuf for CmdBuf { todo!() } - unsafe fn clear_buffer(&self, buffer: &Buffer) { + unsafe fn clear_buffer(&self, buffer: &Buffer, size: Option) { todo!() } @@ -331,3 +341,39 @@ impl crate::MemFlags for MemFlags { MemFlags::HostCoherent } } + +impl crate::PipelineBuilder for PipelineBuilder { + fn add_buffers(&mut self, n_buffers: u32) { + todo!() + } + + fn add_images(&mut self, n_images: u32) { + todo!() + } + + fn add_textures(&mut self, max_textures: u32) { + todo!() + } + + unsafe fn create_compute_pipeline(self, device: &Dx12Device, code: &[u8]) -> Result { + todo!() + } +} + +impl crate::DescriptorSetBuilder for DescriptorSetBuilder { + fn add_buffers(&mut self, buffers: &[&Buffer]) { + todo!() + } + + fn add_images(&mut self, images: &[&Image]) { + todo!() + } + + fn add_textures(&mut self, images: &[&Image]) { + todo!() + } + + unsafe fn build(self, device: &Dx12Device, pipeline: &Pipeline) -> Result { + todo!() + } +}