6648e0ebd3
Either replace the BRW prefix with ELK or add an extra ELK prefix. Used
the following sed script to perform the renames in this patch:
```
# Simple prefix changes.
s/\<BRW_/ELK_/g
s/\<brw_/elk_/g
s/nir_to_brw/nir_to_elk/g
s/\<as_brw_reg\>/as_elk_reg/g
s/\<_brw_/_elk_/g
# Add prefix to various symbols.
#
# Initially I've considered using C++ namespaces here, but in various
# cases the structs or functions had to be also visible from C code.
# So added explicit prefix instead.
s/\<backend_instruction/elk_\0/g
s/\<backend_reg/elk_\0/g
s/\<backend_shader/elk_\0/g
s/\<bblock_t\>/elk_\0/g
s/\<bblock_link\>/elk_\0/g
s/\<cfg_t\>/elk_\0/g
s/\<fs_visitor\>/elk_\0/g
s/\<fs_reg\>/elk_\0/g
s/\<fs_instruction_scheduler\>/elk_\0/g
s/\<vec4_instruction_scheduler\>/elk_\0/g
s/\<instruction_scheduler\>/elk_\0/g
s/\<schedule_node\>/elk_\0/g
s/\<schedule_node_child\>/elk_\0/g
s/\<\([a-z]*_\)\?thread_payload\>/elk_\1thread_payload/g
s/\<fs_generator\>/elk_\0/g
s/\<fs_inst\>/elk_\0/g
s/\<fs_reg_alloc\>/elk_\0/g
s/\<disasm_info\>/elk_\0/g
s/\<gfx._math\>/elk_\0/g
s/\<gfx7_block_read_scratch\>/elk_\0/g
s/\<gfx6_IF\>/elk_\0/g
s/\<gfx9_fb_READ\>/elk_\0/g
s/\<gfx6_resolve_implied_move\>/elk_\0/g
# Opcodes.
s/\<opcode op\>/elk_\0/g
s/\<opcode mov_op\>/elk_\0/g
s/\<opcode opcode\>/elk_\0/g
s/enum opcode\>/enum elk_opcode/g
s/static opcode\>/static elk_opcode/g
s/\<opcode elk_op/elk_opcode elk_op/g
s/struct opcode_desc/struct elk_opcode_desc/g
s/NUM_BRW_OPCODES/NUM_ELK_OPCODES/g
s/\<.._OPCODE_/ELK_\0/g
s/\<T.._OPCODE_/ELK_\0/g
s/\<VEC4_OPCODE_/ELK_\0/g
s/\<VEC4_...\?_OPCODE_/ELK_\0/g
s/\<SHADER_OPCODE_/ELK_\0/g
# Remaining specific cases.
s/\<wm_prog_data_barycentric_modes\>/elk_\0/g
s/\<encode_slm_size\>/elk_\0/g
s/\<intel_calculate_slm_size\>/elk_\0/g
s/\<gfx6_gather_sampler_wa\>/elk_\0/g
s/\<is_3src\>/elk_\0/g
s/\<WA_/ELK_\0/g
s/\<conditional_modifier\>/elk_\0/g
s/\<pred_ctrl_align16\>/elk_\0/g
s/\<shuffle_from_32bit_read\>/elk_\0/g
s/\<shuffle_src_to_dst\>/elk_\0/g
s/\<setup_imm_..\?\>/elk_\0/g
s/\<opt_predicated_break\>/elk_\0/g
s/\<has_bank_conflict\>/elk_\0/g
s/\<dead_control_flow_eliminate\>/elk_\0/g
s/\<disasm_new_inst_group\>/elk_\0/g
s/\<disasm_initialize\>/elk_\0/g
s/\<dump_assembly\>/elk_\0/g
s/\<disasm_insert_error\>/elk_\0/g
s/\<disasm_annotate\>/elk_\0/g
s/\<enum lsc_opcode\>/enum elk_lsc_opcode/g
s/\<lsc_opcode_/elk_lsc_opcode_/g
s/\<lsc_aop_[a-z_]\+\>/elk_\0/g
s/\<type_size_vec4\>/elk_\0/g
s/\<type_size_dvec4\>/elk_\0/g
s/\<type_size_xvec4\>/elk_\0/g
s/\<type_size_[a-z4]\+_bytes\>/elk_\0/g
s/\<gfx12_systolic_depth\>/elk_\0/g
```
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27563>
109 lines
3.2 KiB
C++
109 lines
3.2 KiB
C++
/*
|
|
* Copyright © 2013 Intel 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.
|
|
*/
|
|
|
|
|
|
#include "elk_vec4_vs.h"
|
|
#include "dev/intel_debug.h"
|
|
|
|
namespace elk {
|
|
|
|
void
|
|
vec4_vs_visitor::emit_prolog()
|
|
{
|
|
}
|
|
|
|
|
|
void
|
|
vec4_vs_visitor::emit_urb_write_header(int mrf)
|
|
{
|
|
/* No need to do anything for VS; an implied write to this MRF will be
|
|
* performed by ELK_VEC4_VS_OPCODE_URB_WRITE.
|
|
*/
|
|
(void) mrf;
|
|
}
|
|
|
|
|
|
vec4_instruction *
|
|
vec4_vs_visitor::emit_urb_write_opcode(bool complete)
|
|
{
|
|
vec4_instruction *inst = emit(ELK_VEC4_VS_OPCODE_URB_WRITE);
|
|
inst->urb_write_flags = complete ?
|
|
ELK_URB_WRITE_EOT_COMPLETE : ELK_URB_WRITE_NO_FLAGS;
|
|
|
|
return inst;
|
|
}
|
|
|
|
|
|
void
|
|
vec4_vs_visitor::emit_urb_slot(dst_reg reg, int varying)
|
|
{
|
|
reg.type = ELK_REGISTER_TYPE_F;
|
|
output_reg[varying][0].type = reg.type;
|
|
|
|
switch (varying) {
|
|
case VARYING_SLOT_COL0:
|
|
case VARYING_SLOT_COL1:
|
|
case VARYING_SLOT_BFC0:
|
|
case VARYING_SLOT_BFC1: {
|
|
/* These built-in varyings are only supported in compatibility mode,
|
|
* and we only support GS in core profile. So, this must be a vertex
|
|
* shader.
|
|
*/
|
|
vec4_instruction *inst = emit_generic_urb_slot(reg, varying, 0);
|
|
if (inst && key->clamp_vertex_color)
|
|
inst->saturate = true;
|
|
break;
|
|
}
|
|
default:
|
|
return vec4_visitor::emit_urb_slot(reg, varying);
|
|
}
|
|
}
|
|
|
|
|
|
void
|
|
vec4_vs_visitor::emit_thread_end()
|
|
{
|
|
/* For VS, we always end the thread by emitting a single vertex.
|
|
* emit_urb_write_opcode() will take care of setting the eot flag on the
|
|
* SEND instruction.
|
|
*/
|
|
emit_vertex();
|
|
}
|
|
|
|
|
|
vec4_vs_visitor::vec4_vs_visitor(const struct elk_compiler *compiler,
|
|
const struct elk_compile_params *params,
|
|
const struct elk_vs_prog_key *key,
|
|
struct elk_vs_prog_data *vs_prog_data,
|
|
const nir_shader *shader,
|
|
bool debug_enabled)
|
|
: vec4_visitor(compiler, params, &key->base.tex, &vs_prog_data->base,
|
|
shader, false /* no_spills */, debug_enabled),
|
|
key(key),
|
|
vs_prog_data(vs_prog_data)
|
|
{
|
|
}
|
|
|
|
|
|
} /* namespace elk */
|