wgpu 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/README.md +26 -3
- data/docs/README.md +22 -0
- data/docs/api_coverage.md +132 -0
- data/docs/async.md +31 -0
- data/docs/bind_groups.md +25 -0
- data/docs/buffer_data.md +37 -0
- data/docs/command_encoding.md +24 -0
- data/docs/errors.md +40 -0
- data/docs/getting_started_compute.md +61 -0
- data/docs/getting_started_rendering.md +62 -0
- data/docs/installation.md +94 -0
- data/docs/pipeline_descriptors.md +38 -0
- data/docs/releasing.md +22 -0
- data/docs/resource_lifetime.md +94 -0
- data/docs/shaders.md +32 -0
- data/docs/texture_readback.md +19 -0
- data/docs/troubleshooting.md +48 -0
- data/docs/upgrading_wgpu_native.md +26 -0
- data/ext/wgpu/extconf.rb +10 -142
- data/lib/wgpu/commands/command_buffer.rb +11 -0
- data/lib/wgpu/commands/command_encoder.rb +65 -8
- data/lib/wgpu/commands/compute_pass.rb +10 -0
- data/lib/wgpu/commands/render_bundle_encoder.rb +10 -3
- data/lib/wgpu/commands/render_pass.rb +34 -8
- data/lib/wgpu/core/adapter.rb +49 -20
- data/lib/wgpu/core/async_waiter.rb +92 -0
- data/lib/wgpu/core/canvas_context.rb +0 -2
- data/lib/wgpu/core/device.rb +160 -52
- data/lib/wgpu/core/instance.rb +9 -5
- data/lib/wgpu/core/queue.rb +81 -57
- data/lib/wgpu/core/surface.rb +16 -17
- data/lib/wgpu/data_types.rb +67 -0
- data/lib/wgpu/descriptor_helpers.rb +39 -0
- data/lib/wgpu/error.rb +55 -0
- data/lib/wgpu/logging.rb +63 -0
- data/lib/wgpu/native/abi_verifier.rb +109 -0
- data/lib/wgpu/native/callbacks.rb +9 -6
- data/lib/wgpu/native/capabilities.rb +31 -0
- data/lib/wgpu/native/distribution.rb +113 -0
- data/lib/wgpu/native/enum_helper.rb +63 -0
- data/lib/wgpu/native/enums.rb +82 -13
- data/lib/wgpu/native/functions.rb +17 -8
- data/lib/wgpu/native/installer.rb +192 -0
- data/lib/wgpu/native/loader.rb +40 -21
- data/lib/wgpu/native/structs.rb +19 -5
- data/lib/wgpu/native_resource.rb +171 -0
- data/lib/wgpu/pipeline/bind_group.rb +12 -0
- data/lib/wgpu/pipeline/bind_group_layout.rb +91 -37
- data/lib/wgpu/pipeline/compute_pipeline.rb +28 -26
- data/lib/wgpu/pipeline/render_pipeline.rb +180 -68
- data/lib/wgpu/pipeline/shader_module.rb +51 -12
- data/lib/wgpu/resources/buffer.rb +167 -84
- data/lib/wgpu/resources/query_set.rb +14 -12
- data/lib/wgpu/resources/sampler.rb +36 -20
- data/lib/wgpu/resources/texture.rb +44 -42
- data/lib/wgpu/resources/texture_view.rb +11 -3
- data/lib/wgpu/texture_format.rb +82 -0
- data/lib/wgpu/version.rb +1 -1
- data/lib/wgpu/window.rb +8 -1
- data/lib/wgpu.rb +33 -0
- data/sig/wgpu.rbs +381 -0
- metadata +33 -16
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module WGPU
|
|
4
|
+
module TextureFormat
|
|
5
|
+
COPY_ALIGNMENT = 256
|
|
6
|
+
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
def block_size(format, aspect: :all)
|
|
10
|
+
block_info(format, aspect:).last
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def block_dimensions(format)
|
|
14
|
+
block_info(format).first(2)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def bytes_per_row(width, format, aspect: :all)
|
|
18
|
+
block_width, _, bytes = block_info(format, aspect:)
|
|
19
|
+
((Integer(width) + block_width - 1) / block_width) * bytes
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def aligned_bytes_per_row(width, format, aspect: :all, alignment: COPY_ALIGNMENT)
|
|
23
|
+
row_bytes = bytes_per_row(width, format, aspect:)
|
|
24
|
+
((row_bytes + alignment - 1) / alignment) * alignment
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def block_info(format, aspect: :all)
|
|
28
|
+
name = normalize_format(format)
|
|
29
|
+
special = depth_stencil_block_info(name, aspect)
|
|
30
|
+
return special if special
|
|
31
|
+
|
|
32
|
+
case name.to_s
|
|
33
|
+
when /\Ar8_/
|
|
34
|
+
[1, 1, 1]
|
|
35
|
+
when /\A(?:r16_|rg8_)/
|
|
36
|
+
[1, 1, 2]
|
|
37
|
+
when /\A(?:r32_|rg16_|rgba8_|bgra8_|rgb10a2_|rg11b10_|rgb9e5_)/
|
|
38
|
+
[1, 1, 4]
|
|
39
|
+
when /\A(?:rg32_|rgba16_)/
|
|
40
|
+
[1, 1, 8]
|
|
41
|
+
when /\Argba32_/
|
|
42
|
+
[1, 1, 16]
|
|
43
|
+
when /\A(?:bc(?:1|4)|etc2_rgb8|etc2_rgb8a1|eac_r11)_/
|
|
44
|
+
[4, 4, 8]
|
|
45
|
+
when /\A(?:bc(?:2|3|5|6h|7)|etc2_rgba8|eac_rg11)_/
|
|
46
|
+
[4, 4, 16]
|
|
47
|
+
when /\Aastc_(\d+)x(\d+)_/
|
|
48
|
+
[Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, 16]
|
|
49
|
+
else
|
|
50
|
+
raise ArgumentError, "No texel block copy footprint for #{name.inspect}"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def normalize_format(format)
|
|
55
|
+
return format if format.is_a?(Symbol) &&
|
|
56
|
+
Native::TextureFormat.to_h.key?(format)
|
|
57
|
+
|
|
58
|
+
value = Native::EnumHelper.coerce(Native::TextureFormat, format, name: "texture format")
|
|
59
|
+
Native::TextureFormat[value] || format
|
|
60
|
+
end
|
|
61
|
+
private_class_method :normalize_format
|
|
62
|
+
|
|
63
|
+
def depth_stencil_block_info(format, aspect)
|
|
64
|
+
case format
|
|
65
|
+
when :stencil8
|
|
66
|
+
[1, 1, 1]
|
|
67
|
+
when :depth16_unorm
|
|
68
|
+
[1, 1, 2]
|
|
69
|
+
when :depth32_float
|
|
70
|
+
[1, 1, 4]
|
|
71
|
+
when :depth32_float_stencil8
|
|
72
|
+
return [1, 1, 4] if aspect == :depth_only
|
|
73
|
+
return [1, 1, 1] if aspect == :stencil_only
|
|
74
|
+
|
|
75
|
+
raise ArgumentError, "depth32_float_stencil8 copies require :depth_only or :stencil_only aspect"
|
|
76
|
+
when :depth24_plus, :depth24_plus_stencil8
|
|
77
|
+
raise ArgumentError, "#{format} has no portable texel block copy footprint"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
private_class_method :depth_stencil_block_info
|
|
81
|
+
end
|
|
82
|
+
end
|
data/lib/wgpu/version.rb
CHANGED
data/lib/wgpu/window.rb
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
begin
|
|
4
|
+
require "sdl3"
|
|
5
|
+
rescue LoadError => e
|
|
6
|
+
raise LoadError,
|
|
7
|
+
"wgpu/window requires the optional `sdl3` gem. " \
|
|
8
|
+
"Add `gem \"sdl3\", \"~> 1.0\"` and install the SDL3 system library. " \
|
|
9
|
+
"(original error: #{e.message})"
|
|
10
|
+
end
|
|
4
11
|
|
|
5
12
|
module WGPU
|
|
6
13
|
module Window
|
data/lib/wgpu.rb
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
require_relative "wgpu/version"
|
|
4
4
|
require_relative "wgpu/error"
|
|
5
5
|
require_relative "wgpu/native/loader"
|
|
6
|
+
require_relative "wgpu/native/enum_helper"
|
|
7
|
+
require_relative "wgpu/native/abi_verifier"
|
|
8
|
+
require_relative "wgpu/logging"
|
|
9
|
+
require_relative "wgpu/descriptor_helpers"
|
|
10
|
+
require_relative "wgpu/data_types"
|
|
11
|
+
require_relative "wgpu/texture_format"
|
|
12
|
+
require_relative "wgpu/native_resource"
|
|
6
13
|
require_relative "wgpu/async_task"
|
|
14
|
+
require_relative "wgpu/core/async_waiter"
|
|
7
15
|
|
|
8
16
|
require_relative "wgpu/resources/buffer"
|
|
9
17
|
require_relative "wgpu/resources/texture"
|
|
@@ -33,4 +41,29 @@ require_relative "wgpu/core/surface"
|
|
|
33
41
|
require_relative "wgpu/core/canvas_context"
|
|
34
42
|
|
|
35
43
|
module WGPU
|
|
44
|
+
[
|
|
45
|
+
Instance,
|
|
46
|
+
Adapter,
|
|
47
|
+
Device,
|
|
48
|
+
Queue,
|
|
49
|
+
Surface,
|
|
50
|
+
CanvasContext,
|
|
51
|
+
Buffer,
|
|
52
|
+
Texture,
|
|
53
|
+
TextureView,
|
|
54
|
+
Sampler,
|
|
55
|
+
QuerySet,
|
|
56
|
+
ShaderModule,
|
|
57
|
+
BindGroupLayout,
|
|
58
|
+
BindGroup,
|
|
59
|
+
PipelineLayout,
|
|
60
|
+
ComputePipeline,
|
|
61
|
+
RenderPipeline,
|
|
62
|
+
CommandEncoder,
|
|
63
|
+
CommandBuffer,
|
|
64
|
+
ComputePass,
|
|
65
|
+
RenderPass,
|
|
66
|
+
RenderBundleEncoder,
|
|
67
|
+
RenderBundle
|
|
68
|
+
].each { |resource_class| resource_class.include(NativeResource) }
|
|
36
69
|
end
|
data/sig/wgpu.rbs
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
module WGPU
|
|
2
|
+
VERSION: String
|
|
3
|
+
|
|
4
|
+
type enum_value = Symbol | Integer
|
|
5
|
+
type flags = enum_value | Array[Symbol]
|
|
6
|
+
type data = String | Array[Numeric] | untyped
|
|
7
|
+
type extent_3d = Hash[Symbol, Integer] | Array[Integer]
|
|
8
|
+
|
|
9
|
+
def self.log_level: () -> Symbol
|
|
10
|
+
def self.log_level=: (enum_value) -> enum_value
|
|
11
|
+
def self.on_log: () { (Symbol, String) -> void } -> singleton(WGPU)
|
|
12
|
+
|
|
13
|
+
class Error < StandardError
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class InitializationError < Error
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class AdapterError < Error
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class DeviceError < Error
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class BufferError < Error
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class TextureError < Error
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class ResourceError < Error
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
class ShaderError < Error
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class PipelineError < Error
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class CommandError < Error
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class SurfaceError < Error
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class SurfaceAcquisitionError < SurfaceError
|
|
47
|
+
attr_reader status: Symbol
|
|
48
|
+
def initialize: (Symbol status, ?String? message) -> void
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class RenderBundleError < Error
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class ValidationError < Error
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class OutOfMemoryError < Error
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
class InternalError < Error
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class DeviceLostError < Error
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class TimeoutError < Error
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class GPUError
|
|
70
|
+
attr_reader type: Symbol
|
|
71
|
+
attr_reader message: String
|
|
72
|
+
|
|
73
|
+
def self.from_hash: (Hash[Symbol, untyped]? error) -> GPUError?
|
|
74
|
+
def exception_class: () -> singleton(Error)
|
|
75
|
+
def raise!: () -> bot
|
|
76
|
+
def to_h: () -> { type: Symbol, message: String }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
class CompilationMessage
|
|
80
|
+
attr_reader type: Symbol
|
|
81
|
+
attr_reader message: String
|
|
82
|
+
attr_reader line_num: Integer
|
|
83
|
+
attr_reader line_pos: Integer
|
|
84
|
+
attr_reader line: Integer
|
|
85
|
+
attr_reader column: Integer
|
|
86
|
+
attr_reader offset: Integer
|
|
87
|
+
attr_reader length: Integer
|
|
88
|
+
def to_s: () -> String
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
module NativeResource
|
|
92
|
+
attr_reader label: String?
|
|
93
|
+
def released?: () -> bool
|
|
94
|
+
def use: [A] () { (self) -> A } -> A
|
|
95
|
+
def release: () -> void
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class AsyncTask[A]
|
|
99
|
+
def initialize: () { () -> A } -> void
|
|
100
|
+
def wait: (?timeout: Numeric?) -> self
|
|
101
|
+
def value: (?timeout: Numeric?) -> A
|
|
102
|
+
def then: [B] () { (A) -> B } -> AsyncTask[B]
|
|
103
|
+
def complete?: () -> bool
|
|
104
|
+
def pending?: () -> bool
|
|
105
|
+
def error: () -> Exception?
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
module AsyncWaiter
|
|
109
|
+
def self.poll_interval: () -> Float
|
|
110
|
+
def self.poll_interval=: (Numeric) -> Numeric
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
module DataTypes
|
|
114
|
+
def self.pack: (Array[Numeric], ?type: Symbol) -> String
|
|
115
|
+
def self.unpack: (String, ?type: Symbol) -> Array[Numeric]
|
|
116
|
+
def self.byte_size: (Symbol) -> Integer
|
|
117
|
+
def self.to_pointer: (data, ?type: Symbol) -> [untyped, Integer]
|
|
118
|
+
def self.validate_alignment!: (Integer, Integer, name: String) -> Integer
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
module TextureFormat
|
|
122
|
+
COPY_ALIGNMENT: Integer
|
|
123
|
+
def self.block_size: (enum_value, ?aspect: Symbol) -> Integer
|
|
124
|
+
def self.block_dimensions: (enum_value) -> [Integer, Integer]
|
|
125
|
+
def self.bytes_per_row: (Integer, enum_value, ?aspect: Symbol) -> Integer
|
|
126
|
+
def self.aligned_bytes_per_row: (Integer, enum_value, ?aspect: Symbol, ?alignment: Integer) -> Integer
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
class Instance
|
|
130
|
+
include NativeResource
|
|
131
|
+
attr_reader handle: untyped
|
|
132
|
+
def initialize: () -> void
|
|
133
|
+
def request_adapter: (**untyped) -> Adapter
|
|
134
|
+
def request_adapter_async: (**untyped) -> AsyncTask[Adapter]
|
|
135
|
+
def enumerate_adapters: (?backends: flags?) -> Array[Adapter]
|
|
136
|
+
def enumerate_adapters_async: (?backends: flags?) -> AsyncTask[Array[Adapter]]
|
|
137
|
+
def get_canvas_context: (Hash[Symbol, untyped]) -> CanvasContext
|
|
138
|
+
def process_events: () -> void
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
class Adapter
|
|
142
|
+
include NativeResource
|
|
143
|
+
attr_reader handle: untyped
|
|
144
|
+
attr_reader instance: Instance?
|
|
145
|
+
def self.from_handle: (untyped, ?instance: Instance?) -> Adapter
|
|
146
|
+
def request_device: (**untyped) -> Device
|
|
147
|
+
def request_device_async: (**untyped) -> AsyncTask[Device]
|
|
148
|
+
def info: () -> Hash[Symbol, untyped]
|
|
149
|
+
def name: () -> String
|
|
150
|
+
def vendor: () -> String
|
|
151
|
+
def backend_type: () -> Symbol
|
|
152
|
+
def adapter_type: () -> Symbol
|
|
153
|
+
def features: () -> Array[Symbol]
|
|
154
|
+
def has_feature?: (Symbol) -> bool
|
|
155
|
+
def limits: () -> Hash[Symbol, Integer]
|
|
156
|
+
def summary: () -> String
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
class Device
|
|
160
|
+
include NativeResource
|
|
161
|
+
attr_reader handle: untyped
|
|
162
|
+
attr_reader queue: Queue
|
|
163
|
+
attr_reader adapter: Adapter?
|
|
164
|
+
def adapter_info: () -> Hash[Symbol, untyped]?
|
|
165
|
+
def create_buffer: (?label: String?, size: Integer, usage: flags, ?mapped_at_creation: bool) -> Buffer
|
|
166
|
+
def create_buffer_with_data: (?label: String?, data: data, usage: flags, ?type: Symbol) -> Buffer
|
|
167
|
+
def create_shader_module: (**untyped) -> ShaderModule
|
|
168
|
+
def create_command_encoder: (?label: String?) -> CommandEncoder
|
|
169
|
+
def create_bind_group_layout: (?label: String?, entries: Array[Hash[Symbol, untyped]]) -> BindGroupLayout
|
|
170
|
+
def create_bind_group: (?label: String?, layout: BindGroupLayout, entries: Array[Hash[Symbol, untyped]]) -> BindGroup
|
|
171
|
+
def create_pipeline_layout: (?label: String?, bind_group_layouts: Array[BindGroupLayout]) -> PipelineLayout
|
|
172
|
+
def create_compute_pipeline: (**untyped) -> ComputePipeline
|
|
173
|
+
def create_compute_pipeline_async: (**untyped) -> AsyncTask[ComputePipeline]
|
|
174
|
+
def create_render_pipeline: (**untyped) -> RenderPipeline
|
|
175
|
+
def create_render_pipeline_async: (**untyped) -> AsyncTask[RenderPipeline]
|
|
176
|
+
def create_texture: (**untyped) -> Texture
|
|
177
|
+
def create_sampler: (**untyped) -> Sampler
|
|
178
|
+
def create_query_set: (?label: String?, type: enum_value, count: Integer) -> QuerySet
|
|
179
|
+
def create_render_bundle_encoder: (**untyped) -> RenderBundleEncoder
|
|
180
|
+
def features: () -> Array[Symbol]
|
|
181
|
+
def has_feature?: (Symbol) -> bool
|
|
182
|
+
def limits: () -> Hash[Symbol, Integer]
|
|
183
|
+
def poll: (?wait: bool) -> Integer
|
|
184
|
+
def push_error_scope: (?enum_value) -> void
|
|
185
|
+
def pop_error_scope: (?timeout: Numeric?) -> Hash[Symbol, untyped]
|
|
186
|
+
def pop_error_scope_typed: (?timeout: Numeric?) -> GPUError?
|
|
187
|
+
def with_error_scope: [A] (?enum_value) { () -> A } -> A
|
|
188
|
+
def on_uncaptured_error: () { (GPUError) -> void } -> self
|
|
189
|
+
def on_device_lost: () { (Symbol, String) -> void } -> self
|
|
190
|
+
def destroy: () -> void
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
class Queue
|
|
194
|
+
include NativeResource
|
|
195
|
+
attr_reader handle: untyped
|
|
196
|
+
def submit: (CommandBuffer | Array[CommandBuffer]) -> void
|
|
197
|
+
def write_buffer: (Buffer, Integer, data, ?data_offset: Integer, ?size: Integer?, ?type: Symbol) -> void
|
|
198
|
+
def write_texture: (**untyped) -> void
|
|
199
|
+
def read_buffer: (Buffer, ?offset: Integer, ?size: Integer?, ?device: Device?, ?staging: Buffer?) -> String
|
|
200
|
+
def read_texture: (**untyped) -> String
|
|
201
|
+
def on_submitted_work_done: (?device: Device?, ?timeout: Numeric?) -> Symbol
|
|
202
|
+
def on_submitted_work_done_async: (?device: Device?, ?timeout: Numeric?) -> AsyncTask[Symbol]
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
class Buffer
|
|
206
|
+
include NativeResource
|
|
207
|
+
attr_reader handle: untyped
|
|
208
|
+
attr_reader size: Integer
|
|
209
|
+
attr_reader usage: Integer
|
|
210
|
+
def write: (data, ?offset: Integer, ?type: Symbol) -> void
|
|
211
|
+
def mapped_range: (?offset: Integer, ?size: Integer?) -> BufferMappedRange
|
|
212
|
+
def get_mapped_range: (?offset: Integer, ?size: Integer?) -> BufferMappedRange
|
|
213
|
+
def unmap: () -> void
|
|
214
|
+
def map_sync: (enum_value, ?offset: Integer, ?size: Integer?, ?timeout: Numeric?) -> true
|
|
215
|
+
def map_async: (enum_value, ?offset: Integer, ?size: Integer?) -> AsyncTask[true]
|
|
216
|
+
def read_mapped_data: (?offset: Integer, ?size: Integer?) -> String
|
|
217
|
+
def read_mapped: (?offset: Integer, ?size: Integer?, ?type: Symbol?) -> (String | Array[Numeric])
|
|
218
|
+
def write_mapped: (data, ?offset: Integer, ?type: Symbol) -> void
|
|
219
|
+
def read_mapped_values: (?type: Symbol, ?offset: Integer, ?count: Integer?) -> Array[Numeric]
|
|
220
|
+
def map_state: () -> Symbol
|
|
221
|
+
def destroy: () -> void
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
class BufferMappedRange
|
|
225
|
+
def read: (?type: Symbol, ?count: Integer?) -> Array[Numeric]
|
|
226
|
+
def write: (data, ?type: Symbol) -> void
|
|
227
|
+
def read_floats: (?Integer?) -> Array[Float]
|
|
228
|
+
def write_floats: (Array[Numeric]) -> void
|
|
229
|
+
def read_uint32s: (?Integer?) -> Array[Integer]
|
|
230
|
+
def write_uint32s: (Array[Integer]) -> void
|
|
231
|
+
def read_bytes: () -> String
|
|
232
|
+
def write_bytes: (String) -> void
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
class Texture
|
|
236
|
+
include NativeResource
|
|
237
|
+
attr_reader handle: untyped
|
|
238
|
+
attr_reader surface_status: Symbol?
|
|
239
|
+
def create_view: (**untyped) -> TextureView
|
|
240
|
+
def width: () -> Integer
|
|
241
|
+
def height: () -> Integer
|
|
242
|
+
def depth_or_array_layers: () -> Integer
|
|
243
|
+
def size: () -> Hash[Symbol, Integer]
|
|
244
|
+
def mip_level_count: () -> Integer
|
|
245
|
+
def sample_count: () -> Integer
|
|
246
|
+
def dimension: () -> Symbol
|
|
247
|
+
def format: () -> Symbol
|
|
248
|
+
def usage: () -> Integer
|
|
249
|
+
def destroy: () -> void
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
class TextureView
|
|
253
|
+
include NativeResource
|
|
254
|
+
attr_reader handle: untyped
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
class Sampler
|
|
258
|
+
include NativeResource
|
|
259
|
+
attr_reader handle: untyped
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
class QuerySet
|
|
263
|
+
include NativeResource
|
|
264
|
+
attr_reader handle: untyped
|
|
265
|
+
attr_reader count: Integer
|
|
266
|
+
attr_reader type: Symbol
|
|
267
|
+
def destroy: () -> void
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
class ShaderModule
|
|
271
|
+
include NativeResource
|
|
272
|
+
attr_reader handle: untyped
|
|
273
|
+
def get_compilation_info: () -> { status: Symbol, messages: Array[CompilationMessage] }
|
|
274
|
+
def get_compilation_info_async: () -> AsyncTask[Hash[Symbol, untyped]]
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
class BindGroupLayout
|
|
278
|
+
include NativeResource
|
|
279
|
+
attr_reader handle: untyped
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
class BindGroup
|
|
283
|
+
include NativeResource
|
|
284
|
+
attr_reader handle: untyped
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
class PipelineLayout
|
|
288
|
+
include NativeResource
|
|
289
|
+
attr_reader handle: untyped
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
class ComputePipeline
|
|
293
|
+
include NativeResource
|
|
294
|
+
attr_reader handle: untyped
|
|
295
|
+
def get_bind_group_layout: (Integer) -> BindGroupLayout
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
class RenderPipeline
|
|
299
|
+
include NativeResource
|
|
300
|
+
attr_reader handle: untyped
|
|
301
|
+
def get_bind_group_layout: (Integer) -> BindGroupLayout
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
class CommandEncoder
|
|
305
|
+
include NativeResource
|
|
306
|
+
attr_reader handle: untyped
|
|
307
|
+
def begin_compute_pass: (**untyped) -> ComputePass
|
|
308
|
+
| [A] (**untyped) { (ComputePass) -> A } -> A
|
|
309
|
+
def begin_render_pass: (**untyped) -> RenderPass
|
|
310
|
+
| [A] (**untyped) { (RenderPass) -> A } -> A
|
|
311
|
+
def copy_buffer_to_buffer: (**untyped) -> void
|
|
312
|
+
def copy_buffer_to_texture: (**untyped) -> void
|
|
313
|
+
def copy_texture_to_buffer: (**untyped) -> void
|
|
314
|
+
def copy_texture_to_texture: (**untyped) -> void
|
|
315
|
+
def resolve_query_set: (**untyped) -> void
|
|
316
|
+
def clear_buffer: (Buffer, ?offset: Integer, ?size: Integer?) -> void
|
|
317
|
+
def write_timestamp: (QuerySet, Integer) -> void
|
|
318
|
+
def finish: (?label: String?) -> CommandBuffer
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
class CommandBuffer
|
|
322
|
+
include NativeResource
|
|
323
|
+
attr_reader handle: untyped
|
|
324
|
+
def submitted?: () -> bool
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
class ComputePass
|
|
328
|
+
include NativeResource
|
|
329
|
+
attr_reader handle: untyped
|
|
330
|
+
def set_pipeline: (ComputePipeline) -> void
|
|
331
|
+
def set_bind_group: (Integer, BindGroup, ?dynamic_offsets: Array[Integer]) -> void
|
|
332
|
+
def dispatch_workgroups: (Integer, ?Integer, ?Integer) -> void
|
|
333
|
+
def dispatch_workgroups_indirect: (Buffer, ?offset: Integer) -> void
|
|
334
|
+
def end_pass: () -> void
|
|
335
|
+
def end: () -> void
|
|
336
|
+
def ended?: () -> bool
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
class RenderPass
|
|
340
|
+
include NativeResource
|
|
341
|
+
attr_reader handle: untyped
|
|
342
|
+
def set_pipeline: (RenderPipeline) -> void
|
|
343
|
+
def set_bind_group: (Integer, BindGroup, ?dynamic_offsets: Array[Integer]) -> void
|
|
344
|
+
def set_vertex_buffer: (Integer, Buffer, ?offset: Integer, ?size: Integer?) -> void
|
|
345
|
+
def set_index_buffer: (Buffer, enum_value, ?offset: Integer, ?size: Integer?) -> void
|
|
346
|
+
def draw: (Integer, ?instance_count: Integer, ?first_vertex: Integer, ?first_instance: Integer) -> void
|
|
347
|
+
def draw_indexed: (Integer, **untyped) -> void
|
|
348
|
+
def end_pass: () -> void
|
|
349
|
+
def end: () -> void
|
|
350
|
+
def ended?: () -> bool
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
class RenderBundleEncoder
|
|
354
|
+
include NativeResource
|
|
355
|
+
attr_reader handle: untyped
|
|
356
|
+
def finish: (?label: String?) -> RenderBundle
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
class RenderBundle
|
|
360
|
+
include NativeResource
|
|
361
|
+
attr_reader handle: untyped
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
class Surface
|
|
365
|
+
include NativeResource
|
|
366
|
+
attr_reader handle: untyped
|
|
367
|
+
def configure: (**untyped) -> void
|
|
368
|
+
def unconfigure: () -> void
|
|
369
|
+
def current_texture: () -> Texture
|
|
370
|
+
def present: () -> void
|
|
371
|
+
def capabilities: (Adapter) -> Hash[Symbol, untyped]
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
class CanvasContext
|
|
375
|
+
include NativeResource
|
|
376
|
+
def configure: (**untyped) -> void
|
|
377
|
+
def unconfigure: () -> void
|
|
378
|
+
def get_current_texture: () -> Texture
|
|
379
|
+
def present: () -> void
|
|
380
|
+
end
|
|
381
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wgpu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yudai Takada
|
|
@@ -37,20 +37,6 @@ dependencies:
|
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '2.3'
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: sdl3
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - "~>"
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: 1.0.0
|
|
47
|
-
type: :runtime
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - "~>"
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: 1.0.0
|
|
54
40
|
description: Ruby bindings for the WebGPU API, providing GPU compute and graphics
|
|
55
41
|
capabilities through the wgpu-native library.
|
|
56
42
|
email:
|
|
@@ -60,9 +46,27 @@ extensions:
|
|
|
60
46
|
- ext/wgpu/extconf.rb
|
|
61
47
|
extra_rdoc_files: []
|
|
62
48
|
files:
|
|
49
|
+
- CHANGELOG.md
|
|
63
50
|
- LICENSE-APACHE
|
|
64
51
|
- LICENSE-MIT
|
|
65
52
|
- README.md
|
|
53
|
+
- docs/README.md
|
|
54
|
+
- docs/api_coverage.md
|
|
55
|
+
- docs/async.md
|
|
56
|
+
- docs/bind_groups.md
|
|
57
|
+
- docs/buffer_data.md
|
|
58
|
+
- docs/command_encoding.md
|
|
59
|
+
- docs/errors.md
|
|
60
|
+
- docs/getting_started_compute.md
|
|
61
|
+
- docs/getting_started_rendering.md
|
|
62
|
+
- docs/installation.md
|
|
63
|
+
- docs/pipeline_descriptors.md
|
|
64
|
+
- docs/releasing.md
|
|
65
|
+
- docs/resource_lifetime.md
|
|
66
|
+
- docs/shaders.md
|
|
67
|
+
- docs/texture_readback.md
|
|
68
|
+
- docs/troubleshooting.md
|
|
69
|
+
- docs/upgrading_wgpu_native.md
|
|
66
70
|
- ext/wgpu/Makefile
|
|
67
71
|
- ext/wgpu/extconf.rb
|
|
68
72
|
- lib/wgpu.rb
|
|
@@ -74,17 +78,27 @@ files:
|
|
|
74
78
|
- lib/wgpu/commands/render_bundle_encoder.rb
|
|
75
79
|
- lib/wgpu/commands/render_pass.rb
|
|
76
80
|
- lib/wgpu/core/adapter.rb
|
|
81
|
+
- lib/wgpu/core/async_waiter.rb
|
|
77
82
|
- lib/wgpu/core/canvas_context.rb
|
|
78
83
|
- lib/wgpu/core/device.rb
|
|
79
84
|
- lib/wgpu/core/instance.rb
|
|
80
85
|
- lib/wgpu/core/queue.rb
|
|
81
86
|
- lib/wgpu/core/surface.rb
|
|
87
|
+
- lib/wgpu/data_types.rb
|
|
88
|
+
- lib/wgpu/descriptor_helpers.rb
|
|
82
89
|
- lib/wgpu/error.rb
|
|
90
|
+
- lib/wgpu/logging.rb
|
|
91
|
+
- lib/wgpu/native/abi_verifier.rb
|
|
83
92
|
- lib/wgpu/native/callbacks.rb
|
|
93
|
+
- lib/wgpu/native/capabilities.rb
|
|
94
|
+
- lib/wgpu/native/distribution.rb
|
|
95
|
+
- lib/wgpu/native/enum_helper.rb
|
|
84
96
|
- lib/wgpu/native/enums.rb
|
|
85
97
|
- lib/wgpu/native/functions.rb
|
|
98
|
+
- lib/wgpu/native/installer.rb
|
|
86
99
|
- lib/wgpu/native/loader.rb
|
|
87
100
|
- lib/wgpu/native/structs.rb
|
|
101
|
+
- lib/wgpu/native_resource.rb
|
|
88
102
|
- lib/wgpu/pipeline/bind_group.rb
|
|
89
103
|
- lib/wgpu/pipeline/bind_group_layout.rb
|
|
90
104
|
- lib/wgpu/pipeline/compute_pipeline.rb
|
|
@@ -96,15 +110,18 @@ files:
|
|
|
96
110
|
- lib/wgpu/resources/sampler.rb
|
|
97
111
|
- lib/wgpu/resources/texture.rb
|
|
98
112
|
- lib/wgpu/resources/texture_view.rb
|
|
113
|
+
- lib/wgpu/texture_format.rb
|
|
99
114
|
- lib/wgpu/version.rb
|
|
100
115
|
- lib/wgpu/window.rb
|
|
116
|
+
- sig/wgpu.rbs
|
|
101
117
|
homepage: https://github.com/ydah/wgpu-ruby
|
|
102
118
|
licenses:
|
|
103
119
|
- MIT
|
|
104
120
|
- Apache-2.0
|
|
105
121
|
metadata:
|
|
106
122
|
homepage_uri: https://github.com/ydah/wgpu-ruby
|
|
107
|
-
source_code_uri: https://github.com/ydah/wgpu-ruby
|
|
123
|
+
source_code_uri: https://github.com/ydah/wgpu-ruby/tree/main
|
|
124
|
+
changelog_uri: https://github.com/ydah/wgpu-ruby/blob/main/CHANGELOG.md
|
|
108
125
|
rdoc_options: []
|
|
109
126
|
require_paths:
|
|
110
127
|
- lib
|