101e04c3fSmrg/*
201e04c3fSmrg * Copyright © 2013 Intel Corporation
301e04c3fSmrg *
401e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
501e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
601e04c3fSmrg * to deal in the Software without restriction, including without limitation
701e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
801e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the
901e04c3fSmrg * Software is furnished to do so, subject to the following conditions:
1001e04c3fSmrg *
1101e04c3fSmrg * The above copyright notice and this permission notice (including the next
1201e04c3fSmrg * paragraph) shall be included in all copies or substantial portions of the
1301e04c3fSmrg * Software.
1401e04c3fSmrg *
1501e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1601e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1701e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1801e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1901e04c3fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2001e04c3fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2101e04c3fSmrg * DEALINGS IN THE SOFTWARE.
2201e04c3fSmrg */
2301e04c3fSmrg
2401e04c3fSmrg/**
2501e04c3fSmrg * \file brw_vec4_tcs.h
2601e04c3fSmrg *
2701e04c3fSmrg * The vec4-mode tessellation control shader compiler backend.
2801e04c3fSmrg */
2901e04c3fSmrg
3001e04c3fSmrg#ifndef BRW_VEC4_TCS_H
3101e04c3fSmrg#define BRW_VEC4_TCS_H
3201e04c3fSmrg
3301e04c3fSmrg#include "brw_compiler.h"
3401e04c3fSmrg#include "brw_vec4.h"
3501e04c3fSmrg
3601e04c3fSmrg#ifdef __cplusplus
3701e04c3fSmrgnamespace brw {
3801e04c3fSmrg
3901e04c3fSmrgclass vec4_tcs_visitor : public vec4_visitor
4001e04c3fSmrg{
4101e04c3fSmrgpublic:
4201e04c3fSmrg   vec4_tcs_visitor(const struct brw_compiler *compiler,
4301e04c3fSmrg                    void *log_data,
4401e04c3fSmrg                    const struct brw_tcs_prog_key *key,
4501e04c3fSmrg                    struct brw_tcs_prog_data *prog_data,
4601e04c3fSmrg                    const nir_shader *nir,
4701e04c3fSmrg                    void *mem_ctx,
4801e04c3fSmrg                    int shader_time_index,
497ec681f3Smrg                    bool debug_enabled);
5001e04c3fSmrg
5101e04c3fSmrgprotected:
5201e04c3fSmrg   virtual void setup_payload();
5301e04c3fSmrg   virtual void emit_prolog();
5401e04c3fSmrg   virtual void emit_thread_end();
5501e04c3fSmrg
5601e04c3fSmrg   virtual void nir_emit_intrinsic(nir_intrinsic_instr *instr);
5701e04c3fSmrg
5801e04c3fSmrg   void emit_input_urb_read(const dst_reg &dst,
5901e04c3fSmrg                            const src_reg &vertex_index,
6001e04c3fSmrg                            unsigned base_offset,
6101e04c3fSmrg                            unsigned first_component,
6201e04c3fSmrg                            const src_reg &indirect_offset);
6301e04c3fSmrg   void emit_output_urb_read(const dst_reg &dst,
6401e04c3fSmrg                             unsigned base_offset,
6501e04c3fSmrg                             unsigned first_component,
6601e04c3fSmrg                             const src_reg &indirect_offset);
6701e04c3fSmrg
6801e04c3fSmrg   void emit_urb_write(const src_reg &value, unsigned writemask,
6901e04c3fSmrg                       unsigned base_offset, const src_reg &indirect_offset);
7001e04c3fSmrg
717ec681f3Smrg   /* we do not use the normal end-of-shader URB write mechanism -- but every
727ec681f3Smrg    * vec4 stage must provide implementations of these:
7301e04c3fSmrg    */
747ec681f3Smrg   virtual void emit_urb_write_header(int /* mrf */) {}
757ec681f3Smrg   virtual vec4_instruction *emit_urb_write_opcode(bool /* complete */) { return NULL; }
7601e04c3fSmrg
7701e04c3fSmrg   const struct brw_tcs_prog_key *key;
7801e04c3fSmrg   src_reg invocation_id;
7901e04c3fSmrg};
8001e04c3fSmrg
8101e04c3fSmrg} /* namespace brw */
8201e04c3fSmrg#endif /* __cplusplus */
8301e04c3fSmrg
8401e04c3fSmrg#endif /* BRW_VEC4_TCS_H */
85