00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "i915_state_inlines.h"
00033 #include "i915_context.h"
00034 #include "i915_state.h"
00035 #include "i915_reg.h"
00036 #include "util/u_memory.h"
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 static void upload_S0S1(struct i915_context *i915)
00052 {
00053 unsigned LIS0, LIS1;
00054
00055
00056
00057 LIS0 = i915->vbo_offset;
00058
00059
00060
00061 {
00062 unsigned vertex_size = i915->current.vertex_info.size;
00063
00064 LIS1 = ((vertex_size << 24) |
00065 (vertex_size << 16));
00066 }
00067
00068
00069
00070 if (1 ||
00071 i915->current.immediate[I915_IMMEDIATE_S0] != LIS0 ||
00072 i915->current.immediate[I915_IMMEDIATE_S1] != LIS1)
00073 {
00074 i915->current.immediate[I915_IMMEDIATE_S0] = LIS0;
00075 i915->current.immediate[I915_IMMEDIATE_S1] = LIS1;
00076 i915->hardware_dirty |= I915_HW_IMMEDIATE;
00077 }
00078 }
00079
00080 const struct i915_tracked_state i915_upload_S0S1 = {
00081 I915_NEW_VBO | I915_NEW_VERTEX_FORMAT,
00082 upload_S0S1
00083 };
00084
00085
00086
00087
00088
00089
00090
00091 static void upload_S2S4(struct i915_context *i915)
00092 {
00093 unsigned LIS2, LIS4;
00094
00095
00096 {
00097 LIS2 = i915->current.vertex_info.hwfmt[1];
00098 LIS4 = i915->current.vertex_info.hwfmt[0];
00099
00100
00101
00102 assert(LIS4);
00103 }
00104
00105 LIS4 |= i915->rasterizer->LIS4;
00106
00107 if (LIS2 != i915->current.immediate[I915_IMMEDIATE_S2] ||
00108 LIS4 != i915->current.immediate[I915_IMMEDIATE_S4]) {
00109
00110 i915->current.immediate[I915_IMMEDIATE_S2] = LIS2;
00111 i915->current.immediate[I915_IMMEDIATE_S4] = LIS4;
00112 i915->hardware_dirty |= I915_HW_IMMEDIATE;
00113 }
00114 }
00115
00116
00117 const struct i915_tracked_state i915_upload_S2S4 = {
00118 I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT,
00119 upload_S2S4
00120 };
00121
00122
00123
00124
00125
00126
00127 static void upload_S5( struct i915_context *i915 )
00128 {
00129 unsigned LIS5 = 0;
00130
00131 LIS5 |= i915->depth_stencil->stencil_LIS5;
00132
00133 LIS5 |= i915->blend->LIS5;
00134
00135 #if 0
00136
00137 if (i915->state.Polygon->OffsetFill) {
00138 LIS5 |= S5_GLOBAL_DEPTH_OFFSET_ENABLE;
00139 }
00140 #endif
00141
00142
00143 if (LIS5 != i915->current.immediate[I915_IMMEDIATE_S5]) {
00144 i915->current.immediate[I915_IMMEDIATE_S5] = LIS5;
00145 i915->hardware_dirty |= I915_HW_IMMEDIATE;
00146 }
00147 }
00148
00149 const struct i915_tracked_state i915_upload_S5 = {
00150 (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER),
00151 upload_S5
00152 };
00153
00154
00155
00156
00157 static void upload_S6( struct i915_context *i915 )
00158 {
00159 unsigned LIS6 = (2 << S6_TRISTRIP_PV_SHIFT);
00160
00161
00162
00163 if (i915->framebuffer.cbufs[0])
00164 LIS6 |= S6_COLOR_WRITE_ENABLE;
00165
00166
00167
00168 LIS6 |= i915->blend->LIS6;
00169
00170
00171
00172 LIS6 |= i915->depth_stencil->depth_LIS6;
00173
00174 if (LIS6 != i915->current.immediate[I915_IMMEDIATE_S6]) {
00175 i915->current.immediate[I915_IMMEDIATE_S6] = LIS6;
00176 i915->hardware_dirty |= I915_HW_IMMEDIATE;
00177 }
00178 }
00179
00180 const struct i915_tracked_state i915_upload_S6 = {
00181 I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL | I915_NEW_FRAMEBUFFER,
00182 upload_S6
00183 };
00184
00185
00186
00187
00188 static void upload_S7( struct i915_context *i915 )
00189 {
00190 unsigned LIS7;
00191
00192
00193
00194 LIS7 = i915->rasterizer->LIS7;
00195
00196 if (LIS7 != i915->current.immediate[I915_IMMEDIATE_S7]) {
00197 i915->current.immediate[I915_IMMEDIATE_S7] = LIS7;
00198 i915->hardware_dirty |= I915_HW_IMMEDIATE;
00199 }
00200 }
00201
00202 const struct i915_tracked_state i915_upload_S7 = {
00203 I915_NEW_RASTERIZER,
00204 upload_S7
00205 };
00206
00207
00208 static const struct i915_tracked_state *atoms[] = {
00209 &i915_upload_S0S1,
00210 &i915_upload_S2S4,
00211 &i915_upload_S5,
00212 &i915_upload_S6,
00213 &i915_upload_S7
00214 };
00215
00216
00217
00218 void i915_update_immediate( struct i915_context *i915 )
00219 {
00220 int i;
00221
00222 for (i = 0; i < Elements(atoms); i++)
00223 if (i915->dirty & atoms[i]->dirty)
00224 atoms[i]->update( i915 );
00225 }