lunarg 12
This commit is contained in:
parent
9477f64d50
commit
692fd70519
2 changed files with 55 additions and 21 deletions
|
|
@ -5,5 +5,5 @@ REM clang++ src/main.cpp -o build/window.exe -O0 -g -gcodeview -stdlib=libc++ -l
|
||||||
|
|
||||||
set VSCMD_SKIP_SENDTELEMETRY=1
|
set VSCMD_SKIP_SENDTELEMETRY=1
|
||||||
set VCPKG_KEEP_ENV_VARS=VSCMD_SKIP_SENDTELEMETRY
|
set VCPKG_KEEP_ENV_VARS=VSCMD_SKIP_SENDTELEMETRY
|
||||||
vcvarsall.bat x64 && cl.exe /Fe:build\window.exe /std:c++20 /Od /MDd /EHsc -I%VULKAN_SDK%/Include src/main.cpp user32.lib gdi32.lib kernel32.lib vulkan-1.lib SPIRV.lib SPIRV-Toolsd.lib SPIRV-Tools-diffd.lib SPIRV-Tools-optd.lib SPVRemapperd.lib glslangd.lib OSDependentd.lib GenericCodeGend.lib MachineIndependentd.lib glslang-default-resource-limitsd.lib /link /DEBUG:FULL /IGNORE:4099 /LIBPATH:%VULKAN_SDK%/Lib
|
vcvarsall.bat x64 && cl.exe /Fe:build\window.exe /Fo:build\ /std:c++20 /Od /MDd /EHsc -I%VULKAN_SDK%/Include src/main.cpp user32.lib gdi32.lib kernel32.lib vulkan-1.lib SPIRV.lib SPIRV-Toolsd.lib SPIRV-Tools-diffd.lib SPIRV-Tools-optd.lib SPVRemapperd.lib glslangd.lib OSDependentd.lib GenericCodeGend.lib MachineIndependentd.lib glslang-default-resource-limitsd.lib /link /DEBUG:FULL /IGNORE:4099 /LIBPATH:%VULKAN_SDK%/Lib
|
||||||
|
|
||||||
|
|
|
||||||
74
src/main.cpp
74
src/main.cpp
|
|
@ -687,28 +687,28 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int n
|
||||||
// the color attachment's layout will be transitioned to
|
// the color attachment's layout will be transitioned to
|
||||||
// LAYOUT_PRESENT_SRC_KHR to be ready to present. This is all done as part
|
// LAYOUT_PRESENT_SRC_KHR to be ready to present. This is all done as part
|
||||||
// of the renderpass, no barriers are necessary.
|
// of the renderpass, no barriers are necessary.
|
||||||
VkAttachmentDescription attachments[1];
|
VkAttachmentDescription attachmentsDescription[1];
|
||||||
attachments[0].format = format;
|
attachmentsDescription[0].format = format;
|
||||||
attachments[0].samples = NUM_SAMPLES;
|
attachmentsDescription[0].samples = NUM_SAMPLES;
|
||||||
attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
attachmentsDescription[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||||
attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
attachmentsDescription[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||||
attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
attachmentsDescription[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
attachmentsDescription[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachments[0].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
attachmentsDescription[0].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
attachments[0].finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
attachmentsDescription[0].finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
|
||||||
attachments[0].flags = 0;
|
attachmentsDescription[0].flags = 0;
|
||||||
|
|
||||||
// Depth
|
// Depth
|
||||||
/*
|
/*
|
||||||
* attachments[1].format = info.depth.format;
|
* attachmentsDescription[1].format = info.depth.format;
|
||||||
* attachments[1].samples = NUM_SAMPLES;
|
* attachmentsDescription[1].samples = NUM_SAMPLES;
|
||||||
* attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
* attachmentsDescription[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
|
||||||
* attachments[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
* attachmentsDescription[1].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
* attachments[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
* attachmentsDescription[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
* attachments[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
* attachmentsDescription[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
* attachments[1].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
* attachmentsDescription[1].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
* attachments[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
* attachmentsDescription[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
* attachments[1].flags = 0;
|
* attachmentsDescription[1].flags = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VkAttachmentReference color_reference = {};
|
VkAttachmentReference color_reference = {};
|
||||||
|
|
@ -748,7 +748,7 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int n
|
||||||
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
renderPassInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||||
renderPassInfo.pNext = NULL;
|
renderPassInfo.pNext = NULL;
|
||||||
renderPassInfo.attachmentCount = 1;
|
renderPassInfo.attachmentCount = 1;
|
||||||
renderPassInfo.pAttachments = attachments;
|
renderPassInfo.pAttachments = attachmentsDescription;
|
||||||
renderPassInfo.subpassCount = 1;
|
renderPassInfo.subpassCount = 1;
|
||||||
renderPassInfo.pSubpasses = &subpass;
|
renderPassInfo.pSubpasses = &subpass;
|
||||||
renderPassInfo.dependencyCount = 1;
|
renderPassInfo.dependencyCount = 1;
|
||||||
|
|
@ -949,6 +949,35 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int n
|
||||||
shaderStages[1].pName = "main";
|
shaderStages[1].pName = "main";
|
||||||
shaderStages[1].module = fragmentShader;
|
shaderStages[1].module = fragmentShader;
|
||||||
|
|
||||||
|
/* Framebuffer setup */
|
||||||
|
VkImageView attachments[1];
|
||||||
|
//attachments[1] = info.depth.view;
|
||||||
|
|
||||||
|
VkFramebufferCreateInfo framebufferInfo = {};
|
||||||
|
framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
|
||||||
|
framebufferInfo.pNext = NULL;
|
||||||
|
framebufferInfo.renderPass = renderPass;
|
||||||
|
framebufferInfo.attachmentCount = 1;
|
||||||
|
framebufferInfo.pAttachments = attachments;
|
||||||
|
framebufferInfo.width = swapchainExtent.width;
|
||||||
|
framebufferInfo.height = swapchainExtent.height;
|
||||||
|
framebufferInfo.layers = 1;
|
||||||
|
|
||||||
|
VkFramebuffer* framebuffers;
|
||||||
|
uint32_t i;
|
||||||
|
framebuffers = (VkFramebuffer *)malloc(swapchainImageCount * sizeof(VkFramebuffer));
|
||||||
|
assert(framebuffers);
|
||||||
|
|
||||||
|
for (i = 0; i < swapchainImageCount; i++) {
|
||||||
|
attachments[0] = buffers[i].view;
|
||||||
|
result = vkCreateFramebuffer(device, &framebufferInfo, NULL, &framebuffers[i]);
|
||||||
|
assert(result == VK_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Vertex buffer setup */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -962,6 +991,11 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int n
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < swapchainImageCount; i++) {
|
||||||
|
vkDestroyFramebuffer(device, framebuffers[i], NULL);
|
||||||
|
}
|
||||||
|
free(framebuffers);
|
||||||
vkDestroyShaderModule(device, shaderStages[0].module, NULL);
|
vkDestroyShaderModule(device, shaderStages[0].module, NULL);
|
||||||
vkDestroyShaderModule(device, shaderStages[1].module, NULL);
|
vkDestroyShaderModule(device, shaderStages[1].module, NULL);
|
||||||
vkDestroyRenderPass(device, renderPass, NULL);
|
vkDestroyRenderPass(device, renderPass, NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue