Class: WGPU::RenderPipeline
- Inherits:
-
Object
- Object
- WGPU::RenderPipeline
- Includes:
- NativeResource
- Defined in:
- lib/wgpu/pipeline/render_pipeline.rb,
sig/wgpu.rbs
Constant Summary
Constants included from NativeResource
NativeResource::GUARDED_METHOD_EXEMPTIONS
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Attributes included from NativeResource
Instance Method Summary collapse
-
#get_bind_group_layout(index) ⇒ BindGroupLayout
Returns the bind group layout inferred or assigned at an index.
-
#initialize(device, label: nil, layout:, vertex:, primitive: {}, depth_stencil: nil, multisample: {}, fragment: nil) ⇒ RenderPipeline
constructor
Creates a render pipeline.
-
#release ⇒ void
Releases the native render pipeline handle.
Methods included from NativeResource
included, #inspect, #released?, #use
Constructor Details
#initialize(device, label: nil, layout:, vertex:, primitive: {}, depth_stencil: nil, multisample: {}, fragment: nil) ⇒ RenderPipeline
Creates a render pipeline.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/wgpu/pipeline/render_pipeline.rb', line 13 def initialize(device, label: nil, layout:, vertex:, primitive: {}, depth_stencil: nil, multisample: {}, fragment: nil) @device = device desc, @pointers = build_descriptor( label:, layout:, vertex:, primitive:, depth_stencil:, multisample:, fragment: ) device.push_error_scope(:validation) @handle = Native.wgpuDeviceCreateRenderPipeline(device.handle, desc) error = device.pop_error_scope if @handle.null? || (error[:type] && error[:type] != :no_error) msg = error[:message] || "Failed to create render pipeline" raise PipelineError, msg end end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
5 6 7 |
# File 'lib/wgpu/pipeline/render_pipeline.rb', line 5 def handle @handle end |
Instance Method Details
#get_bind_group_layout(index) ⇒ BindGroupLayout
Returns the bind group layout inferred or assigned at an index.
39 40 41 42 43 |
# File 'lib/wgpu/pipeline/render_pipeline.rb', line 39 def get_bind_group_layout(index) handle = Native.wgpuRenderPipelineGetBindGroupLayout(@handle, index) raise PipelineError, "Failed to get bind group layout at index #{index}" if handle.null? BindGroupLayout.from_handle(handle, device: @device) end |
#release ⇒ void
This method returns an undefined value.
Releases the native render pipeline handle.
Calling this method more than once has no effect.
49 50 51 52 53 |
# File 'lib/wgpu/pipeline/render_pipeline.rb', line 49 def release return if @handle.null? Native.wgpuRenderPipelineRelease(@handle) @handle = FFI::Pointer::NULL end |