summaryrefslogtreecommitdiff
path: root/src/blucat/graphics_pipeline_2d_wired.cpp
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2024-05-16 14:22:35 -0300
committerFrederico Linhares <fred@linhares.blue>2024-05-16 14:22:35 -0300
commitd5a2b6bca9f9cc57dcca19962d5ba9b83d26da3e (patch)
treefa4decb441b0cc5cd189183166a324079f37c45a /src/blucat/graphics_pipeline_2d_wired.cpp
parent43821b0cffc5aa419c0218992f06f8962ae54a13 (diff)
refa Move BluCan initialization to BluCat folderHEADmaster
Diffstat (limited to 'src/blucat/graphics_pipeline_2d_wired.cpp')
-rw-r--r--src/blucat/graphics_pipeline_2d_wired.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/blucat/graphics_pipeline_2d_wired.cpp b/src/blucat/graphics_pipeline_2d_wired.cpp
index 192a9d6..9cd3a86 100644
--- a/src/blucat/graphics_pipeline_2d_wired.cpp
+++ b/src/blucat/graphics_pipeline_2d_wired.cpp
@@ -18,7 +18,7 @@
#include <array>
-#include "../core.hpp"
+#include "core.hpp"
#include "rectangle.hpp"
#include "sprite.hpp"
#include "uniform_data_object.hpp"
@@ -32,7 +32,7 @@ load_indexes(void *obj)
auto self = static_cast<BluCat::GraphicsPipeline2DWired*>(obj);
self->queue_family =
- cg_core.vk_device_with_swapchain->get_queue_family_with_graphics();
+ BluCat::core.vk_device_with_swapchain->get_queue_family_with_graphics();
std::array<uint32_t, 4> indexes{0, 1, 2, 3};
void *indexes_data{indexes.data()};
@@ -64,7 +64,7 @@ load_pipeline(void *obj)
vert_shader_stage_info.flags = 0;
vert_shader_stage_info.stage = VK_SHADER_STAGE_VERTEX_BIT;
vert_shader_stage_info.module =
- cg_core.vk_device_with_swapchain->vert2d_wired_shader_module;
+ BluCat::core.vk_device_with_swapchain->vert2d_wired_shader_module;
vert_shader_stage_info.pName = "main";
vert_shader_stage_info.pSpecializationInfo = nullptr;
@@ -75,7 +75,7 @@ load_pipeline(void *obj)
frag_shader_stage_info.flags = 0;
frag_shader_stage_info.stage = VK_SHADER_STAGE_FRAGMENT_BIT;
frag_shader_stage_info.module =
- cg_core.vk_device_with_swapchain->frag2d_wired_shader_module;
+ BluCat::core.vk_device_with_swapchain->frag2d_wired_shader_module;
frag_shader_stage_info.pName = "main";
frag_shader_stage_info.pSpecializationInfo = nullptr;
@@ -105,14 +105,14 @@ load_pipeline(void *obj)
VkViewport viewport = {};
viewport.x = 0;
viewport.y = 0;
- viewport.width = cg_core.display_width;
- viewport.height = cg_core.display_height;
+ viewport.width = BluCat::core.display_width;
+ viewport.height = BluCat::core.display_height;
viewport.minDepth = 0.0f;
viewport.maxDepth = 1.0f;
VkRect2D scissor = {};
scissor.offset = {0, 0};
- scissor.extent = {cg_core.display_width, cg_core.display_height};
+ scissor.extent = {BluCat::core.display_width, BluCat::core.display_height};
VkPipelineViewportStateCreateInfo viewport_state = {};
viewport_state.sType =
@@ -203,14 +203,14 @@ load_pipeline(void *obj)
pipeline_info.pColorBlendState = &color_blending;
pipeline_info.pDynamicState = &dynamic_state_info;
pipeline_info.layout =
- cg_core.vk_graphics_pipeline_2d_wired_layout->pipeline;
- pipeline_info.renderPass = cg_core.vk_render_pass->pipeline_2d;
+ BluCat::core.vk_graphics_pipeline_2d_wired_layout->pipeline;
+ pipeline_info.renderPass = BluCat::core.vk_render_pass->pipeline_2d;
pipeline_info.subpass = 0;
pipeline_info.basePipelineHandle = VK_NULL_HANDLE;
pipeline_info.basePipelineIndex = -1;
if(vkCreateGraphicsPipelines(
- cg_core.vk_device_with_swapchain->device, VK_NULL_HANDLE, 1,
+ BluCat::core.vk_device_with_swapchain->device, VK_NULL_HANDLE, 1,
&pipeline_info, nullptr, &self->graphic_pipeline) != VK_SUCCESS)
throw CommandError{"Failed to create graphics pipeline."};
}
@@ -221,7 +221,8 @@ unload_pipeline(void *obj)
auto self = static_cast<BluCat::GraphicsPipeline2DWired*>(obj);
vkDestroyPipeline(
- cg_core.vk_device_with_swapchain->device, self->graphic_pipeline, nullptr);
+ BluCat::core.vk_device_with_swapchain->device, self->graphic_pipeline,
+ nullptr);
}
const CommandChain loader{
@@ -277,7 +278,7 @@ GraphicsPipeline2DWired::draw(
vkCmdBindDescriptorSets(
draw_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
- cg_core.vk_graphics_pipeline_2d_wired_layout->pipeline, 0,
+ core.vk_graphics_pipeline_2d_wired_layout->pipeline, 0,
vk_descriptor_sets.size(), vk_descriptor_sets.data(), 0, nullptr);
vkCmdBindPipeline(
draw_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
@@ -294,11 +295,11 @@ GraphicsPipeline2DWired::draw(
UDOVector3D color{rect.color};
vkCmdPushConstants(
draw_command_buffer,
- cg_core.vk_graphics_pipeline_2d_wired_layout->pipeline,
+ core.vk_graphics_pipeline_2d_wired_layout->pipeline,
VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(UDOVector4D), &position);
vkCmdPushConstants(
draw_command_buffer,
- cg_core.vk_graphics_pipeline_2d_wired_layout->pipeline,
+ core.vk_graphics_pipeline_2d_wired_layout->pipeline,
VK_SHADER_STAGE_FRAGMENT_BIT, sizeof(UDOVector4D), sizeof(UDOVector3D),
&color);
vkCmdDrawIndexed(