1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2019 Valve Corporation. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21bf215546Sopenharmony_ci * IN THE SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci#ifndef RADV_SHADER_ARGS_H 25bf215546Sopenharmony_ci#define RADV_SHADER_ARGS_H 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#include "compiler/shader_enums.h" 28bf215546Sopenharmony_ci#include "util/list.h" 29bf215546Sopenharmony_ci#include "util/macros.h" 30bf215546Sopenharmony_ci#include "ac_shader_args.h" 31bf215546Sopenharmony_ci#include "amd_family.h" 32bf215546Sopenharmony_ci#include "radv_constants.h" 33bf215546Sopenharmony_ci#include "radv_shader.h" 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_cistruct radv_shader_args { 36bf215546Sopenharmony_ci struct ac_shader_args ac; 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_ci struct ac_arg descriptor_sets[MAX_SETS]; 39bf215546Sopenharmony_ci /* User data 0/1. GFX: descriptor list, Compute: scratch BO */ 40bf215546Sopenharmony_ci struct ac_arg ring_offsets; 41bf215546Sopenharmony_ci /* User data 2/3. same as the descriptor list above but for task shaders. */ 42bf215546Sopenharmony_ci struct ac_arg task_ring_offsets; 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_ci /* Streamout */ 45bf215546Sopenharmony_ci struct ac_arg streamout_buffers; 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci /* NGG */ 48bf215546Sopenharmony_ci struct ac_arg ngg_query_state; 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_ci /* NGG GS */ 51bf215546Sopenharmony_ci struct ac_arg ngg_culling_settings; 52bf215546Sopenharmony_ci struct ac_arg ngg_viewport_scale[2]; 53bf215546Sopenharmony_ci struct ac_arg ngg_viewport_translate[2]; 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_ci /* Task shaders */ 56bf215546Sopenharmony_ci struct ac_arg task_ib_addr; 57bf215546Sopenharmony_ci struct ac_arg task_ib_stride; 58bf215546Sopenharmony_ci 59bf215546Sopenharmony_ci /* Fragment shaders */ 60bf215546Sopenharmony_ci struct ac_arg ps_epilog_pc; 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ci struct ac_arg prolog_inputs; 63bf215546Sopenharmony_ci struct ac_arg vs_inputs[MAX_VERTEX_ATTRIBS]; 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci /* PS epilogs */ 66bf215546Sopenharmony_ci struct ac_arg ps_epilog_inputs[MAX_RTS]; 67bf215546Sopenharmony_ci 68bf215546Sopenharmony_ci struct radv_userdata_locations user_sgprs_locs; 69bf215546Sopenharmony_ci unsigned num_user_sgprs; 70bf215546Sopenharmony_ci 71bf215546Sopenharmony_ci bool explicit_scratch_args; 72bf215546Sopenharmony_ci bool remap_spi_ps_input; 73bf215546Sopenharmony_ci bool load_grid_size_from_user_sgpr; 74bf215546Sopenharmony_ci bool is_gs_copy_shader; 75bf215546Sopenharmony_ci bool is_trap_handler_shader; 76bf215546Sopenharmony_ci}; 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_cistatic inline struct radv_shader_args * 79bf215546Sopenharmony_ciradv_shader_args_from_ac(struct ac_shader_args *args) 80bf215546Sopenharmony_ci{ 81bf215546Sopenharmony_ci return container_of(args, struct radv_shader_args, ac); 82bf215546Sopenharmony_ci} 83bf215546Sopenharmony_ci 84bf215546Sopenharmony_cistruct radv_pipeline_key; 85bf215546Sopenharmony_cistruct radv_shader_info; 86bf215546Sopenharmony_ci 87bf215546Sopenharmony_civoid radv_declare_shader_args(enum amd_gfx_level gfx_level, const struct radv_pipeline_key *key, 88bf215546Sopenharmony_ci const struct radv_shader_info *info, gl_shader_stage stage, 89bf215546Sopenharmony_ci bool has_previous_stage, gl_shader_stage previous_stage, 90bf215546Sopenharmony_ci struct radv_shader_args *args); 91bf215546Sopenharmony_ci 92bf215546Sopenharmony_civoid radv_declare_ps_epilog_args(enum amd_gfx_level gfx_level, const struct radv_ps_epilog_key *key, 93bf215546Sopenharmony_ci struct radv_shader_args *args); 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_ci#endif 96