~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h

  • 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:
29
29
 * Fetch all elements in [min_index, max_index] with bias, and use the
30
30
 * (rebased) index buffer as the draw elements.
31
31
 */
32
 
static boolean
 
32
static bool
33
33
CONCAT2(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
34
34
                                     unsigned istart, unsigned icount)
35
35
{
39
39
   const unsigned max_index = draw->pt.user.max_index;
40
40
   const int elt_bias = draw->pt.user.eltBias;
41
41
   unsigned fetch_start, fetch_count;
42
 
   const ushort *draw_elts = NULL;
 
42
   const uint16_t *draw_elts = NULL;
43
43
   const unsigned start = istart;
44
44
   const unsigned end = istart + icount;
45
45
 
47
47
    * through the normal paths */
48
48
   if (end >= draw->pt.user.eltMax ||
49
49
       end < istart)
50
 
      return FALSE;
 
50
      return false;
51
51
 
52
52
   /* use the ib directly */
53
53
   if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) {
54
54
      if (icount > vsplit->max_vertices)
55
 
         return FALSE;
 
55
         return false;
56
56
 
57
57
      for (unsigned i = 0; i < icount; i++) {
58
58
         ELT_TYPE idx = DRAW_GET_IDX(ib, start + i);
60
60
            debug_printf("warning: index out of range\n");
61
61
         }
62
62
      }
63
 
      draw_elts = (const ushort *) (ib + istart);
 
63
      draw_elts = (const uint16_t *) (ib + istart);
64
64
   } else {
65
65
      /* have to go through vsplit->draw_elts */
66
66
      if (icount > vsplit->segment_size)
67
 
         return FALSE;
 
67
         return false;
68
68
   }
69
69
 
70
70
   /* this is faster only when we fetch less elements than the normal path */
71
71
   if (max_index - min_index > icount - 1)
72
 
      return FALSE;
 
72
      return false;
73
73
 
74
74
   if (elt_bias < 0 && (int) min_index < -elt_bias)
75
 
      return FALSE;
 
75
      return false;
76
76
 
77
77
   /* why this check? */
78
78
   for (unsigned i = 0; i < draw->pt.nr_vertex_elements; i++) {
79
79
      if (draw->pt.vertex_element[i].instance_divisor)
80
 
         return FALSE;
 
80
         return false;
81
81
   }
82
82
 
83
83
   fetch_start = min_index + elt_bias;
85
85
 
86
86
   /* Check for overflow in the fetch_start */
87
87
   if (fetch_start < min_index || fetch_start < elt_bias)
88
 
      return FALSE;
 
88
      return false;
89
89
 
90
90
   if (!draw_elts) {
91
91
      if (min_index == 0) {
95
95
            if (idx < min_index || idx > max_index) {
96
96
               debug_printf("warning: index out of range\n");
97
97
            }
98
 
            vsplit->draw_elts[i] = (ushort) idx;
 
98
            vsplit->draw_elts[i] = (uint16_t) idx;
99
99
         }
100
100
      } else {
101
101
         for (unsigned i = 0; i < icount; i++) {
104
104
            if (idx < min_index || idx > max_index) {
105
105
               debug_printf("warning: index out of range\n");
106
106
            }
107
 
            vsplit->draw_elts[i] = (ushort) (idx - min_index);
 
107
            vsplit->draw_elts[i] = (uint16_t) (idx - min_index);
108
108
         }
109
109
      }
110
110
 
127
127
CONCAT2(vsplit_segment_cache_, ELT_TYPE)(struct vsplit_frontend *vsplit,
128
128
                                         unsigned flags,
129
129
                                         unsigned istart, unsigned icount,
130
 
                                         boolean spoken, unsigned ispoken,
131
 
                                         boolean close, unsigned iclose)
 
130
                                         bool spoken, unsigned ispoken,
 
131
                                         bool close, unsigned iclose)
132
132
{
133
133
   struct draw_context *draw = vsplit->draw;
134
134
   const ELT_TYPE *ib = (const ELT_TYPE *) draw->pt.user.elts;
171
171
                                          unsigned icount)
172
172
{
173
173
   CONCAT2(vsplit_segment_cache_, ELT_TYPE)(vsplit,
174
 
          flags, istart, icount, FALSE, 0, FALSE, 0);
 
174
          flags, istart, icount, false, 0, false, 0);
175
175
}
176
176
 
177
177
 
182
182
                                        unsigned icount,
183
183
                                        unsigned i0)
184
184
{
185
 
   const boolean close_loop = ((flags) == DRAW_SPLIT_BEFORE);
 
185
   const bool close_loop = ((flags) == DRAW_SPLIT_BEFORE);
186
186
 
187
187
   CONCAT2(vsplit_segment_cache_, ELT_TYPE)(vsplit,
188
 
          flags, istart, icount, FALSE, 0, close_loop, i0);
 
188
          flags, istart, icount, false, 0, close_loop, i0);
189
189
}
190
190
 
191
191
 
196
196
                                       unsigned icount,
197
197
                                       unsigned i0)
198
198
{
199
 
   const boolean use_spoken = (((flags) & DRAW_SPLIT_BEFORE) != 0);
 
199
   const bool use_spoken = (((flags) & DRAW_SPLIT_BEFORE) != 0);
200
200
 
201
201
   CONCAT2(vsplit_segment_cache_, ELT_TYPE)(vsplit,
202
 
          flags, istart, icount, use_spoken, i0, FALSE, 0);
 
202
          flags, istart, icount, use_spoken, i0, false, 0);
203
203
}
204
204
 
205
205
 
206
206
#define LOCAL_VARS                                                         \
207
207
   struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend;   \
208
 
   const enum pipe_prim_type prim = vsplit->prim;                          \
 
208
   const enum mesa_prim prim = vsplit->prim;                          \
209
209
   const unsigned max_count_simple = vsplit->segment_size;                 \
210
210
   const unsigned max_count_loop = vsplit->segment_size - 1;               \
211
211
   const unsigned max_count_fan = vsplit->segment_size;
228
228
vsplit_segment_loop_linear(struct vsplit_frontend *vsplit, unsigned flags,
229
229
                           unsigned istart, unsigned icount, unsigned i0)
230
230
{
231
 
   boolean close_loop = (flags == DRAW_SPLIT_BEFORE);
 
231
   bool close_loop = (flags == DRAW_SPLIT_BEFORE);
232
232
   unsigned nr;
233
233
 
234
234
   assert(icount + !!close_loop <= vsplit->segment_size);
253
253
vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags,
254
254
                          unsigned istart, unsigned icount, unsigned i0)
255
255
{
256
 
   boolean use_spoken = ((flags & DRAW_SPLIT_BEFORE) != 0);
 
256
   bool use_spoken = ((flags & DRAW_SPLIT_BEFORE) != 0);
257
257
   unsigned nr = 0;
258
258
 
259
259
   assert(icount <= vsplit->segment_size);
274
274
 
275
275
#define LOCAL_VARS                                                         \
276
276
   struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend;   \
277
 
   const enum pipe_prim_type prim = vsplit->prim;                          \
 
277
   const enum mesa_prim prim = vsplit->prim;                          \
278
278
   const unsigned max_count_simple = vsplit->max_vertices;                 \
279
279
   const unsigned max_count_loop = vsplit->segment_size - 1;               \
280
280
   const unsigned max_count_fan = vsplit->segment_size;
281
281
 
282
 
#define PRIMITIVE(istart, icount) FALSE
 
282
#define PRIMITIVE(istart, icount) false
283
283
 
284
284
#define ELT_TYPE linear
285
285