Mesa (master): i915g: Move fragment state to its own file

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Sun Jul 4 12:38:38 UTC 2010


Module: Mesa
Branch: master
Commit: 8b122bdf6c0ba3bd77ff6f5b85b7fa84865535db
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b122bdf6c0ba3bd77ff6f5b85b7fa84865535db

Author: Jakob Bornecrantz <wallbraker at gmail.com>
Date:   Sat Jul  3 12:46:42 2010 +0100

i915g: Move fragment state to its own file

---

 src/gallium/drivers/i915/Makefile             |    1 +
 src/gallium/drivers/i915/SConscript           |    1 +
 src/gallium/drivers/i915/i915_state.h         |    1 +
 src/gallium/drivers/i915/i915_state_derived.c |   17 +-------
 src/gallium/drivers/i915/i915_state_emit.c    |    2 +-
 src/gallium/drivers/i915/i915_state_fpc.c     |   59 +++++++++++++++++++++++++
 6 files changed, 64 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/i915/Makefile b/src/gallium/drivers/i915/Makefile
index d4d5c48..b3f387f 100644
--- a/src/gallium/drivers/i915/Makefile
+++ b/src/gallium/drivers/i915/Makefile
@@ -15,6 +15,7 @@ C_SOURCES = \
 	i915_state_dynamic.c \
 	i915_state_derived.c \
 	i915_state_emit.c \
+	i915_state_fpc.c \
 	i915_state_sampler.c \
 	i915_state_static.c \
 	i915_screen.c \
diff --git a/src/gallium/drivers/i915/SConscript b/src/gallium/drivers/i915/SConscript
index a90d094..d4bf6fe 100644
--- a/src/gallium/drivers/i915/SConscript
+++ b/src/gallium/drivers/i915/SConscript
@@ -24,6 +24,7 @@ i915 = env.ConvenienceLibrary(
 		'i915_state.c',
 		'i915_state_derived.c',
 		'i915_state_dynamic.c',
+		'i915_state_fpc.c',
 		'i915_state_emit.c',
 		'i915_state_immediate.c',
 		'i915_state_sampler.c',
diff --git a/src/gallium/drivers/i915/i915_state.h b/src/gallium/drivers/i915/i915_state.h
index 7795046..b4074dc 100644
--- a/src/gallium/drivers/i915/i915_state.h
+++ b/src/gallium/drivers/i915/i915_state.h
@@ -48,6 +48,7 @@ extern struct i915_tracked_state i915_hw_immediate;
 extern struct i915_tracked_state i915_hw_dynamic;
 extern struct i915_tracked_state i915_hw_fs;
 extern struct i915_tracked_state i915_hw_framebuffer;
+extern struct i915_tracked_state i915_hw_constants;
 
 void i915_update_derived(struct i915_context *i915);
 void i915_emit_hardware_state(struct i915_context *i915);
diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c
index 38d13f4..1d4026a 100644
--- a/src/gallium/drivers/i915/i915_state_derived.c
+++ b/src/gallium/drivers/i915/i915_state_derived.c
@@ -156,22 +156,6 @@ struct i915_tracked_state i915_update_vertex_layout = {
 
 
 /***********************************************************************
- * Update fragment state
- */
-static void update_fs(struct i915_context *i915)
-{
-   i915->hardware_dirty |= I915_HW_PROGRAM; /* XXX right? */
-}
-
-struct i915_tracked_state i915_hw_fs = {
-   "fs",
-   update_fs,
-   I915_NEW_FS
-};
-
-
-
-/***********************************************************************
  */
 static struct i915_tracked_state *atoms[] = {
    &i915_update_vertex_layout,
@@ -181,6 +165,7 @@ static struct i915_tracked_state *atoms[] = {
    &i915_hw_dynamic,
    &i915_hw_fs,
    &i915_hw_framebuffer,
+   &i915_hw_constants,
    NULL,
 };
 
diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c
index bbf9ff5..3577a33 100644
--- a/src/gallium/drivers/i915/i915_state_emit.c
+++ b/src/gallium/drivers/i915/i915_state_emit.c
@@ -339,7 +339,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
 
    /* constants */
    /* 2 + I915_MAX_CONSTANT*4 dwords, 0 relocs */
-   if (i915->hardware_dirty & I915_HW_PROGRAM)
+   if (i915->hardware_dirty & I915_HW_CONSTANTS)
    {
       /* Collate the user-defined constants with the fragment shader's
        * immediates according to the constant_flags[] array.
diff --git a/src/gallium/drivers/i915/i915_state_fpc.c b/src/gallium/drivers/i915/i915_state_fpc.c
new file mode 100644
index 0000000..ec7cec0
--- /dev/null
+++ b/src/gallium/drivers/i915/i915_state_fpc.c
@@ -0,0 +1,59 @@
+/**************************************************************************
+ *
+ * Copyright © 2010 Jakob Bornecrantz
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "i915_reg.h"
+#include "i915_context.h"
+#include "i915_state.h"
+
+
+
+/***********************************************************************
+ */
+static void update_hw_constants(struct i915_context *i915)
+{
+   i915->hardware_dirty |= I915_HW_CONSTANTS;
+}
+
+struct i915_tracked_state i915_hw_constants = {
+   "hw_constants",
+   update_hw_constants,
+   I915_NEW_CONSTANTS | I915_NEW_FS
+};
+
+
+
+/***********************************************************************
+ */
+static void update_fs(struct i915_context *i915)
+{
+   i915->hardware_dirty |= I915_HW_PROGRAM;
+}
+
+struct i915_tracked_state i915_hw_fs = {
+   "fs",
+   update_fs,
+   I915_NEW_FS
+};




More information about the mesa-commit mailing list