]> git.pld-linux.org Git - packages/Mesa.git/blob - Mesa-git.patch
- up to 8.0.2 + git fixes
[packages/Mesa.git] / Mesa-git.patch
1 diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
2 index d132638..920612b 100644
3 --- a/src/gallium/drivers/r300/r300_blit.c
4 +++ b/src/gallium/drivers/r300/r300_blit.c
5 @@ -63,8 +63,13 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
6      util_blitter_save_vertex_shader(r300->blitter, r300->vs_state.state);
7      util_blitter_save_viewport(r300->blitter, &r300->viewport);
8      util_blitter_save_vertex_elements(r300->blitter, r300->velems);
9 -    util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers,
10 -                                     r300->vbuf_mgr->vertex_buffer);
11 +    if (r300->vbuf_mgr) {
12 +        util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers,
13 +                                         r300->vbuf_mgr->vertex_buffer);
14 +    } else {
15 +        util_blitter_save_vertex_buffers(r300->blitter, r300->swtcl_nr_vertex_buffers,
16 +                                         r300->swtcl_vertex_buffer);
17 +    }
18  
19      if (op & R300_SAVE_FRAMEBUFFER) {
20          util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
21 diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
22 index 7d289ca..1626768 100644
23 --- a/src/gallium/drivers/r300/r300_context.c
24 +++ b/src/gallium/drivers/r300/r300_context.c
25 @@ -419,17 +419,19 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
26      r300_init_query_functions(r300);
27      r300_init_state_functions(r300);
28      r300_init_resource_functions(r300);
29 -    
30 +
31      r300->context.create_video_decoder = vl_create_decoder;
32      r300->context.create_video_buffer = vl_video_buffer_create;
33  
34 -    r300->vbuf_mgr = u_vbuf_create(&r300->context, 1024 * 1024, 16,
35 +    if (r300->screen->caps.has_tcl) {
36 +        r300->vbuf_mgr = u_vbuf_create(&r300->context, 1024 * 1024, 16,
37                                         PIPE_BIND_VERTEX_BUFFER |
38                                         PIPE_BIND_INDEX_BUFFER,
39                                         U_VERTEX_FETCH_DWORD_ALIGNED);
40 -    if (!r300->vbuf_mgr)
41 -        goto fail;
42 -    r300->vbuf_mgr->caps.format_fixed32 = 0;
43 +        if (!r300->vbuf_mgr)
44 +            goto fail;
45 +        r300->vbuf_mgr->caps.format_fixed32 = 0;
46 +    }
47  
48      r300->blitter = util_blitter_create(&r300->context);
49      if (r300->blitter == NULL)
50 diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
51 index e40b7af..8264b28 100644
52 --- a/src/gallium/drivers/r300/r300_context.h
53 +++ b/src/gallium/drivers/r300/r300_context.h
54 @@ -581,6 +581,9 @@ struct r300_context {
55      void *dsa_decompress_zmask;
56  
57      struct u_vbuf *vbuf_mgr;
58 +    struct pipe_index_buffer swtcl_index_buffer;
59 +    struct pipe_vertex_buffer swtcl_vertex_buffer[PIPE_MAX_ATTRIBS];
60 +    unsigned swtcl_nr_vertex_buffers;
61  
62      struct util_slab_mempool pool_transfers;
63  
64 diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
65 index 83cad42..1542648 100644
66 --- a/src/gallium/drivers/r300/r300_render.c
67 +++ b/src/gallium/drivers/r300/r300_render.c
68 @@ -818,7 +818,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
69      struct pipe_transfer *ib_transfer = NULL;
70      int i;
71      void *indices = NULL;
72 -    boolean indexed = info->indexed && r300->vbuf_mgr->index_buffer.buffer;
73 +    boolean indexed = info->indexed && r300->swtcl_index_buffer.buffer;
74  
75      if (r300->skip_rendering) {
76          return;
77 @@ -831,10 +831,10 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
78              (indexed ? PREP_INDEXED : 0),
79              indexed ? 256 : 6);
80  
81 -    for (i = 0; i < r300->vbuf_mgr->nr_vertex_buffers; i++) {
82 -        if (r300->vbuf_mgr->vertex_buffer[i].buffer) {
83 +    for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
84 +        if (r300->swtcl_vertex_buffer[i].buffer) {
85              void *buf = pipe_buffer_map(pipe,
86 -                                  r300->vbuf_mgr->vertex_buffer[i].buffer,
87 +                                  r300->swtcl_vertex_buffer[i].buffer,
88                                    PIPE_TRANSFER_READ |
89                                    PIPE_TRANSFER_UNSYNCHRONIZED,
90                                    &vb_transfer[i]);
91 @@ -843,7 +843,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
92      }
93  
94      if (indexed) {
95 -        indices = pipe_buffer_map(pipe, r300->vbuf_mgr->index_buffer.buffer,
96 +        indices = pipe_buffer_map(pipe, r300->swtcl_index_buffer.buffer,
97                                    PIPE_TRANSFER_READ |
98                                    PIPE_TRANSFER_UNSYNCHRONIZED, &ib_transfer);
99      }
100 @@ -856,8 +856,8 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
101      draw_flush(r300->draw);
102      r300->draw_vbo_locked = FALSE;
103  
104 -    for (i = 0; i < r300->vbuf_mgr->nr_vertex_buffers; i++) {
105 -        if (r300->vbuf_mgr->vertex_buffer[i].buffer) {
106 +    for (i = 0; i < r300->swtcl_nr_vertex_buffers; i++) {
107 +        if (r300->swtcl_vertex_buffer[i].buffer) {
108              pipe_buffer_unmap(pipe, vb_transfer[i]);
109              draw_set_mapped_vertex_buffer(r300->draw, i, NULL);
110          }
111 diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
112 index 763321b..f28b0be 100644
113 --- a/src/gallium/drivers/r300/r300_screen.c
114 +++ b/src/gallium/drivers/r300/r300_screen.c
115 @@ -212,6 +212,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
116          switch (param)
117          {
118          case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
119 +        case PIPE_SHADER_CAP_SUBROUTINES:
120              return 0;
121          default:;
122          }
123 diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
124 index 2bc7036..c43352a 100644
125 --- a/src/gallium/drivers/r300/r300_state.c
126 +++ b/src/gallium/drivers/r300/r300_state.c
127 @@ -1048,6 +1048,10 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
128  
129      /* Override some states for Draw. */
130      rs->rs_draw.sprite_coord_enable = 0; /* We can do this in HW. */
131 +    rs->rs_draw.offset_point = 0;
132 +    rs->rs_draw.offset_line = 0;
133 +    rs->rs_draw.offset_tri = 0;
134 +    rs->rs_draw.offset_clamp = 0;
135  
136  #ifdef PIPE_ARCH_LITTLE_ENDIAN
137      vap_control_status = R300_VC_NO_SWAP;
138 @@ -1595,7 +1599,6 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
139                                      const struct pipe_vertex_buffer* buffers)
140  {
141      struct r300_context* r300 = r300_context(pipe);
142 -    unsigned i;
143      struct pipe_vertex_buffer dummy_vb = {0};
144  
145      /* There must be at least one vertex buffer set, otherwise it locks up. */
146 @@ -1605,18 +1608,13 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
147          count = 1;
148      }
149  
150 -    u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers);
151 -
152      if (r300->screen->caps.has_tcl) {
153 -        /* HW TCL. */
154 -        for (i = 0; i < count; i++) {
155 -            if (buffers[i].buffer &&
156 -               !r300_resource(buffers[i].buffer)->b.user_ptr) {
157 -            }
158 -        }
159 +        u_vbuf_set_vertex_buffers(r300->vbuf_mgr, count, buffers);
160          r300->vertex_arrays_dirty = TRUE;
161      } else {
162 -        /* SW TCL. */
163 +        util_copy_vertex_buffers(r300->swtcl_vertex_buffer,
164 +                                 &r300->swtcl_nr_vertex_buffers,
165 +                                 buffers, count);
166          draw_set_vertex_buffers(r300->draw, count, buffers);
167      }
168  }
169 @@ -1626,9 +1624,15 @@ static void r300_set_index_buffer(struct pipe_context* pipe,
170  {
171      struct r300_context* r300 = r300_context(pipe);
172  
173 -    u_vbuf_set_index_buffer(r300->vbuf_mgr, ib);
174 -
175 -    if (!r300->screen->caps.has_tcl) {
176 +    if (r300->screen->caps.has_tcl) {
177 +        u_vbuf_set_index_buffer(r300->vbuf_mgr, ib);
178 +    } else {
179 +        if (ib) {
180 +            pipe_resource_reference(&r300->swtcl_index_buffer.buffer, ib->buffer);
181 +            memcpy(&r300->swtcl_index_buffer, ib, sizeof(*ib));
182 +        } else {
183 +            pipe_resource_reference(&r300->swtcl_index_buffer.buffer, NULL);
184 +        }
185          draw_set_index_buffer(r300->draw, ib);
186      }
187  }
188 @@ -1702,11 +1706,11 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
189          return NULL;
190  
191      velems->count = count;
192 -    velems->vmgr_elements =
193 -        u_vbuf_create_vertex_elements(r300->vbuf_mgr, count, attribs,
194 -                                          velems->velem);
195  
196      if (r300_screen(pipe->screen)->caps.has_tcl) {
197 +        velems->vmgr_elements =
198 +            u_vbuf_create_vertex_elements(r300->vbuf_mgr, count, attribs,
199 +                                          velems->velem);
200          /* Setup PSC.
201           * The unused components will be replaced by (..., 0, 1). */
202          r300_vertex_psc(velems);
203 @@ -1716,6 +1720,8 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
204                  align(util_format_get_blocksize(velems->velem[i].src_format), 4);
205              velems->vertex_size_dwords += velems->format_size[i] / 4;
206          }
207 +    } else {
208 +        memcpy(velems->velem, attribs, count * sizeof(struct pipe_vertex_element));
209      }
210  
211      return velems;
212 @@ -1733,9 +1739,9 @@ static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
213  
214      r300->velems = velems;
215  
216 -    u_vbuf_bind_vertex_elements(r300->vbuf_mgr, state, velems->vmgr_elements);
217 -
218 -    if (r300->draw) {
219 +    if (r300->screen->caps.has_tcl) {
220 +        u_vbuf_bind_vertex_elements(r300->vbuf_mgr, state, velems->vmgr_elements);
221 +    } else {
222          draw_set_vertex_elements(r300->draw, velems->count, velems->velem);
223          return;
224      }
225 @@ -1750,7 +1756,9 @@ static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *s
226      struct r300_context *r300 = r300_context(pipe);
227      struct r300_vertex_element_state *velems = state;
228  
229 -    u_vbuf_destroy_vertex_elements(r300->vbuf_mgr, velems->vmgr_elements);
230 +    if (r300->screen->caps.has_tcl) {
231 +        u_vbuf_destroy_vertex_elements(r300->vbuf_mgr, velems->vmgr_elements);
232 +    }
233      FREE(state);
234  }
235  
236 @@ -1765,10 +1773,10 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
237      vs->state.tokens = tgsi_dup_tokens(shader->tokens);
238  
239      if (r300->screen->caps.has_tcl) {
240 -        r300_init_vs_outputs(vs);
241 +        r300_init_vs_outputs(r300, vs);
242          r300_translate_vertex_shader(r300, vs);
243      } else {
244 -        r300_draw_init_vertex_shader(r300->draw, vs);
245 +        r300_draw_init_vertex_shader(r300, vs);
246      }
247  
248      return vs;
249 diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
250 index 1eef071..4faf2b5 100644
251 --- a/src/gallium/drivers/r300/r300_vs.c
252 +++ b/src/gallium/drivers/r300/r300_vs.c
253 @@ -36,6 +36,7 @@
254  
255  /* Convert info about VS output semantics into r300_shader_semantics. */
256  static void r300_shader_read_vs_outputs(
257 +    struct r300_context *r300,
258      struct tgsi_shader_info* info,
259      struct r300_shader_semantics* vs_outputs)
260  {
261 @@ -83,6 +84,14 @@ static void r300_shader_read_vs_outputs(
262                  fprintf(stderr, "r300 VP: cannot handle edgeflag output.\n");
263                  break;
264  
265 +            case TGSI_SEMANTIC_CLIPVERTEX:
266 +                assert(index == 0);
267 +                /* Draw does clip vertex for us. */
268 +                if (r300->screen->caps.has_tcl) {
269 +                    fprintf(stderr, "r300 VP: cannot handle clip vertex output.\n");
270 +                }
271 +                break;
272 +
273              default:
274                  fprintf(stderr, "r300 VP: unknown vertex output semantic: %i.\n",
275                          info->output_semantic_name[i]);
276 @@ -160,10 +169,11 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c)
277      c->code->outputs[outputs->wpos] = reg++;
278  }
279  
280 -void r300_init_vs_outputs(struct r300_vertex_shader *vs)
281 +void r300_init_vs_outputs(struct r300_context *r300,
282 +                          struct r300_vertex_shader *vs)
283  {
284      tgsi_scan_shader(vs->state.tokens, &vs->info);
285 -    r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
286 +    r300_shader_read_vs_outputs(r300, &vs->info, &vs->outputs);
287  }
288  
289  static void r300_dummy_vertex_shader(
290 @@ -187,7 +197,7 @@ static void r300_dummy_vertex_shader(
291      ureg_destroy(ureg);
292  
293      shader->dummy = TRUE;
294 -    r300_init_vs_outputs(shader);
295 +    r300_init_vs_outputs(r300, shader);
296      r300_translate_vertex_shader(r300, shader);
297  }
298  
299 diff --git a/src/gallium/drivers/r300/r300_vs.h b/src/gallium/drivers/r300/r300_vs.h
300 index a482ddc..b02d5d7 100644
301 --- a/src/gallium/drivers/r300/r300_vs.h
302 +++ b/src/gallium/drivers/r300/r300_vs.h
303 @@ -56,12 +56,13 @@ struct r300_vertex_shader {
304      void *draw_vs;
305  };
306  
307 -void r300_init_vs_outputs(struct r300_vertex_shader *vs);
308 +void r300_init_vs_outputs(struct r300_context *r300,
309 +                          struct r300_vertex_shader *vs);
310  
311  void r300_translate_vertex_shader(struct r300_context *r300,
312                                    struct r300_vertex_shader *vs);
313  
314 -void r300_draw_init_vertex_shader(struct draw_context *draw,
315 +void r300_draw_init_vertex_shader(struct r300_context *r300,
316                                    struct r300_vertex_shader *vs);
317  
318  #endif /* R300_VS_H */
319 diff --git a/src/gallium/drivers/r300/r300_vs_draw.c b/src/gallium/drivers/r300/r300_vs_draw.c
320 index 2939963..69d6758 100644
321 --- a/src/gallium/drivers/r300/r300_vs_draw.c
322 +++ b/src/gallium/drivers/r300/r300_vs_draw.c
323 @@ -29,7 +29,7 @@
324   *
325   * Transformations:
326   * 1) If the secondary color output is present, the primary color must be
327 - *    inserted before it.
328 + *    present too.
329   * 2) If any back-face color output is present, there must be all 4 color
330   *    outputs and missing ones must be inserted.
331   * 3) Insert a trailing texcoord output containing a copy of POS, for WPOS.
332 @@ -52,7 +52,6 @@ struct vs_transform_context {
333  
334      boolean color_used[2];
335      boolean bcolor_used[2];
336 -    boolean temp_used[128];
337  
338      /* Index of the pos output, typically 0. */
339      unsigned pos_output;
340 @@ -72,6 +71,8 @@ struct vs_transform_context {
341      boolean first_instruction;
342      /* End instruction processed? */
343      boolean end_instruction;
344 +
345 +    boolean temp_used[1024];
346  };
347  
348  static void emit_temp(struct tgsi_transform_context *ctx, unsigned reg)
349 @@ -102,9 +103,9 @@ static void emit_output(struct tgsi_transform_context *ctx,
350      ++vsctx->num_outputs;
351  }
352  
353 -static void insert_output(struct tgsi_transform_context *ctx,
354 -                          struct tgsi_full_declaration *before,
355 -                          unsigned name, unsigned index, unsigned interp)
356 +static void insert_output_before(struct tgsi_transform_context *ctx,
357 +                                 struct tgsi_full_declaration *before,
358 +                                 unsigned name, unsigned index, unsigned interp)
359  {
360      struct vs_transform_context *vsctx = (struct vs_transform_context *)ctx;
361      unsigned i;
362 @@ -115,28 +116,29 @@ static void insert_output(struct tgsi_transform_context *ctx,
363      }
364  
365      /* Insert the new output. */
366 -    emit_output(ctx, name, index, interp, before->Range.First);
367 +    emit_output(ctx, name, index, interp,
368 +                before->Range.First + vsctx->decl_shift);
369  
370      ++vsctx->decl_shift;
371  }
372  
373 -static void insert_trailing_bcolor(struct tgsi_transform_context *ctx,
374 -                                   struct tgsi_full_declaration *before)
375 +static void insert_output_after(struct tgsi_transform_context *ctx,
376 +                                struct tgsi_full_declaration *after,
377 +                                unsigned name, unsigned index, unsigned interp)
378  {
379      struct vs_transform_context *vsctx = (struct vs_transform_context *)ctx;
380 +    unsigned i;
381  
382 -    /* If BCOLOR0 is used, make sure BCOLOR1 is present too. Otherwise
383 -     * the rasterizer doesn't do the color selection correctly. */
384 -    if (vsctx->bcolor_used[0] && !vsctx->bcolor_used[1]) {
385 -        if (before) {
386 -            insert_output(ctx, before, TGSI_SEMANTIC_BCOLOR, 1,
387 -                          TGSI_INTERPOLATE_LINEAR);
388 -        } else {
389 -            emit_output(ctx, TGSI_SEMANTIC_BCOLOR, 1,
390 -                        TGSI_INTERPOLATE_LINEAR, vsctx->num_outputs);
391 -        }
392 -        vsctx->bcolor_used[1] = TRUE;
393 +    /* Make a place for the new output. */
394 +    for (i = after->Range.First+1; i < Elements(vsctx->out_remap); i++) {
395 +        ++vsctx->out_remap[i];
396      }
397 +
398 +    /* Insert the new output. */
399 +    emit_output(ctx, name, index, interp,
400 +                after->Range.First + 1);
401 +
402 +    ++vsctx->decl_shift;
403  }
404  
405  static void transform_decl(struct tgsi_transform_context *ctx,
406 @@ -153,41 +155,38 @@ static void transform_decl(struct tgsi_transform_context *ctx,
407  
408              case TGSI_SEMANTIC_COLOR:
409                  assert(decl->Semantic.Index < 2);
410 -                vsctx->color_used[decl->Semantic.Index] = TRUE;
411  
412                  /* We must rasterize the first color if the second one is
413                   * used, otherwise the rasterizer doesn't do the color
414                   * selection correctly. Declare it, but don't write to it. */
415                  if (decl->Semantic.Index == 1 && !vsctx->color_used[0]) {
416 -                    insert_output(ctx, decl, TGSI_SEMANTIC_COLOR, 0,
417 -                                  TGSI_INTERPOLATE_LINEAR);
418 +                    insert_output_before(ctx, decl, TGSI_SEMANTIC_COLOR, 0,
419 +                                         TGSI_INTERPOLATE_LINEAR);
420                      vsctx->color_used[0] = TRUE;
421                  }
422                  break;
423  
424              case TGSI_SEMANTIC_BCOLOR:
425                  assert(decl->Semantic.Index < 2);
426 -                vsctx->bcolor_used[decl->Semantic.Index] = TRUE;
427  
428                  /* We must rasterize all 4 colors if back-face colors are
429                   * used, otherwise the rasterizer doesn't do the color
430                   * selection correctly. Declare it, but don't write to it. */
431                  if (!vsctx->color_used[0]) {
432 -                    insert_output(ctx, decl, TGSI_SEMANTIC_COLOR, 0,
433 -                                  TGSI_INTERPOLATE_LINEAR);
434 +                    insert_output_before(ctx, decl, TGSI_SEMANTIC_COLOR, 0,
435 +                                         TGSI_INTERPOLATE_LINEAR);
436                      vsctx->color_used[0] = TRUE;
437                  }
438                  if (!vsctx->color_used[1]) {
439 -                    insert_output(ctx, decl, TGSI_SEMANTIC_COLOR, 1,
440 -                                  TGSI_INTERPOLATE_LINEAR);
441 +                    insert_output_before(ctx, decl, TGSI_SEMANTIC_COLOR, 1,
442 +                                         TGSI_INTERPOLATE_LINEAR);
443                      vsctx->color_used[1] = TRUE;
444                  }
445                  if (decl->Semantic.Index == 1 && !vsctx->bcolor_used[0]) {
446 -                    insert_output(ctx, decl, TGSI_SEMANTIC_BCOLOR, 0,
447 -                                  TGSI_INTERPOLATE_LINEAR);
448 +                    insert_output_before(ctx, decl, TGSI_SEMANTIC_BCOLOR, 0,
449 +                                         TGSI_INTERPOLATE_LINEAR);
450                      vsctx->bcolor_used[0] = TRUE;
451                  }
452 -                /* One more case is handled in insert_trailing_bcolor. */
453                  break;
454  
455              case TGSI_SEMANTIC_GENERIC:
456 @@ -195,11 +194,6 @@ static void transform_decl(struct tgsi_transform_context *ctx,
457                  break;
458          }
459  
460 -        if (decl->Semantic.Name != TGSI_SEMANTIC_BCOLOR) {
461 -            /* Insert it as soon as possible. */
462 -            insert_trailing_bcolor(ctx, decl);
463 -        }
464 -
465          /* Since we're inserting new outputs in between, the following outputs
466           * should be moved to the right so that they don't overlap with
467           * the newly added ones. */
468 @@ -214,6 +208,14 @@ static void transform_decl(struct tgsi_transform_context *ctx,
469      }
470  
471      ctx->emit_declaration(ctx, decl);
472 +
473 +    /* Insert BCOLOR1 if needed. */
474 +    if (decl->Declaration.File == TGSI_FILE_OUTPUT &&
475 +        decl->Semantic.Name == TGSI_SEMANTIC_BCOLOR &&
476 +        !vsctx->bcolor_used[1]) {
477 +        insert_output_after(ctx, decl, TGSI_SEMANTIC_BCOLOR, 1,
478 +                            TGSI_INTERPOLATE_LINEAR);
479 +    }
480  }
481  
482  static void transform_inst(struct tgsi_transform_context *ctx,
483 @@ -226,10 +228,6 @@ static void transform_inst(struct tgsi_transform_context *ctx,
484      if (!vsctx->first_instruction) {
485          vsctx->first_instruction = TRUE;
486  
487 -        /* The trailing BCOLOR should be inserted before the code
488 -         * if it hasn't already been done so. */
489 -        insert_trailing_bcolor(ctx, NULL);
490 -
491          /* Insert the generic output for WPOS. */
492          emit_output(ctx, TGSI_SEMANTIC_GENERIC, vsctx->last_generic + 1,
493                      TGSI_INTERPOLATE_PERSPECTIVE, vsctx->num_outputs);
494 @@ -309,14 +307,18 @@ static void transform_inst(struct tgsi_transform_context *ctx,
495      ctx->emit_instruction(ctx, inst);
496  }
497  
498 -void r300_draw_init_vertex_shader(struct draw_context *draw,
499 +void r300_draw_init_vertex_shader(struct r300_context *r300,
500                                    struct r300_vertex_shader *vs)
501  {
502 +    struct draw_context *draw = r300->draw;
503      struct pipe_shader_state new_vs;
504 +    struct tgsi_shader_info info;
505      struct vs_transform_context transform;
506      const uint newLen = tgsi_num_tokens(vs->state.tokens) + 100 /* XXX */;
507      unsigned i;
508  
509 +    tgsi_scan_shader(vs->state.tokens, &info);
510 +
511      new_vs.tokens = tgsi_alloc_tokens(newLen);
512      if (new_vs.tokens == NULL)
513          return;
514 @@ -329,6 +331,22 @@ void r300_draw_init_vertex_shader(struct draw_context *draw,
515      transform.base.transform_instruction = transform_inst;
516      transform.base.transform_declaration = transform_decl;
517  
518 +    for (i = 0; i < info.num_outputs; i++) {
519 +        unsigned index = info.output_semantic_index[i];
520 +
521 +        switch (info.output_semantic_name[i]) {
522 +            case TGSI_SEMANTIC_COLOR:
523 +                assert(index < 2);
524 +                transform.color_used[index] = TRUE;
525 +                break;
526 +
527 +            case TGSI_SEMANTIC_BCOLOR:
528 +                assert(index < 2);
529 +                transform.bcolor_used[index] = TRUE;
530 +                break;
531 +        }
532 +    }
533 +
534      tgsi_transform_shader(vs->state.tokens,
535                            (struct tgsi_token*)new_vs.tokens,
536                            newLen, &transform.base);
537 @@ -350,7 +368,7 @@ void r300_draw_init_vertex_shader(struct draw_context *draw,
538      vs->state.tokens = new_vs.tokens;
539  
540      /* Init the VS output table for the rasterizer. */
541 -    r300_init_vs_outputs(vs);
542 +    r300_init_vs_outputs(r300, vs);
543  
544      /* Make the last generic be WPOS. */
545      vs->outputs.wpos = vs->outputs.generic[transform.last_generic + 1];
546 diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
547 index d7d17dd..84a8655 100644
548 --- a/src/glsl/Android.mk
549 +++ b/src/glsl/Android.mk
550 @@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \
551         $(LIBGLSL_CXX_SOURCES)
552  
553  LOCAL_C_INCLUDES := \
554 +       external/astl/include \
555         $(MESA_TOP)/src/mapi \
556         $(MESA_TOP)/src/mesa
557  
558 diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
559 index d3c0d70..9cdd804 100644
560 --- a/src/mesa/drivers/dri/intel/intel_context.c
561 +++ b/src/mesa/drivers/dri/intel/intel_context.c
562 @@ -1225,6 +1225,10 @@ intel_process_dri2_buffer_with_separate_stencil(struct intel_context *intel,
563     if (!rb)
564        return;
565  
566 +   /* Check if we failed to allocate the depth miptree earlier. */
567 +   if (buffer->attachment == __DRI_BUFFER_HIZ && rb->mt == NULL)
568 +     return;
569 +
570     /* If the renderbuffer's and DRIbuffer's regions match, then continue. */
571     if ((buffer->attachment != __DRI_BUFFER_HIZ &&
572         rb->mt &&
573 @@ -1266,6 +1270,7 @@ intel_process_dri2_buffer_with_separate_stencil(struct intel_context *intel,
574      * due to failure to allocate new storage.
575      */
576     if (buffer->attachment == __DRI_BUFFER_HIZ) {
577 +      assert(rb->mt);
578        intel_miptree_release(&rb->mt->hiz_mt);
579     } else {
580        intel_miptree_release(&rb->mt);
581 @@ -1291,6 +1296,7 @@ intel_process_dri2_buffer_with_separate_stencil(struct intel_context *intel,
582  
583     /* Associate buffer with new storage. */
584     if (buffer->attachment == __DRI_BUFFER_HIZ) {
585 +      assert(rb->mt);
586        rb->mt->hiz_mt = mt;
587     } else {
588        rb->mt = mt;
This page took 0.074204 seconds and 3 git commands to generate.