Class: WGPU::PipelineLayout
- Inherits:
-
Object
- Object
- WGPU::PipelineLayout
- Includes:
- NativeResource
- Defined in:
- lib/wgpu/pipeline/pipeline_layout.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
-
#initialize(device, label: nil, bind_group_layouts:) ⇒ PipelineLayout
constructor
Creates a pipeline layout from ordered bind group layouts.
-
#release ⇒ void
Releases the native pipeline layout handle.
Methods included from NativeResource
included, #inspect, #released?, #use
Constructor Details
#initialize(device, label: nil, bind_group_layouts:) ⇒ PipelineLayout
Creates a pipeline layout from ordered bind group layouts.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/wgpu/pipeline/pipeline_layout.rb', line 11 def initialize(device, label: nil, bind_group_layouts:) @device = device layouts = Array(bind_group_layouts) layouts_ptr = FFI::MemoryPointer.new(:pointer, layouts.size) layouts_ptr.write_array_of_pointer(layouts.map(&:handle)) desc = Native::PipelineLayoutDescriptor.new desc[:next_in_chain] = nil if label label_ptr = FFI::MemoryPointer.from_string(label) desc[:label][:data] = label_ptr desc[:label][:length] = label.bytesize else desc[:label][:data] = nil desc[:label][:length] = 0 end desc[:bind_group_layout_count] = layouts.size desc[:bind_group_layouts] = layouts_ptr device.push_error_scope(:validation) @handle = Native.wgpuDeviceCreatePipelineLayout(device.handle, desc) error = device.pop_error_scope if @handle.null? || (error[:type] && error[:type] != :no_error) msg = error[:message] || "Failed to create pipeline layout" raise PipelineError, msg end end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
5 6 7 |
# File 'lib/wgpu/pipeline/pipeline_layout.rb', line 5 def handle @handle end |
Instance Method Details
#release ⇒ void
This method returns an undefined value.
Releases the native pipeline layout handle.
Calling this method more than once has no effect.
45 46 47 48 49 |
# File 'lib/wgpu/pipeline/pipeline_layout.rb', line 45 def release return if @handle.null? Native.wgpuPipelineLayoutRelease(@handle) @handle = FFI::Pointer::NULL end |