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") diff --git a/demos/10-textures/application.cpp b/demos/10-textures/application.cpp index 3857116..cf950a3 100644 --- a/demos/10-textures/application.cpp +++ b/demos/10-textures/application.cpp @@ -143,9 +143,10 @@ 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); @@ -228,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 = { 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 +244,8 @@ 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,18 +421,30 @@ 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 = + 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 +455,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..a98986c 100644 --- a/demos/11-depth-buffering/application.cpp +++ b/demos/11-depth-buffering/application.cpp @@ -138,9 +138,10 @@ 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); @@ -221,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 = { 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 +238,8 @@ 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, @@ -416,12 +419,24 @@ 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 +447,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..11df6c0 100644 --- a/demos/12-loading-models/application.cpp +++ b/demos/12-loading-models/application.cpp @@ -299,9 +299,10 @@ 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); @@ -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 = { 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 +400,8 @@ 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, @@ -584,12 +587,24 @@ 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..a2eb2de 100644 --- a/demos/13-skybox/application.cpp +++ b/demos/13-skybox/application.cpp @@ -321,9 +321,10 @@ 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 @@ -404,7 +405,8 @@ 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 +420,8 @@ 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/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/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 c438eed..b417026 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); @@ -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 = { 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,8 +210,8 @@ main() { // Creating Depth Images for depth buffering // vk::image_params depth_image_config = { - // .extent = { swapchain_extent.width, swapchain_extent.width }, - // .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 82aefb8..8fd6016 100644 --- a/demos/6-graphics-pipeline/application.cpp +++ b/demos/6-graphics-pipeline/application.cpp @@ -126,10 +126,8 @@ 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::discrete, + .device_type = vk::physical_gpu::discrete, }; vk::physical_device physical_device(api_instance, enumerate_devices); @@ -210,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 = { 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, @@ -224,7 +223,8 @@ 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, @@ -340,17 +340,29 @@ 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 = + 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); diff --git a/demos/7-vertex-buffer/application.cpp b/demos/7-vertex-buffer/application.cpp index d5c7bf2..32f8fd9 100644 --- a/demos/7-vertex-buffer/application.cpp +++ b/demos/7-vertex-buffer/application.cpp @@ -127,9 +127,10 @@ 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); @@ -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 = { 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, @@ -225,7 +227,8 @@ 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.height }, .format = depth_format, .aspect = vk::image_aspect_flags::depth_bit, .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, @@ -344,11 +347,24 @@ 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); @@ -358,18 +374,20 @@ 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 }, - }, - 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 }, - } }; + 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 90e836d..86fa534 100644 --- a/demos/8-index-uniform-buffers/application.cpp +++ b/demos/8-index-uniform-buffers/application.cpp @@ -127,9 +127,10 @@ 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); @@ -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 = { 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, @@ -222,7 +224,8 @@ 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, @@ -372,11 +375,25 @@ 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 +418,14 @@ 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, diff --git a/demos/9-uniforms/application.cpp b/demos/9-uniforms/application.cpp index bd48b24..2ab3b82 100644 --- a/demos/9-uniforms/application.cpp +++ b/demos/9-uniforms/application.cpp @@ -137,9 +137,10 @@ 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); @@ -232,7 +233,8 @@ 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 +267,8 @@ 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,18 +440,31 @@ 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 = + 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 +475,14 @@ 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, 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/pipeline.cppm b/vulkan-cpp/pipeline.cppm index a0a1d31..dfecade 100644 --- a/vulkan-cpp/pipeline.cppm +++ b/vulkan-cpp/pipeline.cppm @@ -3,6 +3,8 @@ module; #include #include #include +#include +#include export module vk:pipeline; @@ -11,19 +13,96 @@ export import :utilities; export namespace vk { inline namespace v1 { + + struct input_assembly_state { + primitive_topology topology = primitive_topology::triangle_list; + bool primitive_restart_enable = false; + }; + + struct viewport_state { + uint8_t viewport_count= 1; + uint8_t scissor_count = 1; + }; + + 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_bias_clamp = 0.f; + float depth_bias_slope = 0.f; + float line_width = 1.f; + }; + + 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 + }; + + 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; + }; + + struct color_blend_state { + bool logic_op_enable=false; + logical_op logical_op = logical_op::copy; + std::span attachments; + std::span blend_constants; + }; + + 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; + }; + + /** * @param renderpass is required for a VkPipeline to know up front * @param shader_modules is a std::span of the loaded shader * 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_settings { + struct pipeline_params { VkRenderPass renderpass = nullptr; std::span shader_modules{}; 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; + bool depth_stencil_enabled = false; + depth_stencil_state depth_stencil; + std::span dynamic_states = {}; }; /** @@ -39,8 +118,8 @@ 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) { - create(p_info); + pipeline(const VkDevice& p_device, const pipeline_params& p_info) : m_device(p_device) { + invalidate(p_info); } /** @@ -51,7 +130,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(), @@ -71,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_settings& 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; @@ -107,130 +186,101 @@ export namespace vk { }; 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 = { .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 + // 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 + .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, - .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 - // 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::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), + }; + } + 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, + .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 }; - // Enable depth-stencil state + // 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); + } + 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 - }; - 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()) }; + // 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()), + .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"); @@ -246,10 +296,9 @@ 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, + .pDynamicState = (p_info.depth_stencil_enabled) ? &dynamic_state_ci : nullptr, .layout = m_pipeline_layout, .renderPass = p_info.renderpass, .subpass = 0, @@ -273,7 +322,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 @@ -315,7 +364,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); 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 15cf7a1..c48439b 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, @@ -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 { @@ -722,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 : uint32_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 = @@ -1211,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; };