GETRID OF IT
This commit is contained in:
148
.vims
148
.vims
@@ -13,27 +13,29 @@ if &shortmess =~ 'A'
|
||||
else
|
||||
set shortmess=aoO
|
||||
endif
|
||||
badd +288 src/inferno.cpp
|
||||
badd +55 src/graphics/renderpass.cpp
|
||||
badd +12 src/graphics/renderpass.hpp
|
||||
badd +20 src/graphics/swapchain.hpp
|
||||
badd +18 src/graphics/pipeline.hpp
|
||||
badd +41 src/inferno.hpp
|
||||
badd +1 src/main.cpp
|
||||
badd +693 ~/dprog/active/inferno-hart/src/graphics/vulkan_tutorial.cpp
|
||||
badd +1 ~/dprog/active/inferno-hart/src/graphics/descriptor.cpp
|
||||
badd +121 src/graphics/vkrenderer.cpp
|
||||
badd +26 src/graphics/vkrenderer.hpp
|
||||
badd +42 src/renderer/renderer.hpp
|
||||
badd +693 src/graphics/vulkan_tutorial.cpp
|
||||
badd +297 src/inferno.cpp
|
||||
badd +50 src/scene/mesh.hpp
|
||||
badd +1 src/scene/scene.cpp
|
||||
badd +36 src/scene/mesh.cpp
|
||||
badd +153 src/graphics/pipeline.cpp
|
||||
badd +142 src/graphics/pipeline.cpp
|
||||
badd +116 src/graphics/vkrenderer.cpp
|
||||
badd +17 src/graphics/pipeline.hpp
|
||||
badd +25 src/graphics/device.cpp
|
||||
badd +17 src/graphics/device.hpp
|
||||
badd +54 src/graphics/renderpass.cpp
|
||||
badd +20 src/graphics/renderpass.hpp
|
||||
badd +26 src/graphics/swapchain.hpp
|
||||
badd +18 src/inferno.hpp
|
||||
badd +1 src/main.cpp
|
||||
badd +1 ~/dprog/active/inferno-hart/src/graphics/descriptor.cpp
|
||||
badd +42 src/graphics/vkrenderer.hpp
|
||||
badd +42 src/renderer/renderer.hpp
|
||||
badd +1 src/scene/scene.cpp
|
||||
badd +137 src/graphics/buffer.cpp
|
||||
badd +5 res/shaders/vulkan_test.vert
|
||||
badd +18 src/graphics/buffer.hpp
|
||||
badd +238 src/graphics/device.cpp
|
||||
badd +17 src/graphics/device.hpp
|
||||
badd +54 src/renderer/renderer.cpp
|
||||
badd +182 src/graphics/swapchain.cpp
|
||||
argglobal
|
||||
%argdel
|
||||
edit src/inferno.cpp
|
||||
@@ -46,18 +48,11 @@ wincmd _ | wincmd |
|
||||
vsplit
|
||||
2wincmd h
|
||||
wincmd w
|
||||
wincmd w
|
||||
wincmd _ | wincmd |
|
||||
split
|
||||
1wincmd k
|
||||
wincmd w
|
||||
wincmd w
|
||||
wincmd _ | wincmd |
|
||||
split
|
||||
wincmd _ | wincmd |
|
||||
split
|
||||
2wincmd k
|
||||
wincmd w
|
||||
wincmd w
|
||||
let &splitbelow = s:save_splitbelow
|
||||
let &splitright = s:save_splitright
|
||||
wincmd t
|
||||
@@ -67,41 +62,8 @@ set winminheight=0
|
||||
set winheight=1
|
||||
set winminwidth=0
|
||||
set winwidth=1
|
||||
exe 'vert 1resize ' . ((&columns * 103 + 191) / 383)
|
||||
exe '2resize ' . ((&lines * 55 + 35) / 71)
|
||||
exe 'vert 2resize ' . ((&columns * 156 + 191) / 383)
|
||||
exe '3resize ' . ((&lines * 12 + 35) / 71)
|
||||
exe 'vert 3resize ' . ((&columns * 156 + 191) / 383)
|
||||
exe '4resize ' . ((&lines * 46 + 35) / 71)
|
||||
exe 'vert 4resize ' . ((&columns * 122 + 191) / 383)
|
||||
exe '5resize ' . ((&lines * 10 + 35) / 71)
|
||||
exe 'vert 5resize ' . ((&columns * 122 + 191) / 383)
|
||||
exe '6resize ' . ((&lines * 10 + 35) / 71)
|
||||
exe 'vert 6resize ' . ((&columns * 122 + 191) / 383)
|
||||
wincmd =
|
||||
argglobal
|
||||
balt src/inferno.hpp
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
setlocal fdi=#
|
||||
setlocal fdl=0
|
||||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 288 - ((53 * winheight(0) + 34) / 68)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 288
|
||||
normal! 045|
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("src/graphics/pipeline.hpp", ":p")) | buffer src/graphics/pipeline.hpp | else | edit src/graphics/pipeline.hpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file src/graphics/pipeline.hpp
|
||||
endif
|
||||
balt src/graphics/pipeline.cpp
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
@@ -113,19 +75,19 @@ setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 18 - ((17 * winheight(0) + 27) / 55)
|
||||
let s:l = 297 - ((33 * winheight(0) + 34) / 68)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 18
|
||||
normal! 054|
|
||||
keepjumps 297
|
||||
normal! 051|
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("src/graphics/renderpass.cpp", ":p")) | buffer src/graphics/renderpass.cpp | else | edit src/graphics/renderpass.cpp | endif
|
||||
if bufexists(fnamemodify("src/graphics/pipeline.cpp", ":p")) | buffer src/graphics/pipeline.cpp | else | edit src/graphics/pipeline.cpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file src/graphics/renderpass.cpp
|
||||
silent file src/graphics/pipeline.cpp
|
||||
endif
|
||||
balt src/graphics/renderpass.hpp
|
||||
balt src/inferno.cpp
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
@@ -136,19 +98,19 @@ setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 21 - ((3 * winheight(0) + 6) / 12)
|
||||
let s:l = 142 - ((33 * winheight(0) + 34) / 68)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 21
|
||||
normal! 0
|
||||
keepjumps 142
|
||||
normal! 049|
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("src/graphics/device.hpp", ":p")) | buffer src/graphics/device.hpp | else | edit src/graphics/device.hpp | endif
|
||||
if bufexists(fnamemodify("src/graphics/vkrenderer.hpp", ":p")) | buffer src/graphics/vkrenderer.hpp | else | edit src/graphics/vkrenderer.hpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file src/graphics/device.hpp
|
||||
silent file src/graphics/vkrenderer.hpp
|
||||
endif
|
||||
balt src/graphics/vkrenderer.hpp
|
||||
balt src/graphics/swapchain.hpp
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
@@ -159,12 +121,12 @@ setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 17 - ((16 * winheight(0) + 23) / 46)
|
||||
let s:l = 12 - ((7 * winheight(0) + 17) / 35)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 17
|
||||
normal! 05|
|
||||
keepjumps 12
|
||||
normal! 018|
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("src/graphics/pipeline.hpp", ":p")) | buffer src/graphics/pipeline.hpp | else | edit src/graphics/pipeline.hpp | endif
|
||||
@@ -182,48 +144,14 @@ setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 31 - ((5 * winheight(0) + 5) / 10)
|
||||
let s:l = 34 - ((29 * winheight(0) + 16) / 32)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 31
|
||||
normal! 050|
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("src/graphics/renderpass.hpp", ":p")) | buffer src/graphics/renderpass.hpp | else | edit src/graphics/renderpass.hpp | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file src/graphics/renderpass.hpp
|
||||
endif
|
||||
balt src/graphics/pipeline.hpp
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
setlocal fdi=#
|
||||
setlocal fdl=0
|
||||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 12 - ((4 * winheight(0) + 5) / 10)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 12
|
||||
keepjumps 34
|
||||
normal! 0
|
||||
wincmd w
|
||||
2wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 103 + 191) / 383)
|
||||
exe '2resize ' . ((&lines * 55 + 35) / 71)
|
||||
exe 'vert 2resize ' . ((&columns * 156 + 191) / 383)
|
||||
exe '3resize ' . ((&lines * 12 + 35) / 71)
|
||||
exe 'vert 3resize ' . ((&columns * 156 + 191) / 383)
|
||||
exe '4resize ' . ((&lines * 46 + 35) / 71)
|
||||
exe 'vert 4resize ' . ((&columns * 122 + 191) / 383)
|
||||
exe '5resize ' . ((&lines * 10 + 35) / 71)
|
||||
exe 'vert 5resize ' . ((&columns * 122 + 191) / 383)
|
||||
exe '6resize ' . ((&lines * 10 + 35) / 71)
|
||||
exe 'vert 6resize ' . ((&columns * 122 + 191) / 383)
|
||||
wincmd =
|
||||
tabnext 1
|
||||
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
||||
silent exe 'bwipe ' . s:wipebuf
|
||||
|
||||
@@ -14,8 +14,8 @@ const std::vector<const char*> VALIDATION_LAYERS = {
|
||||
#endif
|
||||
|
||||
const std::vector<const char*> DEVICE_EXTENSIONS = {
|
||||
VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
||||
VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME,
|
||||
};
|
||||
|
||||
typedef struct GraphicsDevice {
|
||||
|
||||
@@ -141,10 +141,16 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap)
|
||||
Shader* shader = shader_create(pipeline->Device);
|
||||
shader_load(shader, "res/shaders/vulkan_test");
|
||||
|
||||
VkPipelineRenderingCreateInfoKHR renderingPipelineInfo = {};
|
||||
renderingPipelineInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR;
|
||||
renderingPipelineInfo.colorAttachmentCount = 1;
|
||||
renderingPipelineInfo.pColorAttachmentFormats = &pipeline->Swap->ImageFormat;
|
||||
|
||||
VkGraphicsPipelineCreateInfo pipelineInfo = {};
|
||||
pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||
pipelineInfo.stageCount = 2;
|
||||
pipelineInfo.pStages = shader->ShaderStages;
|
||||
pipelineInfo.pNext = &renderingPipelineInfo;
|
||||
|
||||
std::vector<VkDynamicState> dynamicStates
|
||||
= { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "swapchain.hpp"
|
||||
|
||||
#include "yolo/yolo.hpp"
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
namespace inferno::graphics {
|
||||
|
||||
@@ -81,8 +82,7 @@ void renderer_configure_command_buffer(Renderer* renderer)
|
||||
yolo::debug("Command buffer created");
|
||||
}
|
||||
|
||||
void renderer_record_command_buffer(
|
||||
Renderer* renderer, uint32_t imageIndex)
|
||||
void renderer_record_command_buffer(Renderer* renderer, uint32_t imageIndex)
|
||||
{
|
||||
VkCommandBufferBeginInfo beginInfo {};
|
||||
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||
@@ -95,8 +95,24 @@ void renderer_record_command_buffer(
|
||||
yolo::error("failed to begin recording command buffer!");
|
||||
}
|
||||
|
||||
VkClearValue clearColor = { { { 0.0f, 0.3f, 0.3f, 1.0f } } };
|
||||
VkImageMemoryBarrier imageMemoryBarrier {};
|
||||
imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
imageMemoryBarrier.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
||||
imageMemoryBarrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
imageMemoryBarrier.newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
imageMemoryBarrier.image = renderer->Swap->Images[renderer->ImageIndex];
|
||||
imageMemoryBarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
imageMemoryBarrier.subresourceRange.baseMipLevel = 0;
|
||||
imageMemoryBarrier.subresourceRange.layerCount = 1;
|
||||
imageMemoryBarrier.subresourceRange.baseArrayLayer = 0;
|
||||
imageMemoryBarrier.subresourceRange.levelCount = 1;
|
||||
|
||||
vkCmdPipelineBarrier(renderer->CommandBuffersInFlight[renderer->CurrentFrameIndex],
|
||||
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, 0, 0, nullptr, 0, nullptr, 1,
|
||||
&imageMemoryBarrier);
|
||||
|
||||
VkClearValue clearColor = { { { 0.0f, 0.3f, 0.3f, 1.0f } } };
|
||||
VkRenderingAttachmentInfoKHR attachmentInfo {};
|
||||
attachmentInfo.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO_KHR;
|
||||
attachmentInfo.imageView = renderer->Swap->ImageViews[imageIndex];
|
||||
@@ -122,11 +138,9 @@ bool renderer_begin_frame(VulkanRenderer* renderer)
|
||||
vkWaitForFences(renderer->Device->VulkanDevice, 1, &renderer->CurrentFrame->Fence,
|
||||
VK_TRUE, UINT64_MAX);
|
||||
|
||||
uint32_t imageIndex;
|
||||
auto swapStatus = vkAcquireNextImageKHR(renderer->Device->VulkanDevice,
|
||||
renderer->Swap->Handle, UINT64_MAX, renderer->CurrentFrame->ImageAvailable,
|
||||
VK_NULL_HANDLE, &imageIndex);
|
||||
renderer->ImageIndex = imageIndex;
|
||||
VK_NULL_HANDLE, &renderer->ImageIndex);
|
||||
|
||||
if (swapStatus == VK_ERROR_OUT_OF_DATE_KHR || renderer->Device->Resized) {
|
||||
yolo::info("Swapchain out of date");
|
||||
@@ -139,14 +153,30 @@ bool renderer_begin_frame(VulkanRenderer* renderer)
|
||||
vkResetFences(renderer->Device->VulkanDevice, 1, &renderer->CurrentFrame->Fence);
|
||||
vkResetCommandBuffer(
|
||||
renderer->CommandBuffersInFlight[renderer->CurrentFrameIndex], 0);
|
||||
renderer_record_command_buffer(renderer, imageIndex);
|
||||
renderer_record_command_buffer(renderer, renderer->ImageIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool renderer_draw_frame(Renderer* renderer)
|
||||
{
|
||||
vkCmdEndRendering(
|
||||
renderer->CommandBuffersInFlight[renderer->CurrentFrameIndex]);
|
||||
vkCmdEndRendering(renderer->CommandBuffersInFlight[renderer->CurrentFrameIndex]);
|
||||
|
||||
VkImageMemoryBarrier imageMemoryBarrier {};
|
||||
imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
imageMemoryBarrier.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
||||
imageMemoryBarrier.oldLayout = VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL;
|
||||
imageMemoryBarrier.newLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||
imageMemoryBarrier.image = renderer->Swap->Images[renderer->ImageIndex];
|
||||
imageMemoryBarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
imageMemoryBarrier.subresourceRange.baseMipLevel = 0;
|
||||
imageMemoryBarrier.subresourceRange.layerCount = 1;
|
||||
imageMemoryBarrier.subresourceRange.baseArrayLayer = 0;
|
||||
imageMemoryBarrier.subresourceRange.levelCount = 1;
|
||||
|
||||
vkCmdPipelineBarrier(renderer->CommandBuffersInFlight[renderer->CurrentFrameIndex],
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1,
|
||||
&imageMemoryBarrier);
|
||||
|
||||
if (vkEndCommandBuffer(renderer->CommandBuffersInFlight[renderer->CurrentFrameIndex])
|
||||
!= VK_SUCCESS) {
|
||||
|
||||
Reference in New Issue
Block a user