2 * Copyright © 2013 Intel Corporation
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:
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
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
21 * DEALINGS IN THE SOFTWARE.
25 #include "brw_vec4_vs.h"
26 #include "dev/gen_debug.h"
31 vec4_vs_visitor::emit_prolog()
37 vec4_vs_visitor::emit_urb_write_header(int mrf
)
39 /* No need to do anything for VS; an implied write to this MRF will be
40 * performed by VS_OPCODE_URB_WRITE.
47 vec4_vs_visitor::emit_urb_write_opcode(bool complete
)
49 /* For VS, the URB writes end the thread. */
51 if (INTEL_DEBUG
& DEBUG_SHADER_TIME
)
52 emit_shader_time_end();
55 vec4_instruction
*inst
= emit(VS_OPCODE_URB_WRITE
);
56 inst
->urb_write_flags
= complete
?
57 BRW_URB_WRITE_EOT_COMPLETE
: BRW_URB_WRITE_NO_FLAGS
;
64 vec4_vs_visitor::emit_urb_slot(dst_reg reg
, int varying
)
66 reg
.type
= BRW_REGISTER_TYPE_F
;
67 output_reg
[varying
][0].type
= reg
.type
;
70 case VARYING_SLOT_COL0
:
71 case VARYING_SLOT_COL1
:
72 case VARYING_SLOT_BFC0
:
73 case VARYING_SLOT_BFC1
: {
74 /* These built-in varyings are only supported in compatibility mode,
75 * and we only support GS in core profile. So, this must be a vertex
78 vec4_instruction
*inst
= emit_generic_urb_slot(reg
, varying
, 0);
79 if (inst
&& key
->clamp_vertex_color
)
80 inst
->saturate
= true;
84 return vec4_visitor::emit_urb_slot(reg
, varying
);
90 vec4_vs_visitor::emit_thread_end()
92 /* For VS, we always end the thread by emitting a single vertex.
93 * emit_urb_write_opcode() will take care of setting the eot flag on the
100 vec4_vs_visitor::vec4_vs_visitor(const struct brw_compiler
*compiler
,
102 const struct brw_vs_prog_key
*key
,
103 struct brw_vs_prog_data
*vs_prog_data
,
104 const nir_shader
*shader
,
106 int shader_time_index
)
107 : vec4_visitor(compiler
, log_data
, &key
->base
.tex
, &vs_prog_data
->base
,
108 shader
, mem_ctx
, false /* no_spills */, shader_time_index
),
110 vs_prog_data(vs_prog_data
)
115 } /* namespace brw */