pub struct WgpuRenderState {
pub device: *const Device,
pub render_pass_encoder: *mut c_void,
}Expand description
Selected render state data shared with callbacks
This corresponds to ImGui_ImplWGPU_RenderState in the C++ implementation. This is temporarily stored during the render_draw_data() call to allow draw callbacks to access the current render state.
Fields§
§device: *const DeviceWGPU device for creating resources (raw pointer for lifetime flexibility)
render_pass_encoder: *mut c_voidCurrent render pass encoder for drawing (raw pointer for lifetime flexibility)
Implementations§
Source§impl WgpuRenderState
impl WgpuRenderState
Sourcepub unsafe fn new(device: &Device, render_pass: &mut RenderPass<'_>) -> Self
pub unsafe fn new(device: &Device, render_pass: &mut RenderPass<'_>) -> Self
Create a new render state from references
§Safety
The caller must ensure that the device and render pass remain valid for the lifetime of this render state.
Sourcepub unsafe fn render_pass_encoder(&mut self) -> &mut RenderPass<'_>
pub unsafe fn render_pass_encoder(&mut self) -> &mut RenderPass<'_>
Get the render pass encoder reference
§Safety
The caller must ensure that:
- The render pass pointer is still valid
- No other mutable references to the render pass exist
- The lifetime is appropriate
This method returns a mutable reference and therefore requires &mut self.
In callbacks, you typically obtain &mut WgpuRenderState by casting the raw
Renderer_RenderState pointer provided by Dear ImGui.