Mesa (master): i915g: Put the templates at the beggining of the structures.

Stephane Marchesin marcheu at kemper.freedesktop.org
Tue Dec 20 02:33:42 UTC 2011


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

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Thu Dec 15 10:59:26 2011 -0800

i915g: Put the templates at the beggining of the structures.

Seriously. This fixes fragment-and-vertex-texturing in piglit and probably
a boatload of other stuff.

---

 src/gallium/drivers/i915/i915_context.h |    6 +++---
 src/gallium/drivers/i915/i915_state.c   |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index 7406b7e..bb1b3b1 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -188,6 +188,8 @@ struct i915_depth_stencil_state {
 };
 
 struct i915_rasterizer_state {
+   struct pipe_rasterizer_state templ;
+
    unsigned light_twoside : 1;
    unsigned st;
    enum interp_mode color_interp;
@@ -196,14 +198,12 @@ struct i915_rasterizer_state {
    unsigned LIS7;
    unsigned sc[1];
 
-   struct pipe_rasterizer_state templ;
-
    union { float f; unsigned u; } ds[2];
 };
 
 struct i915_sampler_state {
+   const struct pipe_sampler_state templ;
    unsigned state[3];
-   const struct pipe_sampler_state *templ;
    unsigned minlod;
    unsigned maxlod;
 };
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index bb4089e..fc0c868 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -223,12 +223,12 @@ i915_create_sampler_state(struct pipe_context *pipe,
    unsigned minFilt, magFilt;
    unsigned mipFilt;
 
-   cso->templ = sampler;
+   memcpy(&cso->templ, sampler, sizeof(struct pipe_sampler_state));
 
    mipFilt = translate_mip_filter(sampler->min_mip_filter);
    minFilt = translate_img_filter( sampler->min_img_filter );
    magFilt = translate_img_filter( sampler->mag_img_filter );
-   
+
    if (sampler->max_anisotropy > 1)
       minFilt = magFilt = FILTER_ANISOTROPIC;
 




More information about the mesa-commit mailing list