2023-03-28 22:13:23 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2023 Valve Corporation
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef RADV_NIR_H
|
|
|
|
|
#define RADV_NIR_H
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include "amd_family.h"
|
|
|
|
|
#include "nir.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef struct nir_shader nir_shader;
|
|
|
|
|
struct radeon_info;
|
|
|
|
|
struct radv_pipeline_layout;
|
2023-07-25 09:56:44 +02:00
|
|
|
struct radv_shader_stage;
|
2023-03-28 22:13:23 +02:00
|
|
|
struct radv_shader_info;
|
|
|
|
|
struct radv_shader_args;
|
2023-08-08 18:37:58 +02:00
|
|
|
struct radv_shader_layout;
|
2023-03-28 22:13:23 +02:00
|
|
|
struct radv_device;
|
2024-01-11 15:32:38 +01:00
|
|
|
struct radv_graphics_state_key;
|
2023-03-28 22:13:23 +02:00
|
|
|
|
2024-01-09 13:57:42 +01:00
|
|
|
void radv_nir_apply_pipeline_layout(nir_shader *shader, struct radv_device *device,
|
|
|
|
|
const struct radv_shader_stage *stage);
|
2023-03-28 22:13:23 +02:00
|
|
|
|
2024-01-09 13:57:42 +01:00
|
|
|
void radv_nir_lower_abi(nir_shader *shader, enum amd_gfx_level gfx_level, const struct radv_shader_stage *stage,
|
2024-01-11 15:32:38 +01:00
|
|
|
const struct radv_graphics_state_key *gfx_state, uint32_t address32_hi);
|
2023-03-28 22:13:23 +02:00
|
|
|
|
2023-07-20 21:13:22 +02:00
|
|
|
bool radv_nir_lower_hit_attrib_derefs(nir_shader *shader);
|
|
|
|
|
|
2023-11-15 15:03:09 +01:00
|
|
|
bool radv_nir_lower_ray_payload_derefs(nir_shader *shader, uint32_t offset);
|
|
|
|
|
|
2024-01-09 13:58:43 +01:00
|
|
|
bool radv_nir_lower_ray_queries(nir_shader *shader, struct radv_device *device);
|
2023-03-28 22:13:23 +02:00
|
|
|
|
2023-07-25 09:56:44 +02:00
|
|
|
bool radv_nir_lower_vs_inputs(nir_shader *shader, const struct radv_shader_stage *vs_stage,
|
2024-01-11 15:32:38 +01:00
|
|
|
const struct radv_graphics_state_key *gfx_state, const struct radeon_info *rad_info);
|
2023-03-28 22:13:23 +02:00
|
|
|
|
2023-03-16 13:05:07 -07:00
|
|
|
bool radv_nir_lower_primitive_shading_rate(nir_shader *nir, enum amd_gfx_level gfx_level);
|
|
|
|
|
|
2023-07-25 09:56:44 +02:00
|
|
|
bool radv_nir_lower_fs_intrinsics(nir_shader *nir, const struct radv_shader_stage *fs_stage,
|
2024-01-11 15:32:38 +01:00
|
|
|
const struct radv_graphics_state_key *gfx_state);
|
2023-03-29 18:46:11 +02:00
|
|
|
|
2024-01-11 15:32:38 +01:00
|
|
|
bool radv_nir_lower_fs_barycentric(nir_shader *shader, const struct radv_graphics_state_key *gfx_state,
|
|
|
|
|
unsigned rast_prim);
|
2022-05-26 11:37:24 +02:00
|
|
|
|
2024-01-21 17:48:44 +09:00
|
|
|
bool radv_nir_lower_intrinsics_early(nir_shader *nir, bool lower_view_index_to_zero);
|
2023-03-29 18:54:07 +02:00
|
|
|
|
2023-03-16 13:25:16 -07:00
|
|
|
bool radv_nir_lower_view_index(nir_shader *nir, bool per_primitive);
|
|
|
|
|
|
2023-03-29 19:12:06 +02:00
|
|
|
bool radv_nir_lower_viewport_to_zero(nir_shader *nir);
|
|
|
|
|
|
2023-03-29 19:12:41 +02:00
|
|
|
bool radv_nir_export_multiview(nir_shader *nir);
|
|
|
|
|
|
2023-03-29 22:30:45 +02:00
|
|
|
void radv_nir_lower_io_to_scalar_early(nir_shader *nir, nir_variable_mode mask);
|
|
|
|
|
|
2024-03-07 13:51:59 +01:00
|
|
|
unsigned radv_map_io_driver_location(unsigned semantic);
|
|
|
|
|
|
2023-03-29 22:30:45 +02:00
|
|
|
void radv_nir_lower_io(struct radv_device *device, nir_shader *nir);
|
|
|
|
|
|
2023-07-25 09:56:44 +02:00
|
|
|
bool radv_nir_lower_io_to_mem(struct radv_device *device, struct radv_shader_stage *stage);
|
2023-03-29 22:30:45 +02:00
|
|
|
|
2024-01-11 15:32:38 +01:00
|
|
|
void radv_nir_lower_poly_line_smooth(nir_shader *nir, const struct radv_graphics_state_key *gfx_state);
|
2023-02-28 09:48:56 +01:00
|
|
|
|
2023-07-16 01:01:55 +02:00
|
|
|
bool radv_nir_lower_cooperative_matrix(nir_shader *shader, unsigned wave_size);
|
|
|
|
|
|
2024-03-01 11:48:17 +01:00
|
|
|
bool radv_nir_lower_draw_id_to_zero(nir_shader *shader);
|
|
|
|
|
|
2023-03-28 22:13:23 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* RADV_NIR_H */
|