Browse Source

vulkan: fix canvas rendering

Sometimes canvas commands wouldn't get executed.
This was because when the window gets resized,
the command buffers would get recreated, and would thus
lose the recorded commands.
niki 3 years ago
parent
commit
ac9d8ec2a0

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

@@ -149,8 +149,6 @@ namespace love {
 				this->pixelHeight = pixelheight;
 				this->pixelHeight = pixelheight;
 
 
 				resetProjection();
 				resetProjection();
-
-				recreateSwapChain();
 			}
 			}
 
 
 			bool Graphics::setMode(void* context, int width, int height, int pixelwidth, int pixelheight, bool windowhasstencil, int msaa) {
 			bool Graphics::setMode(void* context, int width, int height, int pixelwidth, int pixelheight, bool windowhasstencil, int msaa) {

+ 1 - 1
src/modules/graphics/vulkan/Graphics.h

@@ -219,7 +219,7 @@ namespace love {
 				VkPolygonMode currentPolygonMode = VK_POLYGON_MODE_FILL;
 				VkPolygonMode currentPolygonMode = VK_POLYGON_MODE_FILL;
 
 
 				VkFormat currentFramebufferOutputFormat = VK_FORMAT_UNDEFINED;
 				VkFormat currentFramebufferOutputFormat = VK_FORMAT_UNDEFINED;
-				Texture* renderTargetTexture = nullptr;
+				Texture* renderTargetTexture;
 				float currentViewportWidth = 0;
 				float currentViewportWidth = 0;
 				float currentViewportHeight = 0;
 				float currentViewportHeight = 0;
 			};
 			};

+ 4 - 4
src/modules/graphics/vulkan/Texture.cpp

@@ -63,10 +63,10 @@ namespace love {
 						std::vector<uint8> defaultPixels;
 						std::vector<uint8> defaultPixels;
 						defaultPixels.reserve(width * height * 4);
 						defaultPixels.reserve(width * height * 4);
 						for (size_t i = 0; i < width * height; i++) {
 						for (size_t i = 0; i < width * height; i++) {
-							// transparent white
-							defaultPixels.push_back(255);
-							defaultPixels.push_back(255);
-							defaultPixels.push_back(255);
+							// transparent black
+							defaultPixels.push_back(0);
+							defaultPixels.push_back(0);
+							defaultPixels.push_back(0);
 							defaultPixels.push_back(255);
 							defaultPixels.push_back(255);
 						}
 						}
 						Rect rect = { 0, 0, width, height };
 						Rect rect = { 0, 0, width, height };