PIPELINE ISSUE FIXED

This commit is contained in:
Ben Kyd
2023-12-01 20:37:43 +00:00
parent c9a8a786b6
commit adaee9eafc
7 changed files with 51 additions and 118 deletions

23
.vims
View File

@@ -43,7 +43,7 @@ badd +2 src/scene/scene.hpp
badd +240 src/scene/camera.cpp
badd +59 libhart/scene/camera.hpp
badd +30 src/graphics.hpp
badd +70 src/gui/gui.hpp
badd +43 src/gui/gui.hpp
badd +130 src/window.cpp
badd +111 src/thirdparty/imgui/imgui_impl_vulkan.cpp
badd +66 ~/dprog/active/inferno-hart/src/thirdparty/imgui/imgui_impl_vulkan.h
@@ -75,9 +75,9 @@ set winminwidth=0
set winwidth=1
exe 'vert 1resize ' . ((&columns * 91 + 191) / 383)
exe 'vert 2resize ' . ((&columns * 173 + 191) / 383)
exe '3resize ' . ((&lines * 20 + 33) / 67)
exe '3resize ' . ((&lines * 24 + 39) / 79)
exe 'vert 3resize ' . ((&columns * 117 + 191) / 383)
exe '4resize ' . ((&lines * 43 + 33) / 67)
exe '4resize ' . ((&lines * 51 + 39) / 79)
exe 'vert 4resize ' . ((&columns * 117 + 191) / 383)
argglobal
balt src/window.cpp
@@ -91,12 +91,12 @@ setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 81 - ((61 * winheight(0) + 32) / 64)
let s:l = 5 - ((4 * winheight(0) + 38) / 76)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 81
normal! 0
keepjumps 5
normal! 030|
wincmd w
argglobal
if bufexists(fnamemodify("src/graphics/pipeline.cpp", ":p")) | buffer src/graphics/pipeline.cpp | else | edit src/graphics/pipeline.cpp | endif
@@ -114,7 +114,7 @@ setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 34 - ((33 * winheight(0) + 32) / 64)
let s:l = 34 - ((33 * winheight(0) + 38) / 76)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
@@ -137,7 +137,7 @@ setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 53 - ((17 * winheight(0) + 10) / 20)
let s:l = 53 - ((20 * winheight(0) + 12) / 24)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
@@ -160,19 +160,18 @@ setlocal fdn=20
setlocal fen
silent! normal! zE
let &fdl = &fdl
let s:l = 18 - ((17 * winheight(0) + 21) / 43)
let s:l = 18 - ((17 * winheight(0) + 25) / 51)
if s:l < 1 | let s:l = 1 | endif
keepjumps exe s:l
normal! zt
keepjumps 18
normal! 047|
wincmd w
2wincmd w
exe 'vert 1resize ' . ((&columns * 91 + 191) / 383)
exe 'vert 2resize ' . ((&columns * 173 + 191) / 383)
exe '3resize ' . ((&lines * 20 + 33) / 67)
exe '3resize ' . ((&lines * 24 + 39) / 79)
exe 'vert 3resize ' . ((&columns * 117 + 191) / 383)
exe '4resize ' . ((&lines * 43 + 33) / 67)
exe '4resize ' . ((&lines * 51 + 39) / 79)
exe 'vert 4resize ' . ((&columns * 117 + 191) / 383)
tabnext 1
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'

77
.vscode/settings.json vendored
View File

@@ -1,77 +0,0 @@
{
"files.associations": {
"string": "cpp",
"vector": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"complex": "cpp",
"hash_map": "cpp",
"filesystem": "cpp"
},
"cmake.configureOnOpen": false
}

1
DAP Breakpoints Normal file
View File

@@ -0,0 +1 @@

View File

@@ -1,7 +1,4 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
@@ -19,9 +16,9 @@
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"text": "-enable-pretty-printing"
}
],
]
}
]
}
}

View File

@@ -56,6 +56,7 @@ void populateDebugMessengerCreateInfo(VkDebugUtilsMessengerCreateInfoEXT& create
createInfo.pfnUserCallback = debugCallback;
}
#ifdef VALIDATION_LAYERS_ENABLED
bool checkValidationLayerSupport()
{
uint32_t layerCount;
@@ -81,6 +82,7 @@ bool checkValidationLayerSupport()
return true;
}
#endif
std::vector<const char*> getRequiredExtensions()
{
@@ -91,10 +93,10 @@ std::vector<const char*> getRequiredExtensions()
std::vector<const char*> extensions(
glfwExtensions, glfwExtensions + glfwExtensionCount);
if constexpr (VALIDATION_LAYERS_ENABLED) {
#ifdef VALIDATION_LAYERS_ENABLED
yolo::info("Validation layers enabled");
extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
}
#endif
yolo::info("Requested instance extensions:");
for (const auto& extension : extensions) {
@@ -213,20 +215,22 @@ void device_cleanup(GraphicsDevice* device)
{
vkDestroyDevice(device->VulkanDevice, nullptr);
if constexpr (VALIDATION_LAYERS_ENABLED) {
#ifdef VALIDATION_LAYERS_ENABLED
destroyDebugUtilsMessengerEXT(
device->VulkanInstance, device->VulkanDebugMessenger, nullptr);
}
#endif
vkDestroySurfaceKHR(device->VulkanInstance, device->VulkanSurface, nullptr);
vkDestroyInstance(device->VulkanInstance, nullptr);
}
void device_create_vulkan_instance(GraphicsDevice* device)
{
if (VALIDATION_LAYERS_ENABLED && !checkValidationLayerSupport()) {
#ifdef VALIDATION_LAYERS_ENABLED
if (!checkValidationLayerSupport()) {
yolo::error("validation layers requested, but not available!");
}
#endif
VkApplicationInfo appInfo {};
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
@@ -265,10 +269,10 @@ void device_create_vulkan_instance(GraphicsDevice* device)
void device_vulkan_debugger(GraphicsDevice* device)
{
if constexpr (!VALIDATION_LAYERS_ENABLED) {
#ifndef VALIDATION_LAYERS_ENABLED
yolo::warn("Validation layers disabled");
return;
}
#endif
VkDebugUtilsMessengerCreateInfoEXT createInfo;
populateDebugMessengerCreateInfo(createInfo);
@@ -361,7 +365,8 @@ void device_create_vulkan_logical_device(GraphicsDevice* device)
#ifdef VALIDATION_LAYERS_ENABLED
createInfo.enabledLayerCount = static_cast<uint32_t>(VALIDATION_LAYERS.size());
createInfo.ppEnabledLayerNames = VALIDATION_LAYERS.data();
#elif
#endif
#ifndef VALIDATION_LAYERS_ENABLED
createInfo.enabledLayerCount = 0;
#endif

View File

@@ -44,6 +44,7 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shade
scene::get_vert_attribute_descriptions());
VkPipelineVertexInputStateCreateInfo vertexInputInfo {};
vertexInputInfo.pNext = nullptr;
vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
vertexInputInfo.vertexBindingDescriptionCount = 1;
vertexInputInfo.vertexAttributeDescriptionCount
@@ -80,14 +81,14 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shade
colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT
| VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
// Alpha blending basically
colorBlendAttachment.blendEnable = VK_FALSE;
// colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
// colorBlendAttachment.dstColorBlendFactor
// = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
// colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
// colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
// colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
// colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.blendEnable = VK_TRUE;
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
colorBlendAttachment.dstColorBlendFactor
= VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
VkPipelineColorBlendStateCreateInfo colorBlending {};
colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;

View File

@@ -55,7 +55,7 @@ void shader_load(Shader* shader, std::filesystem::path path)
VkShaderModuleCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
createInfo.codeSize = vertexLoadedShaderCode.size();
createInfo.pCode = reinterpret_cast<const uint32_t*>(vertexLoadedShaderCode.data());
createInfo.pCode = (uint32_t*)(vertexLoadedShaderCode.data());
if (vkCreateShaderModule(
shader->Device->VulkanDevice, &createInfo, nullptr, &shader->VertexShader)
@@ -63,17 +63,22 @@ void shader_load(Shader* shader, std::filesystem::path path)
yolo::error("failed to create shader module");
}
memset(&shader->ShaderStages, 0,
SHADER_STAGES * sizeof(VkPipelineShaderStageCreateInfo));
shader->ShaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shader->ShaderStages[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
shader->ShaderStages[0].module = shader->VertexShader;
shader->ShaderStages[0].pName = "main";
VkShaderModuleCreateInfo createInfo2 = {};
shader->ShaderStages[0].pSpecializationInfo = nullptr; // Optional
shader->ShaderStages[0].flags = 0; // Optional
shader->ShaderStages[0].pNext = nullptr; // Optional
std::string fragmentLoadedShaderCode = textFromFile(fragmentShaderPath);
VkShaderModuleCreateInfo createInfo2 = {};
createInfo2.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
createInfo2.codeSize = fragmentLoadedShaderCode.size();
createInfo2.pCode
= reinterpret_cast<const uint32_t*>(fragmentLoadedShaderCode.data());
createInfo2.pCode = (uint32_t*)(fragmentLoadedShaderCode.data());
if (vkCreateShaderModule(
shader->Device->VulkanDevice, &createInfo2, nullptr, &shader->FragmentShader)
@@ -85,6 +90,9 @@ void shader_load(Shader* shader, std::filesystem::path path)
shader->ShaderStages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shader->ShaderStages[1].module = shader->FragmentShader;
shader->ShaderStages[1].pName = "main";
shader->ShaderStages[0].pSpecializationInfo = nullptr; // Optional
shader->ShaderStages[0].flags = 0; // Optional
shader->ShaderStages[0].pNext = nullptr; // Optional
}
void shader_update_state(Shader* shader, VkCommandBuffer commandBuffer,
@@ -165,9 +173,8 @@ void shader_build(Shader* shader)
yolo::error("failed to allocate descriptor sets!");
}
shader->GraphicsPipeline = pipeline_create(shader->Device, shader->GraphicsSwapchain,
shader, layouts.size(), layouts.data());
shader, layouts.size(), layouts.data());
shader->GlobalUniformBuffer
= uniform_buffer_create<scene::GlobalUniformObject>(shader->Device, true);
}