~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/crocus/crocus_draw.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:
45
45
#include "util/u_prim.h"
46
46
 
47
47
static bool
48
 
prim_is_points_or_lines(enum pipe_prim_type mode)
 
48
prim_is_points_or_lines(enum mesa_prim mode)
49
49
{
50
50
   /* We don't need to worry about adjacency - it can only be used with
51
51
    * geometry shaders, and we don't care about this info when GS is on.
52
52
    */
53
 
   return mode == PIPE_PRIM_POINTS ||
54
 
          mode == PIPE_PRIM_LINES ||
55
 
          mode == PIPE_PRIM_LINE_LOOP ||
56
 
          mode == PIPE_PRIM_LINE_STRIP;
 
53
   return mode == MESA_PRIM_POINTS ||
 
54
          mode == MESA_PRIM_LINES ||
 
55
          mode == MESA_PRIM_LINE_LOOP ||
 
56
          mode == MESA_PRIM_LINE_STRIP;
57
57
}
58
58
 
59
59
static bool
89
89
      return false;
90
90
 
91
91
   switch (draw->mode) {
92
 
   case PIPE_PRIM_POINTS:
93
 
   case PIPE_PRIM_LINES:
94
 
   case PIPE_PRIM_LINE_STRIP:
95
 
   case PIPE_PRIM_TRIANGLES:
96
 
   case PIPE_PRIM_TRIANGLE_STRIP:
97
 
   case PIPE_PRIM_LINES_ADJACENCY:
98
 
   case PIPE_PRIM_LINE_STRIP_ADJACENCY:
99
 
   case PIPE_PRIM_TRIANGLES_ADJACENCY:
100
 
   case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
 
92
   case MESA_PRIM_POINTS:
 
93
   case MESA_PRIM_LINES:
 
94
   case MESA_PRIM_LINE_STRIP:
 
95
   case MESA_PRIM_TRIANGLES:
 
96
   case MESA_PRIM_TRIANGLE_STRIP:
 
97
   case MESA_PRIM_LINES_ADJACENCY:
 
98
   case MESA_PRIM_LINE_STRIP_ADJACENCY:
 
99
   case MESA_PRIM_TRIANGLES_ADJACENCY:
 
100
   case MESA_PRIM_TRIANGLE_STRIP_ADJACENCY:
101
101
      return true;
102
102
   default:
103
103
      break;
118
118
                        const struct pipe_draw_start_count_bias *draw)
119
119
{
120
120
   struct crocus_screen *screen = (struct crocus_screen *)ice->ctx.screen;
121
 
   enum pipe_prim_type mode = info->mode;
 
121
   enum mesa_prim mode = info->mode;
122
122
 
123
123
   if (screen->devinfo.ver < 6) {
124
124
      /* Slight optimization to avoid the GS program when not needed:
125
125
       */
126
126
      struct pipe_rasterizer_state *rs_state = crocus_get_rast_state(ice);
127
 
      if (mode == PIPE_PRIM_QUAD_STRIP && !rs_state->flatshade &&
 
127
      if (mode == MESA_PRIM_QUAD_STRIP && !rs_state->flatshade &&
128
128
          rs_state->fill_front == PIPE_POLYGON_MODE_FILL &&
129
129
          rs_state->fill_back == PIPE_POLYGON_MODE_FILL)
130
 
         mode = PIPE_PRIM_TRIANGLE_STRIP;
131
 
      if (mode == PIPE_PRIM_QUADS &&
 
130
         mode = MESA_PRIM_TRIANGLE_STRIP;
 
131
      if (mode == MESA_PRIM_QUADS &&
132
132
          draw->count == 4 &&
133
133
          !rs_state->flatshade &&
134
134
          rs_state->fill_front == PIPE_POLYGON_MODE_FILL &&
135
135
          rs_state->fill_back == PIPE_POLYGON_MODE_FILL)
136
 
         mode = PIPE_PRIM_TRIANGLE_FAN;
 
136
         mode = MESA_PRIM_TRIANGLE_FAN;
137
137
   }
138
138
 
139
139
   if (ice->state.prim_mode != mode) {
140
140
      ice->state.prim_mode = mode;
141
141
 
142
 
      enum pipe_prim_type reduced = u_reduced_prim(mode);
 
142
      enum mesa_prim reduced = u_reduced_prim(mode);
143
143
      if (ice->state.reduced_prim_mode != reduced) {
144
144
         if (screen->devinfo.ver < 6)
145
145
            ice->state.dirty |= CROCUS_DIRTY_GEN4_CLIP_PROG | CROCUS_DIRTY_GEN4_SF_PROG;
165
165
      }
166
166
   }
167
167
 
168
 
   if (info->mode == PIPE_PRIM_PATCHES &&
 
168
   if (info->mode == MESA_PRIM_PATCHES &&
169
169
       ice->state.vertices_per_patch != ice->state.patch_vertices) {
170
170
      ice->state.vertices_per_patch = ice->state.patch_vertices;
171
171
 
396
396
    * trifans/tristrips.
397
397
    */
398
398
   if (screen->devinfo.ver < 6) {
399
 
      if (info->mode == PIPE_PRIM_QUADS || info->mode == PIPE_PRIM_QUAD_STRIP) {
 
399
      if (info->mode == MESA_PRIM_QUADS || info->mode == MESA_PRIM_QUAD_STRIP) {
400
400
         bool trim = u_trim_pipe_prim(info->mode, (unsigned *)&draws[0].count);
401
401
         if (!trim)
402
402
            return;