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 <stdint.h>
|
|
|
|
#include "brw_shader.h"
|
|
|
|
#include "main/compiler.h"
|
|
|
|
#include "program/hash_table.h"
|
2013-08-14 17:20:04 -07:00
|
|
|
#include "brw_program.h"
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2013-08-21 07:53:42 -07:00
|
|
|
#ifdef __cplusplus
|
2011-05-02 09:45:40 -07:00
|
|
|
extern "C" {
|
2013-08-21 07:53:42 -07:00
|
|
|
#endif
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
#include "brw_context.h"
|
|
|
|
#include "brw_eu.h"
|
2013-08-21 07:53:42 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}; /* extern "C" */
|
2012-12-06 22:37:34 -08:00
|
|
|
#include "gen8_generator.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"
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2013-08-14 17:20:04 -07:00
|
|
|
|
|
|
|
struct brw_vec4_compile {
|
|
|
|
GLuint last_scratch; /**< measured in 32-byte (register size) units */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct brw_vec4_prog_key {
|
|
|
|
GLuint program_string_id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* True if at least one clip flag is enabled, regardless of whether the
|
|
|
|
* shader uses clip planes or gl_ClipDistance.
|
|
|
|
*/
|
|
|
|
GLuint userclip_active:1;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* How many user clipping planes are being uploaded to the vertex shader as
|
|
|
|
* push constants.
|
|
|
|
*/
|
|
|
|
GLuint nr_userclip_plane_consts:4;
|
|
|
|
|
|
|
|
GLuint clamp_vertex_color:1;
|
|
|
|
|
|
|
|
struct brw_sampler_prog_key_data tex;
|
|
|
|
};
|
|
|
|
|
2013-03-20 11:54:33 -07:00
|
|
|
|
2013-08-21 07:53:42 -07:00
|
|
|
#ifdef __cplusplus
|
2013-08-14 17:20:04 -07:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-10-23 10:17:30 -07:00
|
|
|
void
|
|
|
|
brw_vec4_setup_prog_key_for_precompile(struct gl_context *ctx,
|
|
|
|
struct brw_vec4_prog_key *key,
|
|
|
|
GLuint id, struct gl_program *prog);
|
2013-08-14 17:20:04 -07:00
|
|
|
bool brw_vec4_prog_data_compare(const struct brw_vec4_prog_data *a,
|
|
|
|
const struct brw_vec4_prog_data *b);
|
|
|
|
void brw_vec4_prog_data_free(const struct brw_vec4_prog_data *prog_data);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
namespace brw {
|
|
|
|
|
|
|
|
class dst_reg;
|
|
|
|
|
2012-07-04 13:25:27 -07:00
|
|
|
unsigned
|
|
|
|
swizzle_for_size(int size);
|
2011-05-02 09:45:40 -07:00
|
|
|
|
|
|
|
class reg
|
|
|
|
{
|
|
|
|
public:
|
2013-09-27 17:37:51 -07:00
|
|
|
/** Register file: GRF, MRF, IMM. */
|
2011-05-02 09:45:40 -07:00
|
|
|
enum register_file file;
|
|
|
|
/** virtual register number. 0 = fixed hw reg */
|
|
|
|
int reg;
|
|
|
|
/** Offset within the virtual register. */
|
|
|
|
int reg_offset;
|
|
|
|
/** Register type. BRW_REGISTER_TYPE_* */
|
|
|
|
int type;
|
|
|
|
struct brw_reg fixed_hw_reg;
|
|
|
|
|
|
|
|
/** Value for file == BRW_IMMMEDIATE_FILE */
|
|
|
|
union {
|
|
|
|
int32_t i;
|
|
|
|
uint32_t u;
|
|
|
|
float f;
|
|
|
|
} imm;
|
|
|
|
};
|
|
|
|
|
|
|
|
class src_reg : public reg
|
|
|
|
{
|
|
|
|
public:
|
2013-09-18 14:11:32 -07:00
|
|
|
DECLARE_RALLOC_CXX_OPERATORS(src_reg)
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2012-07-04 13:25:27 -07:00
|
|
|
void init();
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2012-07-04 13:25:27 -07:00
|
|
|
src_reg(register_file file, int reg, const glsl_type *type);
|
|
|
|
src_reg();
|
|
|
|
src_reg(float f);
|
|
|
|
src_reg(uint32_t u);
|
|
|
|
src_reg(int32_t i);
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2011-08-30 13:25:15 -07:00
|
|
|
bool equals(src_reg *r);
|
2011-09-02 15:18:29 -07:00
|
|
|
bool is_zero() const;
|
|
|
|
bool is_one() const;
|
2011-08-30 13:25:15 -07:00
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
src_reg(class vec4_visitor *v, const struct glsl_type *type);
|
|
|
|
|
|
|
|
explicit src_reg(dst_reg reg);
|
|
|
|
|
|
|
|
GLuint swizzle; /**< SWIZZLE_XYZW swizzles from Mesa. */
|
|
|
|
bool negate;
|
|
|
|
bool abs;
|
2011-08-07 10:59:39 -07:00
|
|
|
|
|
|
|
src_reg *reladdr;
|
2011-05-02 09:45:40 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class dst_reg : public reg
|
|
|
|
{
|
|
|
|
public:
|
2013-09-18 14:11:32 -07:00
|
|
|
DECLARE_RALLOC_CXX_OPERATORS(dst_reg)
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2012-07-04 13:25:27 -07:00
|
|
|
void init();
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2012-07-04 13:25:27 -07:00
|
|
|
dst_reg();
|
|
|
|
dst_reg(register_file file, int reg);
|
|
|
|
dst_reg(register_file file, int reg, const glsl_type *type, int writemask);
|
|
|
|
dst_reg(struct brw_reg reg);
|
2011-05-02 09:45:40 -07:00
|
|
|
dst_reg(class vec4_visitor *v, const struct glsl_type *type);
|
|
|
|
|
|
|
|
explicit dst_reg(src_reg reg);
|
|
|
|
|
|
|
|
int writemask; /**< Bitfield of WRITEMASK_[XYZW] */
|
2011-08-07 10:59:39 -07:00
|
|
|
|
|
|
|
src_reg *reladdr;
|
2011-05-02 09:45:40 -07:00
|
|
|
};
|
|
|
|
|
2013-08-31 20:51:48 -07:00
|
|
|
dst_reg
|
|
|
|
with_writemask(dst_reg const &r, int mask);
|
|
|
|
|
2012-10-03 13:01:23 -07:00
|
|
|
class vec4_instruction : public backend_instruction {
|
2011-05-02 09:45:40 -07:00
|
|
|
public:
|
2013-09-11 16:20:18 -07:00
|
|
|
DECLARE_RALLOC_CXX_OPERATORS(vec4_instruction)
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2011-08-26 16:37:37 -07:00
|
|
|
vec4_instruction(vec4_visitor *v, enum opcode opcode,
|
|
|
|
dst_reg dst = dst_reg(),
|
|
|
|
src_reg src0 = src_reg(),
|
|
|
|
src_reg src1 = src_reg(),
|
|
|
|
src_reg src2 = src_reg());
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
struct brw_reg get_dst(void);
|
2013-07-13 07:09:54 -07:00
|
|
|
struct brw_reg get_src(const struct brw_vec4_prog_data *prog_data, int i);
|
2011-05-02 09:45:40 -07:00
|
|
|
|
|
|
|
dst_reg dst;
|
|
|
|
src_reg src[3];
|
|
|
|
|
|
|
|
bool saturate;
|
2012-11-28 14:16:03 -08:00
|
|
|
bool force_writemask_all;
|
2012-11-30 18:29:34 -08:00
|
|
|
bool no_dd_clear, no_dd_check;
|
2011-05-02 09:45:40 -07:00
|
|
|
|
|
|
|
int conditional_mod; /**< BRW_CONDITIONAL_* */
|
|
|
|
|
|
|
|
int sampler;
|
2011-11-12 02:21:44 -08:00
|
|
|
uint32_t texture_offset; /**< Texture Offset bitfield */
|
2011-05-02 09:45:40 -07:00
|
|
|
int target; /**< MRT target. */
|
|
|
|
bool shadow_compare;
|
|
|
|
|
i965: Allow C++ type safety in the use of enum brw_urb_write_flags.
(From a suggestion by Francisco Jerez)
If an enum represents a bitfield of flags, e.g.:
enum E {
A = 1,
B = 2,
C = 4,
D = 8,
};
then C++ normally prohibits statements like this:
enum E x = A | B;
because A and B are implicitly converted to ints before OR-ing them,
and an int can't be stored in an enum without a type cast. C, on the
other hand, allows an int to be implicitly converted to an enum
without casting.
In the past we've dealt with this situation by storing flag bitfields
as ints. This avoids ugly casting at the expense of some type safety
that C++ would normally have offered (e.g. we get no warning if we
accidentally use the wrong enum type).
However, we can get the best of both worlds if we override the |
operator. The ugly casting is confined to the operator overload, and
we still get the benefit of C++ making sure we don't use the wrong
enum type.
v2: Remove unnecessary comment and unnecessary use of "enum" keyword.
Use static_cast.
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2013-08-23 13:19:19 -07:00
|
|
|
enum brw_urb_write_flags urb_write_flags;
|
2011-05-02 09:45:40 -07:00
|
|
|
bool header_present;
|
|
|
|
int mlen; /**< SEND message length */
|
|
|
|
int base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */
|
|
|
|
|
|
|
|
uint32_t offset; /* spill/unspill offset */
|
|
|
|
/** @{
|
|
|
|
* Annotation for the generated IR. One of the two can be set.
|
|
|
|
*/
|
2012-10-08 10:21:30 -07:00
|
|
|
const void *ir;
|
2011-05-02 09:45:40 -07:00
|
|
|
const char *annotation;
|
2011-09-01 16:21:14 -07:00
|
|
|
|
2012-12-17 16:48:20 -08:00
|
|
|
bool is_send_from_grf();
|
2012-11-30 22:29:26 -08:00
|
|
|
bool can_reswizzle_dst(int dst_writemask, int swizzle, int swizzle_mask);
|
|
|
|
void reswizzle_dst(int dst_writemask, int swizzle);
|
2013-08-16 06:54:30 +12:00
|
|
|
|
|
|
|
bool depends_on_flags()
|
|
|
|
{
|
2013-08-08 06:31:33 +12:00
|
|
|
return predicate || opcode == VS_OPCODE_UNPACK_FLAGS_SIMD4X2;
|
2013-08-16 06:54:30 +12:00
|
|
|
}
|
2011-05-02 09:45:40 -07:00
|
|
|
};
|
|
|
|
|
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.
|
|
|
|
*/
|
2012-10-03 13:01:23 -07:00
|
|
|
class vec4_visitor : public backend_visitor
|
2011-05-02 09:45:40 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-11-26 22:14:27 -08:00
|
|
|
vec4_visitor(struct brw_context *brw,
|
2013-02-17 09:09:45 -08:00
|
|
|
struct brw_vec4_compile *c,
|
|
|
|
struct gl_program *prog,
|
|
|
|
const struct brw_vec4_prog_key *key,
|
|
|
|
struct brw_vec4_prog_data *prog_data,
|
2013-04-08 17:17:44 -07:00
|
|
|
struct gl_shader_program *shader_prog,
|
2012-11-26 23:52:20 -08:00
|
|
|
struct brw_shader *shader,
|
2013-03-22 21:55:03 -07:00
|
|
|
void *mem_ctx,
|
2013-10-16 12:13:20 -07:00
|
|
|
bool debug_flag,
|
|
|
|
bool no_spills);
|
2011-05-02 09:45:40 -07:00
|
|
|
~vec4_visitor();
|
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2013-02-17 09:09:45 -08:00
|
|
|
struct brw_vec4_compile *c;
|
|
|
|
const struct brw_vec4_prog_key *key;
|
|
|
|
struct brw_vec4_prog_data *prog_data;
|
2012-11-21 13:11:32 -08:00
|
|
|
unsigned int sanity_param_count;
|
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 *virtual_grf_sizes;
|
|
|
|
int virtual_grf_count;
|
|
|
|
int virtual_grf_array_size;
|
|
|
|
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;
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the size to be used for an array with an element per
|
|
|
|
* reg_offset
|
|
|
|
*/
|
|
|
|
int virtual_grf_reg_count;
|
|
|
|
/** Per-virtual-grf indices into an array of size virtual_grf_reg_count */
|
|
|
|
int *virtual_grf_reg_map;
|
|
|
|
|
2011-08-16 15:09:48 -07:00
|
|
|
bool live_intervals_valid;
|
2011-05-02 09:45:40 -07:00
|
|
|
|
|
|
|
dst_reg *variable_storage(ir_variable *var);
|
|
|
|
|
|
|
|
void reladdr_to_temp(ir_instruction *ir, src_reg *reg, int *num_reladdr);
|
|
|
|
|
2012-10-08 10:21:30 -07:00
|
|
|
bool need_all_constants_in_pull_buffer;
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
/**
|
|
|
|
* \name Visit methods
|
|
|
|
*
|
|
|
|
* As typical for the visitor pattern, there must be one \c visit method for
|
|
|
|
* each concrete subclass of \c ir_instruction. Virtual base classes within
|
|
|
|
* the hierarchy should not have \c visit methods.
|
|
|
|
*/
|
|
|
|
/*@{*/
|
|
|
|
virtual void visit(ir_variable *);
|
|
|
|
virtual void visit(ir_loop *);
|
|
|
|
virtual void visit(ir_loop_jump *);
|
|
|
|
virtual void visit(ir_function_signature *);
|
|
|
|
virtual void visit(ir_function *);
|
|
|
|
virtual void visit(ir_expression *);
|
|
|
|
virtual void visit(ir_swizzle *);
|
|
|
|
virtual void visit(ir_dereference_variable *);
|
|
|
|
virtual void visit(ir_dereference_array *);
|
|
|
|
virtual void visit(ir_dereference_record *);
|
|
|
|
virtual void visit(ir_assignment *);
|
|
|
|
virtual void visit(ir_constant *);
|
|
|
|
virtual void visit(ir_call *);
|
|
|
|
virtual void visit(ir_return *);
|
|
|
|
virtual void visit(ir_discard *);
|
|
|
|
virtual void visit(ir_texture *);
|
|
|
|
virtual void visit(ir_if *);
|
2013-02-15 09:26:35 -06:00
|
|
|
virtual void visit(ir_emit_vertex *);
|
|
|
|
virtual void visit(ir_end_primitive *);
|
2011-05-02 09:45:40 -07:00
|
|
|
/*@}*/
|
|
|
|
|
|
|
|
src_reg result;
|
|
|
|
|
|
|
|
/* 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];
|
2011-05-04 12:50:16 -07:00
|
|
|
int uniform_size[MAX_UNIFORMS];
|
2011-08-22 10:35:24 -07:00
|
|
|
int uniform_vector_size[MAX_UNIFORMS];
|
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;
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
struct hash_table *variable_ht;
|
|
|
|
|
|
|
|
bool run(void);
|
|
|
|
void fail(const char *msg, ...);
|
|
|
|
|
|
|
|
int virtual_grf_alloc(int size);
|
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
|
|
|
void setup_uniform_clipplane_values();
|
2012-11-20 19:18:45 -08:00
|
|
|
void setup_uniform_values(ir_variable *ir);
|
2011-05-04 12:50:16 -07:00
|
|
|
void setup_builtin_uniform_values(ir_variable *ir);
|
|
|
|
int setup_uniforms(int payload_reg);
|
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();
|
2013-11-11 10:33:46 -08:00
|
|
|
void invalidate_live_intervals();
|
2012-10-03 10:04:22 -07:00
|
|
|
void split_virtual_grfs();
|
2011-08-17 10:50:17 -07:00
|
|
|
bool dead_code_eliminate();
|
2011-08-16 15:09:48 -07:00
|
|
|
bool virtual_grf_interferes(int a, int b);
|
2011-08-30 13:25:15 -07:00
|
|
|
bool opt_copy_propagation();
|
2011-09-02 15:18:29 -07:00
|
|
|
bool opt_algebraic();
|
2012-08-01 19:35:18 -07:00
|
|
|
bool opt_register_coalesce();
|
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();
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2012-12-17 17:03:02 -08:00
|
|
|
bool can_do_source_mods(vec4_instruction *inst);
|
|
|
|
|
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);
|
|
|
|
|
2013-04-21 08:51:33 -07:00
|
|
|
vec4_instruction *emit(enum opcode opcode, dst_reg dst);
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
vec4_instruction *emit(enum opcode opcode, dst_reg dst, src_reg src0);
|
|
|
|
|
|
|
|
vec4_instruction *emit(enum opcode opcode, dst_reg dst,
|
|
|
|
src_reg src0, src_reg src1);
|
|
|
|
|
|
|
|
vec4_instruction *emit(enum opcode opcode, dst_reg dst,
|
|
|
|
src_reg src0, src_reg src1, src_reg src2);
|
|
|
|
|
2011-08-27 11:13:33 -07:00
|
|
|
vec4_instruction *emit_before(vec4_instruction *inst,
|
|
|
|
vec4_instruction *new_inst);
|
|
|
|
|
2011-08-26 16:43:06 -07:00
|
|
|
vec4_instruction *MOV(dst_reg dst, src_reg src0);
|
|
|
|
vec4_instruction *NOT(dst_reg dst, src_reg src0);
|
|
|
|
vec4_instruction *RNDD(dst_reg dst, src_reg src0);
|
|
|
|
vec4_instruction *RNDE(dst_reg dst, src_reg src0);
|
|
|
|
vec4_instruction *RNDZ(dst_reg dst, src_reg src0);
|
|
|
|
vec4_instruction *FRC(dst_reg dst, src_reg src0);
|
2013-01-09 11:44:31 -08:00
|
|
|
vec4_instruction *F32TO16(dst_reg dst, src_reg src0);
|
|
|
|
vec4_instruction *F16TO32(dst_reg dst, src_reg src0);
|
2011-08-26 16:43:06 -07:00
|
|
|
vec4_instruction *ADD(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *MUL(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *MACH(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *MAC(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *AND(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *OR(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *XOR(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *DP3(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *DP4(dst_reg dst, src_reg src0, src_reg src1);
|
2012-10-08 10:26:13 -07:00
|
|
|
vec4_instruction *DPH(dst_reg dst, src_reg src0, src_reg src1);
|
2012-11-22 16:23:23 +13:00
|
|
|
vec4_instruction *SHL(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *SHR(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *ASR(dst_reg dst, src_reg src0, src_reg src1);
|
2011-08-26 16:43:06 -07:00
|
|
|
vec4_instruction *CMP(dst_reg dst, src_reg src0, src_reg src1,
|
|
|
|
uint32_t condition);
|
|
|
|
vec4_instruction *IF(src_reg src0, src_reg src1, uint32_t condition);
|
|
|
|
vec4_instruction *IF(uint32_t predicate);
|
2011-08-27 11:13:33 -07:00
|
|
|
vec4_instruction *PULL_CONSTANT_LOAD(dst_reg dst, src_reg index);
|
|
|
|
vec4_instruction *SCRATCH_READ(dst_reg dst, src_reg index);
|
|
|
|
vec4_instruction *SCRATCH_WRITE(dst_reg dst, src_reg src, src_reg index);
|
2013-04-25 11:03:38 -07:00
|
|
|
vec4_instruction *LRP(dst_reg dst, src_reg a, src_reg y, src_reg x);
|
2013-04-17 18:57:58 -07:00
|
|
|
vec4_instruction *BFREV(dst_reg dst, src_reg value);
|
|
|
|
vec4_instruction *BFE(dst_reg dst, src_reg bits, src_reg offset, src_reg value);
|
|
|
|
vec4_instruction *BFI1(dst_reg dst, src_reg bits, src_reg offset);
|
|
|
|
vec4_instruction *BFI2(dst_reg dst, src_reg bfi1_dst, src_reg insert, src_reg base);
|
|
|
|
vec4_instruction *FBH(dst_reg dst, src_reg value);
|
|
|
|
vec4_instruction *FBL(dst_reg dst, src_reg value);
|
|
|
|
vec4_instruction *CBIT(dst_reg dst, src_reg value);
|
2013-08-02 10:28:16 -07:00
|
|
|
vec4_instruction *MAD(dst_reg dst, src_reg c, src_reg b, src_reg a);
|
2013-09-19 13:01:08 -07:00
|
|
|
vec4_instruction *ADDC(dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
vec4_instruction *SUBB(dst_reg dst, src_reg src0, src_reg src1);
|
2011-08-26 16:43:06 -07:00
|
|
|
|
2011-09-06 12:26:42 -07:00
|
|
|
int implied_mrf_writes(vec4_instruction *inst);
|
|
|
|
|
2011-08-11 08:09:10 -07:00
|
|
|
bool try_rewrite_rhs_to_dst(ir_assignment *ir,
|
|
|
|
dst_reg dst,
|
|
|
|
src_reg src,
|
|
|
|
vec4_instruction *pre_rhs_inst,
|
|
|
|
vec4_instruction *last_rhs_inst);
|
|
|
|
|
2013-07-03 00:49:28 -07:00
|
|
|
bool try_copy_propagation(vec4_instruction *inst, int arg,
|
2012-12-17 17:03:02 -08:00
|
|
|
src_reg *values[4]);
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
/** Walks an exec_list of ir_instruction and sends it through this visitor. */
|
|
|
|
void visit_instructions(const exec_list *list);
|
|
|
|
|
2012-10-08 10:21:30 -07:00
|
|
|
void emit_vp_sop(uint32_t condmod, dst_reg dst,
|
|
|
|
src_reg src0, src_reg src1, src_reg one);
|
|
|
|
|
2011-08-30 16:23:44 -07:00
|
|
|
void emit_bool_to_cond_code(ir_rvalue *ir, uint32_t *predicate);
|
2011-05-02 09:45:40 -07:00
|
|
|
void emit_bool_comparison(unsigned int op, dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
void emit_if_gen6(ir_if *ir);
|
|
|
|
|
2012-10-08 10:45:08 -07:00
|
|
|
void emit_minmax(uint32_t condmod, dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
|
2011-08-05 20:46:03 -07:00
|
|
|
void emit_block_move(dst_reg *dst, src_reg *src,
|
2011-08-30 16:23:44 -07:00
|
|
|
const struct glsl_type *type, uint32_t predicate);
|
2011-05-02 09:45:40 -07:00
|
|
|
|
2011-08-05 21:22:36 -07:00
|
|
|
void emit_constant_values(dst_reg *dst, ir_constant *value);
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
/**
|
|
|
|
* Emit the correct dot-product instruction for the type of arguments
|
|
|
|
*/
|
|
|
|
void emit_dp(dst_reg dst, src_reg src0, src_reg src1, unsigned elements);
|
|
|
|
|
|
|
|
void emit_scalar(ir_instruction *ir, enum prog_opcode op,
|
|
|
|
dst_reg dst, src_reg src0);
|
|
|
|
|
|
|
|
void emit_scalar(ir_instruction *ir, enum prog_opcode op,
|
|
|
|
dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
|
|
|
|
void emit_scs(ir_instruction *ir, enum prog_opcode op,
|
|
|
|
dst_reg dst, const src_reg &src);
|
|
|
|
|
2013-04-25 11:02:02 -07:00
|
|
|
src_reg fix_3src_operand(src_reg src);
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
void emit_math1_gen6(enum opcode opcode, dst_reg dst, src_reg src);
|
|
|
|
void emit_math1_gen4(enum opcode opcode, dst_reg dst, src_reg src);
|
|
|
|
void emit_math(enum opcode opcode, dst_reg dst, src_reg src);
|
|
|
|
void emit_math2_gen6(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
void emit_math2_gen4(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1);
|
|
|
|
void emit_math(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1);
|
2012-12-09 22:03:49 +13:00
|
|
|
src_reg fix_math_operand(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);
|
|
|
|
|
2013-03-31 21:39:37 +13:00
|
|
|
uint32_t gather_channel(ir_texture *ir, int sampler);
|
2013-11-30 13:49:50 +13:00
|
|
|
src_reg emit_mcs_fetch(ir_texture *ir, src_reg coordinate, int sampler);
|
2011-12-07 03:20:53 -08:00
|
|
|
void swizzle_result(ir_texture *ir, src_reg orig_val, int sampler);
|
|
|
|
|
2011-08-23 10:26:15 -07:00
|
|
|
void emit_ndc_computation();
|
2011-08-23 10:29:48 -07:00
|
|
|
void emit_psiz_and_flags(struct brw_reg reg);
|
2013-07-08 04:21:08 +12:00
|
|
|
void emit_clip_distances(dst_reg reg, int offset);
|
2013-03-22 09:39:11 -07:00
|
|
|
void emit_generic_urb_slot(dst_reg reg, int varying);
|
|
|
|
void emit_urb_slot(int mrf, 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();
|
|
|
|
void emit_shader_time_write(enum shader_time_shader_type type,
|
2012-12-10 09:21:34 -08:00
|
|
|
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);
|
|
|
|
|
2011-08-07 12:15:26 -07:00
|
|
|
src_reg get_scratch_offset(vec4_instruction *inst,
|
|
|
|
src_reg *reladdr, int reg_offset);
|
2011-08-22 10:35:24 -07:00
|
|
|
src_reg get_pull_constant_offset(vec4_instruction *inst,
|
|
|
|
src_reg *reladdr, int reg_offset);
|
2011-08-07 12:15:26 -07:00
|
|
|
void emit_scratch_read(vec4_instruction *inst,
|
|
|
|
dst_reg dst,
|
|
|
|
src_reg orig_src,
|
|
|
|
int base_offset);
|
|
|
|
void emit_scratch_write(vec4_instruction *inst,
|
|
|
|
int base_offset);
|
2011-08-22 10:35:24 -07:00
|
|
|
void emit_pull_constant_load(vec4_instruction *inst,
|
|
|
|
dst_reg dst,
|
|
|
|
src_reg orig_src,
|
|
|
|
int base_offset);
|
2011-08-07 12:15:26 -07:00
|
|
|
|
2011-10-07 12:26:50 -07:00
|
|
|
bool try_emit_sat(ir_expression *ir);
|
2013-06-06 10:14:41 -07:00
|
|
|
bool try_emit_mad(ir_expression *ir, int mul_arg);
|
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();
|
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
bool process_move_condition(ir_rvalue *ir);
|
|
|
|
|
2013-04-29 14:21:14 -07:00
|
|
|
void dump_instruction(backend_instruction *inst);
|
2013-02-17 08:05:52 -08:00
|
|
|
|
2013-09-25 16:31:35 -07:00
|
|
|
void visit_atomic_counter_intrinsic(ir_call *ir);
|
|
|
|
|
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-02-17 08:05:52 -08:00
|
|
|
virtual dst_reg *make_reg_for_system_value(ir_variable *ir) = 0;
|
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_program_code() = 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;
|
2013-03-22 11:26:34 -07:00
|
|
|
virtual int compute_array_stride(ir_dereference_array *ir);
|
2013-03-22 21:55:03 -07:00
|
|
|
|
|
|
|
const bool debug_flag;
|
2013-10-16 12:13:20 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* If true, then register allocation should fail instead of spilling.
|
|
|
|
*/
|
|
|
|
const bool no_spills;
|
2012-11-26 22:53:10 -08:00
|
|
|
};
|
|
|
|
|
2013-02-15 20:12:13 -08:00
|
|
|
|
2012-11-26 22:53:10 -08:00
|
|
|
/**
|
|
|
|
* The vertex shader code generator.
|
|
|
|
*
|
|
|
|
* Translates VS IR to actual i965 assembly code.
|
|
|
|
*/
|
|
|
|
class vec4_generator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
vec4_generator(struct brw_context *brw,
|
2013-04-09 14:31:28 -07:00
|
|
|
struct gl_shader_program *shader_prog,
|
2013-02-17 11:25:37 -08:00
|
|
|
struct gl_program *prog,
|
2013-08-14 20:42:29 -07:00
|
|
|
struct brw_vec4_prog_data *prog_data,
|
2013-03-22 21:55:03 -07:00
|
|
|
void *mem_ctx,
|
|
|
|
bool debug_flag);
|
2012-11-26 22:53:10 -08:00
|
|
|
~vec4_generator();
|
|
|
|
|
|
|
|
const unsigned *generate_assembly(exec_list *insts, unsigned *asm_size);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void generate_code(exec_list *instructions);
|
2013-02-17 11:34:05 -08:00
|
|
|
void generate_vec4_instruction(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg *src);
|
2011-08-09 12:30:41 -07:00
|
|
|
|
2011-05-02 09:45:40 -07:00
|
|
|
void generate_math1_gen4(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src);
|
|
|
|
void generate_math1_gen6(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src);
|
2011-08-09 12:30:41 -07:00
|
|
|
void generate_math2_gen4(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src0,
|
|
|
|
struct brw_reg src1);
|
|
|
|
void generate_math2_gen6(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src0,
|
|
|
|
struct brw_reg src1);
|
2011-10-18 12:24:47 -07:00
|
|
|
void generate_math2_gen7(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src0,
|
|
|
|
struct brw_reg src1);
|
2011-08-09 12:30:41 -07:00
|
|
|
|
2011-10-26 13:53:11 -07:00
|
|
|
void generate_tex(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src);
|
|
|
|
|
2013-03-21 09:11:12 -07:00
|
|
|
void generate_vs_urb_write(vec4_instruction *inst);
|
|
|
|
void generate_gs_urb_write(vec4_instruction *inst);
|
2013-03-23 07:42:32 -07:00
|
|
|
void generate_gs_thread_end(vec4_instruction *inst);
|
2013-03-23 07:59:13 -07:00
|
|
|
void generate_gs_set_write_offset(struct brw_reg dst,
|
|
|
|
struct brw_reg src0,
|
|
|
|
struct brw_reg src1);
|
2013-03-23 08:18:43 -07:00
|
|
|
void generate_gs_set_vertex_count(struct brw_reg dst,
|
|
|
|
struct brw_reg src);
|
2013-02-19 07:31:16 -08:00
|
|
|
void generate_gs_set_dword_2_immed(struct brw_reg dst, struct brw_reg src);
|
2013-04-21 08:51:33 -07:00
|
|
|
void generate_gs_prepare_channel_masks(struct brw_reg dst);
|
|
|
|
void generate_gs_set_channel_masks(struct brw_reg dst, struct brw_reg src);
|
2011-08-07 13:36:11 -07:00
|
|
|
void generate_oword_dual_block_offsets(struct brw_reg m1,
|
|
|
|
struct brw_reg index);
|
|
|
|
void generate_scratch_write(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src,
|
|
|
|
struct brw_reg index);
|
|
|
|
void generate_scratch_read(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg index);
|
2011-08-22 10:35:24 -07:00
|
|
|
void generate_pull_constant_load(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
2012-06-25 14:36:28 -07:00
|
|
|
struct brw_reg index,
|
|
|
|
struct brw_reg offset);
|
2013-04-04 14:10:18 -07:00
|
|
|
void generate_pull_constant_load_gen7(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg surf_index,
|
|
|
|
struct brw_reg offset);
|
2013-08-08 06:31:33 +12:00
|
|
|
void generate_unpack_flags(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst);
|
2012-10-03 16:11:26 -07:00
|
|
|
|
2013-09-11 14:01:50 -07:00
|
|
|
void generate_untyped_atomic(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg atomic_op,
|
|
|
|
struct brw_reg surf_index);
|
|
|
|
|
2013-09-11 14:03:13 -07:00
|
|
|
void generate_untyped_surface_read(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg surf_index);
|
|
|
|
|
i965/vs: Rework binding table size calculation.
Unlike the FS, the VS backend already computed the binding table size.
However, it did so poorly: after compilation, it looked to see if any
pull constants/textures/UBOs were in use, and set num_surfaces to the
maximum surface index for that category. If the VS only used a single
texture or UBO, this overcounted by quite a bit.
The shader time surface was also noted at state upload time (during
drawing), not at compile time, which is inefficient. I believe it also
had an off by one error.
This patch computes it accurately, while also simplifying the code.
It also renames num_surfaces to binding_table_size, since num_surfaces
wasn't actually the number of surfaces used. For example, a VS that
used one UBO and no other surfaces would have set num_surfaces to
SURF_INDEX_VS_UBO(1) == 18, rather than 1. A bit of a misnomer there.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
2013-08-14 20:25:40 -07:00
|
|
|
void mark_surface_used(unsigned surf_index);
|
|
|
|
|
2012-11-26 22:53:10 -08:00
|
|
|
struct brw_context *brw;
|
|
|
|
|
|
|
|
struct brw_compile *p;
|
|
|
|
|
2013-04-09 14:31:28 -07:00
|
|
|
struct gl_shader_program *shader_prog;
|
2012-11-26 22:53:10 -08:00
|
|
|
struct gl_shader *shader;
|
2013-02-17 11:25:37 -08:00
|
|
|
const struct gl_program *prog;
|
2012-11-26 22:53:10 -08:00
|
|
|
|
2013-08-14 20:42:29 -07:00
|
|
|
struct brw_vec4_prog_data *prog_data;
|
|
|
|
|
2012-11-26 22:53:10 -08:00
|
|
|
void *mem_ctx;
|
2013-03-22 21:55:03 -07:00
|
|
|
const bool debug_flag;
|
2011-05-02 09:45:40 -07:00
|
|
|
};
|
|
|
|
|
2012-12-06 22:37:34 -08:00
|
|
|
/**
|
|
|
|
* The vertex shader code generator.
|
|
|
|
*
|
|
|
|
* Translates VS IR to actual i965 assembly code.
|
|
|
|
*/
|
|
|
|
class gen8_vec4_generator : public gen8_generator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
gen8_vec4_generator(struct brw_context *brw,
|
|
|
|
struct gl_shader_program *shader_prog,
|
|
|
|
struct gl_program *prog,
|
|
|
|
struct brw_vec4_prog_data *prog_data,
|
|
|
|
void *mem_ctx,
|
|
|
|
bool debug_flag);
|
|
|
|
~gen8_vec4_generator();
|
|
|
|
|
|
|
|
const unsigned *generate_assembly(exec_list *insts, unsigned *asm_size);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void generate_code(exec_list *instructions);
|
|
|
|
void generate_vec4_instruction(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg *src);
|
|
|
|
|
|
|
|
void generate_tex(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst);
|
|
|
|
|
|
|
|
void generate_urb_write(vec4_instruction *ir, bool copy_g0);
|
|
|
|
void generate_gs_thread_end(vec4_instruction *ir);
|
|
|
|
void generate_gs_set_write_offset(struct brw_reg dst,
|
|
|
|
struct brw_reg src0,
|
|
|
|
struct brw_reg src1);
|
|
|
|
void generate_gs_set_vertex_count(struct brw_reg dst,
|
|
|
|
struct brw_reg src);
|
|
|
|
void generate_gs_set_dword_2_immed(struct brw_reg dst, struct brw_reg src);
|
|
|
|
void generate_gs_prepare_channel_masks(struct brw_reg dst);
|
|
|
|
void generate_gs_set_channel_masks(struct brw_reg dst, struct brw_reg src);
|
|
|
|
|
|
|
|
void generate_oword_dual_block_offsets(struct brw_reg m1,
|
|
|
|
struct brw_reg index);
|
|
|
|
void generate_scratch_write(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src,
|
|
|
|
struct brw_reg index);
|
|
|
|
void generate_scratch_read(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg index);
|
|
|
|
void generate_pull_constant_load(vec4_instruction *inst,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg index,
|
|
|
|
struct brw_reg offset);
|
|
|
|
|
|
|
|
void mark_surface_used(unsigned surf_index);
|
|
|
|
|
|
|
|
struct brw_vec4_prog_data *prog_data;
|
|
|
|
|
|
|
|
const bool debug_flag;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
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 */
|