Class: WGPU::BindGroupLayout
- Inherits:
-
Object
- Object
- WGPU::BindGroupLayout
- Includes:
- NativeResource
- Defined in:
- lib/wgpu/pipeline/bind_group_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
Class Method Summary collapse
-
.from_handle(handle, device: nil) ⇒ BindGroupLayout
Wraps a native bind group layout handle owned by the caller.
Instance Method Summary collapse
-
#initialize(device, label: nil, entries:) ⇒ BindGroupLayout
constructor
Creates a layout describing shader-visible resource bindings.
-
#release ⇒ void
Releases the native bind group layout handle.
Methods included from NativeResource
included, #inspect, #released?, #use
Constructor Details
#initialize(device, label: nil, entries:) ⇒ BindGroupLayout
Creates a layout describing shader-visible resource bindings.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/wgpu/pipeline/bind_group_layout.rb', line 23 def initialize(device, label: nil, entries:) @device = device desc, @descriptor_keepalive = build_descriptor(label:, entries:) device.push_error_scope(:validation) @handle = Native.wgpuDeviceCreateBindGroupLayout(device.handle, desc) error = device.pop_error_scope @descriptor_keepalive = nil if @handle.null? || (error[:type] && error[:type] != :no_error) msg = error[:message] || "Failed to create bind group 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/bind_group_layout.rb', line 5 def handle @handle end |
Class Method Details
.from_handle(handle, device: nil) ⇒ BindGroupLayout
Wraps a native bind group layout handle owned by the caller.
12 13 14 15 16 17 |
# File 'lib/wgpu/pipeline/bind_group_layout.rb', line 12 def self.from_handle(handle, device: nil) layout = adopt_native_handle(handle) layout.instance_variable_set(:@device, device) layout.send(:attach_device_callback_lifetime, device) layout end |
Instance Method Details
#release ⇒ void
This method returns an undefined value.
Releases the native bind group layout handle.
Calling this method more than once has no effect.
42 43 44 45 46 |
# File 'lib/wgpu/pipeline/bind_group_layout.rb', line 42 def release return if @handle.null? Native.wgpuBindGroupLayoutRelease(@handle) @handle = FFI::Pointer::NULL end |