~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/amd/common/ac_nir.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:
1
1
/*
2
2
 * Copyright © 2021 Valve Corporation
3
3
 *
4
 
 * Permission is hereby granted, free of charge, to any person obtaining a
5
 
 * copy of this software and associated documentation files (the "Software"),
6
 
 * to deal in the Software without restriction, including without limitation
7
 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
 
 * and/or sell copies of the Software, and to permit persons to whom the
9
 
 * Software is furnished to do so, subject to the following conditions:
10
 
 *
11
 
 * The above copyright notice and this permission notice (including the next
12
 
 * paragraph) shall be included in all copies or substantial portions of the
13
 
 * Software.
14
 
 *
15
 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18
 
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
 
 * IN THE SOFTWARE.
22
 
 *
 
4
 * SPDX-License-Identifier: MIT
23
5
 */
24
6
 
25
7
 
31
13
#include "ac_shader_args.h"
32
14
#include "ac_shader_util.h"
33
15
#include "amd_family.h"
34
 
#include "pipe/p_state.h"
35
16
 
36
17
#ifdef __cplusplus
37
18
extern "C" {
76
57
   return ac_nir_load_arg_at_offset(b, ac_args, arg, 0);
77
58
}
78
59
 
 
60
void ac_nir_store_arg(nir_builder *b, const struct ac_shader_args *ac_args, struct ac_arg arg,
 
61
                      nir_ssa_def *val);
 
62
 
79
63
nir_ssa_def *
80
64
ac_nir_unpack_arg(nir_builder *b, const struct ac_shader_args *ac_args, struct ac_arg arg,
81
65
                  unsigned rshift, unsigned bitwidth);
95
79
                       uint32_t clip_cull_mask,
96
80
                       bool no_param_export,
97
81
                       bool force_vrs,
 
82
                       bool done,
98
83
                       uint64_t outputs_written,
99
84
                       nir_ssa_def *(*outputs)[4]);
100
85
 
297
282
   enum radeon_family family;
298
283
   enum amd_gfx_level gfx_level;
299
284
 
 
285
   bool use_aco;
300
286
   bool uses_discard;
301
287
   bool alpha_to_coverage_via_mrtz;
302
288
   bool dual_src_blend_swizzle;
304
290
   unsigned color_is_int8;
305
291
   unsigned color_is_int10;
306
292
 
 
293
   bool bc_optimize_for_persp;
 
294
   bool bc_optimize_for_linear;
 
295
   bool force_persp_sample_interp;
 
296
   bool force_linear_sample_interp;
 
297
   bool force_persp_center_interp;
 
298
   bool force_linear_center_interp;
 
299
   unsigned ps_iter_samples;
 
300
 
307
301
   /* OpenGL only */
308
302
   bool clamp_color;
309
303
   bool alpha_to_one;
310
 
   enum pipe_compare_func alpha_func;
 
304
   bool kill_samplemask;
 
305
   enum compare_func alpha_func;
311
306
   unsigned broadcast_last_cbuf;
312
307
 
313
308
   /* Vulkan only */
314
309
   unsigned enable_mrt_output_nan_fixup;
 
310
   bool no_color_export;
315
311
} ac_nir_lower_ps_options;
316
312
 
317
313
void
318
314
ac_nir_lower_ps(nir_shader *nir, const ac_nir_lower_ps_options *options);
319
315
 
 
316
typedef struct {
 
317
   enum amd_gfx_level gfx_level;
 
318
 
 
319
   /* If true, round the layer component of the coordinates source to the nearest
 
320
    * integer for all array ops. This is always done for cube array ops.
 
321
    */
 
322
   bool lower_array_layer_round_even;
 
323
 
 
324
   /* Fix derivatives of constants and FS inputs in control flow.
 
325
    *
 
326
    * Ignores interpolateAtSample()/interpolateAtOffset(), dynamically indexed input loads,
 
327
    * pervertexEXT input loads, textureGather() with implicit LOD and 16-bit derivatives and
 
328
    * texture samples with nir_tex_src_min_lod.
 
329
    *
 
330
    * The layer must also be a constant or FS input.
 
331
    */
 
332
   bool fix_derivs_in_divergent_cf;
 
333
   unsigned max_wqm_vgprs;
 
334
} ac_nir_lower_tex_options;
 
335
 
 
336
bool
 
337
ac_nir_lower_tex(nir_shader *nir, const ac_nir_lower_tex_options *options);
 
338
 
320
339
#ifdef __cplusplus
321
340
}
322
341
#endif