From 41b00a9cabe0ccbe178758c153dc8b4efc169246 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 29 Nov 2015 10:53:47 -0800 Subject: [PATCH] d3d9: Initialize viewport without errors. --- GPU/Directx9/helper/dx_state.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GPU/Directx9/helper/dx_state.h b/GPU/Directx9/helper/dx_state.h index 04a2477228..e9bbb991a3 100644 --- a/GPU/Directx9/helper/dx_state.h +++ b/GPU/Directx9/helper/dx_state.h @@ -349,7 +349,12 @@ private: class StateVp { D3DVIEWPORT9 viewport; public: - StateVp() { memset(&viewport, 0, sizeof(viewport)); } + StateVp() { + memset(&viewport, 0, sizeof(viewport)); + // It's an error if w/h is zero, so let's start with something that can work. + viewport.Width = 1; + viewport.Height = 1; + } inline void set(int x, int y, int w, int h, float n = 0.f, float f = 1.f) { D3DVIEWPORT9 newviewport; newviewport.X = x;