WineD3D: Create the state table

Stefan Dösinger stefan at codeweavers.com
Tue Dec 5 16:36:10 CST 2006


This patch introduces the beginnings of the state management table. Right now 
its empty, only with the unknown 0 state. It creates the files and the header 
stuff. The rest will follow in seperate patches.

I export the whole table because I am going to access it with the state 
numbers as indices for performance reason. I do not want to do any searching 
on it, and I do not think we should add a get_index(state) { return state; } 
function, the function call is pretty redundant :-) See my next mail about 
more details about this.
-------------- next part --------------
From 547f16bcc231ec224d33287107896e73d0d91c13 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Tue, 5 Dec 2006 21:55:11 +0100
Subject: [PATCH] WineD3D: State table

---
 dlls/wined3d/Makefile.in       |    1 +
 dlls/wined3d/state.c           |   38 ++++++++++++++++++++++++++++++++++++++
 dlls/wined3d/wined3d_private.h |   12 ++++++++++++
 3 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in
index 2eea53c..0cdd967 100644
--- a/dlls/wined3d/Makefile.in
+++ b/dlls/wined3d/Makefile.in
@@ -22,6 +22,7 @@ C_SRCS = \
 	pixelshader.c \
 	query.c \
 	resource.c \
+	state.c \
 	stateblock.c \
 	surface.c \
 	surface_gdi.c \
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
new file mode 100644
index 0000000..2b929b6
--- /dev/null
+++ b/dlls/wined3d/state.c
@@ -0,0 +1,38 @@
+/*
+ * Direct3D state management
+ *
+ * Copyright 2006 Stefan Dösinger for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include <stdio.h>
+#ifdef HAVE_FLOAT_H
+# include <float.h>
+#endif
+#include "wined3d_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(d3d);
+
+static void state_unknown(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+    FIXME("Unknown state %d\n", state);
+}
+
+const struct StateEntry StateTable[] =
+{
+      /* State name                                         representative,                                     apply function */
+    { /* 0,  Undefined                              */      0,                                                  state_unknown     },
+};
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0776767..fac02b1 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -407,6 +407,18 @@ #define eps 1e-8
 #define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \
     (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
 
+/* Routines and structures related to state management */
+typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock);
+
+struct StateEntry
+{
+    DWORD           representative;
+    APPLYSTATEFUNC  apply;
+};
+
+/* Global state table */
+extern const struct StateEntry StateTable[];
+
 /* Routine to fill gl caps for swapchains and IWineD3D */
 BOOL IWineD3DImpl_FillGLCaps(IWineD3D *iface, Display* display);
 
-- 
1.4.2.4



More information about the wine-patches mailing list