From ef865cfac528e69edcf5e5f895782cc5b12ca32a Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Fri, 23 Jan 2026 00:08:52 -0800 Subject: [PATCH 01/21] Renamed vk::physical to vk::physical_gpu for the enum for selecting gpu device types --- vulkan-cpp/physical_device.cppm | 2 +- vulkan-cpp/types.cppm | 31 ++++++++++++++++++++----------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/vulkan-cpp/physical_device.cppm b/vulkan-cpp/physical_device.cppm index 9607227..cc28e20 100644 --- a/vulkan-cpp/physical_device.cppm +++ b/vulkan-cpp/physical_device.cppm @@ -99,7 +99,7 @@ export namespace vk { private: VkPhysicalDevice enumerate_physical_devices( const VkInstance& p_instance, - const physical& p_physical_device_type) { + const physical_gpu& p_physical_device_type) { uint32_t device_count = 0; vkEnumeratePhysicalDevices(p_instance, &device_count, nullptr); diff --git a/vulkan-cpp/types.cppm b/vulkan-cpp/types.cppm index 15cf7a1..b3c7b0b 100644 --- a/vulkan-cpp/types.cppm +++ b/vulkan-cpp/types.cppm @@ -492,16 +492,25 @@ export namespace vk { std::string description; }; - //! @brief vk::physical defines what kinds of physical device - //! specification to use that is available based on your current - //! physical hardware specifications. - enum class physical : uint8_t { - integrated, - discrete, - virtualized, - cpu, - max_enum, - other + //! @brief Defines the enum types for a selection of gpu device + // types to select according to your hardware specs + + /** + * @brief Defines the enum types for a selection of gpu device + * types to select according to your hardware specs + * + * @param other - device does not match any other available types + * @param integrated - the device is typically embedded in or tightly coupled with the host. + * @param discrete - the device is typically a separate processor connected to the host via an interlink. + * @param virtual - the device is typically a virtual node in a virtualization environment. + * @param type_cpu - the device is typically running on the same processor as the host + */ + enum class physical_gpu : uint8_t { + other = VK_PHYSICAL_DEVICE_TYPE_OTHER, + integrated = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, + discrete = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, + virtualized = VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU, + type_cpu = VK_PHYSICAL_DEVICE_TYPE_CPU, }; /** @@ -511,7 +520,7 @@ export namespace vk { * created with */ struct physical_enumeration { - physical device_type; + physical_gpu device_type; }; struct surface_params { From ad6819928d7faab797955fb2aa9938b54b08ba5a Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Fri, 23 Jan 2026 01:28:56 -0800 Subject: [PATCH 02/21] Added the enums for configuring the graphics pipeline and configured setup for input assembly applied those new configurations --- vulkan-cpp/pipeline.cppm | 170 ++++++++++++++++++++++++++++- vulkan-cpp/types.cppm | 227 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 388 insertions(+), 9 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index a0a1d31..1a57bae 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -3,6 +3,7 @@ module; #include #include #include +#include export module vk:pipeline; @@ -11,6 +12,154 @@ export import :utilities; export namespace vk { inline namespace v1 { + + // VkPipelineInputAssemblyStateCreateInfo input_assembly = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, + // .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, + // .primitiveRestartEnable = VK_FALSE, + // }; + struct input_assembly_state { + const primitive_topology topology=primitive_topology::triangle_list; + bool primitive_restart_enable=false; + }; + + // VkPipelineViewportStateCreateInfo viewport_state = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, + // .viewportCount = 1, + // .scissorCount = 1, + // }; + struct viewport_state { + uint8_t viewport_count= 1; + uint8_t scissor_count = 1; + }; + + // VkPipelineRasterizationStateCreateInfo rasterizer_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, + // .depthClampEnable = false, + // .rasterizerDiscardEnable = + // false, // set to true make fragmenta that are beyond near/far + // // planes clamped to them as opposed to discarding them + // .polygonMode = + // VK_POLYGON_MODE_FILL, // if set to true then geometry never passes + // // through rasterizer stage. This basically + // // disables output to frame_buffer + // .cullMode = VK_CULL_MODE_NONE, // determines what culling to use. + // // Can also be disabled, culls + // // front-face, back-face or both + // .frontFace = + // VK_FRONT_FACE_COUNTER_CLOCKWISE, // specifies vertex order of + // // fdaces considered front-face + // // or clockwise/counter-clockwise + // .depthBiasEnable = false, + // .depthBiasConstantFactor = 0.0f, // Optional + // .depthBiasClamp = 0.0f, // Optional + // .depthBiasSlopeFactor = 0.0f, // Optional + // .lineWidth = 1.f + // }; + struct rasterization_state { + bool depth_clamp_enabled = false; + bool rasterizer_discard_enabled = false; + polygon_mode polygon_mode = polygon_mode::fill; + cull_mode cull_mode = cull_mode::none; + front_face front_face = front_face::counter_clockwise; + bool depth_bias_enabled=false; + float depth_bias_constant = 0.f; + float depth_bioas_slope = 0.f; + float line_width = 1.f; + }; + + // VkPipelineMultisampleStateCreateInfo multisampling_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, + // .rasterizationSamples = VK_SAMPLE_COUNT_1_BIT, + // .sampleShadingEnable = false, + // // .minSampleShading = 1.0f, // Optional + // // .pSampleMask = nullptr, // Optional + // // .alphaToCoverageEnable = VK_FALSE, // Optional + // // .alphaToOneEnable = VK_FALSE, // Optional + // }; + + struct multisample_state { + sample_bit rasterization_samples=sample_bit::count_1; + bool shading_enabled=false; + float min_shading = 1.f; // optional + std::span p_sample_masks={}; // optional + bool alpha_to_coverage_enable=false; // optional + bool alpha_to_one_enable=false; // optional + }; + + // VkPipelineColorBlendAttachmentState color_blend_attachment = { + // .blendEnable = true, + // .srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA, // Enabled: alpha blending + // .dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, // Enabled: alpha blending + // .colorBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending + // .srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE, // Enabled: alpha blending + // .dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO, // Enabled: alpha blending + // .alphaBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending + // .colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT, + // }; + + struct color_blend_attachment_state { + bool blend_enabled = true; + blend_factor src_color_blend_factor=blend_factor::src_alpha; + blend_factor dst_color_blend_factor = blend_factor::one_minus_src_alpha; + blend_op color_blend_op = blend_op::add; + blend_factor src_alpha_blend_factor = blend_factor::one; + blend_factor dst_alpha_blend_factor = blend_factor::zero; + blend_op alpha_blend_op = blend_op::add; + uint32_t color_write_mask = color_component::red | color_component::green | color_component::blue | color_component::alpha; + }; + + // VkPipelineColorBlendStateCreateInfo color_blending_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, + // .logicOpEnable = VK_FALSE, + // .logicOp = VK_LOGIC_OP_COPY, // Optional + // .attachmentCount = 1, + // .pAttachments = &color_blend_attachment, + // // these are optional + // .blendConstants = { 0.f, 0.f, 0.f, 0.f } // optional + // }; + + struct color_blend_state { + bool logic_op_enable=false; + logical_op logical_op = logical_op::copy; + std::span attachments; + std::span blend_constants; + }; + + // VkPipelineDepthStencilStateCreateInfo pipeline_deth_stencil_state_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, + // .depthTestEnable = true, + // .depthWriteEnable = true, + // .depthCompareOp = VK_COMPARE_OP_LESS, + // .depthBoundsTestEnable = false, + // .stencilTestEnable = false, + // }; + struct depth_stencil_state { + bool depth_test_enable = true; + bool depth_write_enable = true; + compare_op depth_compare_op = compare_op::less; + bool depth_bounds_test_enable = false; + bool stencil_test_enable = false; + }; + + + //! @note Dynamic State + //! @note -- pipeline states needs to be baked into the pipeline state + // std::array dynamic_states = { + // VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR + // }; + + // VkPipelineDynamicStateCreateInfo dynamic_state_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, + // .dynamicStateCount = static_cast(dynamic_states.size()), + // .pDynamicStates = dynamic_states.data() + // }; + + // struct dynamic_state_configure { + // std::span dynamic_states = {}; + // }; + + /** * @param renderpass is required for a VkPipeline to know up front * @param shader_modules is a std::span of the loaded shader @@ -24,6 +173,14 @@ export namespace vk { std::span vertex_attributes; std::span vertex_bind_attributes; std::span descriptor_layouts; + + input_assembly_state input_assembly; + viewport_state viewport; + rasterization_state rasterization; + multisample_state multisample; + color_blend_state color_blend; + depth_stencil_state depth_stencil; + std::span dynamic_states = {}; }; /** @@ -106,11 +263,16 @@ export namespace vk { .pVertexAttributeDescriptions = attributes.data() }; + // VkPipelineInputAssemblyStateCreateInfo input_assembly = { + // .sType = + // VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, + // .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, + // .primitiveRestartEnable = VK_FALSE, + // }; VkPipelineInputAssemblyStateCreateInfo input_assembly = { - .sType = - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, - .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, - .primitiveRestartEnable = VK_FALSE, + .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, + .topology = static_cast(p_info.input_assembly.topology), + .primitiveRestartEnable = p_info.input_assembly.primitive_restart_enable, }; VkPipelineViewportStateCreateInfo viewport_state = { diff --git a/vulkan-cpp/types.cppm b/vulkan-cpp/types.cppm index b3c7b0b..66b0624 100644 --- a/vulkan-cpp/types.cppm +++ b/vulkan-cpp/types.cppm @@ -412,7 +412,7 @@ export namespace vk { max_enum_format = VK_FORMAT_MAX_ENUM }; - enum image_aspect_flags : uint32_t { + enum class image_aspect_flags : uint32_t { color_bit = VK_IMAGE_ASPECT_COLOR_BIT, depth_bit = VK_IMAGE_ASPECT_DEPTH_BIT, stencil_bit = VK_IMAGE_ASPECT_STENCIL_BIT, @@ -731,10 +731,227 @@ export namespace vk { shader_read_only_optimal = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL }; - // enum class format : uint64_t { - // rgb32_sfloat, // Represent R32G32B32_SFLOAT - // rg32_sfloat, // Represent R32G32_SFLOAT - // }; + enum primitive_topology : uint8_t { + point_light = VK_PRIMITIVE_TOPOLOGY_POINT_LIST, + line_light = VK_PRIMITIVE_TOPOLOGY_LINE_LIST, + line_strip = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, + triangle_list = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, + triangle_strip = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, + triangle_fan = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN, + line_list_with_adjacent = VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY, + line_strip_with_adjacent = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY, + triangle_list_with_adjacent = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY, + triangle_strip_with_adjacent = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY, + patch_list = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST + }; + + enum polygon_mode : uint64_t { + fill = VK_POLYGON_MODE_FILL, + line = VK_POLYGON_MODE_LINE, + point = VK_POLYGON_MODE_POINT, + fill_rectangle_nv = VK_POLYGON_MODE_FILL_RECTANGLE_NV, + }; + + enum class cull_mode : uint32_t { + none = VK_CULL_MODE_NONE, + front_bit = VK_CULL_MODE_FRONT_BIT, + back_bit = VK_CULL_MODE_BACK_BIT, + front_and_back = VK_CULL_MODE_FRONT_AND_BACK, + }; + + enum class front_face : uint8_t { + counter_clockwise = VK_FRONT_FACE_COUNTER_CLOCKWISE, + clockwise = VK_FRONT_FACE_CLOCKWISE + }; + + enum class blend_factor : uint8_t { + zero=VK_BLEND_FACTOR_ZERO, + one=VK_BLEND_FACTOR_ONE, + src_color=VK_BLEND_FACTOR_SRC_COLOR, + one_minus_src_color=VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR, + dst_color = VK_BLEND_FACTOR_DST_COLOR, + one_minus_dst_color = VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR, + src_alpha = VK_BLEND_FACTOR_SRC_ALPHA, + one_minus_src_alpha = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, + dst_alpha = VK_BLEND_FACTOR_DST_ALPHA, + one_minus_dst_alpha = VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA, + constant_color = VK_BLEND_FACTOR_CONSTANT_COLOR, + constant_alpha = VK_BLEND_FACTOR_CONSTANT_ALPHA, + one_minus_constant_alpha = VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA, + src_alpha_saturate = VK_BLEND_FACTOR_SRC_ALPHA_SATURATE, + src1_color = VK_BLEND_FACTOR_SRC1_COLOR, + one_minus_src1_color = VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR, + src1_alpha = VK_BLEND_FACTOR_SRC1_ALPHA, + one_minus_src1_alpha = VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA + }; + + enum class blend_op : uint64_t { + add = VK_BLEND_OP_ADD, + subtract = VK_BLEND_OP_SUBTRACT, + reverse_subtract = VK_BLEND_OP_REVERSE_SUBTRACT, + min = VK_BLEND_OP_MIN, + max = VK_BLEND_OP_MAX, + zero_ext = VK_BLEND_OP_ZERO_EXT, + src_ext = VK_BLEND_OP_SRC_EXT, + dst_ext = VK_BLEND_OP_DST_EXT, + src_over_ext = VK_BLEND_OP_SRC_OVER_EXT, + dst_over_ext = VK_BLEND_OP_DST_OVER_EXT, + src_in_ext = VK_BLEND_OP_SRC_IN_EXT, + dst_in_ext = VK_BLEND_OP_DST_IN_EXT, + src_out_ext = VK_BLEND_OP_SRC_OUT_EXT, + dst_out_ext = VK_BLEND_OP_DST_OUT_EXT, + src_atop_ext = VK_BLEND_OP_SRC_ATOP_EXT, + dst_atop_ext = VK_BLEND_OP_DST_ATOP_EXT, + xor_ext = VK_BLEND_OP_XOR_EXT, + multiply_ext = VK_BLEND_OP_MULTIPLY_EXT, + screen_ext = VK_BLEND_OP_SCREEN_EXT, + overlay_ext = VK_BLEND_OP_OVERLAY_EXT, + darken_ext = VK_BLEND_OP_DARKEN_EXT, + lighten_ext = VK_BLEND_OP_LIGHTEN_EXT, + colordodge_ext = VK_BLEND_OP_COLORDODGE_EXT, + colorburn_ext = VK_BLEND_OP_COLORBURN_EXT, + hardlight_ext = VK_BLEND_OP_HARDLIGHT_EXT, + softlight_ext = VK_BLEND_OP_SOFTLIGHT_EXT, + difference_ext = VK_BLEND_OP_DIFFERENCE_EXT, + exclusion_ext = VK_BLEND_OP_EXCLUSION_EXT, + invert_ext = VK_BLEND_OP_INVERT_EXT, + invert_rgb_ext = VK_BLEND_OP_INVERT_RGB_EXT, + lineardodge_ext = VK_BLEND_OP_LINEARDODGE_EXT, + linearburn_ext = VK_BLEND_OP_LINEARBURN_EXT, + vividlight_ext = VK_BLEND_OP_VIVIDLIGHT_EXT, + linearlight_ext = VK_BLEND_OP_LINEARLIGHT_EXT, + pinlight_ext = VK_BLEND_OP_PINLIGHT_EXT, + hardmix_ext = VK_BLEND_OP_HARDMIX_EXT, + hsl_hue_ext = VK_BLEND_OP_HSL_HUE_EXT, + hsl_saturation_ext = VK_BLEND_OP_HSL_SATURATION_EXT, + hsl_color_ext = VK_BLEND_OP_HSL_COLOR_EXT, + hsl_luminosity_ext = VK_BLEND_OP_HSL_LUMINOSITY_EXT, + plus_ext = VK_BLEND_OP_PLUS_EXT, + plus_clamped_ext = VK_BLEND_OP_PLUS_CLAMPED_EXT, + plus_clamped_alpha_ext = VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT, + plus_darker_ext = VK_BLEND_OP_PLUS_DARKER_EXT, + minus_ext = VK_BLEND_OP_MINUS_EXT, + minus_clamped_ext = VK_BLEND_OP_MINUS_CLAMPED_EXT, + contrast_ext = VK_BLEND_OP_CONTRAST_EXT, + invert_ovg_ext = VK_BLEND_OP_INVERT_OVG_EXT, + red_ext = VK_BLEND_OP_RED_EXT, + green_ext = VK_BLEND_OP_GREEN_EXT, + blue_ext = VK_BLEND_OP_BLUE_EXT + }; + + // VkColorComponentFlags + enum color_component : uint32_t { + red = VK_COLOR_COMPONENT_R_BIT, + green = VK_COLOR_COMPONENT_G_BIT, + blue = VK_COLOR_COMPONENT_B_BIT, + alpha = VK_COLOR_COMPONENT_A_BIT + }; + + enum class logical_op : uint8_t { + clear = VK_LOGIC_OP_CLEAR, + bit_and = VK_LOGIC_OP_AND, + and_reverse = VK_LOGIC_OP_AND_REVERSE, + copy = VK_LOGIC_OP_COPY, + and_inverted = VK_LOGIC_OP_AND_INVERTED, + no_op = VK_LOGIC_OP_NO_OP, + bit_xor = VK_LOGIC_OP_XOR, + bit_or = VK_LOGIC_OP_OR, + nor = VK_LOGIC_OP_NOR, + equivalent = VK_LOGIC_OP_EQUIVALENT, + invert = VK_LOGIC_OP_INVERT, + or_reverse = VK_LOGIC_OP_OR_REVERSE, + copy_inverted = VK_LOGIC_OP_COPY_INVERTED, + or_inverted = VK_LOGIC_OP_OR_INVERTED, + nand = VK_LOGIC_OP_NAND, + set = VK_LOGIC_OP_SET + }; + + enum class compare_op : uint8_t { + never = VK_COMPARE_OP_NEVER, + less = VK_COMPARE_OP_LESS, + equal = VK_COMPARE_OP_EQUAL, + less_or_equal = VK_COMPARE_OP_LESS_OR_EQUAL, + greater = VK_COMPARE_OP_GREATER, + not_equal = VK_COMPARE_OP_NOT_EQUAL, + greater_or_equal = VK_COMPARE_OP_GREATER_OR_EQUAL, + always = VK_COMPARE_OP_ALWAYS + }; + + // VkDynamicState + enum class dynamic_state : uint64_t { + viewport = VK_DYNAMIC_STATE_VIEWPORT, + scissor = VK_DYNAMIC_STATE_SCISSOR, + line_width = VK_DYNAMIC_STATE_LINE_WIDTH, + depth_bias = VK_DYNAMIC_STATE_DEPTH_BIAS, + blend_constants = VK_DYNAMIC_STATE_BLEND_CONSTANTS, + depth_bounds = VK_DYNAMIC_STATE_DEPTH_BOUNDS, + stencil_compare_mask = VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK, + stencil_write_mask = VK_DYNAMIC_STATE_STENCIL_WRITE_MASK, + stencil_reference = VK_DYNAMIC_STATE_STENCIL_REFERENCE, + cull_mode = VK_DYNAMIC_STATE_CULL_MODE, + front_face = VK_DYNAMIC_STATE_FRONT_FACE, + primitive_topology = VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY, + viewport_with_count = VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT, + scissor_with_count = VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT, + vertex_input_binding_stride = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE, + depth_test_enable = VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE, + depth_write_enable = VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE, + depth_compare_op = VK_DYNAMIC_STATE_DEPTH_COMPARE_OP, + depth_bounds_test_enable = VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE, + stencil_test_enable = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE, + stencil_op = VK_DYNAMIC_STATE_STENCIL_OP, + rasterizer_discard_enable = VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE, + depth_bias_enable = VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE, + primitive_restart_enable = VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE, + line_stipple = VK_DYNAMIC_STATE_LINE_STIPPLE, + patch_control_points_ext = VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT, + logic_op_ext = VK_DYNAMIC_STATE_LOGIC_OP_EXT, + color_write_enable_ext = VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT, + depth_clamp_enable_ext = VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT, + polygon_mode_ext = VK_DYNAMIC_STATE_POLYGON_MODE_EXT, + rasterization_samples_ext = VK_DYNAMIC_STATE_RASTERIZATION_SAMPLES_EXT, + sample_mask_ext = VK_DYNAMIC_STATE_SAMPLE_MASK_EXT, + alpha_to_coverage_enable_ext = VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT, + alpha_to_one_enable_ext = VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT, + logic_op_enable_ext = VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT, + color_blend_enable_ext = VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT, + color_blend_equation_ext = VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT, + color_write_mask_ext = VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT, + tessellation_domain_origin_ext = VK_DYNAMIC_STATE_TESSELLATION_DOMAIN_ORIGIN_EXT, + rasterization_stream_ext = VK_DYNAMIC_STATE_RASTERIZATION_STREAM_EXT, + conservative_raster_mode_ext = VK_DYNAMIC_STATE_CONSERVATIVE_RASTERIZATION_MODE_EXT, + extra_primitive_overestim_ext = VK_DYNAMIC_STATE_EXTRA_PRIMITIVE_OVERESTIMATION_SIZE_EXT, + depth_clip_enable_ext = VK_DYNAMIC_STATE_DEPTH_CLIP_ENABLE_EXT, + sample_locations_enable_ext = VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE_EXT, + color_blend_advanced_ext = VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT, + provoking_vertex_mode_ext = VK_DYNAMIC_STATE_PROVOKING_VERTEX_MODE_EXT, + line_rasterization_mode_ext = VK_DYNAMIC_STATE_LINE_RASTERIZATION_MODE_EXT, + line_stipple_enable_ext = VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT, + depth_clip_negative_one_ext = VK_DYNAMIC_STATE_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE_EXT, + viewport_w_scaling_nv = VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV, + discard_rectangle_ext = VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT, + discard_rectangle_enable_ext = VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT, + discard_rectangle_mode_ext = VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT, + sample_locations_ext = VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT, + ray_tracing_stack_size_khr = VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR, + shading_rate_palette_nv = VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV, + coarse_sample_order_nv = VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV, + exclusive_scissor_enable_nv = VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_ENABLE_NV, + exclusive_scissor_nv = VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV, + fragment_shading_rate_khr = VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR, + vertex_input_ext = VK_DYNAMIC_STATE_VERTEX_INPUT_EXT, + viewport_swizzle_nv = VK_DYNAMIC_STATE_VIEWPORT_SWIZZLE_NV, + coverage_to_color_enable_nv = VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_ENABLE_NV, + coverage_to_color_location_nv = VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_LOCATION_NV, + coverage_modulation_mode_nv = VK_DYNAMIC_STATE_COVERAGE_MODULATION_MODE_NV, + coverage_modulation_table_en_nv = VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_ENABLE_NV, + coverage_modulation_table_nv = VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_NV, + shading_rate_image_enable_nv = VK_DYNAMIC_STATE_SHADING_RATE_IMAGE_ENABLE_NV, + representative_frag_test_nv = VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV, + coverage_reduction_mode_nv = VK_DYNAMIC_STATE_COVERAGE_REDUCTION_MODE_NV, + attachment_feedback_loop_ext = VK_DYNAMIC_STATE_ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT, + depth_clamp_range_ext = VK_DYNAMIC_STATE_DEPTH_CLAMP_RANGE_EXT + }; enum buffer : uint8_t { uniform = From e17cee5dc4c253d1f6abbb55c8b1abd2fa953a08 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Fri, 23 Jan 2026 01:47:20 -0800 Subject: [PATCH 03/21] Applied the new configuration to the viewport and rasterizer parameters --- vulkan-cpp/pipeline.cppm | 68 ++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index 1a57bae..cceb926 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -64,7 +64,8 @@ export namespace vk { front_face front_face = front_face::counter_clockwise; bool depth_bias_enabled=false; float depth_bias_constant = 0.f; - float depth_bioas_slope = 0.f; + float depth_bias_clamp = 0.f; + float depth_bias_slope = 0.f; float line_width = 1.f; }; @@ -275,39 +276,60 @@ export namespace vk { .primitiveRestartEnable = p_info.input_assembly.primitive_restart_enable, }; + // VkPipelineViewportStateCreateInfo viewport_state = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, + // .viewportCount = 1, + // .scissorCount = 1, + // }; + VkPipelineViewportStateCreateInfo viewport_state = { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - .viewportCount = 1, - .scissorCount = 1, + .viewportCount = p_info.viewport.viewport_count, + .scissorCount = p_info.viewport.scissor_count, }; + //! @note Rasterization // Keep in mind: if lineWidth is zero, validation layers will occur // because cant be zero. Must be set to 1.0f + // VkPipelineRasterizationStateCreateInfo rasterizer_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, + // .depthClampEnable = false, + // .rasterizerDiscardEnable = + // false, // set to true make fragmenta that are beyond near/far + // // planes clamped to them as opposed to discarding them + // .polygonMode = + // VK_POLYGON_MODE_FILL, // if set to true then geometry never passes + // // through rasterizer stage. This basically + // // disables output to frame_buffer + // .cullMode = VK_CULL_MODE_NONE, // determines what culling to use. + // // Can also be disabled, culls + // // front-face, back-face or both + // .frontFace = + // VK_FRONT_FACE_COUNTER_CLOCKWISE, // specifies vertex order of + // // fdaces considered front-face + // // or clockwise/counter-clockwise + // .depthBiasEnable = false, + // .depthBiasConstantFactor = 0.0f, // Optional + // .depthBiasClamp = 0.0f, // Optional + // .depthBiasSlopeFactor = 0.0f, // Optional + // .lineWidth = 1.f + // }; VkPipelineRasterizationStateCreateInfo rasterizer_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, - .depthClampEnable = false, - .rasterizerDiscardEnable = - false, // set to true make fragmenta that are beyond near/far - // planes clamped to them as opposed to discarding them - .polygonMode = - VK_POLYGON_MODE_FILL, // if set to true then geometry never passes - // through rasterizer stage. This basically - // disables output to frame_buffer - .cullMode = VK_CULL_MODE_NONE, // determines what culling to use. - // Can also be disabled, culls - // front-face, back-face or both - .frontFace = - VK_FRONT_FACE_COUNTER_CLOCKWISE, // specifies vertex order of - // fdaces considered front-face - // or clockwise/counter-clockwise - .depthBiasEnable = false, - .depthBiasConstantFactor = 0.0f, // Optional - .depthBiasClamp = 0.0f, // Optional - .depthBiasSlopeFactor = 0.0f, // Optional - .lineWidth = 1.f + .depthClampEnable = p_info.rasterization.depth_clamp_enabled, + .rasterizerDiscardEnable = p_info.rasterization.rasterizer_discard_enabled, + .polygonMode = static_cast(p_info.rasterization.polygon_mode), + .cullMode = static_cast(p_info.rasterization.cull_mode), + .frontFace = static_cast(p_info.rasterization.front_face), + .depthBiasEnable = p_info.rasterization.depth_bias_enabled, + .depthBiasConstantFactor = p_info.rasterization.depth_bias_constant, + .depthBiasClamp = p_info.rasterization.depth_bias_clamp, + .depthBiasSlopeFactor = p_info.rasterization.depth_bias_slope, + .lineWidth = p_info.rasterization.line_width }; + //! @note Multi-sampling VkPipelineMultisampleStateCreateInfo multisampling_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, From 7e71d7ffc127a2ed06ad84d513096b0a9317d863 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Sat, 24 Jan 2026 02:35:23 -0800 Subject: [PATCH 04/21] Updated to use pipeline parameters for configuring the pipeline multisample state --- vulkan-cpp/pipeline.cppm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index cceb926..e261d2f 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -331,14 +331,25 @@ export namespace vk { //! @note Multi-sampling + // p_info.rasterization + // VkPipelineMultisampleStateCreateInfo multisampling_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, + // .rasterizationSamples = VK_SAMPLE_COUNT_1_BIT, + // .sampleShadingEnable = false, + // // .minSampleShading = 1.0f, // Optional + // // .pSampleMask = nullptr, // Optional + // // .alphaToCoverageEnable = VK_FALSE, // Optional + // // .alphaToOneEnable = VK_FALSE, // Optional + // }; + VkPipelineMultisampleStateCreateInfo multisampling_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, - .rasterizationSamples = VK_SAMPLE_COUNT_1_BIT, - .sampleShadingEnable = false, - // .minSampleShading = 1.0f, // Optional - // .pSampleMask = nullptr, // Optional - // .alphaToCoverageEnable = VK_FALSE, // Optional - // .alphaToOneEnable = VK_FALSE, // Optional + .rasterizationSamples = static_cast(p_info.multisample.rasterization_samples), + .sampleShadingEnable = p_info.multisample.shading_enabled, + .minSampleShading = p_info.multisample.min_shading, + .pSampleMask = p_info.multisample.p_sample_masks.data(), + .alphaToCoverageEnable = p_info.multisample.alpha_to_coverage_enable, + .alphaToOneEnable = p_info.multisample.alpha_to_one_enable, }; // Color blending Attachment -- blending color when the fragment returns From d80599ac72f3c05d9ff14d02a4690195b9cd2f9b Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Sat, 24 Jan 2026 02:50:30 -0800 Subject: [PATCH 05/21] Applied the vulkan-cpp configuration API's to be applied for setting the color blend state to the graphics pipeline --- vulkan-cpp/pipeline.cppm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index e261d2f..d8e91d4 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -4,6 +4,7 @@ module; #include #include #include +#include export module vk:pipeline; @@ -354,6 +355,39 @@ export namespace vk { // Color blending Attachment -- blending color when the fragment returns // the color + // VkPipelineColorBlendAttachmentState color_blend_attachment = { + // .blendEnable = true, + // .srcColorBlendFactor = + // VK_BLEND_FACTOR_SRC_ALPHA, // Enabled: alpha blending + // .dstColorBlendFactor = + // VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, // Enabled: alpha blending + // .colorBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending + // .srcAlphaBlendFactor = + // VK_BLEND_FACTOR_ONE, // Enabled: alpha blending + // .dstAlphaBlendFactor = + // VK_BLEND_FACTOR_ZERO, // Enabled: alpha blending + // .alphaBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending + // .colorWriteMask = + // VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | + // VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT, + // }; + + // std::array color_blend_attachments{}; + std::vector color_blend_attachments(p_info.color_blend.attachments.size()); + + for(size_t i = 0; i < color_blend_attachments.size(); i++) { + color_blend_attachments[i] = { + .blendEnable = p_info.color_blend.attachments[i].blend_enabled, + .srcColorBlendFactor = static_cast(p_info.color_blend.attachments[i].src_color_blend_factor), // Enabled: alpha blending + .dstColorBlendFactor = static_cast(p_info.color_blend.attachments[i].dst_color_blend_factor), // Enabled: alpha blending + .colorBlendOp = static_cast(p_info.color_blend.attachments[i].color_blend_op), // Enabled: alpha blending + .srcAlphaBlendFactor = static_cast(p_info.color_blend.attachments[i].src_alpha_blend_factor), // Enabled: alpha blending + .dstAlphaBlendFactor = static_cast(p_info.color_blend.attachments[i].dst_alpha_blend_factor), // Enabled: alpha blending + .alphaBlendOp = static_cast(p_info.color_blend.attachments[i].alpha_blend_op), // Enabled: alpha blending + .colorWriteMask = static_cast(p_info.color_blend.attachments[i].color_write_mask), + }; + } + VkPipelineColorBlendAttachmentState color_blend_attachment = { .blendEnable = true, .srcColorBlendFactor = From 4c201c6cbc09372a186571694e7b9f5bec693855 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Sat, 24 Jan 2026 02:53:21 -0800 Subject: [PATCH 06/21] Fixed the pipeline configuration to actually apply the parameter correctly --- vulkan-cpp/pipeline.cppm | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index d8e91d4..7946c2d 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -388,29 +388,29 @@ export namespace vk { }; } - VkPipelineColorBlendAttachmentState color_blend_attachment = { - .blendEnable = true, - .srcColorBlendFactor = - VK_BLEND_FACTOR_SRC_ALPHA, // Enabled: alpha blending - .dstColorBlendFactor = - VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, // Enabled: alpha blending - .colorBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending - .srcAlphaBlendFactor = - VK_BLEND_FACTOR_ONE, // Enabled: alpha blending - .dstAlphaBlendFactor = - VK_BLEND_FACTOR_ZERO, // Enabled: alpha blending - .alphaBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending - .colorWriteMask = - VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT, - }; + // VkPipelineColorBlendAttachmentState color_blend_attachment = { + // .blendEnable = true, + // .srcColorBlendFactor = + // VK_BLEND_FACTOR_SRC_ALPHA, // Enabled: alpha blending + // .dstColorBlendFactor = + // VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, // Enabled: alpha blending + // .colorBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending + // .srcAlphaBlendFactor = + // VK_BLEND_FACTOR_ONE, // Enabled: alpha blending + // .dstAlphaBlendFactor = + // VK_BLEND_FACTOR_ZERO, // Enabled: alpha blending + // .alphaBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending + // .colorWriteMask = + // VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | + // VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT, + // }; VkPipelineColorBlendStateCreateInfo color_blending_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, .logicOpEnable = VK_FALSE, .logicOp = VK_LOGIC_OP_COPY, // Optional - .attachmentCount = 1, - .pAttachments = &color_blend_attachment, + .attachmentCount = static_cast(color_blend_attachments.size()), + .pAttachments = color_blend_attachments.data(), // these are optional .blendConstants = { 0.f, 0.f, 0.f, 0.f } // optional }; From 06123bbe70aeb821c6d7c8b0412b1100a2ba9458 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Sat, 24 Jan 2026 03:14:09 -0800 Subject: [PATCH 07/21] Color blend state fixed with applying the color blend configuration with the right attachments color blends set --- vulkan-cpp/pipeline.cppm | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index 7946c2d..72cc51f 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -388,33 +388,37 @@ export namespace vk { }; } - // VkPipelineColorBlendAttachmentState color_blend_attachment = { - // .blendEnable = true, - // .srcColorBlendFactor = - // VK_BLEND_FACTOR_SRC_ALPHA, // Enabled: alpha blending - // .dstColorBlendFactor = - // VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, // Enabled: alpha blending - // .colorBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending - // .srcAlphaBlendFactor = - // VK_BLEND_FACTOR_ONE, // Enabled: alpha blending - // .dstAlphaBlendFactor = - // VK_BLEND_FACTOR_ZERO, // Enabled: alpha blending - // .alphaBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending - // .colorWriteMask = - // VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - // VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT, + // VkPipelineColorBlendStateCreateInfo color_blending_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, + // .logicOpEnable = VK_FALSE, + // .logicOp = VK_LOGIC_OP_COPY, // Optional + // .attachmentCount = static_cast(color_blend_attachments.size()), + // .pAttachments = color_blend_attachments.data(), + // // these are optional + // .blendConstants = { 0.f, 0.f, 0.f, 0.f } // optional // }; + // Get the first 4 elements in the span as those are + // the data we are to set the .blendConstants to. + + // As .blendConstants only take up to 4 elements in the array. + VkPipelineColorBlendStateCreateInfo color_blending_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, - .logicOpEnable = VK_FALSE, - .logicOp = VK_LOGIC_OP_COPY, // Optional + .logicOpEnable = p_info.color_blend.logic_op_enable, + .logicOp = static_cast(p_info.color_blend.logical_op), // Optional .attachmentCount = static_cast(color_blend_attachments.size()), .pAttachments = color_blend_attachments.data(), // these are optional - .blendConstants = { 0.f, 0.f, 0.f, 0.f } // optional + .blendConstants = {0.f, 0.f, 0.f, 0.f} // optional -- set to default in being 0.0f's }; + // Using ranges to load in the floats from an arbitrary array into this. Though it should only be valid to accept only 4 floats rather then N arbitrary floats in this buffer. + if(!p_info.color_blend.blend_constants.empty()) { + std::span color_blend_constants = p_info.color_blend.blend_constants.first<4>(); + std::ranges::copy(color_blend_constants.begin(), color_blend_constants.end(), color_blending_ci.blendConstants); + } + // Enable depth-stencil state VkPipelineDepthStencilStateCreateInfo pipeline_deth_stencil_state_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, From 71ddc6f641e04b346528f2db2e4b7586490847ba Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Sat, 24 Jan 2026 03:28:59 -0800 Subject: [PATCH 08/21] Applied configuration for setting depth stencil state and dynamic states with some additional minor fixes to enum byte types correctly --- vulkan-cpp/pipeline.cppm | 57 +++++++++++++++++----------------------- vulkan-cpp/types.cppm | 2 +- 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index 72cc51f..d10c7f8 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -20,8 +20,8 @@ export namespace vk { // .primitiveRestartEnable = VK_FALSE, // }; struct input_assembly_state { - const primitive_topology topology=primitive_topology::triangle_list; - bool primitive_restart_enable=false; + const enum primitive_topology topology = primitive_topology::triangle_list; + bool primitive_restart_enable = false; }; // VkPipelineViewportStateCreateInfo viewport_state = { @@ -61,8 +61,8 @@ export namespace vk { bool depth_clamp_enabled = false; bool rasterizer_discard_enabled = false; polygon_mode polygon_mode = polygon_mode::fill; - cull_mode cull_mode = cull_mode::none; - front_face front_face = front_face::counter_clockwise; + enum cull_mode cull_mode = cull_mode::none; + enum front_face front_face = front_face::counter_clockwise; bool depth_bias_enabled=false; float depth_bias_constant = 0.f; float depth_bias_clamp = 0.f; @@ -420,50 +420,41 @@ export namespace vk { } // Enable depth-stencil state + // VkPipelineDepthStencilStateCreateInfo pipeline_deth_stencil_state_ci = { + // .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, + // .depthTestEnable = true, + // .depthWriteEnable = true, + // .depthCompareOp = VK_COMPARE_OP_LESS, + // .depthBoundsTestEnable = false, + // .stencilTestEnable = false, + // }; VkPipelineDepthStencilStateCreateInfo pipeline_deth_stencil_state_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, - .depthTestEnable = true, - .depthWriteEnable = true, - .depthCompareOp = VK_COMPARE_OP_LESS, - .depthBoundsTestEnable = false, - .stencilTestEnable = false, + .depthTestEnable = p_info.depth_stencil.depth_test_enable, + .depthWriteEnable = p_info.depth_stencil.depth_write_enable, + .depthCompareOp = static_cast(p_info.depth_stencil.depth_compare_op), + .depthBoundsTestEnable = p_info.depth_stencil.depth_bounds_test_enable, + .stencilTestEnable = p_info.depth_stencil.stencil_test_enable, }; //! @note Dynamic State //! @note -- pipeline states needs to be baked into the pipeline state - std::array dynamic_states = { - VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR - }; + // std::array dynamic_states = { + // VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR + // }; VkPipelineDynamicStateCreateInfo dynamic_state_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - .dynamicStateCount = static_cast(dynamic_states.size()), - .pDynamicStates = dynamic_states.data() + .dynamicStateCount = static_cast(p_info.dynamic_states.size()), + .pDynamicStates = reinterpret_cast(p_info.dynamic_states.data()) }; VkPipelineLayoutCreateInfo pipeline_layout_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, + .setLayoutCount = static_cast(p_info.descriptor_layouts.size()), + .pSetLayouts = p_info.descriptor_layouts.data(), }; - //! This is just to double-check that the descriptor set layout is - //! valid. If the descriptor set layout is invalid, then proceed but not - //! use the descriptor set layout - // if (m_descriptor_set_layout != nullptr) { - // if (!m_descriptor_layouts.empty()) { - // pipeline_layout_ci.setLayoutCount = - // static_cast(m_descriptor_layouts.size()); - // pipeline_layout_ci.pSetLayouts = m_descriptor_layouts.data(); - // } - // else { - // // TODO: Uncomment this when adding back in descriptor sets - // // For now I will disable it to get the base working and add - // // descriptor sets back in afterwards - // pipeline_layout_ci.setLayoutCount = 0; - // pipeline_layout_ci.pSetLayouts = nullptr; - // } - pipeline_layout_ci.setLayoutCount = - static_cast(p_info.descriptor_layouts.size()); - pipeline_layout_ci.pSetLayouts = p_info.descriptor_layouts.data(); vk_check(vkCreatePipelineLayout( m_device, &pipeline_layout_ci, nullptr, &m_pipeline_layout), "vkCreatePipelineLayout"); diff --git a/vulkan-cpp/types.cppm b/vulkan-cpp/types.cppm index 66b0624..a15e797 100644 --- a/vulkan-cpp/types.cppm +++ b/vulkan-cpp/types.cppm @@ -878,7 +878,7 @@ export namespace vk { }; // VkDynamicState - enum class dynamic_state : uint64_t { + enum class dynamic_state : uint32_t { viewport = VK_DYNAMIC_STATE_VIEWPORT, scissor = VK_DYNAMIC_STATE_SCISSOR, line_width = VK_DYNAMIC_STATE_LINE_WIDTH, From 1a728f32d30cf7af1b60b970bcfb65ba61c1aca1 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Sat, 24 Jan 2026 03:31:38 -0800 Subject: [PATCH 09/21] Renamed vk::pipeline_settings to vk::pipeline_params --- vulkan-cpp/pipeline.cppm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index d10c7f8..afd7175 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -169,7 +169,7 @@ export namespace vk { * @param descriptor_layouts are the VkDescriptorSetLayout that you pass up * front to the graphics pipeline if there are any provided */ - struct pipeline_settings { + struct pipeline_params { VkRenderPass renderpass = nullptr; std::span shader_modules{}; std::span vertex_attributes; @@ -198,7 +198,7 @@ export namespace vk { * @param p_device is logical device to create the graphics pipeline handles * @param p_info are the parameters for creating the pipelines with */ - pipeline(const VkDevice& p_device, const pipeline_settings& p_info) : m_device(p_device) { + pipeline(const VkDevice& p_device, const pipeline_params& p_info) : m_device(p_device) { create(p_info); } @@ -210,7 +210,7 @@ export namespace vk { * * ```C++ * - * vk::pipeline_settings pipeline_params = { + * vk::pipeline_params pipeline_params = { * .renderpass = main_renderpass // pass in VkRenderPass handle * .shader_modules = shader_resource.handles() // sets the std::span * .vertex_attributes = shader_resource.vertex_attributes(), @@ -230,7 +230,7 @@ export namespace vk { * More info on vulkan's official * [docs](https://docs.vulkan.org/refpages/latest/refpages/source/vkCreateGraphicsPipelines.html) */ - void create(const pipeline_settings& p_info) { + void create(const pipeline_params& p_info) { std::vector pipeline_shader_stages(p_info.shader_modules.size()); uint32_t shader_src_index = 0; @@ -497,7 +497,7 @@ export namespace vk { * * ```C++ * - * vk::pipeline graphics_pipeline(logical_device, *assume pipeline_settings is specified*); + * vk::pipeline graphics_pipeline(logical_device, *assume pipeline_params is specified*); * * // bound to current command buffer * // in this example we set binding point to VK_PIPELINE_BIND_POINT_GRAPHICS @@ -539,7 +539,7 @@ export namespace vk { * * ```C++ * - * vk::pipeline graphics_pipeline(logical_device, *assume pipeline_settings is specified*); + * vk::pipeline graphics_pipeline(logical_device, *assume pipeline_params is specified*); * * m_pipeline.push_constants(current, shader_stage::vertex, 0, 1, * &global_data); From 7f76881f0a00080d2464491d5a173f3a4f28a0e8 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Sat, 24 Jan 2026 03:36:43 -0800 Subject: [PATCH 10/21] Cleaned up pipeline.cppm and removed commented code --- vulkan-cpp/pipeline.cppm | 194 +-------------------------------------- 1 file changed, 5 insertions(+), 189 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index afd7175..bf80dee 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -14,49 +14,16 @@ export import :utilities; export namespace vk { inline namespace v1 { - // VkPipelineInputAssemblyStateCreateInfo input_assembly = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, - // .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, - // .primitiveRestartEnable = VK_FALSE, - // }; struct input_assembly_state { const enum primitive_topology topology = primitive_topology::triangle_list; bool primitive_restart_enable = false; }; - // VkPipelineViewportStateCreateInfo viewport_state = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - // .viewportCount = 1, - // .scissorCount = 1, - // }; struct viewport_state { uint8_t viewport_count= 1; uint8_t scissor_count = 1; }; - // VkPipelineRasterizationStateCreateInfo rasterizer_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, - // .depthClampEnable = false, - // .rasterizerDiscardEnable = - // false, // set to true make fragmenta that are beyond near/far - // // planes clamped to them as opposed to discarding them - // .polygonMode = - // VK_POLYGON_MODE_FILL, // if set to true then geometry never passes - // // through rasterizer stage. This basically - // // disables output to frame_buffer - // .cullMode = VK_CULL_MODE_NONE, // determines what culling to use. - // // Can also be disabled, culls - // // front-face, back-face or both - // .frontFace = - // VK_FRONT_FACE_COUNTER_CLOCKWISE, // specifies vertex order of - // // fdaces considered front-face - // // or clockwise/counter-clockwise - // .depthBiasEnable = false, - // .depthBiasConstantFactor = 0.0f, // Optional - // .depthBiasClamp = 0.0f, // Optional - // .depthBiasSlopeFactor = 0.0f, // Optional - // .lineWidth = 1.f - // }; struct rasterization_state { bool depth_clamp_enabled = false; bool rasterizer_discard_enabled = false; @@ -70,16 +37,6 @@ export namespace vk { float line_width = 1.f; }; - // VkPipelineMultisampleStateCreateInfo multisampling_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, - // .rasterizationSamples = VK_SAMPLE_COUNT_1_BIT, - // .sampleShadingEnable = false, - // // .minSampleShading = 1.0f, // Optional - // // .pSampleMask = nullptr, // Optional - // // .alphaToCoverageEnable = VK_FALSE, // Optional - // // .alphaToOneEnable = VK_FALSE, // Optional - // }; - struct multisample_state { sample_bit rasterization_samples=sample_bit::count_1; bool shading_enabled=false; @@ -89,17 +46,6 @@ export namespace vk { bool alpha_to_one_enable=false; // optional }; - // VkPipelineColorBlendAttachmentState color_blend_attachment = { - // .blendEnable = true, - // .srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA, // Enabled: alpha blending - // .dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, // Enabled: alpha blending - // .colorBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending - // .srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE, // Enabled: alpha blending - // .dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO, // Enabled: alpha blending - // .alphaBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending - // .colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT, - // }; - struct color_blend_attachment_state { bool blend_enabled = true; blend_factor src_color_blend_factor=blend_factor::src_alpha; @@ -111,16 +57,6 @@ export namespace vk { uint32_t color_write_mask = color_component::red | color_component::green | color_component::blue | color_component::alpha; }; - // VkPipelineColorBlendStateCreateInfo color_blending_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, - // .logicOpEnable = VK_FALSE, - // .logicOp = VK_LOGIC_OP_COPY, // Optional - // .attachmentCount = 1, - // .pAttachments = &color_blend_attachment, - // // these are optional - // .blendConstants = { 0.f, 0.f, 0.f, 0.f } // optional - // }; - struct color_blend_state { bool logic_op_enable=false; logical_op logical_op = logical_op::copy; @@ -128,14 +64,6 @@ export namespace vk { std::span blend_constants; }; - // VkPipelineDepthStencilStateCreateInfo pipeline_deth_stencil_state_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, - // .depthTestEnable = true, - // .depthWriteEnable = true, - // .depthCompareOp = VK_COMPARE_OP_LESS, - // .depthBoundsTestEnable = false, - // .stencilTestEnable = false, - // }; struct depth_stencil_state { bool depth_test_enable = true; bool depth_write_enable = true; @@ -145,23 +73,6 @@ export namespace vk { }; - //! @note Dynamic State - //! @note -- pipeline states needs to be baked into the pipeline state - // std::array dynamic_states = { - // VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR - // }; - - // VkPipelineDynamicStateCreateInfo dynamic_state_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - // .dynamicStateCount = static_cast(dynamic_states.size()), - // .pDynamicStates = dynamic_states.data() - // }; - - // struct dynamic_state_configure { - // std::span dynamic_states = {}; - // }; - - /** * @param renderpass is required for a VkPipeline to know up front * @param shader_modules is a std::span of the loaded shader @@ -265,57 +176,20 @@ export namespace vk { .pVertexAttributeDescriptions = attributes.data() }; - // VkPipelineInputAssemblyStateCreateInfo input_assembly = { - // .sType = - // VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, - // .topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, - // .primitiveRestartEnable = VK_FALSE, - // }; VkPipelineInputAssemblyStateCreateInfo input_assembly = { .sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, .topology = static_cast(p_info.input_assembly.topology), .primitiveRestartEnable = p_info.input_assembly.primitive_restart_enable, }; - // VkPipelineViewportStateCreateInfo viewport_state = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, - // .viewportCount = 1, - // .scissorCount = 1, - // }; - VkPipelineViewportStateCreateInfo viewport_state = { .sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, .viewportCount = p_info.viewport.viewport_count, .scissorCount = p_info.viewport.scissor_count, }; - - //! @note Rasterization - // Keep in mind: if lineWidth is zero, validation layers will occur + // if lineWidth is zero, validation layers will occur // because cant be zero. Must be set to 1.0f - // VkPipelineRasterizationStateCreateInfo rasterizer_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, - // .depthClampEnable = false, - // .rasterizerDiscardEnable = - // false, // set to true make fragmenta that are beyond near/far - // // planes clamped to them as opposed to discarding them - // .polygonMode = - // VK_POLYGON_MODE_FILL, // if set to true then geometry never passes - // // through rasterizer stage. This basically - // // disables output to frame_buffer - // .cullMode = VK_CULL_MODE_NONE, // determines what culling to use. - // // Can also be disabled, culls - // // front-face, back-face or both - // .frontFace = - // VK_FRONT_FACE_COUNTER_CLOCKWISE, // specifies vertex order of - // // fdaces considered front-face - // // or clockwise/counter-clockwise - // .depthBiasEnable = false, - // .depthBiasConstantFactor = 0.0f, // Optional - // .depthBiasClamp = 0.0f, // Optional - // .depthBiasSlopeFactor = 0.0f, // Optional - // .lineWidth = 1.f - // }; VkPipelineRasterizationStateCreateInfo rasterizer_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, .depthClampEnable = p_info.rasterization.depth_clamp_enabled, @@ -330,19 +204,6 @@ export namespace vk { .lineWidth = p_info.rasterization.line_width }; - - //! @note Multi-sampling - // p_info.rasterization - // VkPipelineMultisampleStateCreateInfo multisampling_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, - // .rasterizationSamples = VK_SAMPLE_COUNT_1_BIT, - // .sampleShadingEnable = false, - // // .minSampleShading = 1.0f, // Optional - // // .pSampleMask = nullptr, // Optional - // // .alphaToCoverageEnable = VK_FALSE, // Optional - // // .alphaToOneEnable = VK_FALSE, // Optional - // }; - VkPipelineMultisampleStateCreateInfo multisampling_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, .rasterizationSamples = static_cast(p_info.multisample.rasterization_samples), @@ -353,26 +214,6 @@ export namespace vk { .alphaToOneEnable = p_info.multisample.alpha_to_one_enable, }; - // Color blending Attachment -- blending color when the fragment returns - // the color - // VkPipelineColorBlendAttachmentState color_blend_attachment = { - // .blendEnable = true, - // .srcColorBlendFactor = - // VK_BLEND_FACTOR_SRC_ALPHA, // Enabled: alpha blending - // .dstColorBlendFactor = - // VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, // Enabled: alpha blending - // .colorBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending - // .srcAlphaBlendFactor = - // VK_BLEND_FACTOR_ONE, // Enabled: alpha blending - // .dstAlphaBlendFactor = - // VK_BLEND_FACTOR_ZERO, // Enabled: alpha blending - // .alphaBlendOp = VK_BLEND_OP_ADD, // Enabled: alpha blending - // .colorWriteMask = - // VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | - // VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT, - // }; - - // std::array color_blend_attachments{}; std::vector color_blend_attachments(p_info.color_blend.attachments.size()); for(size_t i = 0; i < color_blend_attachments.size(); i++) { @@ -388,20 +229,6 @@ export namespace vk { }; } - // VkPipelineColorBlendStateCreateInfo color_blending_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, - // .logicOpEnable = VK_FALSE, - // .logicOp = VK_LOGIC_OP_COPY, // Optional - // .attachmentCount = static_cast(color_blend_attachments.size()), - // .pAttachments = color_blend_attachments.data(), - // // these are optional - // .blendConstants = { 0.f, 0.f, 0.f, 0.f } // optional - // }; - - // Get the first 4 elements in the span as those are - // the data we are to set the .blendConstants to. - - // As .blendConstants only take up to 4 elements in the array. VkPipelineColorBlendStateCreateInfo color_blending_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, @@ -415,19 +242,13 @@ export namespace vk { // Using ranges to load in the floats from an arbitrary array into this. Though it should only be valid to accept only 4 floats rather then N arbitrary floats in this buffer. if(!p_info.color_blend.blend_constants.empty()) { + // Get the first 4 elements in the span as those are + // the data we are to set the .blendConstants to. + // As .blendConstants only take up to 4 elements in the array. std::span color_blend_constants = p_info.color_blend.blend_constants.first<4>(); std::ranges::copy(color_blend_constants.begin(), color_blend_constants.end(), color_blending_ci.blendConstants); } - // Enable depth-stencil state - // VkPipelineDepthStencilStateCreateInfo pipeline_deth_stencil_state_ci = { - // .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, - // .depthTestEnable = true, - // .depthWriteEnable = true, - // .depthCompareOp = VK_COMPARE_OP_LESS, - // .depthBoundsTestEnable = false, - // .stencilTestEnable = false, - // }; VkPipelineDepthStencilStateCreateInfo pipeline_deth_stencil_state_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO, .depthTestEnable = p_info.depth_stencil.depth_test_enable, @@ -437,18 +258,14 @@ export namespace vk { .stencilTestEnable = p_info.depth_stencil.stencil_test_enable, }; - //! @note Dynamic State //! @note -- pipeline states needs to be baked into the pipeline state - // std::array dynamic_states = { - // VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR - // }; - VkPipelineDynamicStateCreateInfo dynamic_state_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, .dynamicStateCount = static_cast(p_info.dynamic_states.size()), .pDynamicStates = reinterpret_cast(p_info.dynamic_states.data()) }; + // Specifies layout of the uniforms (data resources) to be used by this specified graphics pipeline VkPipelineLayoutCreateInfo pipeline_layout_ci = { .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = static_cast(p_info.descriptor_layouts.size()), @@ -470,7 +287,6 @@ export namespace vk { .pViewportState = &viewport_state, .pRasterizationState = &rasterizer_ci, .pMultisampleState = &multisampling_ci, - // .pDepthStencilState = nullptr, // Optional .pDepthStencilState = &pipeline_deth_stencil_state_ci, .pColorBlendState = &color_blending_ci, .pDynamicState = &dynamic_state_ci, From 80ba6f41bcaee4000f7a94654d509117bd131dda Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Sat, 24 Jan 2026 03:39:32 -0800 Subject: [PATCH 11/21] Added boolean for enabling/disabling depth stencil configurations --- vulkan-cpp/pipeline.cppm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index bf80dee..6f1f0d5 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -92,6 +92,7 @@ export namespace vk { rasterization_state rasterization; multisample_state multisample; color_blend_state color_blend; + bool depth_stencil_enabled = false; depth_stencil_state depth_stencil; std::span dynamic_states = {}; }; @@ -289,7 +290,7 @@ export namespace vk { .pMultisampleState = &multisampling_ci, .pDepthStencilState = &pipeline_deth_stencil_state_ci, .pColorBlendState = &color_blending_ci, - .pDynamicState = &dynamic_state_ci, + .pDynamicState = (p_info.depth_stencil_enabled) ? &dynamic_state_ci : nullptr, .layout = m_pipeline_layout, .renderPass = p_info.renderpass, .subpass = 0, From f12f8cce3b965b13f37604edfbf86dfdf3e03c1c Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Tue, 27 Jan 2026 00:54:00 -0800 Subject: [PATCH 12/21] Update: graphics pipeline demos have been update to explicitly set some of the parameters specified to creating the graphics pipeline --- demos/6-graphics-pipeline/application.cpp | 28 +++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/demos/6-graphics-pipeline/application.cpp b/demos/6-graphics-pipeline/application.cpp index 82aefb8..6ced5cf 100644 --- a/demos/6-graphics-pipeline/application.cpp +++ b/demos/6-graphics-pipeline/application.cpp @@ -129,7 +129,7 @@ main() { // TODO: Probably enforce the use of // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -210,7 +210,7 @@ main() { // Setting up the images for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -224,7 +224,7 @@ main() { // Creating Depth Images for depth buffering vk::image_params image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -340,17 +340,25 @@ main() { } /* - // This get_pipeline_configuration can work as an easy way for - specfying the vulkan configurations as an ease of setting things up - // TODO: Probably provide a shorthand - which could work as this: - vk::pipeline_settings pipeline_configuration = - vk::get_pipeline_configuration(main_renderpass, geometry_resource); + This get_pipeline_configuration can work as an easy way for specfying the vulkan configurations as an ease of setting things up + // TODO: Probably provide a shorthand - which could work as this: + vk::pipeline_settings pipeline_configuration = vk::get_pipeline_configuration(main_renderpass, geometry_resource); */ - vk::pipeline_settings pipeline_configuration = { + std::array color_blend_attachments = { + vk::color_blend_attachment_state{}, + }; + + std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), .vertex_attributes = geometry_resource.vertex_attributes(), - .vertex_bind_attributes = geometry_resource.vertex_bind_attributes() + .vertex_bind_attributes = geometry_resource.vertex_bind_attributes(), + .color_blend = { + .attachments = color_blend_attachments, + }, + .depth_stencil_enabled = true, + .dynamic_states = dynamic_states, }; vk::pipeline main_graphics_pipeline(logical_device, pipeline_configuration); From e75cea5c227e8c81afa860c348d5b8317d428309 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Tue, 27 Jan 2026 00:57:57 -0800 Subject: [PATCH 13/21] Update: demo 7 for explicit configuration specified to creating the graphics pipeline --- demos/7-vertex-buffer/application.cpp | 37 +++++++++++++++++---------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/demos/7-vertex-buffer/application.cpp b/demos/7-vertex-buffer/application.cpp index d5c7bf2..d4244d3 100644 --- a/demos/7-vertex-buffer/application.cpp +++ b/demos/7-vertex-buffer/application.cpp @@ -129,7 +129,7 @@ main() { // TODO: Probably enforce the use of // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -212,7 +212,7 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -225,7 +225,7 @@ main() { vk::sample_image(logical_device, images[i], swapchain_image_config); vk::image_params image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -344,11 +344,22 @@ main() { std::println("geometry resource is valid!"); } - vk::pipeline_settings pipeline_configuration = { + std::array color_blend_attachments = { + vk::color_blend_attachment_state{}, + }; + + std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + + vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), .vertex_attributes = geometry_resource.vertex_attributes(), - .vertex_bind_attributes = geometry_resource.vertex_bind_attributes() + .vertex_bind_attributes = geometry_resource.vertex_bind_attributes(), + .color_blend = { + .attachments = color_blend_attachments, + }, + .depth_stencil_enabled = true, + .dynamic_states = dynamic_states, }; vk::pipeline main_graphics_pipeline(logical_device, pipeline_configuration); @@ -359,16 +370,16 @@ main() { // Setting up vertex buffer std::array vertices = { vk::vertex_input{ - { 1.f, 1.f, 0.f }, - { 1.f, 1.f, 1.f }, - { 1.f, 1.f, 1.f }, - { 1.f, 1.f }, + .position={ 1.f, 1.f, 0.f }, + .color={ 1.f, 1.f, 1.f }, + .normals={ 1.f, 1.f, 1.f }, + .uv={ 1.f, 1.f }, }, vk::vertex_input{ - { 1.f, 1.f, 0.f }, - { 1.f, 1.f, 1.f }, - { 1.f, 1.f, 1.f }, - { 1.f, 1.f }, + .position={ 1.f, 1.f, 0.f }, + .color={ 1.f, 1.f, 1.f }, + .normals={ 1.f, 1.f, 1.f }, + .uv={ 1.f, 1.f }, } }; vk::vertex_params vertex_info = { .phsyical_memory_properties = physical_device.memory_properties(), From aa60cea3b313e3cabbc629a3424edf08b00e485f Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Tue, 27 Jan 2026 00:58:56 -0800 Subject: [PATCH 14/21] Cleaned up pipeline and renamed create to invalidate naming --- vulkan-cpp/pipeline.cppm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/vulkan-cpp/pipeline.cppm b/vulkan-cpp/pipeline.cppm index 6f1f0d5..dfecade 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -15,7 +15,7 @@ export namespace vk { inline namespace v1 { struct input_assembly_state { - const enum primitive_topology topology = primitive_topology::triangle_list; + primitive_topology topology = primitive_topology::triangle_list; bool primitive_restart_enable = false; }; @@ -28,8 +28,8 @@ export namespace vk { bool depth_clamp_enabled = false; bool rasterizer_discard_enabled = false; polygon_mode polygon_mode = polygon_mode::fill; - enum cull_mode cull_mode = cull_mode::none; - enum front_face front_face = front_face::counter_clockwise; + cull_mode cull_mode = cull_mode::none; + front_face front_face = front_face::counter_clockwise; bool depth_bias_enabled=false; float depth_bias_constant = 0.f; float depth_bias_clamp = 0.f; @@ -79,6 +79,14 @@ export namespace vk { * sources for the pipeline to correspond to * @param descriptor_layouts are the VkDescriptorSetLayout that you pass up * front to the graphics pipeline if there are any provided + * @param input_assembly is for configuring the state of the input assembly for the graphics pipeline + * @param viewport_state is for configuring state of the viewport for this graphics pipeline + * @param rasterization_state is to configure how the topology and rasterization with this graphics pipeline is configured. + * @param multisample is to configure the graphics pipeline's multisample state + * @param color_blend is configuring the graphics pipeline state for specifying color blending + * @param depth_stencil_enable is used to toggle to use this graphics pipeline with an additional of depth stencil or just the color blend. + * @param depth_stencil is for specifying to this graphics pipeline configuring the depth stencil configurations. + * @param dynamic_states is specifying the dynamic state of the viewport and scissor to configure for this graphics pipeline */ struct pipeline_params { VkRenderPass renderpass = nullptr; @@ -111,7 +119,7 @@ export namespace vk { * @param p_info are the parameters for creating the pipelines with */ pipeline(const VkDevice& p_device, const pipeline_params& p_info) : m_device(p_device) { - create(p_info); + invalidate(p_info); } /** @@ -142,7 +150,7 @@ export namespace vk { * More info on vulkan's official * [docs](https://docs.vulkan.org/refpages/latest/refpages/source/vkCreateGraphicsPipelines.html) */ - void create(const pipeline_params& p_info) { + void invalidate(const pipeline_params& p_info) { std::vector pipeline_shader_stages(p_info.shader_modules.size()); uint32_t shader_src_index = 0; From 8887506eef8658bff5b0e2beeaebca660a696f88 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Tue, 27 Jan 2026 01:10:59 -0800 Subject: [PATCH 15/21] Updated demo 7 --- demos/8-index-uniform-buffers/application.cpp | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/demos/8-index-uniform-buffers/application.cpp b/demos/8-index-uniform-buffers/application.cpp index 90e836d..ac8aa66 100644 --- a/demos/8-index-uniform-buffers/application.cpp +++ b/demos/8-index-uniform-buffers/application.cpp @@ -129,7 +129,7 @@ main() { // TODO: Probably enforce the use of // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -208,7 +208,7 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -222,7 +222,7 @@ main() { // Creating Depth Images for depth buffering vk::image_params image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -372,11 +372,23 @@ main() { vk::pipeline_settings pipeline_configuration = vk::get_pipeline_configuration(main_renderpass, geometry_resource); */ - vk::pipeline_settings pipeline_configuration = { + + std::array color_blend_attachments = { + vk::color_blend_attachment_state{}, + }; + + std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + + vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), .vertex_attributes = geometry_resource.vertex_attributes(), - .vertex_bind_attributes = geometry_resource.vertex_bind_attributes() + .vertex_bind_attributes = geometry_resource.vertex_bind_attributes(), + .color_blend = { + .attachments = color_blend_attachments, + }, + .depth_stencil_enabled = true, + .dynamic_states = dynamic_states, }; vk::pipeline main_graphics_pipeline(logical_device, pipeline_configuration); @@ -401,10 +413,10 @@ main() { // } // }; std::array vertices = { - vk::vertex_input{ { -0.5f, -0.5f, 0.f }, { 1.0f, 0.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, -0.5f, 0.f }, { 0.0f, 1.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, 0.5f, 0.f }, { 0.0f, 0.0f, 1.0f } }, - vk::vertex_input{ { -0.5f, 0.5f, 0.f }, { 1.0f, 1.0f, 1.0f } } + vk::vertex_input{ .position={ -0.5f, -0.5f, 0.f }, .color={ 1.0f, 0.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, -0.5f, 0.f }, .color={ 0.0f, 1.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, 0.5f, 0.f }, .color={ 0.0f, 0.0f, 1.0f } }, + vk::vertex_input{ .position={ -0.5f, 0.5f, 0.f }, .color={ 1.0f, 1.0f, 1.0f } } }; // vk::vertex_buffer_info vertex_info = { // .physical_handle = physical_device, From e0eaea7ee68ccf3a43429e2492c9ba2238399a27 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Tue, 27 Jan 2026 18:50:59 -0800 Subject: [PATCH 16/21] Fixed mispelled parameter name for address modes specifications for sampler --- vulkan-cpp/sample_image.cppm | 4 ++-- vulkan-cpp/types.cppm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vulkan-cpp/sample_image.cppm b/vulkan-cpp/sample_image.cppm index 41b833f..70f7787 100644 --- a/vulkan-cpp/sample_image.cppm +++ b/vulkan-cpp/sample_image.cppm @@ -112,7 +112,7 @@ export namespace vk { .magFilter = p_image_properties.range.min, .minFilter = p_image_properties.range.max, .mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR, - .addressModeU = static_cast(p_image_properties.addrses_mode_u), + .addressModeU = static_cast(p_image_properties.address_mode_u), .addressModeV = static_cast(p_image_properties.addrses_mode_v), .addressModeW = static_cast(p_image_properties.addrses_mode_w), .mipLodBias = 0.0f, @@ -170,7 +170,7 @@ export namespace vk { .magFilter = p_image_properties.range.min, .minFilter = p_image_properties.range.max, .mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR, - .addressModeU = static_cast(p_image_properties.addrses_mode_u), + .addressModeU = static_cast(p_image_properties.address_mode_u), .addressModeV = static_cast(p_image_properties.addrses_mode_v), .addressModeW = static_cast(p_image_properties.addrses_mode_w), .mipLodBias = 0.0f, diff --git a/vulkan-cpp/types.cppm b/vulkan-cpp/types.cppm index a15e797..c48439b 100644 --- a/vulkan-cpp/types.cppm +++ b/vulkan-cpp/types.cppm @@ -1437,12 +1437,12 @@ export namespace vk { .min = VK_FILTER_LINEAR, .max = VK_FILTER_LINEAR, }; - // VkSamplerAddressMode addrses_mode_u = + // VkSamplerAddressMode address_mode_u = // VK_SAMPLER_ADDRESS_MODE_REPEAT; VkSamplerAddressMode // addrses_mode_v = VK_SAMPLER_ADDRESS_MODE_REPEAT; // VkSamplerAddressMode addrses_mode_w = // VK_SAMPLER_ADDRESS_MODE_REPEAT; - uint32_t addrses_mode_u = sampler_address_mode::repeat; + uint32_t address_mode_u = sampler_address_mode::repeat; uint32_t addrses_mode_v = sampler_address_mode::repeat; uint32_t addrses_mode_w = sampler_address_mode::repeat; }; From 8606e98e2057a286e4f6f47c126762d24057e6dc Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Fri, 30 Jan 2026 11:54:38 -0800 Subject: [PATCH 17/21] Demos update to specify more graphics pipeline params and rename vk::physical to vk::physical_gpu --- demos/10-textures/application.cpp | 58 +++++++------ demos/11-depth-buffering/application.cpp | 84 +++++++++++-------- demos/12-loading-models/application.cpp | 18 +++- demos/13-skybox/application.cpp | 4 +- demos/2-physical-device/README.md | 4 +- demos/2-physical-device/application.cpp | 2 +- demos/3-logical-device/application.cpp | 2 +- demos/4-surface/application.cpp | 2 +- demos/5-swapchain/application.cpp | 2 +- demos/6-graphics-pipeline/application.cpp | 2 - demos/7-vertex-buffer/application.cpp | 2 +- demos/8-index-uniform-buffers/application.cpp | 2 +- demos/9-uniforms/application.cpp | 35 +++++--- 13 files changed, 126 insertions(+), 91 deletions(-) diff --git a/demos/10-textures/application.cpp b/demos/10-textures/application.cpp index 3857116..a6d7aaf 100644 --- a/demos/10-textures/application.cpp +++ b/demos/10-textures/application.cpp @@ -143,9 +143,9 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) + // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -418,18 +418,26 @@ main() { std::array layouts = { set0_resource.layout() }; /* - // This get_pipeline_configuration can work as an easy way for - specfying the vulkan configurations as an ease of setting things up - // TODO: Probably provide a shorthand - which could work as this: - vk::pipeline_settings pipeline_configuration = - vk::get_pipeline_configuration(main_renderpass, geometry_resource); + This get_pipeline_configuration can work as an easy way for specfying the vulkan configurations as an ease of setting things up + // TODO: Probably provide a shorthand - which could work as this: + vk::pipeline_settings pipeline_configuration = vk::get_pipeline_configuration(main_renderpass, geometry_resource); */ - vk::pipeline_settings pipeline_configuration = { + std::array color_blend_attachments = { + vk::color_blend_attachment_state{}, + }; + + std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), .vertex_attributes = geometry_resource.vertex_attributes(), .vertex_bind_attributes = geometry_resource.vertex_bind_attributes(), - .descriptor_layouts = layouts + .descriptor_layouts = layouts, + .color_blend = { + .attachments = color_blend_attachments, + }, + .depth_stencil_enabled = true, + .dynamic_states = dynamic_states, }; vk::pipeline main_graphics_pipeline(logical_device, pipeline_configuration); @@ -440,22 +448,22 @@ main() { // Setting up vertex buffer std::array vertices = { - vk::vertex_input{ { -0.5f, -0.5f, 0.f }, - { 1.0f, 0.0f, 0.0f }, - { 0.f, 0.f, 0.f }, - { 1.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, -0.5f, 0.f }, - { 0.0f, 1.0f, 0.0f }, - { 0.f, 0.f, 0.f }, - { 0.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, 0.5f, 0.f }, - { 0.0f, 0.0f, 1.0f }, - { 0.f, 0.f, 0.f }, - { 0.0f, 1.0f } }, - vk::vertex_input{ { -0.5f, 0.5f, 0.f }, - { 1.0f, 1.0f, 1.0f }, - { 0.f, 0.f, 0.f }, - { 1.0f, 1.0f } } + vk::vertex_input{ .position={ -0.5f, -0.5f, 0.f }, + .color={ 1.0f, 0.0f, 0.0f }, + .normals={ 0.f, 0.f, 0.f }, + .uv={ 1.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, -0.5f, 0.f }, + .color={ 0.0f, 1.0f, 0.0f }, + .normals={ 0.f, 0.f, 0.f }, + .uv={ 0.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, 0.5f, 0.f }, + .color={ 0.0f, 0.0f, 1.0f }, + .normals={ 0.f, 0.f, 0.f }, + .uv={ 0.0f, 1.0f } }, + vk::vertex_input{ .position={ -0.5f, 0.5f, 0.f }, + .color={ 1.0f, 1.0f, 1.0f }, + .normals={ 0.f, 0.f, 0.f }, + .uv={ 1.0f, 1.0f } } }; vk::vertex_params vertex_info = { .phsyical_memory_properties = physical_device.memory_properties(), diff --git a/demos/11-depth-buffering/application.cpp b/demos/11-depth-buffering/application.cpp index 7655fcd..2fe8b6c 100644 --- a/demos/11-depth-buffering/application.cpp +++ b/demos/11-depth-buffering/application.cpp @@ -138,9 +138,9 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) + // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -416,12 +416,22 @@ main() { std::array layouts = { set0_resource.layout() }; - vk::pipeline_settings pipeline_configuration = { + std::array color_blend_attachments = { + vk::color_blend_attachment_state{}, + }; + + std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), .vertex_attributes = geometry_resource.vertex_attributes(), .vertex_bind_attributes = geometry_resource.vertex_bind_attributes(), - .descriptor_layouts = layouts + .descriptor_layouts = layouts, + .color_blend = { + .attachments = color_blend_attachments, + }, + .depth_stencil_enabled = true, + .dynamic_states = dynamic_states, }; vk::pipeline main_graphics_pipeline(logical_device, pipeline_configuration); @@ -432,39 +442,39 @@ main() { // Setting up vertex buffer std::array vertices = { - vk::vertex_input{ { -0.5f, -0.5f, 0.f }, - { 1.0f, 0.0f, 0.0f }, - { 1.0f, 0.0f, 0.f }, - { 1.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, -0.5f, 0.f }, - { 0.0f, 1.0f, 0.0f }, - { 0.0f, 0.0f, 0.f }, - { 0.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, 0.5f, 0.f }, - { 0.0f, 0.0f, 1.0f }, - { 0.0f, 1.0f, 0.f }, - { 0.0f, 1.0f } }, - vk::vertex_input{ { -0.5f, 0.5f, 0.f }, - { 1.0f, 1.0f, 1.0f }, - { 1.0f, 1.0f, 0.f }, - { 1.0f, 1.0f } }, - - vk::vertex_input{ { -0.5f, -0.5f, -0.5f }, - { 1.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.f }, - { 1.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, -0.5f, -0.5f }, - { 0.0f, 1.0f, 0.0f }, - { 1.0f, 0.0f, 0.f }, - { 0.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, 0.5f, -0.5f }, - { 0.0f, 0.0f, 1.0f }, - { 1.0f, 1.0f, 0.f }, - { 0.0f, 1.0f } }, - vk::vertex_input{ { -0.5f, 0.5f, -0.5f }, - { 1.0f, 1.0f, 1.0f }, - { 0.0f, 1.0f, 0.f }, - { 1.0f, 1.0f } } + vk::vertex_input{ .position={ -0.5f, -0.5f, 0.f }, + .color={ 1.0f, 0.0f, 0.0f }, + .normals={ 1.0f, 0.0f, 0.f }, + .uv={ 1.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, -0.5f, 0.f }, + .color={ 0.0f, 1.0f, 0.0f }, + .normals={ 0.0f, 0.0f, 0.f }, + .uv={ 0.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, 0.5f, 0.f }, + .color={ 0.0f, 0.0f, 1.0f }, + .normals={ 0.0f, 1.0f, 0.f }, + .uv={ 0.0f, 1.0f } }, + vk::vertex_input{ .position={ -0.5f, 0.5f, 0.f }, + .color={ 1.0f, 1.0f, 1.0f }, + .normals={ 1.0f, 1.0f, 0.f }, + .uv={ 1.0f, 1.0f } }, + + vk::vertex_input{ .position={ -0.5f, -0.5f, -0.5f }, + .color={ 1.0f, 0.0f, 0.0f }, + .normals={ 0.0f, 0.0f, 0.f }, + .uv={ 1.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, -0.5f, -0.5f }, + .color={ 0.0f, 1.0f, 0.0f }, + .normals={ 1.0f, 0.0f, 0.f }, + .uv={ 0.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, 0.5f, -0.5f }, + .color={ 0.0f, 0.0f, 1.0f }, + .normals={ 1.0f, 1.0f, 0.f }, + .uv={ 0.0f, 1.0f } }, + vk::vertex_input{ .position={ -0.5f, 0.5f, -0.5f }, + .color={ 1.0f, 1.0f, 1.0f }, + .normals={ 0.0f, 1.0f, 0.f }, + .uv={ 1.0f, 1.0f } } }; vk::vertex_params vertex_info = { .phsyical_memory_properties = physical_device.memory_properties(), diff --git a/demos/12-loading-models/application.cpp b/demos/12-loading-models/application.cpp index 9b46ba7..14c01df 100644 --- a/demos/12-loading-models/application.cpp +++ b/demos/12-loading-models/application.cpp @@ -299,9 +299,9 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) + // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -584,12 +584,22 @@ main() { std::array layouts = { set0_resource.layout() }; - vk::pipeline_settings pipeline_configuration = { + std::array color_blend_attachments = { + vk::color_blend_attachment_state{}, + }; + + std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), .vertex_attributes = geometry_resource.vertex_attributes(), .vertex_bind_attributes = geometry_resource.vertex_bind_attributes(), - .descriptor_layouts = layouts + .descriptor_layouts = layouts, + .color_blend = { + .attachments = color_blend_attachments, + }, + .depth_stencil_enabled = true, + .dynamic_states = dynamic_states, }; vk::pipeline main_graphics_pipeline(logical_device, pipeline_configuration); diff --git a/demos/13-skybox/application.cpp b/demos/13-skybox/application.cpp index 51c7680..9fa629e 100644 --- a/demos/13-skybox/application.cpp +++ b/demos/13-skybox/application.cpp @@ -321,9 +321,9 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) + // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = - vk::physical::discrete }; + vk::physical_gpu::discrete }; vk::physical_device physical_device(api_instance, enumerate_devices); // selecting depth format diff --git a/demos/2-physical-device/README.md b/demos/2-physical-device/README.md index 9c9bfa5..fd2493e 100644 --- a/demos/2-physical-device/README.md +++ b/demos/2-physical-device/README.md @@ -19,7 +19,7 @@ It is required before you select a vulkan physical device, that you must HAVE a There are different types of physical devices: * `vk::physical::integrated` - the device is one embedded or tightly coupled with the host. -* `vk::physical::discrete` - the device is typically a separated processor connected to the host via hyperlink +* `vk::physical_gpu::discrete` - the device is typically a separated processor connected to the host via hyperlink * `vk::physical::virtualized` - the device typically is a virtual node in a virtualization environment * `vk::physical::cpu` - device is typically running on the same processor as the host * `vk::physical::other` - device is typically running on same procesors as the host @@ -35,7 +35,7 @@ vk::instance api_instance(/* set params */); // select a physical device type vk::physical_params params = { - .device_type = vk::physical::discrete + .device_type = vk::physical_gpu::discrete }; vk::physical_device selected_device(api_instance, params); diff --git a/demos/2-physical-device/application.cpp b/demos/2-physical-device/application.cpp index 312a802..d8d9d52 100644 --- a/demos/2-physical-device/application.cpp +++ b/demos/2-physical-device/application.cpp @@ -119,7 +119,7 @@ main() { // setting up physical device vk::physical_enumeration enumerate_devices{ .device_type = - vk::physical::discrete }; + vk::physical_gpu::discrete }; vk::physical_device device(api_instance, enumerate_devices); diff --git a/demos/3-logical-device/application.cpp b/demos/3-logical-device/application.cpp index 125e32f..5239f15 100644 --- a/demos/3-logical-device/application.cpp +++ b/demos/3-logical-device/application.cpp @@ -123,7 +123,7 @@ main() { // setting up physical device vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); diff --git a/demos/4-surface/application.cpp b/demos/4-surface/application.cpp index a9c636c..faf81b0 100644 --- a/demos/4-surface/application.cpp +++ b/demos/4-surface/application.cpp @@ -123,7 +123,7 @@ main() { // setting up physical device vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); diff --git a/demos/5-swapchain/application.cpp b/demos/5-swapchain/application.cpp index c438eed..a9cb105 100644 --- a/demos/5-swapchain/application.cpp +++ b/demos/5-swapchain/application.cpp @@ -127,7 +127,7 @@ main() { // setting up physical device vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); diff --git a/demos/6-graphics-pipeline/application.cpp b/demos/6-graphics-pipeline/application.cpp index 6ced5cf..5db13c6 100644 --- a/demos/6-graphics-pipeline/application.cpp +++ b/demos/6-graphics-pipeline/application.cpp @@ -126,8 +126,6 @@ main() { // std::span // setting up physical device - // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; diff --git a/demos/7-vertex-buffer/application.cpp b/demos/7-vertex-buffer/application.cpp index d4244d3..7d89efa 100644 --- a/demos/7-vertex-buffer/application.cpp +++ b/demos/7-vertex-buffer/application.cpp @@ -127,7 +127,7 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) + // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; diff --git a/demos/8-index-uniform-buffers/application.cpp b/demos/8-index-uniform-buffers/application.cpp index ac8aa66..bce69e4 100644 --- a/demos/8-index-uniform-buffers/application.cpp +++ b/demos/8-index-uniform-buffers/application.cpp @@ -127,7 +127,7 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) + // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; diff --git a/demos/9-uniforms/application.cpp b/demos/9-uniforms/application.cpp index bd48b24..8bdb68d 100644 --- a/demos/9-uniforms/application.cpp +++ b/demos/9-uniforms/application.cpp @@ -137,9 +137,9 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical::discrete}) + // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ - .device_type = vk::physical::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -437,18 +437,27 @@ main() { std::array layouts = { set0_resource.layout() }; /* - // This get_pipeline_configuration can work as an easy way for - specfying the vulkan configurations as an ease of setting things up - // TODO: Probably provide a shorthand - which could work as this: - vk::pipeline_settings pipeline_configuration = - vk::get_pipeline_configuration(main_renderpass, geometry_resource); + This get_pipeline_configuration can work as an easy way for specfying the vulkan configurations as an ease of setting things up + // TODO: Probably provide a shorthand - which could work as this: + vk::pipeline_settings pipeline_configuration = vk::get_pipeline_configuration(main_renderpass, geometry_resource); */ - vk::pipeline_settings pipeline_configuration = { + std::array color_blend_attachments = { + vk::color_blend_attachment_state{}, + }; + + std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + + vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), .vertex_attributes = geometry_resource.vertex_attributes(), .vertex_bind_attributes = geometry_resource.vertex_bind_attributes(), - .descriptor_layouts = layouts + .descriptor_layouts = layouts, + .color_blend = { + .attachments = color_blend_attachments, + }, + .depth_stencil_enabled = true, + .dynamic_states = dynamic_states, }; vk::pipeline main_graphics_pipeline(logical_device, pipeline_configuration); @@ -459,10 +468,10 @@ main() { // Setting up vertex buffer std::array vertices = { - vk::vertex_input{ { -0.5f, -0.5f, 0.f }, { 1.0f, 0.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, -0.5f, 0.f }, { 0.0f, 1.0f, 0.0f } }, - vk::vertex_input{ { 0.5f, 0.5f, 0.f }, { 0.0f, 0.0f, 1.0f } }, - vk::vertex_input{ { -0.5f, 0.5f, 0.f }, { 1.0f, 1.0f, 1.0f } } + vk::vertex_input{ .position={ -0.5f, -0.5f, 0.f }, .color={ 1.0f, 0.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, -0.5f, 0.f }, .color={ 0.0f, 1.0f, 0.0f } }, + vk::vertex_input{ .position={ 0.5f, 0.5f, 0.f }, .color={ 0.0f, 0.0f, 1.0f } }, + vk::vertex_input{ .position={ -0.5f, 0.5f, 0.f }, .color={ 1.0f, 1.0f, 1.0f } } }; vk::vertex_params vertex_info = { // .physical_handle = physical_device, From 735f2723e05901a9741b7ece514a2e5059c1045a Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Fri, 30 Jan 2026 11:56:23 -0800 Subject: [PATCH 18/21] Version update to 5.0 and cmake utils version update in conanfile --- conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index a286703..e17b42b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class VulkanCppRecipe(ConanFile): name = "vulkan-cpp" - version = "4.0" + version = "5.0" license = "Apache-2.0" url = "https://github.com/engine3d-dev/vulkan-cpp" homepage = "https://github.com/engine3d-dev/vulkan-cpp" @@ -22,7 +22,7 @@ def build_requirements(self): self.tool_requires("cmake/[^4.0.0]") self.tool_requires("ninja/[^1.3.0]") self.test_requires("boost-ext-ut/2.3.1") - self.tool_requires("engine3d-cmake-utils/4.0") + self.tool_requires("engine3d-cmake-utils/5.0") def requirements(self): self.requires("glfw/3.4") From d3bd0eb65d0a2f7553a0494bc3f1d83e0285bb1a Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Fri, 30 Jan 2026 12:11:58 -0800 Subject: [PATCH 19/21] Fixed setting extent of images to reference to the proper height value --- demos/6-graphics-pipeline/application.cpp | 4 ++-- demos/7-vertex-buffer/application.cpp | 4 ++-- demos/8-index-uniform-buffers/application.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/demos/6-graphics-pipeline/application.cpp b/demos/6-graphics-pipeline/application.cpp index 5db13c6..020c1d8 100644 --- a/demos/6-graphics-pipeline/application.cpp +++ b/demos/6-graphics-pipeline/application.cpp @@ -208,7 +208,7 @@ main() { // Setting up the images for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -222,7 +222,7 @@ main() { // Creating Depth Images for depth buffering vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, diff --git a/demos/7-vertex-buffer/application.cpp b/demos/7-vertex-buffer/application.cpp index 7d89efa..c40e97c 100644 --- a/demos/7-vertex-buffer/application.cpp +++ b/demos/7-vertex-buffer/application.cpp @@ -212,7 +212,7 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -225,7 +225,7 @@ main() { vk::sample_image(logical_device, images[i], swapchain_image_config); vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, diff --git a/demos/8-index-uniform-buffers/application.cpp b/demos/8-index-uniform-buffers/application.cpp index bce69e4..b3c0f73 100644 --- a/demos/8-index-uniform-buffers/application.cpp +++ b/demos/8-index-uniform-buffers/application.cpp @@ -208,7 +208,7 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -222,7 +222,7 @@ main() { // Creating Depth Images for depth buffering vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, From bb7bd76e23c4935ceb3e8e1354b21c815f75dda0 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Fri, 30 Jan 2026 13:08:20 -0800 Subject: [PATCH 20/21] Code cleanup and conform to clang-format --- demos/10-textures/application.cpp | 49 ++++++------ demos/11-depth-buffering/application.cpp | 77 ++++++++++--------- demos/12-loading-models/application.cpp | 4 +- demos/13-skybox/application.cpp | 4 +- demos/5-swapchain/README.md | 2 +- demos/5-swapchain/application.cpp | 4 +- demos/7-vertex-buffer/application.cpp | 39 ++++++---- demos/8-index-uniform-buffers/application.cpp | 25 ++++-- demos/9-uniforms/application.cpp | 29 ++++--- 9 files changed, 133 insertions(+), 100 deletions(-) diff --git a/demos/10-textures/application.cpp b/demos/10-textures/application.cpp index a6d7aaf..50da9bc 100644 --- a/demos/10-textures/application.cpp +++ b/demos/10-textures/application.cpp @@ -143,7 +143,8 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) + // vk::enumerate_physical_device({.device_type = + // vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; @@ -228,7 +229,7 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -242,7 +243,7 @@ main() { // Creating Depth Images for depth buffering vk::image_params image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -418,15 +419,19 @@ main() { std::array layouts = { set0_resource.layout() }; /* - This get_pipeline_configuration can work as an easy way for specfying the vulkan configurations as an ease of setting things up + This get_pipeline_configuration can work as an easy way for specfying + the vulkan configurations as an ease of setting things up // TODO: Probably provide a shorthand - which could work as this: - vk::pipeline_settings pipeline_configuration = vk::get_pipeline_configuration(main_renderpass, geometry_resource); + vk::pipeline_settings pipeline_configuration = + vk::get_pipeline_configuration(main_renderpass, geometry_resource); */ std::array color_blend_attachments = { vk::color_blend_attachment_state{}, }; - std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + std::array dynamic_states = { + vk::dynamic_state::viewport, vk::dynamic_state::scissor + }; vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), @@ -448,22 +453,22 @@ main() { // Setting up vertex buffer std::array vertices = { - vk::vertex_input{ .position={ -0.5f, -0.5f, 0.f }, - .color={ 1.0f, 0.0f, 0.0f }, - .normals={ 0.f, 0.f, 0.f }, - .uv={ 1.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, -0.5f, 0.f }, - .color={ 0.0f, 1.0f, 0.0f }, - .normals={ 0.f, 0.f, 0.f }, - .uv={ 0.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, 0.5f, 0.f }, - .color={ 0.0f, 0.0f, 1.0f }, - .normals={ 0.f, 0.f, 0.f }, - .uv={ 0.0f, 1.0f } }, - vk::vertex_input{ .position={ -0.5f, 0.5f, 0.f }, - .color={ 1.0f, 1.0f, 1.0f }, - .normals={ 0.f, 0.f, 0.f }, - .uv={ 1.0f, 1.0f } } + vk::vertex_input{ .position = { -0.5f, -0.5f, 0.f }, + .color = { 1.0f, 0.0f, 0.0f }, + .normals = { 0.f, 0.f, 0.f }, + .uv = { 1.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, -0.5f, 0.f }, + .color = { 0.0f, 1.0f, 0.0f }, + .normals = { 0.f, 0.f, 0.f }, + .uv = { 0.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, 0.5f, 0.f }, + .color = { 0.0f, 0.0f, 1.0f }, + .normals = { 0.f, 0.f, 0.f }, + .uv = { 0.0f, 1.0f } }, + vk::vertex_input{ .position = { -0.5f, 0.5f, 0.f }, + .color = { 1.0f, 1.0f, 1.0f }, + .normals = { 0.f, 0.f, 0.f }, + .uv = { 1.0f, 1.0f } } }; vk::vertex_params vertex_info = { .phsyical_memory_properties = physical_device.memory_properties(), diff --git a/demos/11-depth-buffering/application.cpp b/demos/11-depth-buffering/application.cpp index 2fe8b6c..d7c95a6 100644 --- a/demos/11-depth-buffering/application.cpp +++ b/demos/11-depth-buffering/application.cpp @@ -138,7 +138,8 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) + // vk::enumerate_physical_device({.device_type = + // vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; @@ -221,7 +222,7 @@ main() { // Setting up the images for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -236,7 +237,7 @@ main() { // Creating Images for depth buffering vk::image_params image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -420,7 +421,9 @@ main() { vk::color_blend_attachment_state{}, }; - std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + std::array dynamic_states = { + vk::dynamic_state::viewport, vk::dynamic_state::scissor + }; vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), @@ -442,39 +445,39 @@ main() { // Setting up vertex buffer std::array vertices = { - vk::vertex_input{ .position={ -0.5f, -0.5f, 0.f }, - .color={ 1.0f, 0.0f, 0.0f }, - .normals={ 1.0f, 0.0f, 0.f }, - .uv={ 1.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, -0.5f, 0.f }, - .color={ 0.0f, 1.0f, 0.0f }, - .normals={ 0.0f, 0.0f, 0.f }, - .uv={ 0.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, 0.5f, 0.f }, - .color={ 0.0f, 0.0f, 1.0f }, - .normals={ 0.0f, 1.0f, 0.f }, - .uv={ 0.0f, 1.0f } }, - vk::vertex_input{ .position={ -0.5f, 0.5f, 0.f }, - .color={ 1.0f, 1.0f, 1.0f }, - .normals={ 1.0f, 1.0f, 0.f }, - .uv={ 1.0f, 1.0f } }, - - vk::vertex_input{ .position={ -0.5f, -0.5f, -0.5f }, - .color={ 1.0f, 0.0f, 0.0f }, - .normals={ 0.0f, 0.0f, 0.f }, - .uv={ 1.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, -0.5f, -0.5f }, - .color={ 0.0f, 1.0f, 0.0f }, - .normals={ 1.0f, 0.0f, 0.f }, - .uv={ 0.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, 0.5f, -0.5f }, - .color={ 0.0f, 0.0f, 1.0f }, - .normals={ 1.0f, 1.0f, 0.f }, - .uv={ 0.0f, 1.0f } }, - vk::vertex_input{ .position={ -0.5f, 0.5f, -0.5f }, - .color={ 1.0f, 1.0f, 1.0f }, - .normals={ 0.0f, 1.0f, 0.f }, - .uv={ 1.0f, 1.0f } } + vk::vertex_input{ .position = { -0.5f, -0.5f, 0.f }, + .color = { 1.0f, 0.0f, 0.0f }, + .normals = { 1.0f, 0.0f, 0.f }, + .uv = { 1.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, -0.5f, 0.f }, + .color = { 0.0f, 1.0f, 0.0f }, + .normals = { 0.0f, 0.0f, 0.f }, + .uv = { 0.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, 0.5f, 0.f }, + .color = { 0.0f, 0.0f, 1.0f }, + .normals = { 0.0f, 1.0f, 0.f }, + .uv = { 0.0f, 1.0f } }, + vk::vertex_input{ .position = { -0.5f, 0.5f, 0.f }, + .color = { 1.0f, 1.0f, 1.0f }, + .normals = { 1.0f, 1.0f, 0.f }, + .uv = { 1.0f, 1.0f } }, + + vk::vertex_input{ .position = { -0.5f, -0.5f, -0.5f }, + .color = { 1.0f, 0.0f, 0.0f }, + .normals = { 0.0f, 0.0f, 0.f }, + .uv = { 1.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, -0.5f, -0.5f }, + .color = { 0.0f, 1.0f, 0.0f }, + .normals = { 1.0f, 0.0f, 0.f }, + .uv = { 0.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, 0.5f, -0.5f }, + .color = { 0.0f, 0.0f, 1.0f }, + .normals = { 1.0f, 1.0f, 0.f }, + .uv = { 0.0f, 1.0f } }, + vk::vertex_input{ .position = { -0.5f, 0.5f, -0.5f }, + .color = { 1.0f, 1.0f, 1.0f }, + .normals = { 0.0f, 1.0f, 0.f }, + .uv = { 1.0f, 1.0f } } }; vk::vertex_params vertex_info = { .phsyical_memory_properties = physical_device.memory_properties(), diff --git a/demos/12-loading-models/application.cpp b/demos/12-loading-models/application.cpp index 14c01df..75ce501 100644 --- a/demos/12-loading-models/application.cpp +++ b/demos/12-loading-models/application.cpp @@ -384,7 +384,7 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -398,7 +398,7 @@ main() { // Creating Images for depth buffering vk::image_params image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, diff --git a/demos/13-skybox/application.cpp b/demos/13-skybox/application.cpp index 9fa629e..4fdb45d 100644 --- a/demos/13-skybox/application.cpp +++ b/demos/13-skybox/application.cpp @@ -404,7 +404,7 @@ main() { for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -418,7 +418,7 @@ main() { // Creating Images for depth buffering vk::image_params image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, diff --git a/demos/5-swapchain/README.md b/demos/5-swapchain/README.md index 3d790c5..1be3696 100644 --- a/demos/5-swapchain/README.md +++ b/demos/5-swapchain/README.md @@ -115,7 +115,7 @@ Iterate over the array of images and configure their parameters ```C++ for(uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_params = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, diff --git a/demos/5-swapchain/application.cpp b/demos/5-swapchain/application.cpp index a9cb105..35e9979 100644 --- a/demos/5-swapchain/application.cpp +++ b/demos/5-swapchain/application.cpp @@ -195,7 +195,7 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -209,7 +209,7 @@ main() { // Creating Depth Images for depth buffering // vk::image_params depth_image_config = { - // .extent = { swapchain_extent.width, swapchain_extent.width }, + // .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, // .format = depth_format, // .aspect = vk::image_aspect_flags::depth_bit, // .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, diff --git a/demos/7-vertex-buffer/application.cpp b/demos/7-vertex-buffer/application.cpp index c40e97c..32f8fd9 100644 --- a/demos/7-vertex-buffer/application.cpp +++ b/demos/7-vertex-buffer/application.cpp @@ -127,7 +127,8 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) + // vk::enumerate_physical_device({.device_type = + // vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; @@ -212,7 +213,8 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -225,7 +227,8 @@ main() { vk::sample_image(logical_device, images[i], swapchain_image_config); vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -348,7 +351,9 @@ main() { vk::color_blend_attachment_state{}, }; - std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + std::array dynamic_states = { + vk::dynamic_state::viewport, vk::dynamic_state::scissor + }; vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, @@ -369,18 +374,20 @@ main() { } // Setting up vertex buffer - std::array vertices = { vk::vertex_input{ - .position={ 1.f, 1.f, 0.f }, - .color={ 1.f, 1.f, 1.f }, - .normals={ 1.f, 1.f, 1.f }, - .uv={ 1.f, 1.f }, - }, - vk::vertex_input{ - .position={ 1.f, 1.f, 0.f }, - .color={ 1.f, 1.f, 1.f }, - .normals={ 1.f, 1.f, 1.f }, - .uv={ 1.f, 1.f }, - } }; + std::array vertices = { + vk::vertex_input{ + .position = { 1.f, 1.f, 0.f }, + .color = { 1.f, 1.f, 1.f }, + .normals = { 1.f, 1.f, 1.f }, + .uv = { 1.f, 1.f }, + }, + vk::vertex_input{ + .position = { 1.f, 1.f, 0.f }, + .color = { 1.f, 1.f, 1.f }, + .normals = { 1.f, 1.f, 1.f }, + .uv = { 1.f, 1.f }, + } + }; vk::vertex_params vertex_info = { .phsyical_memory_properties = physical_device.memory_properties(), .vertices = vertices, diff --git a/demos/8-index-uniform-buffers/application.cpp b/demos/8-index-uniform-buffers/application.cpp index b3c0f73..86fa534 100644 --- a/demos/8-index-uniform-buffers/application.cpp +++ b/demos/8-index-uniform-buffers/application.cpp @@ -127,7 +127,8 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) + // vk::enumerate_physical_device({.device_type = + // vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; @@ -208,7 +209,8 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -222,7 +224,8 @@ main() { // Creating Depth Images for depth buffering vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -377,7 +380,9 @@ main() { vk::color_blend_attachment_state{}, }; - std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + std::array dynamic_states = { + vk::dynamic_state::viewport, vk::dynamic_state::scissor + }; vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, @@ -413,10 +418,14 @@ main() { // } // }; std::array vertices = { - vk::vertex_input{ .position={ -0.5f, -0.5f, 0.f }, .color={ 1.0f, 0.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, -0.5f, 0.f }, .color={ 0.0f, 1.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, 0.5f, 0.f }, .color={ 0.0f, 0.0f, 1.0f } }, - vk::vertex_input{ .position={ -0.5f, 0.5f, 0.f }, .color={ 1.0f, 1.0f, 1.0f } } + vk::vertex_input{ .position = { -0.5f, -0.5f, 0.f }, + .color = { 1.0f, 0.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, -0.5f, 0.f }, + .color = { 0.0f, 1.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, 0.5f, 0.f }, + .color = { 0.0f, 0.0f, 1.0f } }, + vk::vertex_input{ .position = { -0.5f, 0.5f, 0.f }, + .color = { 1.0f, 1.0f, 1.0f } } }; // vk::vertex_buffer_info vertex_info = { // .physical_handle = physical_device, diff --git a/demos/9-uniforms/application.cpp b/demos/9-uniforms/application.cpp index 8bdb68d..70d2f5c 100644 --- a/demos/9-uniforms/application.cpp +++ b/demos/9-uniforms/application.cpp @@ -137,7 +137,8 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) + // vk::enumerate_physical_device({.device_type = + // vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; @@ -232,7 +233,7 @@ main() { // swapchain_images[i] = // create_image2d_view(logical_device, enumerate_image_properties); vk::image_params swapchain_image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -265,7 +266,7 @@ main() { // swapchain_depth_images[i] = create_depth_image2d( // logical_device, depth_image_enumeration, memory_type_index); vk::image_params image_config = { - .extent = { swapchain_extent.width, swapchain_extent.width }, + .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -437,15 +438,19 @@ main() { std::array layouts = { set0_resource.layout() }; /* - This get_pipeline_configuration can work as an easy way for specfying the vulkan configurations as an ease of setting things up + This get_pipeline_configuration can work as an easy way for specfying + the vulkan configurations as an ease of setting things up // TODO: Probably provide a shorthand - which could work as this: - vk::pipeline_settings pipeline_configuration = vk::get_pipeline_configuration(main_renderpass, geometry_resource); + vk::pipeline_settings pipeline_configuration = + vk::get_pipeline_configuration(main_renderpass, geometry_resource); */ std::array color_blend_attachments = { vk::color_blend_attachment_state{}, }; - std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + std::array dynamic_states = { + vk::dynamic_state::viewport, vk::dynamic_state::scissor + }; vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, @@ -468,10 +473,14 @@ main() { // Setting up vertex buffer std::array vertices = { - vk::vertex_input{ .position={ -0.5f, -0.5f, 0.f }, .color={ 1.0f, 0.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, -0.5f, 0.f }, .color={ 0.0f, 1.0f, 0.0f } }, - vk::vertex_input{ .position={ 0.5f, 0.5f, 0.f }, .color={ 0.0f, 0.0f, 1.0f } }, - vk::vertex_input{ .position={ -0.5f, 0.5f, 0.f }, .color={ 1.0f, 1.0f, 1.0f } } + vk::vertex_input{ .position = { -0.5f, -0.5f, 0.f }, + .color = { 1.0f, 0.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, -0.5f, 0.f }, + .color = { 0.0f, 1.0f, 0.0f } }, + vk::vertex_input{ .position = { 0.5f, 0.5f, 0.f }, + .color = { 0.0f, 0.0f, 1.0f } }, + vk::vertex_input{ .position = { -0.5f, 0.5f, 0.f }, + .color = { 1.0f, 1.0f, 1.0f } } }; vk::vertex_params vertex_info = { // .physical_handle = physical_device, From cbb077c79b8ba74b45d4a5cfc7f8c5bb2258dfdd Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Fri, 30 Jan 2026 13:12:58 -0800 Subject: [PATCH 21/21] Finalizing formatting code to clang-format --- demos/10-textures/application.cpp | 6 ++++-- demos/11-depth-buffering/application.cpp | 6 ++++-- demos/12-loading-models/application.cpp | 13 +++++++++---- demos/13-skybox/application.cpp | 9 ++++++--- demos/5-swapchain/application.cpp | 7 ++++--- demos/6-graphics-pipeline/application.cpp | 16 +++++++++++----- demos/9-uniforms/application.cpp | 6 ++++-- 7 files changed, 42 insertions(+), 21 deletions(-) diff --git a/demos/10-textures/application.cpp b/demos/10-textures/application.cpp index 50da9bc..cf950a3 100644 --- a/demos/10-textures/application.cpp +++ b/demos/10-textures/application.cpp @@ -229,7 +229,8 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -243,7 +244,8 @@ main() { // Creating Depth Images for depth buffering vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, diff --git a/demos/11-depth-buffering/application.cpp b/demos/11-depth-buffering/application.cpp index d7c95a6..a98986c 100644 --- a/demos/11-depth-buffering/application.cpp +++ b/demos/11-depth-buffering/application.cpp @@ -222,7 +222,8 @@ main() { // Setting up the images for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -237,7 +238,8 @@ main() { // Creating Images for depth buffering vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, diff --git a/demos/12-loading-models/application.cpp b/demos/12-loading-models/application.cpp index 75ce501..11df6c0 100644 --- a/demos/12-loading-models/application.cpp +++ b/demos/12-loading-models/application.cpp @@ -299,7 +299,8 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) + // vk::enumerate_physical_device({.device_type = + // vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete, }; @@ -384,7 +385,8 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -398,7 +400,8 @@ main() { // Creating Images for depth buffering vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -588,7 +591,9 @@ main() { vk::color_blend_attachment_state{}, }; - std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + std::array dynamic_states = { + vk::dynamic_state::viewport, vk::dynamic_state::scissor + }; vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), diff --git a/demos/13-skybox/application.cpp b/demos/13-skybox/application.cpp index 4fdb45d..a2eb2de 100644 --- a/demos/13-skybox/application.cpp +++ b/demos/13-skybox/application.cpp @@ -321,7 +321,8 @@ main() { // setting up physical device // TODO: Probably enforce the use of - // vk::enumerate_physical_device({.device_type = vk::physical_gpu::discrete}) + // vk::enumerate_physical_device({.device_type = + // vk::physical_gpu::discrete}) vk::physical_enumeration enumerate_devices{ .device_type = vk::physical_gpu::discrete }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -404,7 +405,8 @@ main() { for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -418,7 +420,8 @@ main() { // Creating Images for depth buffering vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, diff --git a/demos/5-swapchain/application.cpp b/demos/5-swapchain/application.cpp index 35e9979..b417026 100644 --- a/demos/5-swapchain/application.cpp +++ b/demos/5-swapchain/application.cpp @@ -195,7 +195,8 @@ main() { uint32_t mip_levels = 1; for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -209,8 +210,8 @@ main() { // Creating Depth Images for depth buffering // vk::image_params depth_image_config = { - // .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, - // .format = depth_format, + // .extent = { .width=swapchain_extent.width, + // .height=swapchain_extent.height }, .format = depth_format, // .aspect = vk::image_aspect_flags::depth_bit, // .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, // .mip_levels = 1, diff --git a/demos/6-graphics-pipeline/application.cpp b/demos/6-graphics-pipeline/application.cpp index 020c1d8..8fd6016 100644 --- a/demos/6-graphics-pipeline/application.cpp +++ b/demos/6-graphics-pipeline/application.cpp @@ -208,7 +208,8 @@ main() { // Setting up the images for (uint32_t i = 0; i < swapchain_images.size(); i++) { vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -222,7 +223,8 @@ main() { // Creating Depth Images for depth buffering vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -338,15 +340,19 @@ main() { } /* - This get_pipeline_configuration can work as an easy way for specfying the vulkan configurations as an ease of setting things up + This get_pipeline_configuration can work as an easy way for specfying + the vulkan configurations as an ease of setting things up // TODO: Probably provide a shorthand - which could work as this: - vk::pipeline_settings pipeline_configuration = vk::get_pipeline_configuration(main_renderpass, geometry_resource); + vk::pipeline_settings pipeline_configuration = + vk::get_pipeline_configuration(main_renderpass, geometry_resource); */ std::array color_blend_attachments = { vk::color_blend_attachment_state{}, }; - std::array dynamic_states = { vk::dynamic_state::viewport, vk::dynamic_state::scissor }; + std::array dynamic_states = { + vk::dynamic_state::viewport, vk::dynamic_state::scissor + }; vk::pipeline_params pipeline_configuration = { .renderpass = main_renderpass, .shader_modules = geometry_resource.handles(), diff --git a/demos/9-uniforms/application.cpp b/demos/9-uniforms/application.cpp index 70d2f5c..2ab3b82 100644 --- a/demos/9-uniforms/application.cpp +++ b/demos/9-uniforms/application.cpp @@ -233,7 +233,8 @@ main() { // swapchain_images[i] = // create_image2d_view(logical_device, enumerate_image_properties); vk::image_params swapchain_image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = surface_properties.format.format, .aspect = vk::image_aspect_flags::color_bit, .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, @@ -266,7 +267,8 @@ main() { // swapchain_depth_images[i] = create_depth_image2d( // logical_device, depth_image_enumeration, memory_type_index); vk::image_params image_config = { - .extent = { .width=swapchain_extent.width, .height=swapchain_extent.height }, + .extent = { .width = swapchain_extent.width, + .height = swapchain_extent.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,