完成SwapChain去除
parent
07487be2bf
commit
92d7b95f0f
|
@ -225,16 +225,17 @@ namespace vks
|
|||
}
|
||||
|
||||
VkResult result = vkCreateDevice(physicalDevice, &deviceCreateInfo, nullptr, &logicalDevice);
|
||||
|
||||
/*
|
||||
if (result == VK_SUCCESS) {
|
||||
commandPool = createCommandPool(queueFamilyIndices.graphics);
|
||||
}
|
||||
|
||||
*/
|
||||
this->enabledFeatures = enabledFeatures;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a buffer on the device
|
||||
*
|
||||
|
@ -313,6 +314,11 @@ namespace vks
|
|||
return cmdPool;
|
||||
}
|
||||
|
||||
void setCommandPool(VkCommandPool commandPool)
|
||||
{
|
||||
this->commandPool = commandPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a command buffer from the command pool
|
||||
*
|
||||
|
|
|
@ -126,7 +126,7 @@ void VulkanExampleBase::prepare()
|
|||
cmdPoolInfo.queueFamilyIndex = queueFamilyIndex;
|
||||
cmdPoolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
|
||||
VK_CHECK_RESULT(vkCreateCommandPool(device, &cmdPoolInfo, nullptr, &cmdPool));
|
||||
|
||||
vulkanDevice->setCommandPool(cmdPool);
|
||||
/*
|
||||
Render pass
|
||||
*/
|
||||
|
@ -505,24 +505,6 @@ void VulkanExampleBase::initVulkan()
|
|||
queueFamilyIndex creation
|
||||
*/
|
||||
|
||||
const float defaultQueuePriority(0.0f);
|
||||
VkDeviceQueueCreateInfo queueCreateInfo = {};
|
||||
uint32_t queueFamilyCount;
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, nullptr);
|
||||
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queueFamilyCount);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, queueFamilyProperties.data());
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(queueFamilyProperties.size()); i++) {
|
||||
if (queueFamilyProperties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||
queueFamilyIndex = i;
|
||||
queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
queueCreateInfo.queueFamilyIndex = i;
|
||||
queueCreateInfo.queueCount = 1;
|
||||
queueCreateInfo.pQueuePriorities = &defaultQueuePriority;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Device creation
|
||||
*/
|
||||
|
@ -538,14 +520,12 @@ void VulkanExampleBase::initVulkan()
|
|||
exit(res);
|
||||
}
|
||||
device = vulkanDevice->logicalDevice;
|
||||
|
||||
|
||||
/*
|
||||
Graphics queue
|
||||
*/
|
||||
vkGetDeviceQueue(device, vulkanDevice->queueFamilyIndices.graphics, 0, &queue);
|
||||
|
||||
|
||||
|
||||
queueFamilyIndex = vulkanDevice->queueFamilyIndices.graphics;
|
||||
/*
|
||||
Suitable depth format
|
||||
*/
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
|
||||
VkFormat colorFormat = VK_FORMAT_R8G8B8A8_SRGB;
|
||||
uint32_t queueFamilyIndex;
|
||||
uint32_t renderingFrameIndex;
|
||||
uint32_t renderingFrameIndex = 3;
|
||||
|
||||
struct Signal
|
||||
{
|
||||
|
|
|
@ -321,14 +321,14 @@ PlumageRender::PlumageRender()
|
|||
}
|
||||
|
||||
std::vector<VkDescriptorPoolSize> poolSizes = {
|
||||
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, (4 + meshCount) * swapChain.imageCount },
|
||||
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, imageSamplerCount * swapChain.imageCount }
|
||||
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, (4 + meshCount) * renderingFrameIndex },
|
||||
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, imageSamplerCount * renderingFrameIndex }
|
||||
};
|
||||
VkDescriptorPoolCreateInfo descriptorPoolCI{};
|
||||
descriptorPoolCI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||
descriptorPoolCI.poolSizeCount = 2;
|
||||
descriptorPoolCI.pPoolSizes = poolSizes.data();
|
||||
descriptorPoolCI.maxSets = (2 + materialCount + meshCount) * swapChain.imageCount;
|
||||
descriptorPoolCI.maxSets = (2 + materialCount + meshCount) * renderingFrameIndex;
|
||||
VK_CHECK_RESULT(vkCreateDescriptorPool(device, &descriptorPoolCI, nullptr, &descriptorPool));
|
||||
|
||||
/*
|
||||
|
@ -357,7 +357,7 @@ PlumageRender::PlumageRender()
|
|||
descriptorSetAllocInfo.descriptorPool = descriptorPool;
|
||||
descriptorSetAllocInfo.pSetLayouts = &descriptorSetLayouts.scene;
|
||||
descriptorSetAllocInfo.descriptorSetCount = 1;
|
||||
VK_CHECK_RESULT(vkAllocateDescriptorSets(device, &descriptorSetAllocInfo, &descriptorSets[i].scene));
|
||||
vkAllocateDescriptorSets(device, &descriptorSetAllocInfo, &descriptorSets[i].scene);
|
||||
|
||||
std::array<VkWriteDescriptorSet, 5> writeDescriptorSets{};
|
||||
|
||||
|
@ -399,6 +399,7 @@ PlumageRender::PlumageRender()
|
|||
vkUpdateDescriptorSets(device, static_cast<uint32_t>(writeDescriptorSets.size()), writeDescriptorSets.data(), 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Material (samplers)
|
||||
{
|
||||
|
@ -1533,7 +1534,7 @@ PlumageRender::PlumageRender()
|
|||
0.0f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PlumageRender::windowResized()
|
||||
{
|
||||
buildCommandBuffers();
|
||||
|
@ -1542,6 +1543,7 @@ PlumageRender::PlumageRender()
|
|||
//update UI
|
||||
updateUIOverlay();
|
||||
}
|
||||
|
||||
|
||||
void PlumageRender::prepare()
|
||||
{
|
||||
|
@ -1986,7 +1988,7 @@ PlumageRender::PlumageRender()
|
|||
return;
|
||||
}
|
||||
|
||||
updateUIOverlay();
|
||||
//updateUIOverlay();
|
||||
//加入写到文件的函数
|
||||
//swapChainImage = swapChain.images[frameIndex];
|
||||
//outputImageSequeue(swapChainImage,filePath.imageSequenceFilePath);
|
||||
|
|
|
@ -142,8 +142,8 @@ public:
|
|||
struct FilePath
|
||||
{ //model path
|
||||
std::string glTFModelFilePath = getAssetPath() + "models/DamagedHelmet/DamagedHelmet.gltf";
|
||||
//std::string modelVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.vert.spv";
|
||||
//std::string modelFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.frag.spv";
|
||||
std::string modelVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.vert.spv";
|
||||
std::string modelFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.frag.spv";
|
||||
|
||||
//ui
|
||||
std::string uiVertShaderPath = getAssetPath() + "shaders/ui.vert.spv";
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
std::string skyboxVertShaderPath = getAssetPath() + "shaders/skybox.vert.spv";
|
||||
std::string skyboxFragShaderPath = getAssetPath() + "shaders/skybox.frag.spv";
|
||||
|
||||
//std::string iblTexturesFilePath = getAssetPath() + "textures/hdr/gcanyon_cube.ktx";
|
||||
std::string iblTexturesFilePath = getAssetPath() + "textures/hdr/gcanyon_cube.ktx";
|
||||
//tonemapping
|
||||
std::string tonemappingVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/genbrdflut.vert.spv";
|
||||
std::string tonemappingEnableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/tonemapping_enable.frag.spv";
|
||||
|
@ -342,7 +342,7 @@ public:
|
|||
textures.prefilteredCube.destroy();
|
||||
textures.lutBrdf.destroy();
|
||||
textures.empty.destroy();
|
||||
delete gui;
|
||||
//delete gui;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue