~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.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:
90
90
/**
91
91
 * Whether this register channel refers to a specific immediate value.
92
92
 */
93
 
static boolean
 
93
static bool
94
94
is_immediate(const struct lp_tgsi_channel_info *chan_info, float value)
95
95
{
96
96
   return chan_info->file == TGSI_FILE_IMMEDIATE &&
113
113
 
114
114
   if (info->num_texs < ARRAY_SIZE(info->tex)) {
115
115
      struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs];
116
 
      boolean indirect = FALSE;
 
116
      bool indirect = false;
117
117
      unsigned readmask = 0;
118
118
 
119
119
      tex_info->target = inst->Texture.Texture;
143
143
         readmask = TGSI_WRITEMASK_XYZW;
144
144
         /* modifier would be in another not analyzed reg so just say indirect */
145
145
         if (modifier != LP_BLD_TEX_MODIFIER_NONE) {
146
 
            indirect = TRUE;
 
146
            indirect = true;
147
147
         }
148
148
         break;
149
149
      case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
150
150
         readmask = TGSI_WRITEMASK_XYZW;
151
 
         indirect = TRUE;
 
151
         indirect = true;
152
152
         break;
153
153
      default:
154
154
         assert(0);
157
157
 
158
158
      if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) {
159
159
         /* We don't track explicit derivatives, although we could */
160
 
         indirect = TRUE;
 
160
         indirect = true;
161
161
         tex_info->sampler_unit = inst->Src[3].Register.Index;
162
162
         tex_info->texture_unit = inst->Src[3].Register.Index;
163
163
      }  else {
175
175
         if (readmask & (1 << chan)) {
176
176
            analyse_src(ctx, chan_info, &inst->Src[0].Register, chan);
177
177
            if (chan_info->file != TGSI_FILE_INPUT) {
178
 
               indirect = TRUE;
 
178
               indirect = true;
179
179
            }
180
180
         } else {
181
181
            memset(chan_info, 0, sizeof *chan_info);
183
183
      }
184
184
 
185
185
      if (indirect) {
186
 
         info->indirect_textures = TRUE;
 
186
         info->indirect_textures = true;
187
187
      }
188
188
 
189
189
      ++info->num_texs;
190
190
   } else {
191
 
      info->indirect_textures = TRUE;
 
191
      info->indirect_textures = true;
192
192
   }
193
193
}
194
194
 
202
202
analyse_sample(struct analysis_context *ctx,
203
203
               const struct tgsi_full_instruction *inst,
204
204
               enum lp_build_tex_modifier modifier,
205
 
               boolean shadow)
 
205
               bool shadow)
206
206
{
207
207
   struct lp_tgsi_info *info = ctx->info;
208
208
   unsigned chan;
210
210
   if (info->num_texs < ARRAY_SIZE(info->tex)) {
211
211
      struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs];
212
212
      unsigned target = ctx->sample_target[inst->Src[1].Register.Index];
213
 
      boolean indirect = FALSE;
214
 
      boolean shadow = FALSE;
 
213
      bool indirect = false;
 
214
      bool shadow = false;
215
215
      unsigned readmask;
216
216
 
217
217
      switch (target) {
245
245
      tex_info->sampler_unit = inst->Src[2].Register.Index;
246
246
 
247
247
      if (tex_info->texture_unit != tex_info->sampler_unit) {
248
 
         info->sampler_texture_units_different = TRUE;
 
248
         info->sampler_texture_units_different = true;
249
249
      }
250
250
 
251
251
      if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV ||
252
252
          modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_LOD ||
253
253
          modifier == LP_BLD_TEX_MODIFIER_LOD_BIAS || shadow) {
254
254
         /* We don't track insts with additional regs, although we could */
255
 
         indirect = TRUE;
 
255
         indirect = true;
256
256
      }
257
257
 
258
258
      for (chan = 0; chan < 4; ++chan) {
260
260
         if (readmask & (1 << chan)) {
261
261
            analyse_src(ctx, chan_info, &inst->Src[0].Register, chan);
262
262
            if (chan_info->file != TGSI_FILE_INPUT) {
263
 
               indirect = TRUE;
 
263
               indirect = true;
264
264
            }
265
265
         } else {
266
266
            memset(chan_info, 0, sizeof *chan_info);
268
268
      }
269
269
 
270
270
      if (indirect) {
271
 
         info->indirect_textures = TRUE;
 
271
         info->indirect_textures = true;
272
272
      }
273
273
 
274
274
      ++info->num_texs;
275
275
   } else {
276
 
      info->indirect_textures = TRUE;
 
276
      info->indirect_textures = true;
277
277
   }
278
278
}
279
279
 
349
349
         analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_LOD);
350
350
         break;
351
351
      case TGSI_OPCODE_SAMPLE:
352
 
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_NONE, FALSE);
 
352
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_NONE, false);
353
353
         break;
354
354
      case TGSI_OPCODE_SAMPLE_C:
355
 
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_NONE, TRUE);
 
355
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_NONE, true);
356
356
         break;
357
357
      case TGSI_OPCODE_SAMPLE_C_LZ:
358
 
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_LOD_ZERO, TRUE);
 
358
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_LOD_ZERO, true);
359
359
         break;
360
360
      case TGSI_OPCODE_SAMPLE_D:
361
 
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV, FALSE);
 
361
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV, false);
362
362
         break;
363
363
      case TGSI_OPCODE_SAMPLE_B:
364
 
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_LOD_BIAS, FALSE);
 
364
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_LOD_BIAS, false);
365
365
         break;
366
366
      case TGSI_OPCODE_SAMPLE_L:
367
 
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_LOD, FALSE);
 
367
         analyse_sample(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_LOD, false);
368
368
         break;
369
369
      default:
370
370
         break;
590
590
                  ctx->imm[ctx->num_imms][chan] = value;
591
591
 
592
592
                  if (value < 0.0f || value > 1.0f) {
593
 
                     info->unclamped_immediates = TRUE;
 
593
                     info->unclamped_immediates = true;
594
594
                  }
595
595
               }
596
596
               ++ctx->num_imms;