Class: Vulkan::RenderPass::Subpass

Inherits:
Object
  • Object
show all
Includes:
Conversions
Defined in:
lib/vulkan/render_pass/subpass.rb

Constant Summary

Constants included from Conversions

Conversions::ACCESS_MASK_BITS, Conversions::BORDER_COLORS, Conversions::BUFFER_USAGE_BITS, Conversions::COMPARE_OPS, Conversions::DEPENDENCY_FLAG_BITS, Conversions::DESCRIPTOR_TYPES, Conversions::DYNAMIC_STATES, Conversions::FILTERS, Conversions::FORMAT_FEATURE_BITS, Conversions::IMAGE_ASPECT_BITS, Conversions::IMAGE_CREATE_BITS, Conversions::IMAGE_FORMATS, Conversions::IMAGE_TILING, Conversions::IMAGE_TYPES, Conversions::IMAGE_USAGE_BITS, Conversions::MEMORY_PROPERTIES, Conversions::PIPELINE_STAGE_BITS, Conversions::PRESENT_MODES, Conversions::SAMPLER_ADDRESS_MODES, Conversions::SAMPLER_MIPMAP_MODES, Conversions::SHADER_STAGE_BITS, Conversions::SHARING_MODES, Conversions::SURFACE_TRANSFORMS, Conversions::VERTEX_INPUT_RATES

Instance Method Summary collapse

Methods included from Conversions

#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, bind_point: :graphics) ⇒ Subpass

Returns a new instance of Subpass.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vulkan/render_pass/subpass.rb', line 6

def initialize(vk, bind_point: :graphics)
  @color_attachments    = []
  @input_attachments    = []
  @resolve_attachments  = []
  @preserve_attachments = []

  @ptr = VkSubpassDescription.malloc
  @ptr.pipelineBindPoint       = sym_to_pipeline_bind_point(bind_point)
  @ptr.colorAttachmentCount    = 0
  @ptr.pColorAttachments       = nil
  @ptr.inputAttachmentCount    = 0
  @ptr.pInputAttachments       = nil
  @ptr.pResolveAttachments     = nil
  @ptr.pDepthStencilAttachment = nil
  @ptr.preserveAttachmentCount = 0
  @ptr.pPreserveAttachments    = nil
end

Instance Method Details

#add_attachment_ref(ary, index:, layout:, addr_mbr:, count_mbr:) ⇒ Object



24
25
26
27
# File 'lib/vulkan/render_pass/subpass.rb', line 24

def add_attachment_ref(ary, index:, layout:, addr_mbr:, count_mbr:)
  ary << create_attachment_ref(index, layout)
  update_attachment_refs(ary, addr_mbr: addr_mbr, count_mbr: count_mbr)
end

#add_color_attachment_ref(index:, layout: :color) ⇒ Object



34
35
36
37
38
39
# File 'lib/vulkan/render_pass/subpass.rb', line 34

def add_color_attachment_ref(index:, layout: :color)
  add_attachment_ref(@color_attachments, index: index,
                                         layout: layout,
                                         addr_mbr: :pColorAttachments,
                                         count_mbr: :colorAttachmentCount)
end

#add_input_attachment_ref(index:, layout:) ⇒ Object



48
49
50
51
52
53
# File 'lib/vulkan/render_pass/subpass.rb', line 48

def add_input_attachment_ref(index:, layout:)
  add_attachment_ref(@input_attachments, index: index,
                                         layout: layout,
                                         addr_mbr: :pInputAttachments,
                                         count_mbr: :inputAttachmentCount)
end

#add_preserve_attachment_ref(index:, layout:) ⇒ Object



55
56
57
58
59
60
# File 'lib/vulkan/render_pass/subpass.rb', line 55

def add_preserve_attachment_ref(index:, layout:)
  add_attachment_ref(@preserve_attachments, index: index,
                                            layout: layout,
                                            addr_mbr: :pPreserveStencilAttachments,
                                            count_mbr: :preserveStencilAttachmentCount)
end

#add_resolve_attachment_ref(index:, layout: :color) ⇒ Object



41
42
43
44
45
46
# File 'lib/vulkan/render_pass/subpass.rb', line 41

def add_resolve_attachment_ref(index:, layout: :color)
  add_attachment_ref(@resolve_attachments, index: index,
                                           layout: layout,
                                           addr_mbr: :pResolveAttachments,
                                           count_mbr: nil)
end

#create_attachment_ref(index, layout) ⇒ Object



72
73
74
75
76
77
# File 'lib/vulkan/render_pass/subpass.rb', line 72

def create_attachment_ref(index, layout)
  ref = VkAttachmentReference.malloc
  ref.attachment = index # attachment index
  ref.layout = sym_to_image_layout(layout)
  ref
end

#set_depth_stencil_attachment_ref(index:, layout: :depth_stencil_attachment_optimal) ⇒ Object



62
63
64
65
66
# File 'lib/vulkan/render_pass/subpass.rb', line 62

def set_depth_stencil_attachment_ref(index:, layout: :depth_stencil_attachment_optimal)
  ref = create_attachment_ref(index, layout)
  @depth_stencil_attachment = ref
  @ptr.pDepthStencilAttachment = ref
end

#to_ptrObject



68
69
70
# File 'lib/vulkan/render_pass/subpass.rb', line 68

def to_ptr
  @ptr&.to_ptr
end

#update_attachment_refs(ary, addr_mbr:, count_mbr:) ⇒ Object



29
30
31
32
# File 'lib/vulkan/render_pass/subpass.rb', line 29

def update_attachment_refs(ary, addr_mbr:, count_mbr:)
  @ptr.send(:"#{addr_mbr}=",  array_of_structures(ary))
  @ptr.send(:"#{count_mbr}=", ary.size) if count_mbr
end