1bf215546Sopenharmony_ci/* -*- mesa-c++ -*- 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright (c) 2022 Collabora LTD 4bf215546Sopenharmony_ci * 5bf215546Sopenharmony_ci * Author: Gert Wollny <gert.wollny@collabora.com> 6bf215546Sopenharmony_ci * 7bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 8bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 9bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 10bf215546Sopenharmony_ci * on the rights to use, copy, modify, merge, publish, distribute, sub 11bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom 12bf215546Sopenharmony_ci * the Software is furnished to do so, subject to the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 15bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 16bf215546Sopenharmony_ci * Software. 17bf215546Sopenharmony_ci * 18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 21bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 22bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 23bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 24bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. 25bf215546Sopenharmony_ci */ 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#ifndef SFN_SHADER_H 28bf215546Sopenharmony_ci#define SFN_SHADER_H 29bf215546Sopenharmony_ci 30bf215546Sopenharmony_ci#include "sfn_instr.h" 31bf215546Sopenharmony_ci#include "sfn_instrfactory.h" 32bf215546Sopenharmony_ci#include "sfn_instr_controlflow.h" 33bf215546Sopenharmony_ci#include "gallium/drivers/r600/r600_shader.h" 34bf215546Sopenharmony_ci#include "sfn_liverangeevaluator.h" 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci#include <bitset> 37bf215546Sopenharmony_ci#include <memory> 38bf215546Sopenharmony_ci#include <stack> 39bf215546Sopenharmony_ci#include <vector> 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_cistruct nir_shader; 42bf215546Sopenharmony_cistruct nir_cf_node; 43bf215546Sopenharmony_cistruct nir_if; 44bf215546Sopenharmony_cistruct nir_block; 45bf215546Sopenharmony_cistruct nir_instr; 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_cinamespace r600 { 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_ciclass ShaderIO { 50bf215546Sopenharmony_cipublic: 51bf215546Sopenharmony_ci void set_sid(int sid); 52bf215546Sopenharmony_ci void override_spi_sid(int spi_sid); 53bf215546Sopenharmony_ci void print(std::ostream& os) const; 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_ci int spi_sid() const { return m_spi_sid;} 56bf215546Sopenharmony_ci unsigned sid() const { return m_sid;} 57bf215546Sopenharmony_ci 58bf215546Sopenharmony_ci int location() const {return m_location;} 59bf215546Sopenharmony_ci unsigned name() const { return m_name;} 60bf215546Sopenharmony_ci 61bf215546Sopenharmony_ci int pos() const { return m_pos;} 62bf215546Sopenharmony_ci void set_pos(int pos) {m_pos = pos;} 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ci bool is_param() const { return m_is_param;} 65bf215546Sopenharmony_ci void set_is_param(bool val) { m_is_param = val;} 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci void set_gpr(int gpr) {m_gpr = gpr;} 68bf215546Sopenharmony_ci int gpr() const {return m_gpr;} 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_ciprotected: 71bf215546Sopenharmony_ci ShaderIO(const char *type, int loc, int name); 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_ciprivate: 74bf215546Sopenharmony_ci 75bf215546Sopenharmony_ci virtual void do_print(std::ostream& os) const = 0; 76bf215546Sopenharmony_ci 77bf215546Sopenharmony_ci const char *m_type; 78bf215546Sopenharmony_ci int m_location{-1}; 79bf215546Sopenharmony_ci int m_name{-1}; 80bf215546Sopenharmony_ci int m_sid{0}; 81bf215546Sopenharmony_ci int m_spi_sid{0}; 82bf215546Sopenharmony_ci int m_pos{0}; 83bf215546Sopenharmony_ci int m_is_param{false}; 84bf215546Sopenharmony_ci int m_gpr{0}; 85bf215546Sopenharmony_ci}; 86bf215546Sopenharmony_ci 87bf215546Sopenharmony_ciclass ShaderOutput : public ShaderIO { 88bf215546Sopenharmony_cipublic: 89bf215546Sopenharmony_ci ShaderOutput(); 90bf215546Sopenharmony_ci ShaderOutput(int location, int name, int writemask); 91bf215546Sopenharmony_ci 92bf215546Sopenharmony_ci int writemask() const { return m_writemask;} 93bf215546Sopenharmony_ci 94bf215546Sopenharmony_ciprivate: 95bf215546Sopenharmony_ci void do_print(std::ostream& os) const override; 96bf215546Sopenharmony_ci 97bf215546Sopenharmony_ci int m_writemask{0}; 98bf215546Sopenharmony_ci}; 99bf215546Sopenharmony_ci 100bf215546Sopenharmony_ci 101bf215546Sopenharmony_ciclass ShaderInput : public ShaderIO { 102bf215546Sopenharmony_cipublic: 103bf215546Sopenharmony_ci ShaderInput(); 104bf215546Sopenharmony_ci ShaderInput(int location, int name); 105bf215546Sopenharmony_ci void set_interpolator(int interp, int interp_loc, bool uses_interpolate_at_centroid); 106bf215546Sopenharmony_ci void set_uses_interpolate_at_centroid(); 107bf215546Sopenharmony_ci void set_need_lds_pos() { m_need_lds_pos = true;} 108bf215546Sopenharmony_ci int ij_index() const { return m_ij_index;} 109bf215546Sopenharmony_ci 110bf215546Sopenharmony_ci int interpolator() const{return m_interpolator;} 111bf215546Sopenharmony_ci int interpolate_loc() const {return m_interpolate_loc;} 112bf215546Sopenharmony_ci bool need_lds_pos() const {return m_need_lds_pos;} 113bf215546Sopenharmony_ci int lds_pos() const {return m_lds_pos;} 114bf215546Sopenharmony_ci void set_lds_pos(int pos) {m_lds_pos = pos;} 115bf215546Sopenharmony_ci 116bf215546Sopenharmony_ci int ring_offset() const {return m_ring_offset;} 117bf215546Sopenharmony_ci void set_ring_offset(int offs) {m_ring_offset = offs;} 118bf215546Sopenharmony_ci bool uses_interpolate_at_centroid() const {return m_uses_interpolate_at_centroid;} 119bf215546Sopenharmony_ci 120bf215546Sopenharmony_ciprivate: 121bf215546Sopenharmony_ci void do_print(std::ostream& os) const override; 122bf215546Sopenharmony_ci 123bf215546Sopenharmony_ci int m_interpolator{0}; 124bf215546Sopenharmony_ci int m_interpolate_loc{0}; 125bf215546Sopenharmony_ci int m_ij_index{0}; 126bf215546Sopenharmony_ci bool m_uses_interpolate_at_centroid{false}; 127bf215546Sopenharmony_ci bool m_need_lds_pos{false}; 128bf215546Sopenharmony_ci int m_lds_pos{0}; 129bf215546Sopenharmony_ci int m_ring_offset{0}; 130bf215546Sopenharmony_ci}; 131bf215546Sopenharmony_ci 132bf215546Sopenharmony_ciclass Shader : public Allocate { 133bf215546Sopenharmony_cipublic: 134bf215546Sopenharmony_ci using InputIterator = std::map<int, ShaderInput>::iterator; 135bf215546Sopenharmony_ci using OutputIterator = std::map<int, ShaderOutput>::iterator; 136bf215546Sopenharmony_ci 137bf215546Sopenharmony_ci using ShaderBlocks = std::list<Block::Pointer, Allocator<Block::Pointer>>; 138bf215546Sopenharmony_ci 139bf215546Sopenharmony_ci Shader(const Shader& orig) = delete; 140bf215546Sopenharmony_ci 141bf215546Sopenharmony_ci virtual ~Shader() {} 142bf215546Sopenharmony_ci 143bf215546Sopenharmony_ci bool add_info_from_string(std::istream& is); 144bf215546Sopenharmony_ci 145bf215546Sopenharmony_ci static Shader *translate_from_nir(nir_shader *nir, const pipe_stream_output_info *so_info, r600_shader *gs_shader, 146bf215546Sopenharmony_ci r600_shader_key& key, r600_chip_class chip_class); 147bf215546Sopenharmony_ci 148bf215546Sopenharmony_ci bool process(nir_shader *nir); 149bf215546Sopenharmony_ci 150bf215546Sopenharmony_ci bool process_cf_node(nir_cf_node *node); 151bf215546Sopenharmony_ci bool process_if(nir_if *node); 152bf215546Sopenharmony_ci bool process_loop(nir_loop *node); 153bf215546Sopenharmony_ci bool process_block(nir_block *node); 154bf215546Sopenharmony_ci bool process_instr(nir_instr *instr); 155bf215546Sopenharmony_ci void emit_instruction(PInst instr); 156bf215546Sopenharmony_ci bool emit_atomic_local_shared(nir_intrinsic_instr* instr); 157bf215546Sopenharmony_ci 158bf215546Sopenharmony_ci void print(std::ostream& os ) const; 159bf215546Sopenharmony_ci void print_header(std::ostream& os ) const; 160bf215546Sopenharmony_ci 161bf215546Sopenharmony_ci bool process_intrinsic(nir_intrinsic_instr *intr); 162bf215546Sopenharmony_ci 163bf215546Sopenharmony_ci virtual bool load_input(nir_intrinsic_instr *intr) = 0; 164bf215546Sopenharmony_ci virtual bool store_output(nir_intrinsic_instr *intr) = 0; 165bf215546Sopenharmony_ci 166bf215546Sopenharmony_ci bool load_uniform(nir_intrinsic_instr *intr); 167bf215546Sopenharmony_ci bool load_ubo(nir_intrinsic_instr *intr); 168bf215546Sopenharmony_ci 169bf215546Sopenharmony_ci ValueFactory& value_factory(); 170bf215546Sopenharmony_ci 171bf215546Sopenharmony_ci void add_output(const ShaderOutput& output) { 172bf215546Sopenharmony_ci m_outputs[output.location()] = output; 173bf215546Sopenharmony_ci } 174bf215546Sopenharmony_ci 175bf215546Sopenharmony_ci void add_input(const ShaderInput& input) { 176bf215546Sopenharmony_ci m_inputs[input.location()] = input; 177bf215546Sopenharmony_ci } 178bf215546Sopenharmony_ci 179bf215546Sopenharmony_ci void set_input_gpr(int driver_lcation, int gpr); 180bf215546Sopenharmony_ci 181bf215546Sopenharmony_ci InputIterator find_input(int location) { return m_inputs.find(location);} 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_ci InputIterator input_not_found() {return m_inputs.end();} 184bf215546Sopenharmony_ci 185bf215546Sopenharmony_ci OutputIterator find_output(int location); 186bf215546Sopenharmony_ci OutputIterator output_not_found() {return m_outputs.end();} 187bf215546Sopenharmony_ci 188bf215546Sopenharmony_ci ShaderBlocks& func() { return m_root; } 189bf215546Sopenharmony_ci void reset_function(ShaderBlocks& new_root); 190bf215546Sopenharmony_ci 191bf215546Sopenharmony_ci void emit_instruction_from_string(const std::string &s); 192bf215546Sopenharmony_ci 193bf215546Sopenharmony_ci void set_info(nir_shader *nir); 194bf215546Sopenharmony_ci void get_shader_info(r600_shader *sh_info); 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_ci r600_chip_class chip_class() const {return m_chip_class;}; 197bf215546Sopenharmony_ci void set_chip_class(r600_chip_class cls) {m_chip_class = cls;}; 198bf215546Sopenharmony_ci 199bf215546Sopenharmony_ci void start_new_block(int nesting_depth); 200bf215546Sopenharmony_ci 201bf215546Sopenharmony_ci const ShaderOutput& output(int base) const; 202bf215546Sopenharmony_ci 203bf215546Sopenharmony_ci LiveRangeMap prepare_live_range_map(); 204bf215546Sopenharmony_ci 205bf215546Sopenharmony_ci void set_last_txd(Instr *txd){m_last_txd = txd;} 206bf215546Sopenharmony_ci Instr *last_txd(){return m_last_txd;} 207bf215546Sopenharmony_ci 208bf215546Sopenharmony_ci // Needed for keeping the memory access in order 209bf215546Sopenharmony_ci void chain_scratch_read(Instr *instr); 210bf215546Sopenharmony_ci void chain_ssbo_read(Instr *instr); 211bf215546Sopenharmony_ci 212bf215546Sopenharmony_ci virtual uint32_t enabled_stream_buffers_mask() const {return 0;}; 213bf215546Sopenharmony_ci 214bf215546Sopenharmony_ci size_t noutputs() const { return m_outputs.size();} 215bf215546Sopenharmony_ci size_t ninputs() const { return m_inputs.size();} 216bf215546Sopenharmony_ci 217bf215546Sopenharmony_ci enum Flags { 218bf215546Sopenharmony_ci sh_indirect_const_file, 219bf215546Sopenharmony_ci sh_needs_scratch_space, 220bf215546Sopenharmony_ci sh_needs_sbo_ret_address, 221bf215546Sopenharmony_ci sh_uses_atomics, 222bf215546Sopenharmony_ci sh_uses_images, 223bf215546Sopenharmony_ci sh_uses_tex_buffer, 224bf215546Sopenharmony_ci sh_writes_memory, 225bf215546Sopenharmony_ci sh_txs_cube_array_comp, 226bf215546Sopenharmony_ci sh_indirect_atomic, 227bf215546Sopenharmony_ci sh_mem_barrier, 228bf215546Sopenharmony_ci sh_legacy_math_rules, 229bf215546Sopenharmony_ci sh_flags_count 230bf215546Sopenharmony_ci }; 231bf215546Sopenharmony_ci 232bf215546Sopenharmony_ci void set_flag(Flags f) {m_flags.set(f);} 233bf215546Sopenharmony_ci bool has_flag(Flags f) const {return m_flags.test(f);} 234bf215546Sopenharmony_ci 235bf215546Sopenharmony_ci int atomic_file_count() const { return m_atomic_file_count; } 236bf215546Sopenharmony_ci 237bf215546Sopenharmony_ci PRegister atomic_update(); 238bf215546Sopenharmony_ci int remap_atomic_base(int base); 239bf215546Sopenharmony_ci auto evaluate_resource_offset(nir_intrinsic_instr *instr, int src_id) -> std::pair<int, PRegister>; 240bf215546Sopenharmony_ci int ssbo_image_offset() const {return m_ssbo_image_offset;} 241bf215546Sopenharmony_ci PRegister rat_return_address() {assert(m_rat_return_address); return m_rat_return_address;} 242bf215546Sopenharmony_ci 243bf215546Sopenharmony_ci PRegister emit_load_to_register(PVirtualValue src); 244bf215546Sopenharmony_ci 245bf215546Sopenharmony_ciprotected: 246bf215546Sopenharmony_ci enum ESlots { 247bf215546Sopenharmony_ci es_face, 248bf215546Sopenharmony_ci es_instanceid, 249bf215546Sopenharmony_ci es_invocation_id, 250bf215546Sopenharmony_ci es_patch_id, 251bf215546Sopenharmony_ci es_pos, 252bf215546Sopenharmony_ci es_rel_patch_id, 253bf215546Sopenharmony_ci es_sample_mask_in, 254bf215546Sopenharmony_ci es_sample_id, 255bf215546Sopenharmony_ci es_sample_pos, 256bf215546Sopenharmony_ci es_tess_factor_base, 257bf215546Sopenharmony_ci es_vertexid, 258bf215546Sopenharmony_ci es_tess_coord, 259bf215546Sopenharmony_ci es_primitive_id, 260bf215546Sopenharmony_ci es_helper_invocation, 261bf215546Sopenharmony_ci es_last 262bf215546Sopenharmony_ci }; 263bf215546Sopenharmony_ci 264bf215546Sopenharmony_ci std::bitset<es_last> m_sv_values; 265bf215546Sopenharmony_ci 266bf215546Sopenharmony_ci Shader(const char *type_id); 267bf215546Sopenharmony_ci 268bf215546Sopenharmony_ci const ShaderInput& input(int base) const; 269bf215546Sopenharmony_ci 270bf215546Sopenharmony_ci bool emit_simple_mov(nir_dest& dest, int chan, PVirtualValue src, Pin pin = pin_free); 271bf215546Sopenharmony_ci 272bf215546Sopenharmony_ci template <typename T> 273bf215546Sopenharmony_ci using IOMap = std::map<int, T, std::less<int>, Allocator<std::pair<const int, T>>>; 274bf215546Sopenharmony_ci 275bf215546Sopenharmony_ci IOMap<ShaderInput>& inputs() {return m_inputs;} 276bf215546Sopenharmony_ci 277bf215546Sopenharmony_ciprivate: 278bf215546Sopenharmony_ci virtual bool process_stage_intrinsic(nir_intrinsic_instr *intr) = 0; 279bf215546Sopenharmony_ci 280bf215546Sopenharmony_ci bool allocate_registers_from_string(std::istream& is, Pin pin); 281bf215546Sopenharmony_ci bool allocate_arrays_from_string(std::istream& is); 282bf215546Sopenharmony_ci 283bf215546Sopenharmony_ci bool read_chipclass(std::istream& is); 284bf215546Sopenharmony_ci 285bf215546Sopenharmony_ci bool load_uniform_indirect(nir_intrinsic_instr *intr, PVirtualValue addr, int offset , int buffer_id); 286bf215546Sopenharmony_ci 287bf215546Sopenharmony_ci bool scan_shader(const nir_function *impl); 288bf215546Sopenharmony_ci bool scan_uniforms(nir_variable *uniform); 289bf215546Sopenharmony_ci void allocate_reserved_registers(); 290bf215546Sopenharmony_ci 291bf215546Sopenharmony_ci void allocate_local_registers(const exec_list *registers); 292bf215546Sopenharmony_ci 293bf215546Sopenharmony_ci virtual int do_allocate_reserved_registers() = 0; 294bf215546Sopenharmony_ci 295bf215546Sopenharmony_ci bool scan_instruction(nir_instr *instr); 296bf215546Sopenharmony_ci virtual bool do_scan_instruction(nir_instr *instr) = 0; 297bf215546Sopenharmony_ci 298bf215546Sopenharmony_ci void print_properties(std::ostream& os) const; 299bf215546Sopenharmony_ci virtual void do_print_properties(std::ostream& os) const = 0; 300bf215546Sopenharmony_ci 301bf215546Sopenharmony_ci bool read_output(std::istream& is); 302bf215546Sopenharmony_ci bool read_input(std::istream& is); 303bf215546Sopenharmony_ci virtual bool read_prop(std::istream& is) = 0; 304bf215546Sopenharmony_ci 305bf215546Sopenharmony_ci bool emit_if_start(nir_if *if_stmt); 306bf215546Sopenharmony_ci bool emit_control_flow(ControlFlowInstr::CFType type); 307bf215546Sopenharmony_ci bool emit_store_scratch(nir_intrinsic_instr *intr); 308bf215546Sopenharmony_ci bool emit_load_scratch(nir_intrinsic_instr *intr); 309bf215546Sopenharmony_ci bool emit_local_store(nir_intrinsic_instr *intr); 310bf215546Sopenharmony_ci bool emit_local_load(nir_intrinsic_instr* instr); 311bf215546Sopenharmony_ci bool emit_load_tcs_param_base(nir_intrinsic_instr* instr, int offset); 312bf215546Sopenharmony_ci bool emit_barrier(nir_intrinsic_instr* intr); 313bf215546Sopenharmony_ci bool emit_shader_clock(nir_intrinsic_instr* instr); 314bf215546Sopenharmony_ci bool emit_wait_ack(); 315bf215546Sopenharmony_ci 316bf215546Sopenharmony_ci bool equal_to(const Shader& other) const; 317bf215546Sopenharmony_ci void finalize(); 318bf215546Sopenharmony_ci virtual void do_finalize(); 319bf215546Sopenharmony_ci 320bf215546Sopenharmony_ci virtual void do_get_shader_info(r600_shader *sh_info); 321bf215546Sopenharmony_ci 322bf215546Sopenharmony_ci ShaderBlocks m_root; 323bf215546Sopenharmony_ci Block::Pointer m_current_block; 324bf215546Sopenharmony_ci 325bf215546Sopenharmony_ci InstrFactory *m_instr_factory; 326bf215546Sopenharmony_ci const char *m_type_id; 327bf215546Sopenharmony_ci 328bf215546Sopenharmony_ci IOMap<ShaderOutput> m_outputs; 329bf215546Sopenharmony_ci IOMap<ShaderInput> m_inputs; 330bf215546Sopenharmony_ci r600_chip_class m_chip_class; 331bf215546Sopenharmony_ci 332bf215546Sopenharmony_ci int m_scratch_size; 333bf215546Sopenharmony_ci int m_next_block; 334bf215546Sopenharmony_ci bool m_indirect_const_file{false}; 335bf215546Sopenharmony_ci 336bf215546Sopenharmony_ci Instr *m_last_txd {nullptr}; 337bf215546Sopenharmony_ci 338bf215546Sopenharmony_ci uint32_t m_indirect_files{0}; 339bf215546Sopenharmony_ci std::bitset<sh_flags_count> m_flags; 340bf215546Sopenharmony_ci uint32_t nhwatomic_ranges{0}; 341bf215546Sopenharmony_ci std::vector<r600_shader_atomic> m_atomics; 342bf215546Sopenharmony_ci 343bf215546Sopenharmony_ci uint32_t m_nhwatomic{0}; 344bf215546Sopenharmony_ci uint32_t m_atomic_base{0}; 345bf215546Sopenharmony_ci uint32_t m_next_hwatomic_loc{0}; 346bf215546Sopenharmony_ci std::unordered_map<int, int> m_atomic_base_map; 347bf215546Sopenharmony_ci uint32_t m_atomic_file_count{0}; 348bf215546Sopenharmony_ci PRegister m_atomic_update{nullptr}; 349bf215546Sopenharmony_ci PRegister m_rat_return_address{nullptr}; 350bf215546Sopenharmony_ci 351bf215546Sopenharmony_ci int32_t m_ssbo_image_offset{0}; 352bf215546Sopenharmony_ci uint32_t m_nloops{0}; 353bf215546Sopenharmony_ci 354bf215546Sopenharmony_ci class InstructionChain : public InstrVisitor { 355bf215546Sopenharmony_ci public: 356bf215546Sopenharmony_ci void visit(AluInstr *instr) override {(void) instr;} 357bf215546Sopenharmony_ci void visit(AluGroup *instr) override {(void) instr;} 358bf215546Sopenharmony_ci void visit(TexInstr *instr) override {(void) instr;} 359bf215546Sopenharmony_ci void visit(ExportInstr *instr) override {(void) instr;} 360bf215546Sopenharmony_ci void visit(FetchInstr *instr) override {(void) instr;} 361bf215546Sopenharmony_ci void visit(Block *instr) override {(void) instr;} 362bf215546Sopenharmony_ci void visit(ControlFlowInstr *instr) override {(void) instr;} 363bf215546Sopenharmony_ci void visit(IfInstr *instr) override {(void) instr;} 364bf215546Sopenharmony_ci void visit(StreamOutInstr *instr) override {(void) instr;} 365bf215546Sopenharmony_ci void visit(MemRingOutInstr *instr) override {(void) instr;} 366bf215546Sopenharmony_ci void visit(EmitVertexInstr *instr) override {(void) instr;} 367bf215546Sopenharmony_ci void visit(WriteTFInstr *instr) override {(void) instr;} 368bf215546Sopenharmony_ci void visit(LDSAtomicInstr *instr) override {(void) instr;} 369bf215546Sopenharmony_ci void visit(LDSReadInstr *instr) override {(void) instr;} 370bf215546Sopenharmony_ci 371bf215546Sopenharmony_ci void visit(ScratchIOInstr *instr) override; 372bf215546Sopenharmony_ci void visit(GDSInstr *instr) override; 373bf215546Sopenharmony_ci void visit(RatInstr *instr) override; 374bf215546Sopenharmony_ci 375bf215546Sopenharmony_ci void apply(Instr *current, Instr **last); 376bf215546Sopenharmony_ci 377bf215546Sopenharmony_ci Shader *this_shader{nullptr}; 378bf215546Sopenharmony_ci Instr *last_scratch_instr{nullptr}; 379bf215546Sopenharmony_ci Instr *last_gds_instr{nullptr}; 380bf215546Sopenharmony_ci Instr *last_ssbo_instr{nullptr}; 381bf215546Sopenharmony_ci bool prepare_mem_barrier{false}; 382bf215546Sopenharmony_ci }; 383bf215546Sopenharmony_ci 384bf215546Sopenharmony_ci InstructionChain m_chain_instr; 385bf215546Sopenharmony_ci std::vector<Instr *> m_loops; 386bf215546Sopenharmony_ci}; 387bf215546Sopenharmony_ci 388bf215546Sopenharmony_ci 389bf215546Sopenharmony_cistd::pair<unsigned, unsigned> 390bf215546Sopenharmony_cir600_get_varying_semantic(unsigned varying_location); 391bf215546Sopenharmony_ci 392bf215546Sopenharmony_ci} 393bf215546Sopenharmony_ci 394bf215546Sopenharmony_ci#endif // SHADER_H 395