Browse Source

vulkan: implement setActive

niki 3 years ago
parent
commit
913aab0226

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

@@ -125,6 +125,10 @@ namespace love {
 			}
 			}
 
 
 			void Graphics::present(void* screenshotCallbackdata) {
 			void Graphics::present(void* screenshotCallbackdata) {
+				if (!isActive()) {
+					return;
+				}
+
 				flushBatchedDraws();
 				flushBatchedDraws();
 
 
 				endRecordingGraphicsCommands();
 				endRecordingGraphicsCommands();
@@ -301,6 +305,11 @@ namespace love {
 				cleanup();
 				cleanup();
 			}
 			}
 
 
+			void Graphics::setActive(bool enable) {
+				flushBatchedDraws();
+				active = enable;
+			}
+
 			void Graphics::setFrontFaceWinding(Winding winding) {
 			void Graphics::setFrontFaceWinding(Winding winding) {
 				const auto& currentState = states.back();
 				const auto& currentState = states.back();
 
 

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

@@ -97,7 +97,7 @@ namespace love {
 				void setViewportSize(int width, int height, int pixelwidth, int pixelheight) override;
 				void setViewportSize(int width, int height, int pixelwidth, int pixelheight) override;
 				bool setMode(void* context, int width, int height, int pixelwidth, int pixelheight, bool windowhasstencil, int msaa) override;
 				bool setMode(void* context, int width, int height, int pixelwidth, int pixelheight, bool windowhasstencil, int msaa) override;
 				void unSetMode() override;
 				void unSetMode() override;
-				void setActive(bool active) override { }
+				void setActive(bool active) override;
 				int getRequestedBackbufferMSAA() const override { return 0; }
 				int getRequestedBackbufferMSAA() const override { return 0; }
 				int getBackbufferMSAA() const  override { return 0; }
 				int getBackbufferMSAA() const  override { return 0; }
 				void setColor(Colorf c) override;
 				void setColor(Colorf c) override;