vulkan: remove unnecessary quadindex code

This commit is contained in:
niki
2022-08-01 19:30:08 +02:00
parent dcea056fcb
commit 1647f6c9c2
6 changed files with 9 additions and 15 deletions
+2 -1
View File
@@ -2,9 +2,10 @@
#define LOVE_GRAPHICS_VULKAN_BUFFER_H
#include "graphics/Buffer.h"
#include "graphics/Volatile.h"
#include <vulkan/vulkan.h>
#include "vk_mem_alloc.h"
#include "graphics/Volatile.h"
namespace love {
+3 -12
View File
@@ -1266,7 +1266,6 @@ VkSampler Graphics::createSampler(const SamplerState& samplerState) {
VkPhysicalDeviceProperties properties{};
vkGetPhysicalDeviceProperties(physicalDevice, &properties);
// fixme: determine actual values
VkSamplerCreateInfo samplerInfo{};
samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
samplerInfo.magFilter = Vulkan::getFilter(samplerState.magFilter);
@@ -1511,18 +1510,10 @@ void Graphics::createDefaultTexture() {
standardTexture.reset((Texture*)newTexture(settings));
}
void Graphics::createQuadIndexBuffer() {
if (quadIndexBuffer != nullptr)
return;
size_t size = sizeof(uint16) * getIndexCount(TRIANGLEINDEX_QUADS, LOVE_UINT16_MAX);
quadIndexBuffer.reset((StreamBuffer*)newStreamBuffer(BUFFERUSAGE_INDEX, size));
auto map = quadIndexBuffer->map(size);
fillIndices(TRIANGLEINDEX_QUADS, 0, LOVE_UINT16_MAX, (uint16*)map.data);
quadIndexBuffer->unmap(size);
}
void Graphics::cleanup() {
delete quadIndexBuffer;
quadIndexBuffer = nullptr;
cleanupSwapChain();
for (auto &cleanUpFns : cleanUpFunctions) {
-2
View File
@@ -182,7 +182,6 @@ private:
void createCommandBuffers();
void createSyncObjects();
void createDefaultTexture();
void createQuadIndexBuffer();
void cleanup();
void cleanupSwapChain();
void recreateSwapChain();
@@ -230,7 +229,6 @@ private:
bool framebufferResized = false;
VmaAllocator vmaAllocator = VK_NULL_HANDLE;
std::unique_ptr<Texture> standardTexture = nullptr;
std::unique_ptr<StreamBuffer> quadIndexBuffer = nullptr;
// we need an array of draw buffers, since the frames are being rendered asynchronously
// and we can't (or shouldn't) update the contents of the buffers while they're still in flight / being rendered.
std::vector<BatchedDrawBuffers> batchedDrawBuffers;
+1
View File
@@ -4,6 +4,7 @@
#include <graphics/Shader.h>
#include <graphics/vulkan/ShaderStage.h>
#include "Vulkan.h"
#include <vulkan/vulkan.h>
#include <map>
@@ -3,6 +3,7 @@
#include "graphics/ShaderStage.h"
#include "modules/graphics/Graphics.h"
#include <vulkan/vulkan.h>
namespace love {
+2
View File
@@ -301,6 +301,8 @@ TextureFormat Vulkan::getTextureFormat(PixelFormat format) {
case PIXELFORMAT_ASTC_12x10:
case PIXELFORMAT_ASTC_12x12:
throw love::Exception("unimplemented pixel format");
default:
throw love::Exception("unknown pixel format");
}
return textureFormat;