2011-05-02 09:45:40 -07:00
|
|
|
/*
|
|
|
|
* Copyright © 2011 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BRW_VEC4_H
|
|
|
|
#define BRW_VEC4_H
|
|
|
|
|
|
|
|
#include "brw_shader.h"
|
2015-11-22 18:27:42 -08:00
|
|
|
#include "brw_program.h"
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2013-08-21 07:53:42 -07:00
|
|
|
#ifdef __cplusplus
|
2015-02-06 01:11:18 +02:00
|
|
|
#include "brw_ir_vec4.h"
|
2013-08-21 07:53:42 -07:00
|
|
|
#endif
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2011-08-26 13:58:41 -07:00
|
|
|
#include "glsl/ir.h"
|
2015-06-16 12:08:09 +02:00
|
|
|
#include "glsl/nir/nir.h"
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2013-08-14 17:20:04 -07:00
|
|
|
|
2013-08-21 07:53:42 -07:00
|
|
|
#ifdef __cplusplus
|
2013-08-14 17:20:04 -07:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-10-22 15:01:27 -07:00
|
|
|
const unsigned *
|
|
|
|
brw_vec4_generate_assembly(const struct brw_compiler *compiler,
|
|
|
|
void *log_data,
|
|
|
|
void *mem_ctx,
|
|
|
|
const nir_shader *nir,
|
|
|
|
struct brw_vue_prog_data *prog_data,
|
|
|
|
const struct cfg_t *cfg,
|
|
|
|
unsigned *out_assembly_size);
|
|
|
|
|
2013-08-14 17:20:04 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
namespace brw {
|
|
|
|
|
2014-10-29 13:27:37 -07:00
|
|
|
class vec4_live_variables;
|
|
|
|
|
2012-11-26 22:53:10 -08:00
|
|
|
/**
|
|
|
|
* The vertex shader front-end.
|
|
|
|
*
|
|
|
|
* Translates either GLSL IR or Mesa IR (for ARB_vertex_program and
|
|
|
|
* fixed-function) into VS IR.
|
|
|
|
*/
|
2015-09-21 11:03:29 -07:00
|
|
|
class vec4_visitor : public backend_shader
|
2011-05-02 09:45:40 -07:00
|
|
|
{
|
|
|
|
public:
|
2015-06-22 17:17:56 -07:00
|
|
|
vec4_visitor(const struct brw_compiler *compiler,
|
2015-06-29 21:58:47 -07:00
|
|
|
void *log_data,
|
2015-08-27 18:24:39 -07:00
|
|
|
const struct brw_sampler_prog_key_data *key,
|
2014-11-25 14:29:48 -08:00
|
|
|
struct brw_vue_prog_data *prog_data,
|
2015-10-05 19:26:02 -07:00
|
|
|
const nir_shader *shader,
|
2013-03-22 21:55:03 -07:00
|
|
|
void *mem_ctx,
|
2014-01-17 14:42:48 -08:00
|
|
|
bool no_spills,
|
2015-06-19 15:40:09 -07:00
|
|
|
int shader_time_index);
|
2015-10-05 09:02:54 +02:00
|
|
|
virtual ~vec4_visitor();
|
2011-05-02 09:45:40 -07:00
|
|
|
|
|
|
|
dst_reg dst_null_f()
|
|
|
|
{
|
|
|
|
return dst_reg(brw_null_reg());
|
|
|
|
}
|
|
|
|
|
|
|
|
dst_reg dst_null_d()
|
|
|
|
{
|
|
|
|
return dst_reg(retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
|
|
|
|
}
|
|
|
|
|
2013-09-19 13:02:23 -07:00
|
|
|
dst_reg dst_null_ud()
|
|
|
|
{
|
|
|
|
return dst_reg(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
|
|
|
|
}
|
|
|
|
|
2015-08-27 23:55:28 -07:00
|
|
|
const struct brw_sampler_prog_key_data * const key_tex;
|
2014-11-25 14:29:48 -08:00
|
|
|
struct brw_vue_prog_data * const prog_data;
|
2011-05-02 09:45:40 -07:00
|
|
|
char *fail_msg;
|
|
|
|
bool failed;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GLSL IR currently being processed, which is associated with our
|
|
|
|
* driver IR instructions for debugging purposes.
|
|
|
|
*/
|
2012-10-08 10:21:30 -07:00
|
|
|
const void *base_ir;
|
2011-05-02 09:45:40 -07:00
|
|
|
const char *current_annotation;
|
|
|
|
|
|
|
|
int first_non_payload_grf;
|
2012-01-27 12:59:24 -08:00
|
|
|
unsigned int max_grf;
|
2013-04-30 15:15:21 -07:00
|
|
|
int *virtual_grf_start;
|
|
|
|
int *virtual_grf_end;
|
2014-10-29 13:27:37 -07:00
|
|
|
brw::vec4_live_variables *live_intervals;
|
i965 new VS: don't share clip plane constants in pre-GEN6
In pre-GEN6, when using clip planes, both the vertex shader and the
clipper need access to the client-supplied clip planes, since the
vertex shader needs them to set the clip flags, and the clipper needs
them to determine where to insert new vertices.
With the old VS backend, we used a clever optimization to avoid
placing duplicate copies of these planes in the CURBE: we used the
same block of memory for both the clipper and vertex shader constants,
with the clip planes at the front of it, and then we instructed the
clipper to read just the initial part of this block containing the
clip planes.
This optimization was tricky, of dubious value, and not completely
working in the new VS backend, so I've removed it. Now, when using
the new VS backend, separate parts of the CURBE are used for the
clipper and the vertex shader. Note that this doesn't affect the
number of push constants available to the vertex shader, it simply
causes the CURBE to occupy a few more bytes of URB memory.
The old VS backend is unaffected. GEN6+, which does clipping entirely
in hardware, is also unaffected.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-09-23 21:33:50 -07:00
|
|
|
dst_reg userplane[MAX_CLIP_PLANES];
|
2011-09-01 08:34:18 -07:00
|
|
|
|
2012-10-08 10:21:30 -07:00
|
|
|
bool need_all_constants_in_pull_buffer;
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
/* Regs for vertex results. Generated at ir_variable visiting time
|
|
|
|
* for the ir->location's used.
|
|
|
|
*/
|
2013-03-23 15:53:33 -07:00
|
|
|
dst_reg output_reg[BRW_VARYING_SLOT_COUNT];
|
|
|
|
const char *output_reg_annotation[BRW_VARYING_SLOT_COUNT];
|
2014-02-27 16:15:04 +02:00
|
|
|
int *uniform_size;
|
2015-09-30 11:02:14 -07:00
|
|
|
int uniform_array_size; /*< Size of the uniform_size array */
|
2011-05-04 12:50:16 -07:00
|
|
|
int uniforms;
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2012-11-27 14:10:52 -08:00
|
|
|
src_reg shader_start_time;
|
|
|
|
|
2015-08-27 23:49:03 -07:00
|
|
|
bool run();
|
2011-05-02 09:45:40 -07:00
|
|
|
void fail(const char *msg, ...);
|
|
|
|
|
2011-05-04 12:50:16 -07:00
|
|
|
int setup_uniforms(int payload_reg);
|
2015-06-28 21:04:17 +03:00
|
|
|
|
2012-10-03 10:03:22 -07:00
|
|
|
bool reg_allocate_trivial();
|
|
|
|
bool reg_allocate();
|
2012-10-01 15:28:56 -07:00
|
|
|
void evaluate_spill_costs(float *spill_costs, bool *no_spill);
|
|
|
|
int choose_spill_reg(struct ra_graph *g);
|
|
|
|
void spill_reg(int spill_reg);
|
2011-08-07 12:15:26 -07:00
|
|
|
void move_grf_array_access_to_scratch();
|
2011-08-22 10:35:24 -07:00
|
|
|
void move_uniform_array_access_to_pull_constants();
|
2011-09-06 22:32:33 -07:00
|
|
|
void move_push_constants_to_pull_constants();
|
2011-08-23 10:22:50 -07:00
|
|
|
void split_uniform_registers();
|
2011-08-23 12:13:14 -07:00
|
|
|
void pack_uniform_registers();
|
2011-08-16 15:09:48 -07:00
|
|
|
void calculate_live_intervals();
|
2014-09-01 10:54:00 -07:00
|
|
|
void invalidate_live_intervals();
|
2012-10-03 10:04:22 -07:00
|
|
|
void split_virtual_grfs();
|
2014-12-20 11:50:31 -08:00
|
|
|
bool opt_vector_float();
|
2014-08-17 15:13:54 -07:00
|
|
|
bool opt_reduce_swizzle();
|
2011-08-17 10:50:17 -07:00
|
|
|
bool dead_code_eliminate();
|
2015-03-18 20:49:43 +02:00
|
|
|
int var_range_start(unsigned v, unsigned n) const;
|
|
|
|
int var_range_end(unsigned v, unsigned n) const;
|
2011-08-16 15:09:48 -07:00
|
|
|
bool virtual_grf_interferes(int a, int b);
|
2015-09-28 17:00:19 +02:00
|
|
|
bool opt_cmod_propagation();
|
2014-12-20 17:37:09 -08:00
|
|
|
bool opt_copy_propagation(bool do_constant_prop = true);
|
2014-07-11 20:36:39 -07:00
|
|
|
bool opt_cse_local(bblock_t *block);
|
2013-03-06 10:48:55 -08:00
|
|
|
bool opt_cse();
|
2011-09-02 15:18:29 -07:00
|
|
|
bool opt_algebraic();
|
2012-08-01 19:35:18 -07:00
|
|
|
bool opt_register_coalesce();
|
2015-02-20 20:25:04 +02:00
|
|
|
bool eliminate_find_live_channel();
|
2014-11-21 10:47:41 -08:00
|
|
|
bool is_dep_ctrl_unsafe(const vec4_instruction *inst);
|
2012-11-30 18:29:34 -08:00
|
|
|
void opt_set_dependency_control();
|
2012-11-30 16:13:34 -08:00
|
|
|
void opt_schedule_instructions();
|
2015-10-22 16:04:15 -07:00
|
|
|
void convert_to_hw_regs();
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2011-08-26 16:37:37 -07:00
|
|
|
vec4_instruction *emit(vec4_instruction *inst);
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
vec4_instruction *emit(enum opcode opcode);
|
2014-11-10 17:20:37 -08:00
|
|
|
vec4_instruction *emit(enum opcode opcode, const dst_reg &dst);
|
|
|
|
vec4_instruction *emit(enum opcode opcode, const dst_reg &dst,
|
|
|
|
const src_reg &src0);
|
|
|
|
vec4_instruction *emit(enum opcode opcode, const dst_reg &dst,
|
|
|
|
const src_reg &src0, const src_reg &src1);
|
|
|
|
vec4_instruction *emit(enum opcode opcode, const dst_reg &dst,
|
|
|
|
const src_reg &src0, const src_reg &src1,
|
|
|
|
const src_reg &src2);
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2014-08-24 19:38:21 -07:00
|
|
|
vec4_instruction *emit_before(bblock_t *block,
|
|
|
|
vec4_instruction *inst,
|
2011-08-27 11:13:33 -07:00
|
|
|
vec4_instruction *new_inst);
|
|
|
|
|
2014-11-10 17:14:48 -08:00
|
|
|
#define EMIT1(op) vec4_instruction *op(const dst_reg &, const src_reg &);
|
|
|
|
#define EMIT2(op) vec4_instruction *op(const dst_reg &, const src_reg &, const src_reg &);
|
|
|
|
#define EMIT3(op) vec4_instruction *op(const dst_reg &, const src_reg &, const src_reg &, const src_reg &);
|
|
|
|
EMIT1(MOV)
|
|
|
|
EMIT1(NOT)
|
|
|
|
EMIT1(RNDD)
|
|
|
|
EMIT1(RNDE)
|
|
|
|
EMIT1(RNDZ)
|
|
|
|
EMIT1(FRC)
|
|
|
|
EMIT1(F32TO16)
|
|
|
|
EMIT1(F16TO32)
|
|
|
|
EMIT2(ADD)
|
|
|
|
EMIT2(MUL)
|
|
|
|
EMIT2(MACH)
|
|
|
|
EMIT2(MAC)
|
|
|
|
EMIT2(AND)
|
|
|
|
EMIT2(OR)
|
|
|
|
EMIT2(XOR)
|
|
|
|
EMIT2(DP3)
|
|
|
|
EMIT2(DP4)
|
|
|
|
EMIT2(DPH)
|
|
|
|
EMIT2(SHL)
|
|
|
|
EMIT2(SHR)
|
|
|
|
EMIT2(ASR)
|
2011-08-26 16:43:06 -07:00
|
|
|
vec4_instruction *CMP(dst_reg dst, src_reg src0, src_reg src1,
|
2014-06-29 17:50:20 -07:00
|
|
|
enum brw_conditional_mod condition);
|
|
|
|
vec4_instruction *IF(src_reg src0, src_reg src1,
|
|
|
|
enum brw_conditional_mod condition);
|
2014-06-29 17:58:59 -07:00
|
|
|
vec4_instruction *IF(enum brw_predicate predicate);
|
2014-11-10 17:14:48 -08:00
|
|
|
EMIT1(SCRATCH_READ)
|
|
|
|
EMIT2(SCRATCH_WRITE)
|
|
|
|
EMIT3(LRP)
|
|
|
|
EMIT1(BFREV)
|
|
|
|
EMIT3(BFE)
|
|
|
|
EMIT2(BFI1)
|
|
|
|
EMIT3(BFI2)
|
|
|
|
EMIT1(FBH)
|
|
|
|
EMIT1(FBL)
|
|
|
|
EMIT1(CBIT)
|
|
|
|
EMIT3(MAD)
|
|
|
|
EMIT2(ADDC)
|
|
|
|
EMIT2(SUBB)
|
|
|
|
#undef EMIT1
|
|
|
|
#undef EMIT2
|
|
|
|
#undef EMIT3
|
2011-08-26 16:43:06 -07:00
|
|
|
|
2011-09-06 12:26:42 -07:00
|
|
|
int implied_mrf_writes(vec4_instruction *inst);
|
|
|
|
|
2015-06-17 00:32:58 +02:00
|
|
|
vec4_instruction *emit_minmax(enum brw_conditional_mod conditionalmod, dst_reg dst,
|
|
|
|
src_reg src0, src_reg src1);
|
2012-10-08 10:45:08 -07:00
|
|
|
|
2015-06-17 10:01:07 +02:00
|
|
|
vec4_instruction *emit_lrp(const dst_reg &dst, const src_reg &x,
|
|
|
|
const src_reg &y, const src_reg &a);
|
2014-02-23 16:29:46 -08:00
|
|
|
|
2015-07-13 15:52:28 +03:00
|
|
|
/**
|
|
|
|
* Copy any live channel from \p src to the first channel of the
|
|
|
|
* result.
|
|
|
|
*/
|
|
|
|
src_reg emit_uniformize(const src_reg &src);
|
2015-03-20 14:16:09 +02:00
|
|
|
|
2015-08-10 11:48:14 -07:00
|
|
|
src_reg fix_3src_operand(const src_reg &src);
|
|
|
|
src_reg resolve_source_modifiers(const src_reg &src);
|
2013-04-25 11:02:02 -07:00
|
|
|
|
2015-06-17 00:04:09 +02:00
|
|
|
vec4_instruction *emit_math(enum opcode opcode, const dst_reg &dst, const src_reg &src0,
|
|
|
|
const src_reg &src1 = src_reg());
|
|
|
|
|
2015-08-10 11:48:14 -07:00
|
|
|
src_reg fix_math_operand(const src_reg &src);
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2013-01-09 11:44:31 -08:00
|
|
|
void emit_pack_half_2x16(dst_reg dst, src_reg src0);
|
|
|
|
void emit_unpack_half_2x16(dst_reg dst, src_reg src0);
|
2014-03-08 17:29:33 -08:00
|
|
|
void emit_unpack_unorm_4x8(const dst_reg &dst, src_reg src0);
|
2014-03-09 20:22:23 -07:00
|
|
|
void emit_unpack_snorm_4x8(const dst_reg &dst, src_reg src0);
|
2014-03-10 13:27:46 -07:00
|
|
|
void emit_pack_unorm_4x8(const dst_reg &dst, const src_reg &src0);
|
2014-03-10 14:11:05 -07:00
|
|
|
void emit_pack_snorm_4x8(const dst_reg &dst, const src_reg &src0);
|
2013-01-09 11:44:31 -08:00
|
|
|
|
2015-07-06 14:33:21 +02:00
|
|
|
void emit_texture(ir_texture_opcode op,
|
|
|
|
dst_reg dest,
|
|
|
|
const glsl_type *dest_type,
|
|
|
|
src_reg coordinate,
|
|
|
|
int coord_components,
|
|
|
|
src_reg shadow_comparitor,
|
|
|
|
src_reg lod, src_reg lod2,
|
|
|
|
src_reg sample_index,
|
|
|
|
uint32_t constant_offset,
|
|
|
|
src_reg offset_value,
|
|
|
|
src_reg mcs,
|
|
|
|
bool is_cube_array,
|
|
|
|
uint32_t sampler, src_reg sampler_reg);
|
|
|
|
|
2015-06-18 11:31:54 +02:00
|
|
|
src_reg emit_mcs_fetch(const glsl_type *coordinate_type, src_reg coordinate,
|
|
|
|
src_reg sampler);
|
2014-02-03 22:15:41 +13:00
|
|
|
void emit_gen6_gather_wa(uint8_t wa, dst_reg dst);
|
2011-12-07 03:20:53 -08:00
|
|
|
|
2011-08-23 10:26:15 -07:00
|
|
|
void emit_ndc_computation();
|
2014-07-17 16:59:10 +02:00
|
|
|
void emit_psiz_and_flags(dst_reg reg);
|
2014-12-01 00:53:02 -08:00
|
|
|
vec4_instruction *emit_generic_urb_slot(dst_reg reg, int varying);
|
2015-08-28 00:29:05 -07:00
|
|
|
virtual void emit_urb_slot(dst_reg reg, int varying);
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2012-11-27 14:10:52 -08:00
|
|
|
void emit_shader_time_begin();
|
|
|
|
void emit_shader_time_end();
|
2015-06-19 15:40:09 -07:00
|
|
|
void emit_shader_time_write(int shader_time_subindex, src_reg value);
|
2012-11-27 14:10:52 -08:00
|
|
|
|
2013-09-25 16:31:35 -07:00
|
|
|
void emit_untyped_atomic(unsigned atomic_op, unsigned surf_index,
|
|
|
|
dst_reg dst, src_reg offset, src_reg src0,
|
|
|
|
src_reg src1);
|
|
|
|
|
|
|
|
void emit_untyped_surface_read(unsigned surf_index, dst_reg dst,
|
|
|
|
src_reg offset);
|
|
|
|
|
2014-08-24 19:38:21 -07:00
|
|
|
src_reg get_scratch_offset(bblock_t *block, vec4_instruction *inst,
|
2011-08-07 12:15:26 -07:00
|
|
|
src_reg *reladdr, int reg_offset);
|
2014-08-24 19:38:21 -07:00
|
|
|
src_reg get_pull_constant_offset(bblock_t *block, vec4_instruction *inst,
|
2011-08-22 10:35:24 -07:00
|
|
|
src_reg *reladdr, int reg_offset);
|
2014-08-24 19:38:21 -07:00
|
|
|
void emit_scratch_read(bblock_t *block, vec4_instruction *inst,
|
2011-08-07 12:15:26 -07:00
|
|
|
dst_reg dst,
|
|
|
|
src_reg orig_src,
|
|
|
|
int base_offset);
|
2014-08-24 19:38:21 -07:00
|
|
|
void emit_scratch_write(bblock_t *block, vec4_instruction *inst,
|
2011-08-07 12:15:26 -07:00
|
|
|
int base_offset);
|
2014-08-24 19:38:21 -07:00
|
|
|
void emit_pull_constant_load(bblock_t *block, vec4_instruction *inst,
|
2011-08-22 10:35:24 -07:00
|
|
|
dst_reg dst,
|
|
|
|
src_reg orig_src,
|
|
|
|
int base_offset);
|
2015-04-15 14:28:26 +01:00
|
|
|
void emit_pull_constant_load_reg(dst_reg dst,
|
|
|
|
src_reg surf_index,
|
|
|
|
src_reg offset,
|
|
|
|
bblock_t *before_block,
|
|
|
|
vec4_instruction *before_inst);
|
2015-03-17 10:48:04 +01:00
|
|
|
src_reg emit_resolve_reladdr(int scratch_loc[], bblock_t *block,
|
|
|
|
vec4_instruction *inst, src_reg src);
|
2011-08-07 12:15:26 -07:00
|
|
|
|
2011-10-03 15:31:52 -07:00
|
|
|
void resolve_ud_negate(src_reg *reg);
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2012-11-27 14:10:52 -08:00
|
|
|
src_reg get_timestamp();
|
|
|
|
|
2013-04-29 14:21:14 -07:00
|
|
|
void dump_instruction(backend_instruction *inst);
|
2014-05-29 11:45:15 -07:00
|
|
|
void dump_instruction(backend_instruction *inst, FILE *file);
|
2013-02-17 08:05:52 -08:00
|
|
|
|
2015-06-18 09:37:33 +02:00
|
|
|
bool is_high_sampler(src_reg sampler);
|
2015-06-16 13:39:48 +02:00
|
|
|
|
i965/vec4: Optimize predicate handling for any/all.
For a select whose condition is any(v), instead of emitting
cmp.nz.f0(8) null<1>D g1<0,4,1>D 0D
mov(8) g7<1>.xUD 0x00000000UD
(+f0.any4h) mov(8) g7<1>.xUD 0xffffffffUD
cmp.nz.f0(8) null<1>D g7<4,4,1>.xD 0D
(+f0) sel(8) g8<1>UD g4<4,4,1>UD g3<4,4,1>UD
we now emit
cmp.nz.f0(8) null<1>D g1<0,4,1>D 0D
(+f0.any4h) sel(8) g9<1>UD g4<4,4,1>UD g3<4,4,1>UD
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-11-25 21:54:30 -08:00
|
|
|
bool optimize_predicate(nir_alu_instr *instr, enum brw_predicate *predicate);
|
|
|
|
|
2015-06-16 12:08:09 +02:00
|
|
|
virtual void emit_nir_code();
|
2015-10-01 12:23:53 -07:00
|
|
|
virtual void nir_setup_uniforms();
|
2015-06-16 17:08:04 +02:00
|
|
|
virtual void nir_setup_system_value_intrinsic(nir_intrinsic_instr *instr);
|
2015-10-01 12:23:53 -07:00
|
|
|
virtual void nir_setup_system_values();
|
2015-06-16 12:08:09 +02:00
|
|
|
virtual void nir_emit_impl(nir_function_impl *impl);
|
|
|
|
virtual void nir_emit_cf_list(exec_list *list);
|
|
|
|
virtual void nir_emit_if(nir_if *if_stmt);
|
|
|
|
virtual void nir_emit_loop(nir_loop *loop);
|
|
|
|
virtual void nir_emit_block(nir_block *block);
|
|
|
|
virtual void nir_emit_instr(nir_instr *instr);
|
|
|
|
virtual void nir_emit_load_const(nir_load_const_instr *instr);
|
|
|
|
virtual void nir_emit_intrinsic(nir_intrinsic_instr *instr);
|
|
|
|
virtual void nir_emit_alu(nir_alu_instr *instr);
|
|
|
|
virtual void nir_emit_jump(nir_jump_instr *instr);
|
|
|
|
virtual void nir_emit_texture(nir_tex_instr *instr);
|
2015-09-09 13:55:39 -07:00
|
|
|
virtual void nir_emit_undef(nir_ssa_undef_instr *instr);
|
2015-08-07 11:31:13 +02:00
|
|
|
virtual void nir_emit_ssbo_atomic(int op, nir_intrinsic_instr *instr);
|
2015-06-16 12:08:09 +02:00
|
|
|
|
2015-06-16 17:43:02 +02:00
|
|
|
dst_reg get_nir_dest(nir_dest dest, enum brw_reg_type type);
|
|
|
|
dst_reg get_nir_dest(nir_dest dest, nir_alu_type type);
|
|
|
|
dst_reg get_nir_dest(nir_dest dest);
|
|
|
|
src_reg get_nir_src(nir_src src, enum brw_reg_type type,
|
|
|
|
unsigned num_components = 4);
|
|
|
|
src_reg get_nir_src(nir_src src, nir_alu_type type,
|
|
|
|
unsigned num_components = 4);
|
|
|
|
src_reg get_nir_src(nir_src src,
|
|
|
|
unsigned num_components = 4);
|
2015-11-17 01:07:39 -08:00
|
|
|
src_reg get_indirect_offset(nir_intrinsic_instr *instr);
|
2015-06-16 17:43:02 +02:00
|
|
|
|
2015-06-16 17:01:29 +02:00
|
|
|
virtual dst_reg *make_reg_for_system_value(int location,
|
|
|
|
const glsl_type *type) = 0;
|
|
|
|
|
2015-07-22 09:34:35 +02:00
|
|
|
dst_reg *nir_locals;
|
2015-07-01 16:10:49 +02:00
|
|
|
dst_reg *nir_ssa_values;
|
2015-06-16 17:08:04 +02:00
|
|
|
dst_reg *nir_system_values;
|
2015-06-16 13:50:43 +02:00
|
|
|
|
2013-02-17 08:05:52 -08:00
|
|
|
protected:
|
2013-03-22 06:59:52 -07:00
|
|
|
void emit_vertex();
|
2013-10-16 11:40:41 -07:00
|
|
|
void lower_attributes_to_hw_regs(const int *attribute_map,
|
|
|
|
bool interleaved);
|
2013-08-21 21:55:40 -07:00
|
|
|
void setup_payload_interference(struct ra_graph *g, int first_payload_node,
|
|
|
|
int reg_node_count);
|
2013-07-13 09:03:18 -07:00
|
|
|
virtual void setup_payload() = 0;
|
2013-02-17 08:05:52 -08:00
|
|
|
virtual void emit_prolog() = 0;
|
|
|
|
virtual void emit_thread_end() = 0;
|
2013-03-22 06:59:52 -07:00
|
|
|
virtual void emit_urb_write_header(int mrf) = 0;
|
|
|
|
virtual vec4_instruction *emit_urb_write_opcode(bool complete) = 0;
|
2015-06-29 13:37:31 +02:00
|
|
|
virtual void gs_emit_vertex(int stream_id);
|
|
|
|
virtual void gs_end_primitive();
|
2013-03-22 21:55:03 -07:00
|
|
|
|
2013-10-16 12:13:20 -07:00
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* If true, then register allocation should fail instead of spilling.
|
|
|
|
*/
|
|
|
|
const bool no_spills;
|
2014-01-17 14:42:48 -08:00
|
|
|
|
2015-06-19 15:40:09 -07:00
|
|
|
int shader_time_index;
|
2015-06-28 21:02:15 -07:00
|
|
|
|
|
|
|
unsigned last_scratch; /**< measured in 32-byte (register size) units */
|
2012-11-26 22:53:10 -08:00
|
|
|
};
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
} /* namespace brw */
|
2013-08-21 07:53:42 -07:00
|
|
|
#endif /* __cplusplus */
|
2011-05-02 09:45:40 -07:00
|
|
|
|
|
|
|
#endif /* BRW_VEC4_H */
|