diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-31 10:19:38 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-31 10:19:38 +1000 |
commit | 0a60692230841cbcbbf67acba55d2dbb4730b6cb (patch) | |
tree | 1f53fb5144310e6972aa3448c3b68c57e922cb70 /bindgen | |
parent | 547268b5a9cacc514445a59cc482897fd2f201ee (diff) |
add empty grid system
Diffstat (limited to 'bindgen')
-rw-r--r-- | bindgen/rust/src/ral.rs | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/bindgen/rust/src/ral.rs b/bindgen/rust/src/ral.rs index 775335a..2941275 100644 --- a/bindgen/rust/src/ral.rs +++ b/bindgen/rust/src/ral.rs @@ -1,15 +1,20 @@ //! Wrapper around the RAL code in celeritas-core +use std::{os::raw::c_void, ptr}; + use celeritas_sys::{ - BufferHandle, GPU_CmdEncoder, GPU_CmdEncoder_BeginRender, GPU_CmdEncoder_EndRender, - GPU_GetDefaultEncoder, + BufferHandle, GPU_CmdEncoder, GPU_CmdEncoder_BeginRender, GPU_CmdEncoder_EndRender, GPU_GetDefaultEncoder, GPU_GetDefaultRenderpass, GPU_GraphicsPipeline_Create, GraphicsPipelineDesc, ShaderData }; +/// Holds a pointer to the raw `GPU_CmdEncoder` pub struct FrameRenderEncoder(*mut GPU_CmdEncoder); -/// Holds a pointer into the raw `GPU_Renderpass` +/// Holds a pointer to the raw `GPU_Renderpass` pub struct RenderPass(*mut celeritas_sys::GPU_Renderpass); +/// Holds a pointer to the raw `GPU_Pipeline` +pub struct Pipeline(*mut celeritas_sys::GPU_Pipeline); + impl FrameRenderEncoder { pub fn new(renderpass: &RenderPass) -> Self { let enc = unsafe { @@ -42,6 +47,45 @@ impl FrameRenderEncoder { } } +pub struct PipelineBuilder { + renderpass: Option<RenderPass>, + data_layouts: Vec<()>, + +} +impl PipelineBuilder { + // pub fn add_ + + pub fn build(self) -> Pipeline { + let shad = ShaderData { + get_layout: todo!(), + data: ptr::null_mut() + }; + let desc = GraphicsPipelineDesc { + debug_name: todo!(), + vertex_desc: todo!(), + vs: todo!(), + fs: todo!(), + data_layouts: todo!(), + data_layouts_count: todo!(), + wireframe: todo!(), + depth_test: todo!(), + }; + let p = unsafe { GPU_GraphicsPipeline_Create( + todo!(), + self.renderpass.map(|r| r.0).unwrap_or(GPU_GetDefaultRenderpass()) + ) }; + Pipeline(p) + } +} +// impl Default for PipelineBuilder { +// fn default() -> Self { +// Self { +// renderpass: Default::default(), + +// } +// } +// } + // --- types #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |