mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
Fix code to make clang happy
This commit is contained in:
parent
fa34a8c583
commit
3df5cfbc02
@ -129,7 +129,7 @@ namespace engine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkFilter getTextureFilter(gfx::TextureFilter filter)
|
[[maybe_unused]] static VkFilter getTextureFilter(gfx::TextureFilter filter)
|
||||||
{
|
{
|
||||||
switch (filter) {
|
switch (filter) {
|
||||||
case gfx::TextureFilter::LINEAR:
|
case gfx::TextureFilter::LINEAR:
|
||||||
@ -140,7 +140,7 @@ namespace engine {
|
|||||||
throw std::runtime_error("Unknown texture filter");
|
throw std::runtime_error("Unknown texture filter");
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkSampleCountFlags getSampleCountFlags(gfx::MSAALevel level)
|
[[maybe_unused]] static VkSampleCountFlags getSampleCountFlags(gfx::MSAALevel level)
|
||||||
{
|
{
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case gfx::MSAALevel::MSAA_OFF:
|
case gfx::MSAALevel::MSAA_OFF:
|
||||||
@ -622,7 +622,7 @@ namespace engine {
|
|||||||
|
|
||||||
/* make synchronisation primitives for rendering and allocate command buffers */
|
/* make synchronisation primitives for rendering and allocate command buffers */
|
||||||
|
|
||||||
for (int i = 0; i < FRAMES_IN_FLIGHT; i++) {
|
for (uint32_t i = 0; i < FRAMES_IN_FLIGHT; i++) {
|
||||||
VkFenceCreateInfo fenceInfo{
|
VkFenceCreateInfo fenceInfo{
|
||||||
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
|
||||||
.pNext = nullptr,
|
.pNext = nullptr,
|
||||||
@ -656,10 +656,9 @@ namespace engine {
|
|||||||
std::vector<VkDescriptorPoolSize> poolSizes{};
|
std::vector<VkDescriptorPoolSize> poolSizes{};
|
||||||
poolSizes.emplace_back(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 5); // purposely low limit
|
poolSizes.emplace_back(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 5); // purposely low limit
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo descriptorPoolInfo{
|
VkDescriptorPoolCreateInfo descriptorPoolInfo{};
|
||||||
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
descriptorPoolInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||||
.pNext = nullptr,
|
descriptorPoolInfo.pNext = nullptr;
|
||||||
};
|
|
||||||
descriptorPoolInfo.flags = 0;
|
descriptorPoolInfo.flags = 0;
|
||||||
descriptorPoolInfo.maxSets = 5; // purposely low limit
|
descriptorPoolInfo.maxSets = 5; // purposely low limit
|
||||||
descriptorPoolInfo.poolSizeCount = poolSizes.size();
|
descriptorPoolInfo.poolSizeCount = poolSizes.size();
|
||||||
@ -672,7 +671,7 @@ namespace engine {
|
|||||||
{
|
{
|
||||||
vkDestroyDescriptorPool(pimpl->device.device, pimpl->descriptorPool, nullptr);
|
vkDestroyDescriptorPool(pimpl->device.device, pimpl->descriptorPool, nullptr);
|
||||||
|
|
||||||
for (int i = 0; i < FRAMES_IN_FLIGHT; i++) {
|
for (uint32_t i = 0; i < FRAMES_IN_FLIGHT; i++) {
|
||||||
vkFreeCommandBuffers(pimpl->device.device, pimpl->device.commandPools.draw, 1, &pimpl->frameData[i].drawBuf);
|
vkFreeCommandBuffers(pimpl->device.device, pimpl->device.commandPools.draw, 1, &pimpl->frameData[i].drawBuf);
|
||||||
vkDestroySemaphore(pimpl->device.device, pimpl->frameData[i].renderSemaphore, nullptr);
|
vkDestroySemaphore(pimpl->device.device, pimpl->frameData[i].renderSemaphore, nullptr);
|
||||||
vkDestroySemaphore(pimpl->device.device, pimpl->frameData[i].presentSemaphore, nullptr);
|
vkDestroySemaphore(pimpl->device.device, pimpl->frameData[i].presentSemaphore, nullptr);
|
||||||
@ -758,10 +757,9 @@ namespace engine {
|
|||||||
clearValue.color.float32[2] = 1.0f;
|
clearValue.color.float32[2] = 1.0f;
|
||||||
clearValue.color.float32[3] = 1.0f;
|
clearValue.color.float32[3] = 1.0f;
|
||||||
|
|
||||||
VkRenderPassBeginInfo passBegin{
|
VkRenderPassBeginInfo passBegin{};
|
||||||
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
|
passBegin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
||||||
.pNext = nullptr
|
passBegin.pNext = nullptr;
|
||||||
};
|
|
||||||
passBegin.renderPass = pimpl->swapchain.renderpass;
|
passBegin.renderPass = pimpl->swapchain.renderpass;
|
||||||
passBegin.framebuffer = std::get<2>(pimpl->swapchain.images[swapchainImageIndex]);
|
passBegin.framebuffer = std::get<2>(pimpl->swapchain.images[swapchainImageIndex]);
|
||||||
passBegin.renderArea.extent = pimpl->swapchain.extent;
|
passBegin.renderArea.extent = pimpl->swapchain.extent;
|
||||||
@ -1115,10 +1113,9 @@ namespace engine {
|
|||||||
bindings[0].descriptorCount = 1; // if > 1, accessible as an array in the shader
|
bindings[0].descriptorCount = 1; // if > 1, accessible as an array in the shader
|
||||||
bindings[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT; // only accessible in vertex
|
bindings[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT; // only accessible in vertex
|
||||||
|
|
||||||
VkDescriptorSetLayoutCreateInfo info{
|
VkDescriptorSetLayoutCreateInfo info{};
|
||||||
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
|
info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
||||||
.pNext = nullptr
|
info.pNext = nullptr;
|
||||||
};
|
|
||||||
info.flags = 0;
|
info.flags = 0;
|
||||||
info.bindingCount = bindings.size();
|
info.bindingCount = bindings.size();
|
||||||
info.pBindings = bindings.data();
|
info.pBindings = bindings.data();
|
||||||
@ -1344,6 +1341,13 @@ namespace engine {
|
|||||||
gfx::MipmapSetting mipmapSetting,
|
gfx::MipmapSetting mipmapSetting,
|
||||||
bool useAnisotropy)
|
bool useAnisotropy)
|
||||||
{
|
{
|
||||||
|
(void)imageData;
|
||||||
|
(void)width;
|
||||||
|
(void)height;
|
||||||
|
(void)minFilter;
|
||||||
|
(void)magFilter;
|
||||||
|
(void)mipmapSetting;
|
||||||
|
(void)useAnisotropy;
|
||||||
auto out = new gfx::Texture;
|
auto out = new gfx::Texture;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -1544,6 +1548,7 @@ namespace engine {
|
|||||||
|
|
||||||
void GFXDevice::destroyTexture(const gfx::Texture* texture)
|
void GFXDevice::destroyTexture(const gfx::Texture* texture)
|
||||||
{
|
{
|
||||||
|
(void)texture;
|
||||||
#if 0
|
#if 0
|
||||||
vkDestroyDescriptorPool(pimpl->device, texture->pool, nullptr);
|
vkDestroyDescriptorPool(pimpl->device, texture->pool, nullptr);
|
||||||
vkDestroySampler(pimpl->device, texture->sampler, nullptr);
|
vkDestroySampler(pimpl->device, texture->sampler, nullptr);
|
||||||
@ -1562,4 +1567,4 @@ namespace engine {
|
|||||||
vkDeviceWaitIdle(pimpl->device.device);
|
vkDeviceWaitIdle(pimpl->device.device);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <Volk/volk.h>
|
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
@ -210,7 +209,7 @@ namespace engine {
|
|||||||
for (size_t i = 0; i < queueFamilies.size(); i++) {
|
for (size_t i = 0; i < queueFamilies.size(); i++) {
|
||||||
VkQueueFamilyProperties p = queueFamilies[i];
|
VkQueueFamilyProperties p = queueFamilies[i];
|
||||||
|
|
||||||
if (p.queueCount < 2) break; // need one queue for presenting and one-or-more for rendering
|
if (p.queueCount < 2) continue; // need one queue for presenting and one-or-more for rendering
|
||||||
|
|
||||||
if (p.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
if (p.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||||
VkBool32 supportsPresent;
|
VkBool32 supportsPresent;
|
||||||
@ -330,4 +329,4 @@ namespace engine {
|
|||||||
vkDestroyDevice(device.device, nullptr);
|
vkDestroyDevice(device.device, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <Volk/volk.h>
|
#include <volk.h>
|
||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
@ -36,4 +36,4 @@ namespace engine {
|
|||||||
Device createDevice(VkInstance instance, DeviceRequirements requirements, VkSurfaceKHR surface);
|
Device createDevice(VkInstance instance, DeviceRequirements requirements, VkSurfaceKHR surface);
|
||||||
void destroyDevice(Device device);
|
void destroyDevice(Device device);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <Volk/volk.h>
|
#include <volk.h>
|
||||||
|
|
||||||
#define VMA_STATIC_VULKAN_FUNCTIONS 0
|
#define VMA_STATIC_VULKAN_FUNCTIONS 0
|
||||||
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 0
|
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 0
|
||||||
#define VMA_VULKAN_VERSION 1003000
|
#define VMA_VULKAN_VERSION 1003000
|
||||||
#define VMA_IMPLEMENTATION
|
#define VMA_IMPLEMENTATION
|
||||||
#include <vma/vk_mem_alloc.h>
|
#include <vk_mem_alloc.h>
|
||||||
|
|
||||||
#include "gpu_allocator.h"
|
#include "gpu_allocator.h"
|
||||||
|
|
||||||
@ -71,4 +71,4 @@ namespace engine {
|
|||||||
vmaDestroyAllocator(allocator);
|
vmaDestroyAllocator(allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <vma/vk_mem_alloc.h>
|
#include <vk_mem_alloc.h>
|
||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
VmaAllocator createAllocator(VkInstance instance, VkDevice device, VkPhysicalDevice physicalDevice);
|
VmaAllocator createAllocator(VkInstance instance, VkDevice device, VkPhysicalDevice physicalDevice);
|
||||||
void destroyAllocator(VmaAllocator allocator);
|
void destroyAllocator(VmaAllocator allocator);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -148,16 +148,15 @@ namespace engine {
|
|||||||
|
|
||||||
const char* validationLayer = nullptr;
|
const char* validationLayer = nullptr;
|
||||||
if (useValidation) {
|
if (useValidation) {
|
||||||
const char* validationLayer = getValidationLayer();
|
validationLayer = getValidationLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDebugUtilsMessengerCreateInfoEXT debugMessengerInfo = getDebugMessengerCreateInfo(validationLevel);
|
VkDebugUtilsMessengerCreateInfoEXT debugMessengerInfo = getDebugMessengerCreateInfo(validationLevel);
|
||||||
|
|
||||||
VkInstanceCreateInfo instanceInfo{
|
VkInstanceCreateInfo instanceInfo{};
|
||||||
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
instanceInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
.pNext = &debugMessengerInfo,
|
instanceInfo.pNext = &debugMessengerInfo;
|
||||||
.flags = 0
|
instanceInfo.flags = 0;
|
||||||
};
|
|
||||||
instanceInfo.pApplicationInfo = &applicationInfo;
|
instanceInfo.pApplicationInfo = &applicationInfo;
|
||||||
if (validationLayer) {
|
if (validationLayer) {
|
||||||
instanceInfo.enabledLayerCount = 1;
|
instanceInfo.enabledLayerCount = 1;
|
||||||
@ -201,4 +200,4 @@ namespace engine {
|
|||||||
vkDestroyInstance(instance.instance, nullptr);
|
vkDestroyInstance(instance.instance, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <SDL2/SDL_video.h>
|
#include <SDL2/SDL_video.h>
|
||||||
|
|
||||||
#include <Volk/volk.h>
|
#include <volk.h>
|
||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
@ -21,4 +21,4 @@ namespace engine {
|
|||||||
Instance createVulkanInstance(SDL_Window* window, const char* appName, const char* appVersion, bool useValidation, MessageSeverity validationLevel = MessageSeverity::SEV_WARNING);
|
Instance createVulkanInstance(SDL_Window* window, const char* appName, const char* appVersion, bool useValidation, MessageSeverity validationLevel = MessageSeverity::SEV_WARNING);
|
||||||
void destroyVulkanInstance(Instance instance);
|
void destroyVulkanInstance(Instance instance);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <SDL2/SDL_vulkan.h>
|
#include <SDL2/SDL_vulkan.h>
|
||||||
|
|
||||||
#include <Volk/volk.h>
|
#include <volk.h>
|
||||||
|
|
||||||
namespace engine {
|
namespace engine {
|
||||||
|
|
||||||
@ -31,4 +31,4 @@ namespace engine {
|
|||||||
void createSwapchain(Swapchain* sc, const SwapchainInfo& info);
|
void createSwapchain(Swapchain* sc, const SwapchainInfo& info);
|
||||||
void destroySwapchain(const Swapchain& sc);
|
void destroySwapchain(const Swapchain& sc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user