Class: WGPU::CommandBuffer

Inherits:
Object
  • Object
show all
Includes:
NativeResource
Defined in:
lib/wgpu/commands/command_buffer.rb,
sig/wgpu.rbs

Constant Summary

Constants included from NativeResource

NativeResource::GUARDED_METHOD_EXEMPTIONS

Instance Attribute Summary collapse

Attributes included from NativeResource

#label

Instance Method Summary collapse

Methods included from NativeResource

included, #inspect, #released?, #use

Constructor Details

#initialize(handle, device: nil) ⇒ CommandBuffer

Wraps an encoded native command buffer.

Parameters:

  • handle (FFI::Pointer)

    native command buffer handle

  • device (Device, nil) (defaults to: nil)

    device whose callbacks the command buffer may use



10
11
12
13
14
# File 'lib/wgpu/commands/command_buffer.rb', line 10

def initialize(handle, device: nil)
  @handle = handle
  @device = device
  @submitted = false
end

Instance Attribute Details

#handleObject (readonly)

Returns the value of attribute handle.

Returns:

  • (Object)


5
6
7
# File 'lib/wgpu/commands/command_buffer.rb', line 5

def handle
  @handle
end

Instance Method Details

#mark_submitted!void

This method returns an undefined value.

Marks this command buffer as submitted.

Raises:



25
26
27
28
29
# File 'lib/wgpu/commands/command_buffer.rb', line 25

def 
  raise CommandError, "Command buffer has already been submitted" if @submitted

  @submitted = true
end

#releasevoid

This method returns an undefined value.

Releases the native command buffer handle.

Calling this method more than once has no effect.



35
36
37
38
39
# File 'lib/wgpu/commands/command_buffer.rb', line 35

def release
  return if @handle.null?
  Native.wgpuCommandBufferRelease(@handle)
  @handle = FFI::Pointer::NULL
end

#submitted?Boolean

Reports whether this command buffer has been submitted.

Returns:

  • (Boolean)


18
19
20
# File 'lib/wgpu/commands/command_buffer.rb', line 18

def 
  @submitted
end