Class: WGPU::ComputePipeline
- Inherits:
-
Object
- Object
- WGPU::ComputePipeline
- Includes:
- NativeResource
- Defined in:
- lib/wgpu/pipeline/compute_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:, compute:) ⇒ ComputePipeline
constructor
Creates a compute pipeline.
-
#release ⇒ void
Releases the native compute pipeline handle.
Methods included from NativeResource
included, #inspect, #released?, #use
Constructor Details
#initialize(device, label: nil, layout:, compute:) ⇒ ComputePipeline
Creates a compute pipeline.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/wgpu/pipeline/compute_pipeline.rb', line 12 def initialize(device, label: nil, layout:, compute:) @device = device desc, @pointers = build_descriptor(label:, layout:, compute:) device.push_error_scope(:validation) @handle = Native.wgpuDeviceCreateComputePipeline(device.handle, desc) error = device.pop_error_scope if @handle.null? || (error[:type] && error[:type] != :no_error) msg = error[:message] || "Failed to create compute 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/compute_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.
30 31 32 33 34 |
# File 'lib/wgpu/pipeline/compute_pipeline.rb', line 30 def get_bind_group_layout(index) handle = Native.wgpuComputePipelineGetBindGroupLayout(@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 compute pipeline handle.
Calling this method more than once has no effect.
40 41 42 43 44 |
# File 'lib/wgpu/pipeline/compute_pipeline.rb', line 40 def release return if @handle.null? Native.wgpuComputePipelineRelease(@handle) @handle = FFI::Pointer::NULL end |