Browse Source

vulkan: remove unnecessary quadindex code

niki 3 years ago
parent
commit
1647f6c9c2

+ 2 - 1
src/modules/graphics/vulkan/Buffer.h

@@ -2,9 +2,10 @@
 #define LOVE_GRAPHICS_VULKAN_BUFFER_H
 #define LOVE_GRAPHICS_VULKAN_BUFFER_H
 
 
 #include "graphics/Buffer.h"
 #include "graphics/Buffer.h"
+#include "graphics/Volatile.h"
+
 #include <vulkan/vulkan.h>
 #include <vulkan/vulkan.h>
 #include "vk_mem_alloc.h"
 #include "vk_mem_alloc.h"
-#include "graphics/Volatile.h"
 
 
 
 
 namespace love {
 namespace love {

+ 3 - 12
src/modules/graphics/vulkan/Graphics.cpp

@@ -1266,7 +1266,6 @@ VkSampler Graphics::createSampler(const SamplerState& samplerState) {
 	VkPhysicalDeviceProperties properties{};
 	VkPhysicalDeviceProperties properties{};
 	vkGetPhysicalDeviceProperties(physicalDevice, &properties);
 	vkGetPhysicalDeviceProperties(physicalDevice, &properties);
 
 
-	// fixme: determine actual values
 	VkSamplerCreateInfo samplerInfo{};
 	VkSamplerCreateInfo samplerInfo{};
 	samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
 	samplerInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
 	samplerInfo.magFilter = Vulkan::getFilter(samplerState.magFilter);
 	samplerInfo.magFilter = Vulkan::getFilter(samplerState.magFilter);
@@ -1511,18 +1510,10 @@ void Graphics::createDefaultTexture() {
 	standardTexture.reset((Texture*)newTexture(settings));
 	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() {
 void Graphics::cleanup() {
+	delete quadIndexBuffer;
+	quadIndexBuffer = nullptr;
+
 	cleanupSwapChain();
 	cleanupSwapChain();
 
 
 	for (auto &cleanUpFns : cleanUpFunctions) {
 	for (auto &cleanUpFns : cleanUpFunctions) {

+ 0 - 2
src/modules/graphics/vulkan/Graphics.h

@@ -182,7 +182,6 @@ private:
 	void createCommandBuffers();
 	void createCommandBuffers();
 	void createSyncObjects();
 	void createSyncObjects();
 	void createDefaultTexture();
 	void createDefaultTexture();
-	void createQuadIndexBuffer();
 	void cleanup();
 	void cleanup();
 	void cleanupSwapChain();
 	void cleanupSwapChain();
 	void recreateSwapChain();
 	void recreateSwapChain();
@@ -230,7 +229,6 @@ private:
 	bool framebufferResized = false;
 	bool framebufferResized = false;
 	VmaAllocator vmaAllocator = VK_NULL_HANDLE;
 	VmaAllocator vmaAllocator = VK_NULL_HANDLE;
 	std::unique_ptr<Texture> standardTexture = nullptr;
 	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
 	// 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.
 	// 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;
 	std::vector<BatchedDrawBuffers> batchedDrawBuffers;

+ 1 - 0
src/modules/graphics/vulkan/Shader.h

@@ -4,6 +4,7 @@
 #include <graphics/Shader.h>
 #include <graphics/Shader.h>
 #include <graphics/vulkan/ShaderStage.h>
 #include <graphics/vulkan/ShaderStage.h>
 #include "Vulkan.h"
 #include "Vulkan.h"
+
 #include <vulkan/vulkan.h>
 #include <vulkan/vulkan.h>
 
 
 #include <map>
 #include <map>

+ 1 - 0
src/modules/graphics/vulkan/ShaderStage.h

@@ -3,6 +3,7 @@
 
 
 #include "graphics/ShaderStage.h"
 #include "graphics/ShaderStage.h"
 #include "modules/graphics/Graphics.h"
 #include "modules/graphics/Graphics.h"
+
 #include <vulkan/vulkan.h>
 #include <vulkan/vulkan.h>
 
 
 namespace love {
 namespace love {

+ 2 - 0
src/modules/graphics/vulkan/Vulkan.cpp

@@ -301,6 +301,8 @@ TextureFormat Vulkan::getTextureFormat(PixelFormat format) {
 		case PIXELFORMAT_ASTC_12x10:
 		case PIXELFORMAT_ASTC_12x10:
 		case PIXELFORMAT_ASTC_12x12:
 		case PIXELFORMAT_ASTC_12x12:
 			throw love::Exception("unimplemented pixel format");
 			throw love::Exception("unimplemented pixel format");
+		default:
+			throw love::Exception("unknown pixel format");
 	}
 	}
 
 
 	return textureFormat;
 	return textureFormat;