summaryrefslogtreecommitdiff
path: root/src/win95/vramtime.c
diff options
context:
space:
mode:
authorSteven Fuller <relnev@icculus.org>2001-07-01 00:55:22 +0000
committerPatryk Obara <dreamer.tan@gmail.com>2019-08-20 02:09:04 +0200
commit2186d5f3f95cd74a070a490d899291648d58667a (patch)
tree55241a1afa3e1a22e0b6593a8dead0b703800f44 /src/win95/vramtime.c
parent218ca90543758a20ac326e444ca0643174ca7384 (diff)
Initial revision
Diffstat (limited to 'src/win95/vramtime.c')
-rw-r--r--src/win95/vramtime.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/win95/vramtime.c b/src/win95/vramtime.c
new file mode 100644
index 0000000..a4fae03
--- /dev/null
+++ b/src/win95/vramtime.c
@@ -0,0 +1,33 @@
+#include <windows.h>
+
+#include "vramtime.h"
+
+static DWORD transition_times_matrix[][VWS_MAXSTATES] =
+{
+/* from DDRELEASE */
+ { 0, 20, 0, 100, 100 },
+/* from D3DTEXRELEASE */
+ { 20, 0, 100, 100, 100 },
+/* from DDCREATE */
+ { 0, 100, 0, 20, 100 },
+/* from D3DTEXCREATE */
+ { 20, 100, 20, 20, 100 },
+/* from UNKNOWN */
+ { 100, 100, 100, 100, 100 }
+};
+
+
+void WaitForVRamReady(VRAM_WAIT_STATE vws)
+{
+ static DWORD old_time = 0;
+ static VRAM_WAIT_STATE old_vws = VWS_UNKNOWN;
+
+ DWORD new_time;
+
+ if (0==old_time) old_time = timeGetTime();
+
+ do new_time = timeGetTime(); while (new_time - old_time < transition_times_matrix[old_vws][vws]);
+
+ old_time = new_time;
+ old_vws = vws;
+}