Fix minor stuff
This commit is contained in:
parent
33e60a97b6
commit
385927b05a
|
|
@ -8,8 +8,8 @@
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline VulkanBuffer::VulkanBuffer(Vk::Device& device, BufferType type) :
|
inline VulkanBuffer::VulkanBuffer(Vk::Device& device, BufferType type) :
|
||||||
m_device(device),
|
m_type(type),
|
||||||
m_type(type)
|
m_device(device)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,14 +120,7 @@ namespace Nz
|
||||||
|
|
||||||
inline void CommandBuffer::BeginDebugRegion(const char* label)
|
inline void CommandBuffer::BeginDebugRegion(const char* label)
|
||||||
{
|
{
|
||||||
Vk::Device* device = m_pool->GetDevice();
|
return BeginDebugRegion(label, Nz::Color(0, 0, 0, 0));
|
||||||
if (device->vkCmdBeginDebugUtilsLabelEXT)
|
|
||||||
{
|
|
||||||
VkDebugUtilsLabelEXT debugLabel = { VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT };
|
|
||||||
debugLabel.pLabelName = label;
|
|
||||||
|
|
||||||
device->vkCmdBeginDebugUtilsLabelEXT(m_handle, &debugLabel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CommandBuffer::BeginDebugRegion(const char* label, Nz::Color color)
|
inline void CommandBuffer::BeginDebugRegion(const char* label, Nz::Color color)
|
||||||
|
|
@ -135,12 +128,17 @@ namespace Nz
|
||||||
Vk::Device* device = m_pool->GetDevice();
|
Vk::Device* device = m_pool->GetDevice();
|
||||||
if (device->vkCmdBeginDebugUtilsLabelEXT)
|
if (device->vkCmdBeginDebugUtilsLabelEXT)
|
||||||
{
|
{
|
||||||
VkDebugUtilsLabelEXT debugLabel = { VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT };
|
VkDebugUtilsLabelEXT debugLabel = {
|
||||||
debugLabel.pLabelName = label;
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
|
||||||
debugLabel.color[0] = color.r / 255.f;
|
nullptr,
|
||||||
debugLabel.color[1] = color.g / 255.f;
|
label,
|
||||||
debugLabel.color[2] = color.b / 255.f;
|
{
|
||||||
debugLabel.color[3] = color.a / 255.f;
|
color.r / 255.f,
|
||||||
|
color.g / 255.f,
|
||||||
|
color.b / 255.f,
|
||||||
|
color.a / 255.f
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
device->vkCmdBeginDebugUtilsLabelEXT(m_handle, &debugLabel);
|
device->vkCmdBeginDebugUtilsLabelEXT(m_handle, &debugLabel);
|
||||||
}
|
}
|
||||||
|
|
@ -299,14 +297,7 @@ namespace Nz
|
||||||
|
|
||||||
inline void CommandBuffer::InsertDebugLabel(const char* label)
|
inline void CommandBuffer::InsertDebugLabel(const char* label)
|
||||||
{
|
{
|
||||||
Vk::Device* device = m_pool->GetDevice();
|
return InsertDebugLabel(label, Nz::Color(0, 0, 0, 0));
|
||||||
if (device->vkCmdInsertDebugUtilsLabelEXT)
|
|
||||||
{
|
|
||||||
VkDebugUtilsLabelEXT debugLabel = { VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT };
|
|
||||||
debugLabel.pLabelName = label;
|
|
||||||
|
|
||||||
device->vkCmdInsertDebugUtilsLabelEXT(m_handle, &debugLabel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CommandBuffer::InsertDebugLabel(const char* label, Nz::Color color)
|
inline void CommandBuffer::InsertDebugLabel(const char* label, Nz::Color color)
|
||||||
|
|
@ -314,12 +305,17 @@ namespace Nz
|
||||||
Vk::Device* device = m_pool->GetDevice();
|
Vk::Device* device = m_pool->GetDevice();
|
||||||
if (device->vkCmdInsertDebugUtilsLabelEXT)
|
if (device->vkCmdInsertDebugUtilsLabelEXT)
|
||||||
{
|
{
|
||||||
VkDebugUtilsLabelEXT debugLabel = { VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT };
|
VkDebugUtilsLabelEXT debugLabel = {
|
||||||
debugLabel.pLabelName = label;
|
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
|
||||||
debugLabel.color[0] = color.r / 255.f;
|
nullptr,
|
||||||
debugLabel.color[1] = color.g / 255.f;
|
label,
|
||||||
debugLabel.color[2] = color.b / 255.f;
|
{
|
||||||
debugLabel.color[3] = color.a / 255.f;
|
color.r / 255.f,
|
||||||
|
color.g / 255.f,
|
||||||
|
color.b / 255.f,
|
||||||
|
color.a / 255.f
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
device->vkCmdInsertDebugUtilsLabelEXT(m_handle, &debugLabel);
|
device->vkCmdInsertDebugUtilsLabelEXT(m_handle, &debugLabel);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ namespace Nz
|
||||||
~Instance();
|
~Instance();
|
||||||
|
|
||||||
bool Create(const VkInstanceCreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
bool Create(const VkInstanceCreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
||||||
inline bool Create(const std::string& appName, UInt32 appVersion, const std::string& engineName, UInt32 engineVersion, const std::vector<const char*>& layers, const std::vector<const char*>& extensions, const VkAllocationCallbacks* allocator = nullptr);
|
inline bool Create(const std::string& appName, UInt32 appVersion, const std::string& engineName, UInt32 engineVersion, UInt32 apiVersion, const std::vector<const char*>& layers, const std::vector<const char*>& extensions, const VkAllocationCallbacks* allocator = nullptr);
|
||||||
inline void Destroy();
|
inline void Destroy();
|
||||||
|
|
||||||
bool EnumeratePhysicalDevices(std::vector<VkPhysicalDevice>* physicalDevices);
|
bool EnumeratePhysicalDevices(std::vector<VkPhysicalDevice>* physicalDevices);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
namespace Vk
|
namespace Vk
|
||||||
{
|
{
|
||||||
inline bool Instance::Create(const std::string& appName, UInt32 appVersion, const std::string& engineName, UInt32 engineVersion, const std::vector<const char*>& layers, const std::vector<const char*>& extensions, const VkAllocationCallbacks* allocator)
|
inline bool Instance::Create(const std::string& appName, UInt32 appVersion, const std::string& engineName, UInt32 engineVersion, UInt32 apiVersion, const std::vector<const char*>& layers, const std::vector<const char*>& extensions, const VkAllocationCallbacks* allocator)
|
||||||
{
|
{
|
||||||
VkApplicationInfo appInfo =
|
VkApplicationInfo appInfo =
|
||||||
{
|
{
|
||||||
|
|
@ -21,7 +21,8 @@ namespace Nz
|
||||||
appName.data(),
|
appName.data(),
|
||||||
appVersion,
|
appVersion,
|
||||||
engineName.data(),
|
engineName.data(),
|
||||||
engineVersion
|
engineVersion,
|
||||||
|
apiVersion
|
||||||
};
|
};
|
||||||
|
|
||||||
VkInstanceCreateInfo instanceInfo =
|
VkInstanceCreateInfo instanceInfo =
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ namespace Nz
|
||||||
{
|
{
|
||||||
VkRenderWindow::VkRenderWindow(RenderWindow& owner) :
|
VkRenderWindow::VkRenderWindow(RenderWindow& owner) :
|
||||||
m_currentFrame(0),
|
m_currentFrame(0),
|
||||||
m_depthStencilFormat(VK_FORMAT_MAX_ENUM),
|
|
||||||
m_owner(owner),
|
m_owner(owner),
|
||||||
|
m_depthStencilFormat(VK_FORMAT_MAX_ENUM),
|
||||||
m_shouldRecreateSwapchain(false)
|
m_shouldRecreateSwapchain(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -221,21 +221,21 @@ namespace Nz
|
||||||
|
|
||||||
std::unique_ptr<CommandPool> VkRenderWindow::CreateCommandPool(QueueType queueType)
|
std::unique_ptr<CommandPool> VkRenderWindow::CreateCommandPool(QueueType queueType)
|
||||||
{
|
{
|
||||||
UInt32 queueFamilyIndex;
|
UInt32 queueFamilyIndex = [&] {
|
||||||
switch (queueType)
|
switch (queueType)
|
||||||
{
|
{
|
||||||
case QueueType::Compute:
|
case QueueType::Compute:
|
||||||
queueFamilyIndex = m_device->GetDefaultFamilyIndex(QueueType::Compute);
|
return m_device->GetDefaultFamilyIndex(QueueType::Compute);
|
||||||
break;
|
|
||||||
|
|
||||||
case QueueType::Graphics:
|
case QueueType::Graphics:
|
||||||
queueFamilyIndex = m_graphicsQueue.GetQueueFamilyIndex();
|
return m_graphicsQueue.GetQueueFamilyIndex();
|
||||||
break;
|
|
||||||
|
|
||||||
case QueueType::Transfer:
|
case QueueType::Transfer:
|
||||||
queueFamilyIndex = m_transferQueue.GetQueueFamilyIndex();
|
return m_transferQueue.GetQueueFamilyIndex();
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
throw std::runtime_error("invalid queue type " + std::to_string(UnderlyingCast(queueType)));
|
||||||
|
}();
|
||||||
|
|
||||||
return std::make_unique<VulkanCommandPool>(*m_device, queueFamilyIndex);
|
return std::make_unique<VulkanCommandPool>(*m_device, queueFamilyIndex);
|
||||||
}
|
}
|
||||||
|
|
@ -509,7 +509,7 @@ namespace Nz
|
||||||
imageCount = surfaceCapabilities.maxImageCount;
|
imageCount = surfaceCapabilities.maxImageCount;
|
||||||
|
|
||||||
VkExtent2D extent;
|
VkExtent2D extent;
|
||||||
if (surfaceCapabilities.currentExtent.width == -1)
|
if (surfaceCapabilities.currentExtent.width == 0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
extent.width = Nz::Clamp<Nz::UInt32>(size.x, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width);
|
extent.width = Nz::Clamp<Nz::UInt32>(size.x, surfaceCapabilities.minImageExtent.width, surfaceCapabilities.maxImageExtent.width);
|
||||||
extent.height = Nz::Clamp<Nz::UInt32>(size.y, surfaceCapabilities.minImageExtent.height, surfaceCapabilities.maxImageExtent.height);
|
extent.height = Nz::Clamp<Nz::UInt32>(size.y, surfaceCapabilities.minImageExtent.height, surfaceCapabilities.maxImageExtent.height);
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,6 @@ namespace Nz
|
||||||
throw std::runtime_error("Unhandled framebuffer type " + std::to_string(UnderlyingCast(vkFramebuffer.GetType())));
|
throw std::runtime_error("Unhandled framebuffer type " + std::to_string(UnderlyingCast(vkFramebuffer.GetType())));
|
||||||
}();
|
}();
|
||||||
|
|
||||||
VkRect2D renderArea;
|
|
||||||
renderArea.offset.x = renderRect.x;
|
|
||||||
renderArea.offset.y = renderRect.y;
|
|
||||||
renderArea.extent.width = renderRect.width;
|
|
||||||
renderArea.extent.height = renderRect.height;
|
|
||||||
|
|
||||||
StackArray<VkClearValue> vkClearValues = NazaraStackArray(VkClearValue, clearValues.size());
|
StackArray<VkClearValue> vkClearValues = NazaraStackArray(VkClearValue, clearValues.size());
|
||||||
|
|
||||||
std::size_t index = 0;
|
std::size_t index = 0;
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ namespace Nz
|
||||||
|
|
||||||
default:
|
default:
|
||||||
NazaraWarning("Device " + device.name + " has handled device type (0x" + String::Number(physDevice.properties.deviceType, 16) + ')');
|
NazaraWarning("Device " + device.name + " has handled device type (0x" + String::Number(physDevice.properties.deviceType, 16) + ')');
|
||||||
|
// fallthrough
|
||||||
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
|
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
|
||||||
device.type = RenderDeviceType::Unknown;
|
device.type = RenderDeviceType::Unknown;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue