~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/draw/draw_pipe_vbuf.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
   /* FIXME: we have no guarantee that 'unsigned' is 32bit */
64
64
 
65
65
   /** Vertices in hardware format */
66
 
   unsigned *vertices;
67
 
   unsigned *vertex_ptr;
 
66
   uint8_t *vertices;
 
67
   uint8_t *vertex_ptr;
68
68
   unsigned max_vertices;
69
69
   unsigned nr_vertices;
70
70
 
71
71
   /** Indices */
72
 
   ushort *indices;
 
72
   uint16_t *indices;
73
73
   unsigned max_indices;
74
74
   unsigned nr_indices;
75
75
 
115
115
 * have a couple of slots at the beginning (1-dword header, 4-dword
116
116
 * clip pos) that we ignore here.  We only use the vertex->data[] fields.
117
117
 */
118
 
static inline ushort
 
118
static inline uint16_t
119
119
emit_vertex(struct vbuf_stage *vbuf, struct vertex_header *vertex)
120
120
{
121
121
   if (vertex->vertex_id == UNDEFINED_VERTEX_ID && vbuf->vertex_ptr) {
130
130
 
131
131
      if (0) draw_dump_emitted_vertex(vbuf->vinfo, (uint8_t *)vbuf->vertex_ptr);
132
132
 
133
 
      vbuf->vertex_ptr += vbuf->vertex_size/4;
 
133
      vbuf->vertex_ptr += vbuf->vertex_size;
134
134
      vertex->vertex_id = vbuf->nr_vertices++;
135
135
   }
136
136
 
137
 
   return (ushort)vertex->vertex_id;
 
137
   return (uint16_t)vertex->vertex_id;
138
138
}
139
139
 
140
140
 
183
183
 * will be flushed if needed and a new one allocated.
184
184
 */
185
185
static void
186
 
vbuf_start_prim(struct vbuf_stage *vbuf, uint prim)
 
186
vbuf_start_prim(struct vbuf_stage *vbuf, enum mesa_prim prim)
187
187
{
188
188
   struct translate_key hw_key;
189
189
   unsigned dst_offset;
270
270
   struct vbuf_stage *vbuf = vbuf_stage(stage);
271
271
 
272
272
   vbuf_flush_vertices(vbuf);
273
 
   vbuf_start_prim(vbuf, PIPE_PRIM_TRIANGLES);
 
273
   vbuf_start_prim(vbuf, MESA_PRIM_TRIANGLES);
274
274
   stage->tri = vbuf_tri;
275
275
   stage->tri(stage, prim);
276
276
}
282
282
   struct vbuf_stage *vbuf = vbuf_stage(stage);
283
283
 
284
284
   vbuf_flush_vertices(vbuf);
285
 
   vbuf_start_prim(vbuf, PIPE_PRIM_LINES);
 
285
   vbuf_start_prim(vbuf, MESA_PRIM_LINES);
286
286
   stage->line = vbuf_line;
287
287
   stage->line(stage, prim);
288
288
}
294
294
   struct vbuf_stage *vbuf = vbuf_stage(stage);
295
295
 
296
296
   vbuf_flush_vertices(vbuf);
297
 
   vbuf_start_prim(vbuf, PIPE_PRIM_POINTS);
 
297
   vbuf_start_prim(vbuf, MESA_PRIM_POINTS);
298
298
   stage->point = vbuf_point;
299
299
   stage->point(stage, prim);
300
300
}
362
362
    * fail, we are basically without usable hardware.
363
363
    */
364
364
   vbuf->render->allocate_vertices(vbuf->render,
365
 
                                   (ushort) vbuf->vertex_size,
366
 
                                   (ushort) vbuf->max_vertices);
367
 
 
368
 
   vbuf->vertices = (uint *) vbuf->render->map_vertices(vbuf->render);
369
 
 
370
 
   vbuf->vertex_ptr = vbuf->vertices;
 
365
                                   (uint16_t) vbuf->vertex_size,
 
366
                                   (uint16_t) vbuf->max_vertices);
 
367
 
 
368
   vbuf->vertex_ptr = vbuf->vertices =
 
369
      vbuf->render->map_vertices(vbuf->render);
371
370
}
372
371
 
373
372
 
429
428
   vbuf->render = render;
430
429
   vbuf->max_indices = MIN2(render->max_indices, UNDEFINED_VERTEX_ID-1);
431
430
 
432
 
   vbuf->indices = (ushort *) align_malloc(vbuf->max_indices *
 
431
   vbuf->indices = (uint16_t *) align_malloc(vbuf->max_indices *
433
432
                    sizeof(vbuf->indices[0]),
434
433
                    16);
435
434
   if (!vbuf->indices)
439
438
   if (!vbuf->cache)
440
439
      goto fail;
441
440
 
442
 
   vbuf->vertices = NULL;
443
 
   vbuf->vertex_ptr = vbuf->vertices;
 
441
   vbuf->vertex_ptr = vbuf->vertices = NULL;
444
442
 
445
443
   vbuf->zero4[0] = vbuf->zero4[1] = vbuf->zero4[2] = vbuf->zero4[3] = 0.0f;
446
444