i915_state_derived.c revision d3eb25c575464bed7dbfc8be4717d85cb2928ec1
101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell/**************************************************************************
201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * All Rights Reserved.
501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * copy of this software and associated documentation files (the
801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * "Software"), to deal in the Software without restriction, including
901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
1001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
1101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * permit persons to whom the Software is furnished to do so, subject to
1201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * the following conditions:
1301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
1401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * The above copyright notice and this permission notice (including the
1501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * next paragraph) shall be included in all copies or substantial portions
1601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * of the Software.
1701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
1801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
2101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
2201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
2301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell *
2601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell **************************************************************************/
2701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
28d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian
29d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian#include "pipe/p_util.h"
3001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell#include "pipe/draw/draw_context.h"
31d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian#include "pipe/draw/draw_vertex.h"
3201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell#include "i915_context.h"
3301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell#include "i915_state.h"
34c990d0fd57a05301429b3af75b7fed0337621941Brian#include "i915_reg.h"
3501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
364ed87bf2291e4873e94cefe44ddf2b590b09cc42Brian/* XXX should include i915_fpc.h but that causes some trouble atm */
374ed87bf2291e4873e94cefe44ddf2b590b09cc42Brianextern void i915_translate_fragment_program( struct i915_context *i915 );
384ed87bf2291e4873e94cefe44ddf2b590b09cc42Brian
394ed87bf2291e4873e94cefe44ddf2b590b09cc42Brian
4001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
4140a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwellstatic const unsigned frag_to_vf[FRAG_ATTRIB_MAX] =
4201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell{
4301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_POS,
4401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_COLOR0,
4501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_COLOR1,
4601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_FOG,
4701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_TEX0,
4801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_TEX1,
4901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_TEX2,
5001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_TEX3,
5101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_TEX4,
5201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_TEX5,
5301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_TEX6,
5401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_TEX7,
5501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_VAR0,
5601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_VAR1,
5701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_VAR2,
5801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_VAR3,
5901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_VAR4,
6001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_VAR5,
6101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_VAR6,
6201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   VF_ATTRIB_VAR7,
6301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell};
6401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
6501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
66c990d0fd57a05301429b3af75b7fed0337621941Brianstatic INLINE void
67c990d0fd57a05301429b3af75b7fed0337621941Brianemit_vertex_attr(struct vertex_info *vinfo, uint vfAttr, uint format)
68c990d0fd57a05301429b3af75b7fed0337621941Brian{
69c990d0fd57a05301429b3af75b7fed0337621941Brian   const uint n = vinfo->num_attribs;
70c990d0fd57a05301429b3af75b7fed0337621941Brian   vinfo->attr_mask |= (1 << vfAttr);
71c990d0fd57a05301429b3af75b7fed0337621941Brian   vinfo->slot_to_attrib[n] = vfAttr;
72d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian   printf("Vertex slot %d = vfattrib %d\n", n, vfAttr);
73c990d0fd57a05301429b3af75b7fed0337621941Brian   /*vinfo->interp_mode[n] = interpMode;*/
74c990d0fd57a05301429b3af75b7fed0337621941Brian   vinfo->format[n] = format;
75c990d0fd57a05301429b3af75b7fed0337621941Brian   vinfo->num_attribs++;
76c990d0fd57a05301429b3af75b7fed0337621941Brian}
77c990d0fd57a05301429b3af75b7fed0337621941Brian
78c990d0fd57a05301429b3af75b7fed0337621941Brian
79d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian/**
80d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian * Recompute the vinfo->size field.
81d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian */
82d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brianstatic void
83d3eb25c575464bed7dbfc8be4717d85cb2928ec1Briancompute_vertex_size(struct vertex_info *vinfo)
84d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian{
85d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian   uint i;
86d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian
87d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian   vinfo->size = 0;
88d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian   for (i = 0; i < vinfo->num_attribs; i++) {
89d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      switch (vinfo->format[i]) {
90d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      case FORMAT_OMIT:
91d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         break;
92d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      case FORMAT_4UB:
93d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         /* fall-through */
94d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      case FORMAT_1F:
95d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         vinfo->size += 1;
96d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         break;
97d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      case FORMAT_2F:
98d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         vinfo->size += 2;
99d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         break;
100d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      case FORMAT_3F:
101d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         vinfo->size += 3;
102d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         break;
103d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      case FORMAT_4F:
104d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         vinfo->size += 4;
105d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         break;
106d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      default:
107d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian         assert(0);
108d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian      }
109d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian   }
110d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian}
111d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian
112d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian
113c990d0fd57a05301429b3af75b7fed0337621941Brian
11401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell/**
11501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * Determine which post-transform / pre-rasterization vertex attributes
11601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * we need.
11701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * Derived from:  fs, setup states.
11801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell */
11901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwellstatic void calculate_vertex_layout( struct i915_context *i915 )
12001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell{
121c990d0fd57a05301429b3af75b7fed0337621941Brian   const unsigned inputsRead = i915->fs.inputs_read;
122c990d0fd57a05301429b3af75b7fed0337621941Brian//   const unsigned inputsRead = (FRAG_BIT_WPOS | FRAG_BIT_COL0);
12340a86b20478024ca7c55400019c536cb5ff631d1Keith Whitwell   unsigned i;
124c990d0fd57a05301429b3af75b7fed0337621941Brian   struct vertex_info *vinfo = &i915->current.vertex_info;
12501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
126c990d0fd57a05301429b3af75b7fed0337621941Brian   memset(vinfo, 0, sizeof(*vinfo));
12701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
12801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   /* TODO - Figure out if we need to do perspective divide, etc.
12901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell    */
130c990d0fd57a05301429b3af75b7fed0337621941Brian   emit_vertex_attr(vinfo, VF_ATTRIB_POS, FORMAT_3F);
131c990d0fd57a05301429b3af75b7fed0337621941Brian   vinfo->hwfmt[0] |= S4_VFMT_XYZ;
13201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
13301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   /* Pull in the rest of the attributes.  They are all in float4
13401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell    * format.  Future optimizations could be to keep some attributes
13501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell    * as fixed point or ubyte format.
13601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell    */
13701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   for (i = 1; i < FRAG_ATTRIB_TEX0; i++) {
13801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      if (inputsRead & (1 << i)) {
139c990d0fd57a05301429b3af75b7fed0337621941Brian         assert(i < Elements(frag_to_vf));
14001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell         if (i915->setup.flatshade
141c990d0fd57a05301429b3af75b7fed0337621941Brian             && (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)) {
142c990d0fd57a05301429b3af75b7fed0337621941Brian            emit_vertex_attr(vinfo, frag_to_vf[i], FORMAT_4UB);
143c990d0fd57a05301429b3af75b7fed0337621941Brian         }
144c990d0fd57a05301429b3af75b7fed0337621941Brian         else {
145c990d0fd57a05301429b3af75b7fed0337621941Brian            emit_vertex_attr(vinfo, frag_to_vf[i], FORMAT_4UB);
146c990d0fd57a05301429b3af75b7fed0337621941Brian         }
147c990d0fd57a05301429b3af75b7fed0337621941Brian         vinfo->hwfmt[0] |= S4_VFMT_COLOR;
14801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      }
14901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   }
15001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
151d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian   for (i = FRAG_ATTRIB_TEX0; i <= FRAG_ATTRIB_TEX7/*MAX*/; i++) {
152c990d0fd57a05301429b3af75b7fed0337621941Brian      uint hwtc;
15301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      if (inputsRead & (1 << i)) {
154c990d0fd57a05301429b3af75b7fed0337621941Brian         hwtc = TEXCOORDFMT_4D;
15501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell         assert(i < sizeof(frag_to_vf) / sizeof(frag_to_vf[0]));
156c990d0fd57a05301429b3af75b7fed0337621941Brian         emit_vertex_attr(vinfo, frag_to_vf[i], FORMAT_4F);
157c990d0fd57a05301429b3af75b7fed0337621941Brian      }
158c990d0fd57a05301429b3af75b7fed0337621941Brian      else {
159c990d0fd57a05301429b3af75b7fed0337621941Brian         hwtc = TEXCOORDFMT_NOT_PRESENT;
16001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      }
161c990d0fd57a05301429b3af75b7fed0337621941Brian      vinfo->hwfmt[1] |= hwtc << ((i - FRAG_ATTRIB_TEX0) * 4);
16201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   }
16301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
16401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   /* Additional attributes required for setup: Just twosided
16501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell    * lighting.  Edgeflag is dealt with specially by setting bits in
16601c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell    * the vertex header.
16701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell    */
16801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   if (i915->setup.light_twoside) {
16901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      if (inputsRead & FRAG_BIT_COL0) {
170c990d0fd57a05301429b3af75b7fed0337621941Brian         /* XXX: mark as discarded after setup */
171c990d0fd57a05301429b3af75b7fed0337621941Brian         emit_vertex_attr(vinfo, VF_ATTRIB_BFC0, FORMAT_OMIT);
17201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      }
17301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
17401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      if (inputsRead & FRAG_BIT_COL1) {
175c990d0fd57a05301429b3af75b7fed0337621941Brian         /* XXX: discard after setup */
176c990d0fd57a05301429b3af75b7fed0337621941Brian         emit_vertex_attr(vinfo, VF_ATTRIB_BFC1, FORMAT_OMIT);
17701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      }
17801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   }
17901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
180d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian   compute_vertex_size(vinfo);
181d3eb25c575464bed7dbfc8be4717d85cb2928ec1Brian
182c990d0fd57a05301429b3af75b7fed0337621941Brian   /* If the attributes have changed, tell the draw module about the new
183c990d0fd57a05301429b3af75b7fed0337621941Brian    * vertex layout.  We'll also update the hardware vertex format info.
18401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell    */
18501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   draw_set_vertex_attributes( i915->draw,
186c990d0fd57a05301429b3af75b7fed0337621941Brian                               vinfo->slot_to_attrib,
187c990d0fd57a05301429b3af75b7fed0337621941Brian			       vinfo->num_attribs);
188c990d0fd57a05301429b3af75b7fed0337621941Brian#if 0
189c990d0fd57a05301429b3af75b7fed0337621941Brian   printf("VERTEX_FORMAT LIS2: 0x%x  LIS4: 0x%x\n",
190c990d0fd57a05301429b3af75b7fed0337621941Brian          vinfo->hwfmt[1], vinfo->hwfmt[0]);
191c990d0fd57a05301429b3af75b7fed0337621941Brian#endif
19201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell}
19301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
19401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
19501c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
196c990d0fd57a05301429b3af75b7fed0337621941Brian
19701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell/* Hopefully this will remain quite simple, otherwise need to pull in
19801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell * something like the state tracker mechanism.
19901c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell */
20001c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwellvoid i915_update_derived( struct i915_context *i915 )
20101c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell{
20201c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   if (i915->dirty & (I915_NEW_SETUP | I915_NEW_FS))
20301c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell      calculate_vertex_layout( i915 );
20401c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell
205c990d0fd57a05301429b3af75b7fed0337621941Brian   if (i915->dirty & I915_NEW_SAMPLER)
206c990d0fd57a05301429b3af75b7fed0337621941Brian      i915_update_samplers(i915);
207c990d0fd57a05301429b3af75b7fed0337621941Brian
208c990d0fd57a05301429b3af75b7fed0337621941Brian   if (i915->dirty & I915_NEW_TEXTURE)
209c990d0fd57a05301429b3af75b7fed0337621941Brian      i915_update_textures(i915);
210c990d0fd57a05301429b3af75b7fed0337621941Brian
211277e4989f348913e3852f3d8c4efb82ba1380fcbKeith Whitwell   if (i915->dirty)
212e23966f3de81342f7bd11f1e79c04022b5f0193fKeith Whitwell      i915_update_immediate( i915 );
213e23966f3de81342f7bd11f1e79c04022b5f0193fKeith Whitwell
2147c9a1357beabd6d0df88142d31cd5d77a012e85aKeith Whitwell   if (i915->dirty)
2157c9a1357beabd6d0df88142d31cd5d77a012e85aKeith Whitwell      i915_update_dynamic( i915 );
2167c9a1357beabd6d0df88142d31cd5d77a012e85aKeith Whitwell
2170d9bcdbeb11ad1ce7e5257f652ccf9ebf1aa59a7Brian   if (i915->dirty & I915_NEW_FS) {
2180d9bcdbeb11ad1ce7e5257f652ccf9ebf1aa59a7Brian      i915_translate_fragment_program(i915);
2190d9bcdbeb11ad1ce7e5257f652ccf9ebf1aa59a7Brian      i915->hardware_dirty |= I915_HW_PROGRAM; /* XXX right? */
2200d9bcdbeb11ad1ce7e5257f652ccf9ebf1aa59a7Brian   }
2210d9bcdbeb11ad1ce7e5257f652ccf9ebf1aa59a7Brian
222e23966f3de81342f7bd11f1e79c04022b5f0193fKeith Whitwell   /* HW emit currently references framebuffer state directly:
223e23966f3de81342f7bd11f1e79c04022b5f0193fKeith Whitwell    */
224e23966f3de81342f7bd11f1e79c04022b5f0193fKeith Whitwell   if (i915->dirty & I915_NEW_FRAMEBUFFER)
2257c9a1357beabd6d0df88142d31cd5d77a012e85aKeith Whitwell      i915->hardware_dirty |= I915_HW_STATIC;
226277e4989f348913e3852f3d8c4efb82ba1380fcbKeith Whitwell
22701c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell   i915->dirty = 0;
22801c35b52a1fccbe4253a96b9c0506ef6c991e44fKeith Whitwell}
229