Class: Vulkan::CommandBuffer
Constant Summary
Constants included
from Conversions
Vulkan::Conversions::ACCESS_MASK_BITS, Vulkan::Conversions::BORDER_COLORS, Vulkan::Conversions::BUFFER_USAGE_BITS, Vulkan::Conversions::COMPARE_OPS, Vulkan::Conversions::DEPENDENCY_FLAG_BITS, Vulkan::Conversions::DESCRIPTOR_TYPES, Vulkan::Conversions::DYNAMIC_STATES, Vulkan::Conversions::FILTERS, Vulkan::Conversions::FORMAT_FEATURE_BITS, Vulkan::Conversions::IMAGE_ASPECT_BITS, Vulkan::Conversions::IMAGE_CREATE_BITS, Vulkan::Conversions::IMAGE_FORMATS, Vulkan::Conversions::IMAGE_TILING, Vulkan::Conversions::IMAGE_TYPES, Vulkan::Conversions::IMAGE_USAGE_BITS, Vulkan::Conversions::MEMORY_PROPERTIES, Vulkan::Conversions::PIPELINE_STAGE_BITS, Vulkan::Conversions::PRESENT_MODES, Vulkan::Conversions::SAMPLER_ADDRESS_MODES, Vulkan::Conversions::SAMPLER_MIPMAP_MODES, Vulkan::Conversions::SHADER_STAGE_BITS, Vulkan::Conversions::SHARING_MODES, Vulkan::Conversions::SURFACE_TRANSFORMS, Vulkan::Conversions::VERTEX_INPUT_RATES
Class Method Summary
collapse
Instance Method Summary
collapse
-
#begin_render_pass(render_pass, framebuffer:, left: 0, top: 0, width: framebuffer.width, height: framebuffer.height, clear: nil, subpass_contents: :inline) ⇒ Object
-
#bind_descriptor_set(bind_point, set, pipeline_layout:) ⇒ Object
-
#bind_descriptor_sets(bind_point, sets, pipeline_layout:, set_count: sets.size, first_set: 0, dynamic_offsets: nil, dynamic_offset_count: dynamic_offsets ? dynamic_offsets.size : 0) ⇒ Object
-
#bind_index_buffer(index_buffer, offset: 0, type:) ⇒ Object
-
#bind_pipeline(binding_point, pipeline) ⇒ Object
-
#bind_vertex_buffer(vertex_buffer, binding_index: 0, offset: 0) ⇒ Object
-
#bind_vertex_buffers(vertex_buffers:, offsets: nil, first_binding: 0, binding_count: vertex_buffers.size) ⇒ Object
-
#blit_image(src:, src_layout: :transfer_src_optimal, dst:, dst_layout: :transfer_dst_optimal, regions:, filter: :nearest) ⇒ Object
Blit from the image at :src into the image at :dst.
-
#build_buffer_image_copy_region(buffer_offset:, buffer_row_length:, buffer_image_height:, x:, y:, z:, width:, height:, depth:, aspects:, mip_level:, base_array_layer:, layer_count:) ⇒ Object
-
#copy_buffer(src, dst, regions: [{size: src.size}]) ⇒ Object
-
#copy_buffer_to_image(buffer, image, regions, layout: :dst_optimal) ⇒ Object
-
#draw(vertex_count, instance_count, first_vertex_index, first_instance_index) ⇒ Object
-
#draw_indexed(index_count, instance_count, first_index, vertex_offset, first_instance) ⇒ Object
-
#end_render_pass ⇒ Object
-
#initialize(vk, handle, index = 0, &block) ⇒ CommandBuffer
constructor
A new instance of CommandBuffer.
-
#pipeline_barriers(memory_barriers: nil, buffer_barriers: nil, image_barriers: nil, src_stages:, dst_stages:, dependencies: 0) ⇒ Object
-
#pipeline_image_barrier(from_layout:, to_layout:, src_queue_family: :ignored, dst_queue_family: :ignored, image:, aspects:, base_mip_level:, level_count:, base_array_layer:, layer_count:, src_access:, dst_access:, **barrier_args) ⇒ Object
-
#record(user_arg = nil) ⇒ Object
-
#recording? ⇒ Boolean
-
#render_pass(render_pass, **args) ⇒ Object
-
#set_scissor(scissors, first: 0) ⇒ Object
-
#start_recording ⇒ Object
-
#stop_recording ⇒ Object
-
#to_ptr ⇒ Object
-
#viewport(x, y, width, height, min_depth = 0, max_depth = 1) ⇒ Object
Methods included from Checks
check_result
array_of_pointers, array_of_structures, array_of_uint32s, bool_to_vk, buffer_usage_flags_to_syms, const_to_symbol, cstr_to_rbstr, flags_to_symbols, flags_to_syms, num_to_samples, present_mode_to_sym, queue_family_to_index, struct_to_hash, sym_to_blend_factor, sym_to_blend_op, sym_to_border_color, sym_to_color_component_bit, sym_to_command_buffer_level, sym_to_command_buffer_usage, sym_to_compare_op, sym_to_cull_mode, sym_to_descriptor_type, sym_to_dynamic_state, sym_to_filter, sym_to_front_face, sym_to_image_format, sym_to_image_layout, sym_to_image_tiling, sym_to_image_type, sym_to_index_type, sym_to_load_op, sym_to_pipeline_bind_point, sym_to_polygon_mode, sym_to_present_mode, sym_to_sampler_address_mode, sym_to_sampler_mipmap_mode, sym_to_samples, sym_to_sharing_mode, sym_to_store_op, sym_to_subpass_contents, sym_to_topology, sym_to_val, sym_to_vertex_input_rate, syms_to_access_mask, syms_to_buffer_usage_flags, syms_to_dependency_flags, syms_to_descriptor_set_layout_type_flags, syms_to_flags, syms_to_format_feature_flags, syms_to_image_aspect_flags, syms_to_image_create_flags, syms_to_image_usage_flags, syms_to_memory_properties, syms_to_pipeline_stage_flags, syms_to_shader_stage_flags, syms_to_surface_transforms, vk_make_version, vk_parse_version
Constructor Details
#initialize(vk, handle, index = 0, &block) ⇒ CommandBuffer
Returns a new instance of CommandBuffer.
24
25
26
27
28
29
30
|
# File 'lib/vulkan/command_buffer.rb', line 24
def initialize(vk, handle, index = 0, &block)
@vk = vk
@handle = handle
@recording = false
@scissors_p = {}
record(index, &block) if block_given?
end
|
Class Method Details
.create(vk, command_pool, count: 1, level: :primary, usage: :simultaneous, &block) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/vulkan/command_buffer.rb', line 9
def create(vk, command_pool, count: 1, level: :primary, usage: :simultaneous, &block)
@usage = usage
alloc_info = VkCommandBufferAllocateInfo.malloc
alloc_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO
alloc_info.commandPool = command_pool.to_ptr
alloc_info.level = sym_to_command_buffer_level(level)
alloc_info.commandBufferCount = count
buffers = Vulkan.struct(["void *value[#{count}]"]).malloc
check_result vk.vkAllocateCommandBuffers(vk.device, alloc_info, buffers)
count.times.map { |i| new(vk, buffers.value[i], i, &block) }
end
|
Instance Method Details
#begin_render_pass(render_pass, framebuffer:, left: 0, top: 0, width: framebuffer.width, height: framebuffer.height, clear: nil, subpass_contents: :inline) ⇒ Object
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
# File 'lib/vulkan/command_buffer.rb', line 225
def begin_render_pass(render_pass, framebuffer:,
left: 0,
top: 0,
width: framebuffer.width,
height: framebuffer.height,
clear: nil,
subpass_contents: :inline)
attachments = render_pass.attachments
@refs << render_pass
@refs << framebuffer
@clear_values = attachments.size.times.map { VkClearValue.malloc }
attachments.each_with_index do |attachment, i|
clear_i = clear && clear[i]
if attachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL ||
attachments[i].finalLayout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL
clear_i ||= [1, 0]
@clear_values[i].depthStencil.depth = clear_i[0]
@clear_values[i].depthStencil.stencil = clear_i[1]
else
clear_i ||= [0, 0, 0, 1]
@clear_values[i].color.float32 = clear_i
end
end
@clear_values_p = array_of_structures(@clear_values)
@render_pass_info = VkRenderPassBeginInfo.malloc
@render_pass_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO
@render_pass_info.renderPass = render_pass.to_ptr
@render_pass_info.framebuffer = framebuffer.to_ptr
@render_pass_info.renderArea.offset.x = left
@render_pass_info.renderArea.offset.y = top
@render_pass_info.renderArea.extent.width = width
@render_pass_info.renderArea.extent.height = height
@render_pass_info.clearValueCount = attachments.size
@render_pass_info.pClearValues = @clear_values_p
@vk.vkCmdBeginRenderPass(to_ptr, @render_pass_info, sym_to_subpass_contents(subpass_contents))
end
|
#bind_descriptor_set(bind_point, set, pipeline_layout:) ⇒ Object
353
354
355
|
# File 'lib/vulkan/command_buffer.rb', line 353
def bind_descriptor_set(bind_point, set, pipeline_layout:)
bind_descriptor_sets(bind_point, [set], pipeline_layout: pipeline_layout)
end
|
#bind_descriptor_sets(bind_point, sets, pipeline_layout:, set_count: sets.size, first_set: 0, dynamic_offsets: nil, dynamic_offset_count: dynamic_offsets ? dynamic_offsets.size : 0) ⇒ Object
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
# File 'lib/vulkan/command_buffer.rb', line 337
def bind_descriptor_sets(bind_point, sets, pipeline_layout:,
set_count: sets.size,
first_set: 0,
dynamic_offsets: nil,
dynamic_offset_count: dynamic_offsets ? dynamic_offsets.size : 0)
@refs << sets
@vk.vkCmdBindDescriptorSets(to_ptr,
sym_to_pipeline_bind_point(bind_point),
pipeline_layout,
first_set,
set_count,
array_of_pointers(sets),
dynamic_offset_count,
dynamic_offsets);
end
|
#bind_index_buffer(index_buffer, offset: 0, type:) ⇒ Object
332
333
334
335
|
# File 'lib/vulkan/command_buffer.rb', line 332
def bind_index_buffer(index_buffer, offset: 0, type:)
@refs << index_buffer
@vk.vkCmdBindIndexBuffer(to_ptr, index_buffer, offset, sym_to_index_type(type))
end
|
#bind_pipeline(binding_point, pipeline) ⇒ Object
268
269
270
271
|
# File 'lib/vulkan/command_buffer.rb', line 268
def bind_pipeline(binding_point, pipeline)
@refs << pipeline
@vk.vkCmdBindPipeline(to_ptr, sym_to_pipeline_bind_point(binding_point), pipeline)
end
|
#bind_vertex_buffer(vertex_buffer, binding_index: 0, offset: 0) ⇒ Object
314
315
316
317
318
|
# File 'lib/vulkan/command_buffer.rb', line 314
def bind_vertex_buffer(vertex_buffer, binding_index: 0, offset: 0)
bind_vertex_buffers vertex_buffers: [vertex_buffer],
first_binding: binding_index,
offsets: [offset]
end
|
#bind_vertex_buffers(vertex_buffers:, offsets: nil, first_binding: 0, binding_count: vertex_buffers.size) ⇒ Object
320
321
322
323
324
325
326
327
328
329
330
|
# File 'lib/vulkan/command_buffer.rb', line 320
def bind_vertex_buffers(vertex_buffers:,
offsets: nil,
first_binding: 0,
binding_count: vertex_buffers.size)
offsets ||= vertex_buffers.map { 0 }
@refs.concat vertex_buffers
buffers_p = array_of_pointers(vertex_buffers)
offsets_p = Vulkan.struct("VkDeviceSize offsets[#{offsets.size}]").malloc
offsets.each_with_index { |o, i| offsets_p.offsets[i] = o }
@vk.vkCmdBindVertexBuffers(to_ptr, first_binding, binding_count, buffers_p, offsets_p)
end
|
#blit_image(src:, src_layout: :transfer_src_optimal, dst:, dst_layout: :transfer_dst_optimal, regions:, filter: :nearest) ⇒ Object
Blit from the image at :src into the image at :dst.
:regions contains an array of hashes, which must correspond to
this layout (values given are defaults used if the field is omitted):
{
src: { # corresponds to struct VkImageSubresourceLayers
aspect_mask: VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM, # (everything)
mip_level: (required),
base_array_layer: 0,
layer_count: 1,
tl: { # corresponds to srcOffests[0], a struct VkOffset3D
x: 0,
y: 0,
z: 0
},
br: { # corresponds to srcOffests[1], a struct VkOffset3D
x: (required)
y: (required)
z: (required)
}
},
dst: { # corresponds to struct VkImageSubresourceLayers
aspect_mask: VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM, # (everything)
mip_level: (required),
base_array_layer: 0,
layer_count: 1,
tl: { # corresponds to dstOffests[0], a struct VkOffset3D
x: 0,
y: 0,
z: 0
},
br: { # corresponds to dstOffests[1], a struct VkOffset3D
x: (required)
y: (required)
z: (required)
}
},
}
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/vulkan/command_buffer.rb', line 118
def blit_image(src:,
src_layout: :transfer_src_optimal,
dst:,
dst_layout: :transfer_dst_optimal,
regions:,
filter: :nearest)
blit_regions_p = Vulkan.struct("regions[#{regions.size}]" => VkImageBlit).malloc
@refs << blit_regions_p
regions.each_with_index do |region, i|
blit_region = blit_regions_p.regions[i]
blit_region.srcSubresource.aspectMask = syms_to_image_aspect_flags(region[:src][:aspect_mask] || VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM)
blit_region.srcSubresource.mipLevel = region[:src][:mip_level]
blit_region.srcSubresource.baseArrayLayer = region[:src][:base_array_layer] || 0
blit_region.srcSubresource.layerCount = region[:src][:layer_count] || 1
blit_region.dstSubresource.aspectMask = syms_to_image_aspect_flags(region[:dst][:aspect_mask] || VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM)
blit_region.dstSubresource.mipLevel = region[:dst][:mip_level]
blit_region.dstSubresource.baseArrayLayer = region[:dst][:base_array_layer] || 0
blit_region.dstSubresource.layerCount = region[:dst][:layer_count] || 1
tl = region[:src][:tl] || {}
blit_region.srcOffsets[0].x = tl[:x] || 0
blit_region.srcOffsets[0].y = tl[:y] || 0
blit_region.srcOffsets[0].z = tl[:z] || 0
blit_region.srcOffsets[1].x = region[:src][:br][:x] || raise(ArgumentError, "Need src :br offsets (x)")
blit_region.srcOffsets[1].y = region[:src][:br][:y] || raise(ArgumentError, "Need src :br offsets (y)")
blit_region.srcOffsets[1].z = region[:src][:br][:z] || raise(ArgumentError, "Need src :br offsets (z)")
tl = region[:dst][:tl] || {}
blit_region.dstOffsets[0].x = tl[:x] || 0
blit_region.dstOffsets[0].y = tl[:y] || 0
blit_region.dstOffsets[0].z = tl[:z] || 0
blit_region.dstOffsets[1].x = region[:dst][:br][:x] || raise(ArgumentError, "Need dst :br offsets (x)")
blit_region.dstOffsets[1].y = region[:dst][:br][:y] || raise(ArgumentError, "Need dst :br offsets (y)")
blit_region.dstOffsets[1].z = region[:dst][:br][:z] || raise(ArgumentError, "Need dst :br offsets (z)")
end
@vk.vkCmdBlitImage(to_ptr,
src,
sym_to_image_layout(src_layout),
dst,
sym_to_image_layout(dst_layout),
regions.size,
blit_regions_p,
sym_to_filter(filter))
end
|
#build_buffer_image_copy_region(buffer_offset:, buffer_row_length:, buffer_image_height:, x:, y:, z:, width:, height:, depth:, aspects:, mip_level:, base_array_layer:, layer_count:) ⇒ Object
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
|
# File 'lib/vulkan/command_buffer.rb', line 284
def build_buffer_image_copy_region(buffer_offset:,
buffer_row_length:,
buffer_image_height:,
x:,
y:,
z:,
width:,
height:,
depth:,
aspects:,
mip_level:,
base_array_layer:,
layer_count:)
VkBufferImageCopy.malloc.tap do |region|
region.bufferOffset = buffer_offset
region.bufferRowLength = buffer_row_length
region.bufferImageHeight = buffer_image_height
region.imageSubresource.aspectMask = syms_to_image_aspect_flags(aspects)
region.imageSubresource.mipLevel = mip_level
region.imageSubresource.baseArrayLayer = base_array_layer
region.imageSubresource.layerCount = layer_count
region.imageOffset.x = x
region.imageOffset.y = y
region.imageOffset.z = z
region.imageExtent.width = width
region.imageExtent.height = height
region.imageExtent.depth = depth
end
end
|
#copy_buffer(src, dst, regions: [{size: src.size}]) ⇒ Object
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/vulkan/command_buffer.rb', line 69
def copy_buffer(src, dst, regions: [{size: src.size}])
copy_regions_p = Vulkan.struct("regions[#{regions.size}]" => VkBufferCopy).malloc
@refs << copy_regions_p
regions.each_with_index do |region, i|
copy_regions_p.regions[i].srcOffset = region[:src_offset] if region[:src_offset]
copy_regions_p.regions[i].dstOffset = region[:dst_offset] if region[:dst_offset]
copy_regions_p.regions[i].size = region[:size] || raise(ArgumentError, 'region[:size] is required')
end
@vk.vkCmdCopyBuffer(to_ptr, src, dst, regions.size, copy_regions_p)
end
|
#copy_buffer_to_image(buffer, image, regions, layout: :dst_optimal) ⇒ Object
273
274
275
276
277
278
279
280
281
282
|
# File 'lib/vulkan/command_buffer.rb', line 273
def copy_buffer_to_image(buffer, image, regions, layout: :dst_optimal)
regions = [regions].flatten
regions_p = regions.map { |region| build_buffer_image_copy_region(**region) }
@vk.vkCmdCopyBufferToImage to_ptr,
buffer.respond_to?(:to_ptr) ? buffer.to_ptr : buffer,
image.respond_to?(:to_ptr) ? image.to_ptr : image,
sym_to_image_layout(layout),
regions.size,
array_of_structures(regions_p)
end
|
#draw(vertex_count, instance_count, first_vertex_index, first_instance_index) ⇒ Object
357
358
359
|
# File 'lib/vulkan/command_buffer.rb', line 357
def draw(vertex_count, instance_count, first_vertex_index, first_instance_index)
@vk.vkCmdDraw(to_ptr, vertex_count, instance_count, first_vertex_index, first_instance_index)
end
|
#draw_indexed(index_count, instance_count, first_index, vertex_offset, first_instance) ⇒ Object
361
362
363
|
# File 'lib/vulkan/command_buffer.rb', line 361
def draw_indexed(index_count, instance_count, first_index, vertex_offset, first_instance)
@vk.vkCmdDrawIndexed(to_ptr, index_count, instance_count, first_index, vertex_offset, first_instance)
end
|
#end_render_pass ⇒ Object
264
265
266
|
# File 'lib/vulkan/command_buffer.rb', line 264
def end_render_pass
@vk.vkCmdEndRenderPass(to_ptr)
end
|
#pipeline_barriers(memory_barriers: nil, buffer_barriers: nil, image_barriers: nil, src_stages:, dst_stages:, dependencies: 0) ⇒ Object
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
# File 'lib/vulkan/command_buffer.rb', line 192
def pipeline_barriers(memory_barriers: nil,
buffer_barriers: nil,
image_barriers: nil,
src_stages: ,
dst_stages: ,
dependencies: 0)
memory_barriers_p = array_of_structures(memory_barriers)
buffer_barriers_p = array_of_structures(buffer_barriers)
image_barriers_p = array_of_structures(image_barriers)
@vk.vkCmdPipelineBarrier to_ptr,
syms_to_pipeline_stage_flags(src_stages),
syms_to_pipeline_stage_flags(dst_stages),
syms_to_dependency_flags(dependencies),
memory_barriers&.size || 0,
memory_barriers_p,
buffer_barriers&.size || 0,
buffer_barriers_p,
image_barriers&.size || 0,
image_barriers_p
end
|
#pipeline_image_barrier(from_layout:, to_layout:, src_queue_family: :ignored, dst_queue_family: :ignored, image:, aspects:, base_mip_level:, level_count:, base_array_layer:, layer_count:, src_access:, dst_access:, **barrier_args) ⇒ Object
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/vulkan/command_buffer.rb', line 162
def pipeline_image_barrier(from_layout:,
to_layout:,
src_queue_family: :ignored,
dst_queue_family: :ignored,
image:,
aspects:,
base_mip_level:,
level_count:,
base_array_layer:,
layer_count:,
src_access:,
dst_access:,
**barrier_args)
barrier = VkImageMemoryBarrier.malloc
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER
barrier.oldLayout = sym_to_image_layout(from_layout)
barrier.newLayout = sym_to_image_layout(to_layout)
barrier.srcQueueFamilyIndex = queue_family_to_index(src_queue_family)
barrier.dstQueueFamilyIndex = queue_family_to_index(dst_queue_family)
barrier.image = image.to_ptr
barrier.subresourceRange.aspectMask = syms_to_image_aspect_flags(aspects)
barrier.subresourceRange.baseMipLevel = base_mip_level
barrier.subresourceRange.levelCount = level_count
barrier.subresourceRange.baseArrayLayer = base_array_layer
barrier.subresourceRange.layerCount = layer_count
barrier.srcAccessMask = syms_to_access_mask(src_access)
barrier.dstAccessMask = syms_to_access_mask(dst_access)
pipeline_barriers(image_barriers: [barrier], **barrier_args)
end
|
#record(user_arg = nil) ⇒ Object
32
33
34
35
36
37
|
# File 'lib/vulkan/command_buffer.rb', line 32
def record(user_arg = nil)
start_recording
yield self, user_arg
ensure
stop_recording
end
|
#recording? ⇒ Boolean
51
52
53
|
# File 'lib/vulkan/command_buffer.rb', line 51
def recording?
@recording
end
|
#render_pass(render_pass, **args) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/vulkan/command_buffer.rb', line 62
def render_pass(render_pass, **args)
begin_render_pass(render_pass, **args)
yield self if block_given?
ensure
end_render_pass
end
|
#set_scissor(scissors, first: 0) ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/vulkan/command_buffer.rb', line 213
def set_scissor(scissors, first: 0)
scissors_p = @scissors_p[scissors.size] ||=
Vulkan.struct("scissors[#{scissors.size}]" => VkRect2D).malloc
scissors.each_with_index do |scissor, i|
scissors_p.scissors[i].offset.x = scissor[:left]
scissors_p.scissors[i].offset.y = scissor[:top]
scissors_p.scissors[i].extent.width = scissor[:width]
scissors_p.scissors[i].extent.height = scissor[:height]
end
@vk.vkCmdSetScissor(to_ptr, first, scissors.size, scissors_p)
end
|
#start_recording ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/vulkan/command_buffer.rb', line 39
def start_recording
@begin_info = VkCommandBufferBeginInfo.malloc
@begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
@begin_info.flags = sym_to_command_buffer_usage(@usage)
@begin_info.pInheritanceInfo = nil
check_result @vk.vkBeginCommandBuffer(to_ptr, @begin_info)
@recording = true
@refs = []
end
|
#stop_recording ⇒ Object
55
56
57
58
59
60
|
# File 'lib/vulkan/command_buffer.rb', line 55
def stop_recording
if recording?
check_result @vk.vkEndCommandBuffer(to_ptr)
@recording = false
end
end
|
#to_ptr ⇒ Object
376
377
378
|
# File 'lib/vulkan/command_buffer.rb', line 376
def to_ptr
@handle
end
|
#viewport(x, y, width, height, min_depth = 0, max_depth = 1) ⇒ Object
365
366
367
368
369
370
371
372
373
374
|
# File 'lib/vulkan/command_buffer.rb', line 365
def viewport(x, y, width, height, min_depth = 0, max_depth = 1)
vp = VkViewport.malloc
vp.x = x
vp.y = y
vp.width = width
vp.height = height
vp.minDepth = min_depth
vp.maxDepth = max_depth
@vk.vkCmdSetViewport(to_ptr, 0, 1, vp)
end
|