fix bufferSize control
parent
c2b3bbec51
commit
07487be2bf
|
@ -123,7 +123,7 @@ void VulkanExampleBase::prepare()
|
||||||
*/
|
*/
|
||||||
VkCommandPoolCreateInfo cmdPoolInfo = {};
|
VkCommandPoolCreateInfo cmdPoolInfo = {};
|
||||||
cmdPoolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
cmdPoolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||||
cmdPoolInfo.queueFamilyIndex = swapChain.queueNodeIndex;
|
cmdPoolInfo.queueFamilyIndex = queueFamilyIndex;
|
||||||
cmdPoolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
|
cmdPoolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
|
||||||
VK_CHECK_RESULT(vkCreateCommandPool(device, &cmdPoolInfo, nullptr, &cmdPool));
|
VK_CHECK_RESULT(vkCreateCommandPool(device, &cmdPoolInfo, nullptr, &cmdPool));
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ void VulkanExampleBase::renderLoop()
|
||||||
{
|
{
|
||||||
renderFrame();
|
renderFrame();
|
||||||
}
|
}
|
||||||
|
renderingFrameIndex++;
|
||||||
// Flush device to make sure all resources can be freed
|
// Flush device to make sure all resources can be freed
|
||||||
vkDeviceWaitIdle(device);
|
vkDeviceWaitIdle(device);
|
||||||
}
|
}
|
||||||
|
@ -501,6 +501,28 @@ void VulkanExampleBase::initVulkan()
|
||||||
vkGetPhysicalDeviceFeatures(physicalDevice, &deviceFeatures);
|
vkGetPhysicalDeviceFeatures(physicalDevice, &deviceFeatures);
|
||||||
vkGetPhysicalDeviceMemoryProperties(physicalDevice, &deviceMemoryProperties);
|
vkGetPhysicalDeviceMemoryProperties(physicalDevice, &deviceMemoryProperties);
|
||||||
|
|
||||||
|
/*
|
||||||
|
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
|
Device creation
|
||||||
*/
|
*/
|
||||||
|
@ -522,6 +544,8 @@ void VulkanExampleBase::initVulkan()
|
||||||
*/
|
*/
|
||||||
vkGetDeviceQueue(device, vulkanDevice->queueFamilyIndices.graphics, 0, &queue);
|
vkGetDeviceQueue(device, vulkanDevice->queueFamilyIndices.graphics, 0, &queue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Suitable depth format
|
Suitable depth format
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -113,6 +113,8 @@ public:
|
||||||
uint32_t lastFPS = 0;
|
uint32_t lastFPS = 0;
|
||||||
|
|
||||||
VkFormat colorFormat = VK_FORMAT_R8G8B8A8_SRGB;
|
VkFormat colorFormat = VK_FORMAT_R8G8B8A8_SRGB;
|
||||||
|
uint32_t queueFamilyIndex;
|
||||||
|
uint32_t renderingFrameIndex;
|
||||||
|
|
||||||
struct Signal
|
struct Signal
|
||||||
{
|
{
|
||||||
|
|
|
@ -1553,13 +1553,14 @@ PlumageRender::PlumageRender()
|
||||||
camera.rotationSpeed = 0.25f;
|
camera.rotationSpeed = 0.25f;
|
||||||
camera.movementSpeed = 0.1f;
|
camera.movementSpeed = 0.1f;
|
||||||
|
|
||||||
|
auto frameRange = settings.outputFrameCount - settings.startFrameCount + 1;
|
||||||
|
|
||||||
waitFences.resize(renderAhead);
|
waitFences.resize(renderAhead);
|
||||||
presentCompleteSemaphores.resize(renderAhead);
|
presentCompleteSemaphores.resize(renderAhead);
|
||||||
renderCompleteSemaphores.resize(renderAhead);
|
renderCompleteSemaphores.resize(renderAhead);
|
||||||
commandBuffers.resize(swapChain.imageCount);
|
commandBuffers.resize(renderingFrameIndex);
|
||||||
uniformBuffers.resize(swapChain.imageCount);
|
uniformBuffers.resize(renderingFrameIndex);
|
||||||
descriptorSets.resize(swapChain.imageCount);
|
descriptorSets.resize(renderingFrameIndex);
|
||||||
// Command buffer execution fences
|
// Command buffer execution fences
|
||||||
for (auto& waitFence : waitFences) {
|
for (auto& waitFence : waitFences) {
|
||||||
VkFenceCreateInfo fenceCI{ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, nullptr, VK_FENCE_CREATE_SIGNALED_BIT };
|
VkFenceCreateInfo fenceCI{ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, nullptr, VK_FENCE_CREATE_SIGNALED_BIT };
|
||||||
|
@ -1598,8 +1599,8 @@ PlumageRender::PlumageRender()
|
||||||
sampleCount = settings.sampleCount;
|
sampleCount = settings.sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
gui = new UI(vulkanDevice, renderPass, queue, pipelineCache, sampleCount);
|
//gui = new UI(vulkanDevice, renderPass, queue, pipelineCache, sampleCount);
|
||||||
updateUIOverlay();
|
//updateUIOverlay();
|
||||||
|
|
||||||
buildCommandBuffers();
|
buildCommandBuffers();
|
||||||
|
|
||||||
|
@ -2311,6 +2312,7 @@ PlumageRender::PlumageRender()
|
||||||
{
|
{
|
||||||
for (int32_t i = 0; i < __argc; i++) { PlumageRender::args.push_back(__argv[i]); };
|
for (int32_t i = 0; i < __argc; i++) { PlumageRender::args.push_back(__argv[i]); };
|
||||||
plumageRender = new PlumageRender();
|
plumageRender = new PlumageRender();
|
||||||
|
std::cout << "start to init vulkan" << std::endl;
|
||||||
plumageRender->initVulkan();
|
plumageRender->initVulkan();
|
||||||
//plumageRender->setupWindow(hInstance, WndProc);
|
//plumageRender->setupWindow(hInstance, WndProc);
|
||||||
plumageRender->prepare();
|
plumageRender->prepare();
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
} info ;
|
} info ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Models
|
struct Models
|
||||||
|
|
Loading…
Reference in New Issue