hello-tool: use vk::pipline<T>
This commit is contained in:
parent
7c7192842e
commit
93ea18dbdd
@ -13,6 +13,7 @@
|
||||
#include <cruft/vk/command_pool.hpp>
|
||||
#include <cruft/vk/device_memory.hpp>
|
||||
#include <cruft/vk/swapchain.hpp>
|
||||
#include <cruft/vk/pipeline.hpp>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <GLFW/glfw3native.h>
|
||||
@ -121,14 +122,16 @@ main (void)
|
||||
auto pdevices = cruft::vk::physical_device::find (instance);
|
||||
auto &pdevice = pdevices[0];
|
||||
|
||||
VkSurfaceKHR surface_handle = cruft::vk::error::try_query (
|
||||
auto surface = cruft::vk::make_owned<cruft::vk::surface> (
|
||||
cruft::vk::error::try_query (
|
||||
glfwCreateWindowSurface, instance.native (), window, nullptr
|
||||
),
|
||||
instance
|
||||
);
|
||||
cruft::vk::surface surface { surface_handle };
|
||||
|
||||
auto surface_capabilities = pdevice.surface_capabilities (surface);
|
||||
auto surface_formats = pdevice.surface_formats (surface);
|
||||
auto present_modes = pdevice.present_modes (surface);
|
||||
auto surface_capabilities = pdevice.surface_capabilities (surface.get ());
|
||||
auto surface_formats = pdevice.surface_formats (surface.get ());
|
||||
auto present_modes = pdevice.present_modes (surface.get ());
|
||||
|
||||
auto queues = pdevice.queue_families ();
|
||||
int graphics_queue_id = -1, present_queue_id = -1;
|
||||
@ -141,7 +144,7 @@ main (void)
|
||||
|
||||
for (int i = 0, last = queues.size (); i != last; ++i) {
|
||||
if (cruft::vk::error::try_query (vkGetPhysicalDeviceSurfaceSupportKHR,
|
||||
pdevice.native (), i, surface.native ())) {
|
||||
pdevice.native (), i, surface->native ())) {
|
||||
present_queue_id = i;
|
||||
break;
|
||||
}
|
||||
@ -218,7 +221,7 @@ main (void)
|
||||
.sType = cruft::vk::structure_type_v<VkSwapchainCreateInfoKHR>,
|
||||
.pNext = nullptr,
|
||||
.flags = {},
|
||||
.surface = surface.native (),
|
||||
.surface = surface->native (),
|
||||
.minImageCount = image_count,
|
||||
.imageFormat = surface_format.format,
|
||||
.imageColorSpace = surface_format.colorSpace,
|
||||
@ -486,14 +489,10 @@ main (void)
|
||||
pipeline_info.basePipelineHandle = VK_NULL_HANDLE;
|
||||
pipeline_info.basePipelineIndex = -1;
|
||||
|
||||
VkPipeline graphics_pipeline;
|
||||
cruft::vk::error::try_code (
|
||||
vkCreateGraphicsPipelines (
|
||||
ldevice.native (), VK_NULL_HANDLE, 1, &pipeline_info, nullptr, &graphics_pipeline
|
||||
)
|
||||
auto graphics_pipeline = cruft::vk::make_owned<cruft::vk::pipeline<cruft::vk::bindpoint::GRAPHICS>> (
|
||||
ldevice, VK_NULL_HANDLE, 1, &pipeline_info, nullptr
|
||||
);
|
||||
|
||||
|
||||
using framebuffer_ptr = cruft::vk::owned_ptr<cruft::vk::framebuffer>;
|
||||
std::vector<framebuffer_ptr> swapchain_framebuffers;
|
||||
swapchain_framebuffers.reserve (swap_image_views.size ());
|
||||
@ -556,7 +555,9 @@ main (void)
|
||||
|
||||
vkCmdBeginRenderPass (command_buffers[i], &render_begin, VK_SUBPASS_CONTENTS_INLINE);
|
||||
|
||||
vkCmdBindPipeline (command_buffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline);
|
||||
vkCmdBindPipeline (
|
||||
command_buffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, graphics_pipeline->native ()
|
||||
);
|
||||
|
||||
VkBuffer buffers[] = {vertex_buffer->native ()};
|
||||
VkDeviceSize offsets[] = {0};
|
||||
|
Loading…
Reference in New Issue
Block a user