~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to src/gallium/drivers/llvmpipe/lp_state_derived.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
{
51
51
   const struct lp_fragment_shader *lpfs = llvmpipe->fs;
52
52
   struct vertex_info *vinfo = &llvmpipe->vertex_info;
53
 
   const uint num = draw_num_shader_outputs(llvmpipe->draw);
 
53
   struct lp_shader_input *inputs = llvmpipe->inputs;
 
54
   unsigned vs_index;
54
55
   uint i;
55
56
 
56
 
   /* Tell setup to tell the draw module to simply emit the whole
57
 
    * post-xform vertex as-is.
58
 
    *
59
 
    * Not really sure if this is the best approach.
 
57
   /*
 
58
    * Match FS inputs against VS outputs, emitting the necessary attributes.
60
59
    */
 
60
 
61
61
   vinfo->num_attribs = 0;
62
 
   for (i = 0; i < num; i++) {
63
 
      draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, i);
64
 
   }
 
62
 
 
63
   vs_index = draw_find_shader_output(llvmpipe->draw,
 
64
                                       TGSI_SEMANTIC_POSITION,
 
65
                                       0);
 
66
 
 
67
   draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index);
 
68
 
 
69
   for (i = 0; i < lpfs->info.num_inputs; i++) {
 
70
      /*
 
71
       * Search for each input in current vs output:
 
72
       */
 
73
 
 
74
      vs_index = draw_find_shader_output(llvmpipe->draw,
 
75
                                         lpfs->info.input_semantic_name[i],
 
76
                                         lpfs->info.input_semantic_index[i]);
 
77
      if (vs_index < 0) {
 
78
         /*
 
79
          * This can happen with sprite coordinates - the vertex
 
80
          * shader doesn't need to provide an output as we generate
 
81
          * them internally.  However, lets keep pretending that there
 
82
          * is something there to not confuse other code.
 
83
          */
 
84
         vs_index = 0;
 
85
      }
 
86
 
 
87
      /* This can be pre-computed, except for flatshade:
 
88
       */
 
89
      inputs[i].usage_mask = lpfs->info.input_usage_mask[i];
 
90
 
 
91
      switch (lpfs->info.input_interpolate[i]) {
 
92
      case TGSI_INTERPOLATE_CONSTANT:
 
93
         inputs[i].interp = LP_INTERP_CONSTANT;
 
94
         break;
 
95
      case TGSI_INTERPOLATE_LINEAR:
 
96
         inputs[i].interp = LP_INTERP_LINEAR;
 
97
         break;
 
98
      case TGSI_INTERPOLATE_PERSPECTIVE:
 
99
         inputs[i].interp = LP_INTERP_PERSPECTIVE;
 
100
         break;
 
101
      default:
 
102
         assert(0);
 
103
         break;
 
104
      }
 
105
 
 
106
      switch (lpfs->info.input_semantic_name[i]) {
 
107
      case TGSI_SEMANTIC_FACE:
 
108
         inputs[i].interp = LP_INTERP_FACING;
 
109
         break;
 
110
      case TGSI_SEMANTIC_POSITION:
 
111
         /* Position was already emitted above
 
112
          */
 
113
         inputs[i].interp = LP_INTERP_POSITION;
 
114
         inputs[i].src_index = 0;
 
115
         continue;
 
116
      case TGSI_SEMANTIC_COLOR:
 
117
         /* Colors are linearly inputs[i].interpolated in the fragment shader
 
118
          * even when flatshading is active.  This just tells the
 
119
          * setup module to use coefficients with ddx==0 and
 
120
          * ddy==0.
 
121
          */
 
122
         if (llvmpipe->rasterizer->flatshade)
 
123
            inputs[i].interp = LP_INTERP_CONSTANT;
 
124
         break;
 
125
 
 
126
      default:
 
127
         break;
 
128
      }
 
129
 
 
130
      /*
 
131
       * Emit the requested fs attribute for all but position.
 
132
       */
 
133
 
 
134
      inputs[i].src_index = vinfo->num_attribs;
 
135
      draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index);
 
136
   }
 
137
 
 
138
   /* Figure out if we need pointsize as well.
 
139
    */
 
140
   vs_index = draw_find_shader_output(llvmpipe->draw,
 
141
                                      TGSI_SEMANTIC_PSIZE, 0);
 
142
 
 
143
   if (vs_index > 0) {
 
144
      llvmpipe->psize_slot = vinfo->num_attribs;
 
145
      draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
 
146
   }
 
147
 
 
148
   llvmpipe->num_inputs = lpfs->info.num_inputs;
 
149
 
65
150
   draw_compute_vertex_size(vinfo);
66
151
 
67
 
 
68
152
   lp_setup_set_vertex_info(llvmpipe->setup, vinfo);
69
153
 
70
 
/*
71
 
   llvmpipe->psize_slot = draw_find_vs_output(llvmpipe->draw,
72
 
                                              TGSI_SEMANTIC_PSIZE, 0);
73
 
*/
74
 
 
75
 
   /* Now match FS inputs against emitted vertex data.  It's also
76
 
    * entirely possible to just have a fixed layout for FS input,
77
 
    * determined by the fragment shader itself, and adjust the draw
78
 
    * outputs to match that.
79
 
    */
80
 
   {
81
 
      struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
82
 
 
83
 
      for (i = 0; i < lpfs->info.num_inputs; i++) {
84
 
 
85
 
         /* This can be precomputed, except for flatshade:
86
 
          */
87
 
         switch (lpfs->info.input_semantic_name[i]) {
88
 
         case TGSI_SEMANTIC_FACE:
89
 
            inputs[i].interp = LP_INTERP_FACING;
90
 
            break;
91
 
         case TGSI_SEMANTIC_POSITION:
92
 
            inputs[i].interp = LP_INTERP_POSITION;
93
 
            break;
94
 
         case TGSI_SEMANTIC_COLOR:
95
 
            /* Colors are linearly interpolated in the fragment shader
96
 
             * even when flatshading is active.  This just tells the
97
 
             * setup module to use coefficients with ddx==0 and
98
 
             * ddy==0.
99
 
             */
100
 
            if (llvmpipe->rasterizer->flatshade)
101
 
               inputs[i].interp = LP_INTERP_CONSTANT;
102
 
            else
103
 
               inputs[i].interp = LP_INTERP_LINEAR;
104
 
            break;
105
 
 
106
 
         default:
107
 
            switch (lpfs->info.input_interpolate[i]) {
108
 
            case TGSI_INTERPOLATE_CONSTANT:
109
 
               inputs[i].interp = LP_INTERP_CONSTANT;
110
 
               break;
111
 
            case TGSI_INTERPOLATE_LINEAR:
112
 
               inputs[i].interp = LP_INTERP_LINEAR;
113
 
               break;
114
 
            case TGSI_INTERPOLATE_PERSPECTIVE:
115
 
               inputs[i].interp = LP_INTERP_PERSPECTIVE;
116
 
               break;
117
 
            default:
118
 
               assert(0);
119
 
               break;
120
 
            }
121
 
         }
122
 
 
123
 
         /* Search for each input in current vs output:
124
 
          */
125
 
         inputs[i].src_index = 
126
 
            draw_find_shader_output(llvmpipe->draw,
127
 
                                    lpfs->info.input_semantic_name[i],
128
 
                                    lpfs->info.input_semantic_index[i]);
129
 
      }
130
 
 
131
 
      lp_setup_set_fs_inputs(llvmpipe->setup, 
132
 
                             inputs,
133
 
                             lpfs->info.num_inputs);
134
 
   }
 
154
   lp_setup_set_fs_inputs(llvmpipe->setup,
 
155
                          inputs,
 
156
                          lpfs->info.num_inputs);
135
157
}
136
158
 
137
159
 
150
172
    */
151
173
   if (llvmpipe->tex_timestamp != lp_screen->timestamp) {
152
174
      llvmpipe->tex_timestamp = lp_screen->timestamp;
153
 
      llvmpipe->dirty |= LP_NEW_TEXTURE;
 
175
      llvmpipe->dirty |= LP_NEW_SAMPLER_VIEW;
154
176
   }
155
177
      
156
178
   if (llvmpipe->dirty & (LP_NEW_RASTERIZER |
164
186
                          LP_NEW_DEPTH_STENCIL_ALPHA |
165
187
                          LP_NEW_RASTERIZER |
166
188
                          LP_NEW_SAMPLER |
167
 
                          LP_NEW_TEXTURE))
 
189
                          LP_NEW_SAMPLER_VIEW |
 
190
                          LP_NEW_QUERY))
168
191
      llvmpipe_update_fs( llvmpipe );
169
192
 
170
193
   if (llvmpipe->dirty & LP_NEW_BLEND_COLOR)
174
197
   if (llvmpipe->dirty & LP_NEW_SCISSOR)
175
198
      lp_setup_set_scissor(llvmpipe->setup, &llvmpipe->scissor);
176
199
 
177
 
   if (llvmpipe->dirty & LP_NEW_DEPTH_STENCIL_ALPHA)
 
200
   if (llvmpipe->dirty & LP_NEW_DEPTH_STENCIL_ALPHA) {
178
201
      lp_setup_set_alpha_ref_value(llvmpipe->setup, 
179
202
                                   llvmpipe->depth_stencil->alpha.ref_value);
 
203
      lp_setup_set_stencil_ref_values(llvmpipe->setup,
 
204
                                      llvmpipe->stencil_ref.ref_value);
 
205
   }
180
206
 
181
207
   if (llvmpipe->dirty & LP_NEW_CONSTANTS)
182
208
      lp_setup_set_fs_constants(llvmpipe->setup, 
183
 
                                llvmpipe->constants[PIPE_SHADER_FRAGMENT]);
 
209
                                llvmpipe->constants[PIPE_SHADER_FRAGMENT][0]);
184
210
 
185
 
   if (llvmpipe->dirty & LP_NEW_TEXTURE)
186
 
      lp_setup_set_sampler_textures(llvmpipe->setup, 
187
 
                                    llvmpipe->num_textures,
188
 
                                    llvmpipe->texture);
 
211
   if (llvmpipe->dirty & LP_NEW_SAMPLER_VIEW)
 
212
      lp_setup_set_fragment_sampler_views(llvmpipe->setup,
 
213
                                          llvmpipe->num_fragment_sampler_views,
 
214
                                          llvmpipe->fragment_sampler_views);
189
215
 
190
216
   llvmpipe->dirty = 0;
191
217
}