Moved tool functions to vks namespace (Refs #260)
This commit is contained in:
parent
a105dfdece
commit
1309ee0ef9
34 changed files with 376 additions and 370 deletions
|
|
@ -13,7 +13,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
|
|
||||||
namespace vks
|
namespace vks
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
#include "VulkanBuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
namespace vks
|
namespace vks
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
|
|
||||||
namespace vks
|
namespace vks
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include <gli/gli.hpp>
|
#include <gli/gli.hpp>
|
||||||
|
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "VulkanBuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
|
|
@ -216,7 +216,7 @@ namespace vks
|
||||||
|
|
||||||
// Image barrier for optimal image (target)
|
// Image barrier for optimal image (target)
|
||||||
// Optimal image will be used as destination for the copy
|
// Optimal image will be used as destination for the copy
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -236,7 +236,7 @@ namespace vks
|
||||||
|
|
||||||
// Change texture image layout to shader read after all mip levels have been copied
|
// Change texture image layout to shader read after all mip levels have been copied
|
||||||
this->imageLayout = imageLayout;
|
this->imageLayout = imageLayout;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -320,7 +320,7 @@ namespace vks
|
||||||
imageLayout = imageLayout;
|
imageLayout = imageLayout;
|
||||||
|
|
||||||
// Setup image memory barrier
|
// Setup image memory barrier
|
||||||
vkTools::setImageLayout(copyCmd, image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, imageLayout);
|
vks::tools::setImageLayout(copyCmd, image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, imageLayout);
|
||||||
|
|
||||||
device->flushCommandBuffer(copyCmd, copyQueue);
|
device->flushCommandBuffer(copyCmd, copyQueue);
|
||||||
}
|
}
|
||||||
|
|
@ -477,7 +477,7 @@ namespace vks
|
||||||
|
|
||||||
// Image barrier for optimal image (target)
|
// Image barrier for optimal image (target)
|
||||||
// Optimal image will be used as destination for the copy
|
// Optimal image will be used as destination for the copy
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -497,7 +497,7 @@ namespace vks
|
||||||
|
|
||||||
// Change texture image layout to shader read after all mip levels have been copied
|
// Change texture image layout to shader read after all mip levels have been copied
|
||||||
this->imageLayout = imageLayout;
|
this->imageLayout = imageLayout;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -688,7 +688,7 @@ namespace vks
|
||||||
subresourceRange.levelCount = mipLevels;
|
subresourceRange.levelCount = mipLevels;
|
||||||
subresourceRange.layerCount = layerCount;
|
subresourceRange.layerCount = layerCount;
|
||||||
|
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -707,7 +707,7 @@ namespace vks
|
||||||
|
|
||||||
// Change texture image layout to shader read after all faces have been copied
|
// Change texture image layout to shader read after all faces have been copied
|
||||||
this->imageLayout = imageLayout;
|
this->imageLayout = imageLayout;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -899,7 +899,7 @@ namespace vks
|
||||||
subresourceRange.levelCount = mipLevels;
|
subresourceRange.levelCount = mipLevels;
|
||||||
subresourceRange.layerCount = 6;
|
subresourceRange.layerCount = 6;
|
||||||
|
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -918,7 +918,7 @@ namespace vks
|
||||||
|
|
||||||
// Change texture image layout to shader read after all faces have been copied
|
// Change texture image layout to shader read after all faces have been copied
|
||||||
this->imageLayout = imageLayout;
|
this->imageLayout = imageLayout;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@
|
||||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
|
|
||||||
namespace vkTools
|
namespace vks
|
||||||
|
{
|
||||||
|
namespace tools
|
||||||
{
|
{
|
||||||
std::string errorString(VkResult errorCode)
|
std::string errorString(VkResult errorCode)
|
||||||
{
|
{
|
||||||
|
|
@ -344,3 +346,4 @@ namespace vkTools
|
||||||
return shaderModule;
|
return shaderModule;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
VkResult res = (f); \
|
VkResult res = (f); \
|
||||||
if (res != VK_SUCCESS) \
|
if (res != VK_SUCCESS) \
|
||||||
{ \
|
{ \
|
||||||
LOGE("Fatal : VkResult is \" %s \" in %s at line %d", vkTools::errorString(res).c_str(), __FILE__, __LINE__); \
|
LOGE("Fatal : VkResult is \" %s \" in %s at line %d", vks::tools::errorString(res).c_str(), __FILE__, __LINE__); \
|
||||||
assert(res == VK_SUCCESS); \
|
assert(res == VK_SUCCESS); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
@ -52,13 +52,15 @@
|
||||||
VkResult res = (f); \
|
VkResult res = (f); \
|
||||||
if (res != VK_SUCCESS) \
|
if (res != VK_SUCCESS) \
|
||||||
{ \
|
{ \
|
||||||
std::cout << "Fatal : VkResult is \"" << vkTools::errorString(res) << "\" in " << __FILE__ << " at line " << __LINE__ << std::endl; \
|
std::cout << "Fatal : VkResult is \"" << vks::tools::errorString(res) << "\" in " << __FILE__ << " at line " << __LINE__ << std::endl; \
|
||||||
assert(res == VK_SUCCESS); \
|
assert(res == VK_SUCCESS); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace vkTools
|
namespace vks
|
||||||
|
{
|
||||||
|
namespace tools
|
||||||
{
|
{
|
||||||
/** @brief Returns an error code as a string */
|
/** @brief Returns an error code as a string */
|
||||||
std::string errorString(VkResult errorCode);
|
std::string errorString(VkResult errorCode);
|
||||||
|
|
@ -104,3 +106,4 @@ namespace vkTools
|
||||||
// Note: GLSL support requires vendor-specific extensions to be enabled and is not a core-feature of Vulkan
|
// Note: GLSL support requires vendor-specific extensions to be enabled and is not a core-feature of Vulkan
|
||||||
VkShaderModule loadShaderGLSL(const char *fileName, VkDevice device, VkShaderStageFlagBits stage);
|
VkShaderModule loadShaderGLSL(const char *fileName, VkDevice device, VkShaderStageFlagBits stage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,9 +200,9 @@ VkPipelineShaderStageCreateInfo VulkanExampleBase::loadShader(std::string fileNa
|
||||||
shaderStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
shaderStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||||
shaderStage.stage = stage;
|
shaderStage.stage = stage;
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
shaderStage.module = vkTools::loadShader(androidApp->activity->assetManager, fileName.c_str(), device, stage);
|
shaderStage.module = vks::tools::loadShader(androidApp->activity->assetManager, fileName.c_str(), device, stage);
|
||||||
#else
|
#else
|
||||||
shaderStage.module = vkTools::loadShader(fileName.c_str(), device, stage);
|
shaderStage.module = vks::tools::loadShader(fileName.c_str(), device, stage);
|
||||||
#endif
|
#endif
|
||||||
shaderStage.pName = "main"; // todo : make param
|
shaderStage.pName = "main"; // todo : make param
|
||||||
assert(shaderStage.module != NULL);
|
assert(shaderStage.module != NULL);
|
||||||
|
|
@ -721,7 +721,7 @@ void VulkanExampleBase::initVulkan()
|
||||||
err = createInstance(settings.validation);
|
err = createInstance(settings.validation);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Could not create Vulkan instance : \n" + vkTools::errorString(err), "Fatal error");
|
vks::tools::exitFatal("Could not create Vulkan instance : \n" + vks::tools::errorString(err), "Fatal error");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
|
|
@ -748,7 +748,7 @@ void VulkanExampleBase::initVulkan()
|
||||||
err = vkEnumeratePhysicalDevices(instance, &gpuCount, physicalDevices.data());
|
err = vkEnumeratePhysicalDevices(instance, &gpuCount, physicalDevices.data());
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Could not enumerate physical devices : \n" + vkTools::errorString(err), "Fatal error");
|
vks::tools::exitFatal("Could not enumerate physical devices : \n" + vks::tools::errorString(err), "Fatal error");
|
||||||
}
|
}
|
||||||
|
|
||||||
// GPU selection
|
// GPU selection
|
||||||
|
|
@ -799,7 +799,7 @@ void VulkanExampleBase::initVulkan()
|
||||||
VkPhysicalDeviceProperties deviceProperties;
|
VkPhysicalDeviceProperties deviceProperties;
|
||||||
vkGetPhysicalDeviceProperties(devices[i], &deviceProperties);
|
vkGetPhysicalDeviceProperties(devices[i], &deviceProperties);
|
||||||
std::cout << "Device [" << i << "] : " << deviceProperties.deviceName << std::endl;
|
std::cout << "Device [" << i << "] : " << deviceProperties.deviceName << std::endl;
|
||||||
std::cout << " Type: " << vkTools::physicalDeviceTypeString(deviceProperties.deviceType) << std::endl;
|
std::cout << " Type: " << vks::tools::physicalDeviceTypeString(deviceProperties.deviceType) << std::endl;
|
||||||
std::cout << " API: " << (deviceProperties.apiVersion >> 22) << "." << ((deviceProperties.apiVersion >> 12) & 0x3ff) << "." << (deviceProperties.apiVersion & 0xfff) << std::endl;
|
std::cout << " API: " << (deviceProperties.apiVersion >> 22) << "." << ((deviceProperties.apiVersion >> 12) & 0x3ff) << "." << (deviceProperties.apiVersion & 0xfff) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -815,7 +815,7 @@ void VulkanExampleBase::initVulkan()
|
||||||
vulkanDevice = new vks::VulkanDevice(physicalDevice);
|
vulkanDevice = new vks::VulkanDevice(physicalDevice);
|
||||||
VkResult res = vulkanDevice->createLogicalDevice(enabledFeatures, enabledExtensions);
|
VkResult res = vulkanDevice->createLogicalDevice(enabledFeatures, enabledExtensions);
|
||||||
if (res != VK_SUCCESS) {
|
if (res != VK_SUCCESS) {
|
||||||
vkTools::exitFatal("Could not create Vulkan device: \n" + vkTools::errorString(res), "Fatal error");
|
vks::tools::exitFatal("Could not create Vulkan device: \n" + vks::tools::errorString(res), "Fatal error");
|
||||||
}
|
}
|
||||||
device = vulkanDevice->logicalDevice;
|
device = vulkanDevice->logicalDevice;
|
||||||
|
|
||||||
|
|
@ -831,7 +831,7 @@ void VulkanExampleBase::initVulkan()
|
||||||
vkGetDeviceQueue(device, vulkanDevice->queueFamilyIndices.graphics, 0, &queue);
|
vkGetDeviceQueue(device, vulkanDevice->queueFamilyIndices.graphics, 0, &queue);
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &depthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &depthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
swapChain.connect(instance, physicalDevice, device);
|
swapChain.connect(instance, physicalDevice, device);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
|
|
||||||
#include "keycodes.hpp"
|
#include "keycodes.hpp"
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
#include "VulkanDebug.h"
|
#include "VulkanDebug.h"
|
||||||
|
|
||||||
#include "VulkanInitializers.hpp"
|
#include "VulkanInitializers.hpp"
|
||||||
|
|
@ -127,7 +127,7 @@ protected:
|
||||||
VkSemaphore textOverlayComplete;
|
VkSemaphore textOverlayComplete;
|
||||||
} semaphores;
|
} semaphores;
|
||||||
// Simple texture loader
|
// Simple texture loader
|
||||||
//vkTools::VulkanTextureLoader *textureLoader = nullptr;
|
//vks::tools::VulkanTextureLoader *textureLoader = nullptr;
|
||||||
// Returns the base asset path (for shaders, models, textures) depending on the os
|
// Returns the base asset path (for shaders, models, textures) depending on the os
|
||||||
const std::string getAssetPath();
|
const std::string getAssetPath();
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#include "vulkanandroid.h"
|
#include "vulkanandroid.h"
|
||||||
|
|
@ -211,13 +211,13 @@ public:
|
||||||
// Exit if either a graphics or a presenting queue hasn't been found
|
// Exit if either a graphics or a presenting queue hasn't been found
|
||||||
if (graphicsQueueNodeIndex == UINT32_MAX || presentQueueNodeIndex == UINT32_MAX)
|
if (graphicsQueueNodeIndex == UINT32_MAX || presentQueueNodeIndex == UINT32_MAX)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Could not find a graphics and/or presenting queue!", "Fatal error");
|
vks::tools::exitFatal("Could not find a graphics and/or presenting queue!", "Fatal error");
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo : Add support for separate graphics and presenting queue
|
// todo : Add support for separate graphics and presenting queue
|
||||||
if (graphicsQueueNodeIndex != presentQueueNodeIndex)
|
if (graphicsQueueNodeIndex != presentQueueNodeIndex)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Separate graphics and presenting queues are not supported yet!", "Fatal error");
|
vks::tools::exitFatal("Separate graphics and presenting queues are not supported yet!", "Fatal error");
|
||||||
}
|
}
|
||||||
|
|
||||||
queueNodeIndex = graphicsQueueNodeIndex;
|
queueNodeIndex = graphicsQueueNodeIndex;
|
||||||
|
|
@ -576,7 +576,7 @@ public:
|
||||||
|
|
||||||
if(!foundMode)
|
if(!foundMode)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Can't find a display and a display mode!", "Fatal error");
|
vks::tools::exitFatal("Can't find a display and a display mode!", "Fatal error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -613,7 +613,7 @@ public:
|
||||||
|
|
||||||
if(bestPlaneIndex == UINT32_MAX)
|
if(bestPlaneIndex == UINT32_MAX)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Can't find a plane for displaying!", "Fatal error");
|
vks::tools::exitFatal("Can't find a plane for displaying!", "Fatal error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -651,7 +651,7 @@ public:
|
||||||
VkResult result = vkCreateDisplayPlaneSurfaceKHR(instance, &surfaceInfo, NULL, &surface);
|
VkResult result = vkCreateDisplayPlaneSurfaceKHR(instance, &surfaceInfo, NULL, &surface);
|
||||||
if(result !=VK_SUCCESS)
|
if(result !=VK_SUCCESS)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Failed to create surface!", "Fatal error");
|
vks::tools::exitFatal("Failed to create surface!", "Fatal error");
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] pDisplays;
|
delete[] pDisplays;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
#include "VulkanDebug.h"
|
#include "VulkanDebug.h"
|
||||||
#include "VulkanBuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
|
|
@ -224,7 +224,7 @@ public:
|
||||||
VK_CHECK_RESULT(vkBeginCommandBuffer(copyCmd, &cmdBufInfo));
|
VK_CHECK_RESULT(vkBeginCommandBuffer(copyCmd, &cmdBufInfo));
|
||||||
|
|
||||||
// Prepare for transfer
|
// Prepare for transfer
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -249,7 +249,7 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
// Prepare for shader read
|
// Prepare for shader read
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ public:
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkFormat fbDepthFormat;
|
VkFormat fbDepthFormat;
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
// Create a separate render pass for the offscreen rendering as it may differ from the one used for scene rendering
|
// Create a separate render pass for the offscreen rendering as it may differ from the one used for scene rendering
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ public:
|
||||||
VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||||
|
|
||||||
tex->imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
tex->imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
layoutCmd, tex->image,
|
layoutCmd, tex->image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
VK_IMAGE_LAYOUT_UNDEFINED,
|
VK_IMAGE_LAYOUT_UNDEFINED,
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ public:
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkFormat fbDepthFormat;
|
VkFormat fbDepthFormat;
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
// Color attachment
|
// Color attachment
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ public:
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkFormat attDepthFormat;
|
VkFormat attDepthFormat;
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
createAttachment(
|
createAttachment(
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ public:
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkFormat attDepthFormat;
|
VkFormat attDepthFormat;
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
createAttachment(
|
createAttachment(
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ public:
|
||||||
VK_CHECK_RESULT(frameBuffers.shadow->createRenderPass());
|
VK_CHECK_RESULT(frameBuffers.shadow->createRenderPass());
|
||||||
|
|
||||||
VkCommandBuffer cmdBuf = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
VkCommandBuffer cmdBuf = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
cmdBuf,
|
cmdBuf,
|
||||||
frameBuffers.shadow->attachments[0].image,
|
frameBuffers.shadow->attachments[0].image,
|
||||||
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT,
|
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT,
|
||||||
|
|
@ -303,7 +303,7 @@ public:
|
||||||
// Depth attachment
|
// Depth attachment
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkFormat attDepthFormat;
|
VkFormat attDepthFormat;
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
attachmentInfo.format = attDepthFormat;
|
attachmentInfo.format = attDepthFormat;
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,7 @@ public:
|
||||||
// Check if device supports tessellation shaders
|
// Check if device supports tessellation shaders
|
||||||
if (!deviceFeatures.tessellationShader)
|
if (!deviceFeatures.tessellationShader)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Selected GPU does not support tessellation shaders!", "Feature not supported");
|
vks::tools::exitFatal("Selected GPU does not support tessellation shaders!", "Feature not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
VulkanExampleBase::prepare();
|
VulkanExampleBase::prepare();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
|
|
||||||
#include "vulkantools.h"
|
#include "VulkanTools.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "VulkanBuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ public:
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkFormat fbDepthFormat;
|
VkFormat fbDepthFormat;
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
// Color attachment
|
// Color attachment
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ public:
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkFormat fbDepthFormat;
|
VkFormat fbDepthFormat;
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
// Color attachment
|
// Color attachment
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ public:
|
||||||
VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||||
|
|
||||||
tex->imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
tex->imageLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
layoutCmd,
|
layoutCmd,
|
||||||
tex->image,
|
tex->image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ public:
|
||||||
VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||||
|
|
||||||
// Transition destination image to transfer destination layout
|
// Transition destination image to transfer destination layout
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
dstImage,
|
dstImage,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -402,7 +402,7 @@ public:
|
||||||
VK_PIPELINE_STAGE_TRANSFER_BIT);
|
VK_PIPELINE_STAGE_TRANSFER_BIT);
|
||||||
|
|
||||||
// Transition swapchain image from present to transfer source layout
|
// Transition swapchain image from present to transfer source layout
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
srcImage,
|
srcImage,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -434,7 +434,7 @@ public:
|
||||||
VK_FILTER_NEAREST);
|
VK_FILTER_NEAREST);
|
||||||
|
|
||||||
// Transition destination image to general layout, which is the required layout for mapping the image memory later on
|
// Transition destination image to general layout, which is the required layout for mapping the image memory later on
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
dstImage,
|
dstImage,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -444,7 +444,7 @@ public:
|
||||||
VK_PIPELINE_STAGE_TRANSFER_BIT);
|
VK_PIPELINE_STAGE_TRANSFER_BIT);
|
||||||
|
|
||||||
// Transition back the swap chain image after the blit is done
|
// Transition back the swap chain image after the blit is done
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
srcImage,
|
srcImage,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ public:
|
||||||
subresourceRange.baseMipLevel = 0;
|
subresourceRange.baseMipLevel = 0;
|
||||||
subresourceRange.levelCount = 1;
|
subresourceRange.levelCount = 1;
|
||||||
subresourceRange.layerCount = 6;
|
subresourceRange.layerCount = 6;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
layoutCmd,
|
layoutCmd,
|
||||||
shadowCubeMap.image,
|
shadowCubeMap.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -312,7 +312,7 @@ public:
|
||||||
|
|
||||||
VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true);
|
||||||
|
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
layoutCmd,
|
layoutCmd,
|
||||||
offscreenPass.color.image,
|
offscreenPass.color.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -344,7 +344,7 @@ public:
|
||||||
VK_CHECK_RESULT(vkAllocateMemory(device, &memAlloc, nullptr, &offscreenPass.depth.mem));
|
VK_CHECK_RESULT(vkAllocateMemory(device, &memAlloc, nullptr, &offscreenPass.depth.mem));
|
||||||
VK_CHECK_RESULT(vkBindImageMemory(device, offscreenPass.depth.image, offscreenPass.depth.mem, 0));
|
VK_CHECK_RESULT(vkBindImageMemory(device, offscreenPass.depth.image, offscreenPass.depth.mem, 0));
|
||||||
|
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
layoutCmd,
|
layoutCmd,
|
||||||
offscreenPass.depth.image,
|
offscreenPass.depth.image,
|
||||||
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT,
|
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT,
|
||||||
|
|
@ -441,7 +441,7 @@ public:
|
||||||
|
|
||||||
vkCmdEndRenderPass(offscreenPass.commandBuffer);
|
vkCmdEndRenderPass(offscreenPass.commandBuffer);
|
||||||
// Make sure color writes to the framebuffer are finished before using it as transfer source
|
// Make sure color writes to the framebuffer are finished before using it as transfer source
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
offscreenPass.commandBuffer,
|
offscreenPass.commandBuffer,
|
||||||
offscreenPass.color.image,
|
offscreenPass.color.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -478,7 +478,7 @@ public:
|
||||||
©Region);
|
©Region);
|
||||||
|
|
||||||
// Transform framebuffer color attachment back
|
// Transform framebuffer color attachment back
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
offscreenPass.commandBuffer,
|
offscreenPass.commandBuffer,
|
||||||
offscreenPass.color.image,
|
offscreenPass.color.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -517,7 +517,7 @@ public:
|
||||||
subresourceRange.layerCount = 6;
|
subresourceRange.layerCount = 6;
|
||||||
|
|
||||||
// Change image layout for all cubemap faces to transfer destination
|
// Change image layout for all cubemap faces to transfer destination
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
offscreenPass.commandBuffer,
|
offscreenPass.commandBuffer,
|
||||||
shadowCubeMap.image,
|
shadowCubeMap.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -531,7 +531,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change image layout for all cubemap faces to shader read after they have been copied
|
// Change image layout for all cubemap faces to shader read after they have been copied
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
offscreenPass.commandBuffer,
|
offscreenPass.commandBuffer,
|
||||||
shadowCubeMap.image,
|
shadowCubeMap.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -794,7 +794,7 @@ public:
|
||||||
VkAttachmentDescription osAttachments[2] = {};
|
VkAttachmentDescription osAttachments[2] = {};
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &fbDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
osAttachments[0].format = FB_COLOR_FORMAT;
|
osAttachments[0].format = FB_COLOR_FORMAT;
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ public:
|
||||||
|
|
||||||
// Find a suitable depth format
|
// Find a suitable depth format
|
||||||
VkFormat attDepthFormat;
|
VkFormat attDepthFormat;
|
||||||
VkBool32 validDepthFormat = vkTools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
VkBool32 validDepthFormat = vks::tools::getSupportedDepthFormat(physicalDevice, &attDepthFormat);
|
||||||
assert(validDepthFormat);
|
assert(validDepthFormat);
|
||||||
|
|
||||||
// G-Buffer
|
// G-Buffer
|
||||||
|
|
|
||||||
|
|
@ -879,7 +879,7 @@ public:
|
||||||
// Check if device supports tessellation shaders
|
// Check if device supports tessellation shaders
|
||||||
if (!deviceFeatures.tessellationShader)
|
if (!deviceFeatures.tessellationShader)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Selected GPU does not support tessellation shaders!", "Feature not supported");
|
vks::tools::exitFatal("Selected GPU does not support tessellation shaders!", "Feature not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
VulkanExampleBase::prepare();
|
VulkanExampleBase::prepare();
|
||||||
|
|
|
||||||
|
|
@ -489,7 +489,7 @@ public:
|
||||||
// Check if device supports tessellation shaders
|
// Check if device supports tessellation shaders
|
||||||
if (!deviceFeatures.tessellationShader)
|
if (!deviceFeatures.tessellationShader)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Selected GPU does not support tessellation shaders!", "Feature not supported");
|
vks::tools::exitFatal("Selected GPU does not support tessellation shaders!", "Feature not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
VulkanExampleBase::prepare();
|
VulkanExampleBase::prepare();
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ public:
|
||||||
VK_CHECK_RESULT(vkBeginCommandBuffer(copyCmd, &cmdBufInfo));
|
VK_CHECK_RESULT(vkBeginCommandBuffer(copyCmd, &cmdBufInfo));
|
||||||
|
|
||||||
// Prepare for transfer
|
// Prepare for transfer
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -265,7 +265,7 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
// Prepare for shader read
|
// Prepare for shader read
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
image,
|
image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ public:
|
||||||
imageMemoryBarrier.subresourceRange = subresourceRange;
|
imageMemoryBarrier.subresourceRange = subresourceRange;
|
||||||
|
|
||||||
// Only sets masks for layouts used in this example
|
// Only sets masks for layouts used in this example
|
||||||
// For a more complete version that can be used with other layouts see vkTools::setImageLayout
|
// For a more complete version that can be used with other layouts see vks::tools::setImageLayout
|
||||||
|
|
||||||
// Source layouts (old)
|
// Source layouts (old)
|
||||||
switch (oldImageLayout)
|
switch (oldImageLayout)
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,7 @@ public:
|
||||||
|
|
||||||
// Optimal image will be used as destination for the copy, so we must transfer from our
|
// Optimal image will be used as destination for the copy, so we must transfer from our
|
||||||
// initial undefined image layout to the transfer destination layout
|
// initial undefined image layout to the transfer destination layout
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
texture.image,
|
texture.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -427,7 +427,7 @@ public:
|
||||||
|
|
||||||
// Change texture image layout to shader read after all mip levels have been copied
|
// Change texture image layout to shader read after all mip levels have been copied
|
||||||
texture.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
texture.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
texture.image,
|
texture.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ public:
|
||||||
subresourceRange.levelCount = 1;
|
subresourceRange.levelCount = 1;
|
||||||
subresourceRange.layerCount = layerCount;
|
subresourceRange.layerCount = layerCount;
|
||||||
|
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
textureArray.image,
|
textureArray.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -270,7 +270,7 @@ public:
|
||||||
|
|
||||||
// Change texture image layout to shader read after all faces have been copied
|
// Change texture image layout to shader read after all faces have been copied
|
||||||
textureArray.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
textureArray.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
textureArray.image,
|
textureArray.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ public:
|
||||||
subresourceRange.levelCount = cubeMap.mipLevels;
|
subresourceRange.levelCount = cubeMap.mipLevels;
|
||||||
subresourceRange.layerCount = 6;
|
subresourceRange.layerCount = 6;
|
||||||
|
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
cubeMap.image,
|
cubeMap.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -249,7 +249,7 @@ public:
|
||||||
|
|
||||||
// Change texture image layout to shader read after all faces have been copied
|
// Change texture image layout to shader read after all faces have been copied
|
||||||
cubeMap.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
cubeMap.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
cubeMap.image,
|
cubeMap.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ public:
|
||||||
subresourceRange.layerCount = 1;
|
subresourceRange.layerCount = 1;
|
||||||
|
|
||||||
// Optimal image will be used as destination for the copy, so we must transfer from our initial undefined image layout to the transfer destination layout
|
// Optimal image will be used as destination for the copy, so we must transfer from our initial undefined image layout to the transfer destination layout
|
||||||
vkTools::setImageLayout(copyCmd, texture.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresourceRange);
|
vks::tools::setImageLayout(copyCmd, texture.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresourceRange);
|
||||||
|
|
||||||
// Copy the first mip of the chain, remaining mips will be generated
|
// Copy the first mip of the chain, remaining mips will be generated
|
||||||
VkBufferImageCopy bufferCopyRegion = {};
|
VkBufferImageCopy bufferCopyRegion = {};
|
||||||
|
|
@ -217,7 +217,7 @@ public:
|
||||||
|
|
||||||
// Transition first mip level to transfer source for read during blit
|
// Transition first mip level to transfer source for read during blit
|
||||||
texture.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
texture.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
copyCmd,
|
copyCmd,
|
||||||
texture.image,
|
texture.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -265,7 +265,7 @@ public:
|
||||||
mipSubRange.layerCount = 1;
|
mipSubRange.layerCount = 1;
|
||||||
|
|
||||||
// Transiton current mip level to transfer dest
|
// Transiton current mip level to transfer dest
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
blitCmd,
|
blitCmd,
|
||||||
texture.image,
|
texture.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -287,7 +287,7 @@ public:
|
||||||
VK_FILTER_LINEAR);
|
VK_FILTER_LINEAR);
|
||||||
|
|
||||||
// Transiton current mip level to transfer source for read in next iteration
|
// Transiton current mip level to transfer source for read in next iteration
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
blitCmd,
|
blitCmd,
|
||||||
texture.image,
|
texture.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
@ -300,7 +300,7 @@ public:
|
||||||
|
|
||||||
// After the loop, all mip layers are in TRANSFER_SRC layout, so transition all to SHADER_READ
|
// After the loop, all mip layers are in TRANSFER_SRC layout, so transition all to SHADER_READ
|
||||||
subresourceRange.levelCount = texture.mipLevels;
|
subresourceRange.levelCount = texture.mipLevels;
|
||||||
vkTools::setImageLayout(
|
vks::tools::setImageLayout(
|
||||||
blitCmd,
|
blitCmd,
|
||||||
texture.image,
|
texture.image,
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
|
||||||
|
|
@ -905,7 +905,7 @@ public:
|
||||||
// Check if the GPU supports sparse residency for 2D images
|
// Check if the GPU supports sparse residency for 2D images
|
||||||
if (!vulkanDevice->features.sparseResidencyImage2D)
|
if (!vulkanDevice->features.sparseResidencyImage2D)
|
||||||
{
|
{
|
||||||
vkTools::exitFatal("Device does not support sparse residency for 2D images!", "Feature not supported");
|
vks::tools::exitFatal("Device does not support sparse residency for 2D images!", "Feature not supported");
|
||||||
}
|
}
|
||||||
loadAssets();
|
loadAssets();
|
||||||
generateTerrain();
|
generateTerrain();
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Base", "Base", "{09B9A54B-F
|
||||||
base\vulkanswapchain.hpp = base\vulkanswapchain.hpp
|
base\vulkanswapchain.hpp = base\vulkanswapchain.hpp
|
||||||
base\vulkantextoverlay.hpp = base\vulkantextoverlay.hpp
|
base\vulkantextoverlay.hpp = base\vulkantextoverlay.hpp
|
||||||
base\VulkanTexture.hpp = base\VulkanTexture.hpp
|
base\VulkanTexture.hpp = base\VulkanTexture.hpp
|
||||||
base\vulkantools.cpp = base\vulkantools.cpp
|
base\VulkanTools.h = base\VulkanTools.h
|
||||||
base\vulkantools.h = base\vulkantools.h
|
base\VulkanTools.hpp = base\VulkanTools.hpp
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "indirectdraw", "indirectdraw\indirectdraw.vcxproj", "{2BBDD10F-2C9D-4BEA-8C7B-1C510A2CE08B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "indirectdraw", "indirectdraw\indirectdraw.vcxproj", "{2BBDD10F-2C9D-4BEA-8C7B-1C510A2CE08B}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue