summaryrefslogtreecommitdiff
path: root/engine/xe_swap_chain.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xengine/xe_swap_chain.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/engine/xe_swap_chain.cpp b/engine/xe_swap_chain.cpp
index c7a0345..6f15fda 100755
--- a/engine/xe_swap_chain.cpp
+++ b/engine/xe_swap_chain.cpp
@@ -11,21 +11,21 @@
namespace xe {
-bool XeSwapChain::initialSwapChainCreated = false;
+bool SwapChain::initialSwapChainCreated = false;
-XeSwapChain::XeSwapChain(XeDevice &deviceRef, VkExtent2D extent)
+SwapChain::SwapChain(Device &deviceRef, VkExtent2D extent)
: device{deviceRef}, windowExtent{extent} {
init();
}
-XeSwapChain::XeSwapChain(XeDevice &deviceRef, VkExtent2D extent, std::shared_ptr<XeSwapChain> previous)
+SwapChain::SwapChain(Device &deviceRef, VkExtent2D extent, std::shared_ptr<SwapChain> previous)
: device{deviceRef}, windowExtent{extent}, oldSwapChain{previous} {
init();
oldSwapChain = nullptr;
}
-void XeSwapChain::init() {
+void SwapChain::init() {
createSwapChain();
createImageViews();
createRenderPass();
@@ -35,7 +35,7 @@ void XeSwapChain::init() {
initialSwapChainCreated = true;
}
-XeSwapChain::~XeSwapChain() {
+SwapChain::~SwapChain() {
for (auto imageView : swapChainImageViews) {
vkDestroyImageView(device.device(), imageView, nullptr);
}
@@ -65,7 +65,7 @@ XeSwapChain::~XeSwapChain() {
}
}
-VkResult XeSwapChain::acquireNextImage(uint32_t *imageIndex) {
+VkResult SwapChain::acquireNextImage(uint32_t *imageIndex) {
vkWaitForFences(
device.device(),
1,
@@ -84,7 +84,7 @@ VkResult XeSwapChain::acquireNextImage(uint32_t *imageIndex) {
return result;
}
-VkResult XeSwapChain::submitCommandBuffers(
+VkResult SwapChain::submitCommandBuffers(
const VkCommandBuffer *buffers, uint32_t *imageIndex) {
if (imagesInFlight[*imageIndex] != VK_NULL_HANDLE) {
vkWaitForFences(device.device(), 1, &imagesInFlight[*imageIndex], VK_TRUE, UINT64_MAX);
@@ -132,7 +132,7 @@ VkResult XeSwapChain::submitCommandBuffers(
return result;
}
-void XeSwapChain::createSwapChain() {
+void SwapChain::createSwapChain() {
SwapChainSupportDetails swapChainSupport = device.getSwapChainSupport();
VkSurfaceFormatKHR surfaceFormat = chooseSwapSurfaceFormat(swapChainSupport.formats);
@@ -189,7 +189,7 @@ void XeSwapChain::createSwapChain() {
swapChainExtent = extent;
}
-void XeSwapChain::createImageViews() {
+void SwapChain::createImageViews() {
swapChainImageViews.resize(swapChainImages.size());
for (size_t i = 0; i < swapChainImages.size(); i++) {
VkImageViewCreateInfo viewInfo{};
@@ -210,7 +210,7 @@ void XeSwapChain::createImageViews() {
}
}
-void XeSwapChain::createRenderPass() {
+void SwapChain::createRenderPass() {
VkAttachmentDescription depthAttachment{};
depthAttachment.format = findDepthFormat();
depthAttachment.samples = VK_SAMPLE_COUNT_1_BIT;
@@ -271,7 +271,7 @@ void XeSwapChain::createRenderPass() {
}
}
-void XeSwapChain::createFramebuffers() {
+void SwapChain::createFramebuffers() {
swapChainFramebuffers.resize(imageCount());
for (size_t i = 0; i < imageCount(); i++) {
std::array<VkImageView, 2> attachments = {swapChainImageViews[i], depthImageViews[i]};
@@ -296,7 +296,7 @@ void XeSwapChain::createFramebuffers() {
}
}
-void XeSwapChain::createDepthResources() {
+void SwapChain::createDepthResources() {
VkFormat depthFormat = findDepthFormat();
swapChainDepthFormat = depthFormat;
VkExtent2D swapChainExtent = getSwapChainExtent();
@@ -345,7 +345,7 @@ void XeSwapChain::createDepthResources() {
}
}
-void XeSwapChain::createSyncObjects() {
+void SwapChain::createSyncObjects() {
imageAvailableSemaphores.resize(MAX_FRAMES_IN_FLIGHT);
renderFinishedSemaphores.resize(MAX_FRAMES_IN_FLIGHT);
inFlightFences.resize(MAX_FRAMES_IN_FLIGHT);
@@ -369,7 +369,7 @@ void XeSwapChain::createSyncObjects() {
}
}
-VkSurfaceFormatKHR XeSwapChain::chooseSwapSurfaceFormat(
+VkSurfaceFormatKHR SwapChain::chooseSwapSurfaceFormat(
const std::vector<VkSurfaceFormatKHR> &availableFormats) {
for (const auto &availableFormat : availableFormats) {
if (availableFormat.format == VK_FORMAT_B8G8R8A8_UNORM &&
@@ -381,7 +381,7 @@ VkSurfaceFormatKHR XeSwapChain::chooseSwapSurfaceFormat(
return availableFormats[0];
}
-VkPresentModeKHR XeSwapChain::chooseSwapPresentMode(
+VkPresentModeKHR SwapChain::chooseSwapPresentMode(
const std::vector<VkPresentModeKHR> &availablePresentModes) {
for (const auto &availablePresentMode : availablePresentModes) {
if (availablePresentMode == VK_PRESENT_MODE_MAILBOX_KHR) {
@@ -404,7 +404,7 @@ VkPresentModeKHR XeSwapChain::chooseSwapPresentMode(
return VK_PRESENT_MODE_FIFO_KHR;
}
-VkExtent2D XeSwapChain::chooseSwapExtent(const VkSurfaceCapabilitiesKHR &capabilities) {
+VkExtent2D SwapChain::chooseSwapExtent(const VkSurfaceCapabilitiesKHR &capabilities) {
if (capabilities.currentExtent.width != std::numeric_limits<uint32_t>::max()) {
return capabilities.currentExtent;
} else {
@@ -420,7 +420,7 @@ VkExtent2D XeSwapChain::chooseSwapExtent(const VkSurfaceCapabilitiesKHR &capabil
}
}
-VkFormat XeSwapChain::findDepthFormat() {
+VkFormat SwapChain::findDepthFormat() {
return device.findSupportedFormat(
{VK_FORMAT_D32_SFLOAT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT},
VK_IMAGE_TILING_OPTIMAL,