if (!state)
return NULL;
+ state->info.dev = ilo->dev;
state->info.type = type;
- state->info.gen = ilo->dev->gen;
if (type == PIPE_SHADER_COMPUTE) {
const struct pipe_compute_state *c =
* Information about a shader state.
*/
struct ilo_shader_info {
+ const struct ilo_dev_info *dev;
int type;
- int gen;
const struct tgsi_token *tokens;
fs_lower_opcode_tgsi_in(fcc, inst->dst, dim, idx);
break;
case TOY_OPCODE_TGSI_CONST:
- if (tc->gen >= ILO_GEN(7))
+ if (tc->dev->gen >= ILO_GEN(7))
fs_lower_opcode_tgsi_const_gen7(fcc, inst->dst, dim, inst->src[1]);
else
fs_lower_opcode_tgsi_const_gen6(fcc, inst->dst, dim, inst->src[1]);
}
/* set up sampler parameters */
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
msg_len = fs_add_sampler_params_gen7(tc, msg_type, base_mrf, param_size,
coords, num_coords, bias_or_lod, ref_or_si, ddx, ddy, num_derivs);
}
fcc->variant = variant;
- toy_compiler_init(&fcc->tc, state->info.gen);
+ toy_compiler_init(&fcc->tc, state->info.dev);
fcc->dispatch_mode = GEN6_WM_8_DISPATCH_ENABLE;
fcc->num_grf_per_vrf =
(fcc->dispatch_mode == GEN6_WM_16_DISPATCH_ENABLE) ? 2 : 1;
- if (fcc->tc.gen >= ILO_GEN(7)) {
+ if (fcc->tc.dev->gen >= ILO_GEN(7)) {
fcc->last_free_grf -= 15;
fcc->first_free_mrf = fcc->last_free_grf + 1;
fcc->last_free_mrf = fcc->first_free_mrf + 14;
gcc->variant = variant;
gcc->so_info = &state->info.stream_output;
- toy_compiler_init(&gcc->tc, state->info.gen);
+ toy_compiler_init(&gcc->tc, state->info.dev);
gcc->write_so = (state->info.stream_output.num_outputs > 0);
gcc->write_vue = !gcc->variant->u.gs.rasterizer_discard;
vs_lower_opcode_tgsi_in(vcc, inst->dst, dim, idx);
break;
case TOY_OPCODE_TGSI_CONST:
- if (tc->gen >= ILO_GEN(7))
+ if (tc->dev->gen >= ILO_GEN(7))
vs_lower_opcode_tgsi_const_gen7(vcc, inst->dst, dim, inst->src[1]);
else
vs_lower_opcode_tgsi_const_gen6(vcc, inst->dst, dim, inst->src[1]);
indirect_idx = tsrc_from(tmp);
}
- if (tc->gen >= ILO_GEN(7))
+ if (tc->dev->gen >= ILO_GEN(7))
vs_lower_opcode_tgsi_const_gen7(vcc, inst->dst, dim, indirect_idx);
else
vs_lower_opcode_tgsi_const_gen6(vcc, inst->dst, dim, indirect_idx);
assert(num_coords <= 3);
tc_MOV(tc, tdst_writemask(tdst_d(m[0]), coords_writemask), coords);
tc_MOV(tc, tdst_writemask(tdst_d(m[0]), TOY_WRITEMASK_W), bias_or_lod);
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
num_params = 4;
}
else {
inst = tc_MOV(tc, header, r0);
inst->mask_ctrl = BRW_MASK_DISABLE;
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
inst = tc_OR(tc, tdst_offset(header, 0, 5),
tsrc_rect(tsrc_offset(r0, 0, 5), TOY_RECT_010),
tsrc_rect(tsrc_imm_ud(0xff00), TOY_RECT_010));
eot = false;
}
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
/* do not forget about the header */
msg_len = 1 + num_attrs;
}
vcc->variant = variant;
- toy_compiler_init(&vcc->tc, state->info.gen);
+ toy_compiler_init(&vcc->tc, state->info.dev);
vcc->tc.templ.access_mode = BRW_ALIGN_16;
vcc->tc.templ.exec_size = BRW_EXECUTE_8;
vcc->tc.rect_linear_width = 4;
vcc->num_grf_per_vrf = 1;
- if (vcc->tc.gen >= ILO_GEN(7)) {
+ if (vcc->tc.dev->gen >= ILO_GEN(7)) {
vcc->last_free_grf -= 15;
vcc->first_free_mrf = vcc->last_free_grf + 1;
vcc->last_free_mrf = vcc->first_free_mrf + 14;
if (!vs_setup(&vcc, state, variant))
return NULL;
- if (vcc.tc.gen >= ILO_GEN(7)) {
+ if (vcc.tc.dev->gen >= ILO_GEN(7)) {
need_gs = false;
}
else {
* Initialize the toy compiler.
*/
void
-toy_compiler_init(struct toy_compiler *tc, int gen)
+toy_compiler_init(struct toy_compiler *tc, const struct ilo_dev_info *dev)
{
memset(tc, 0, sizeof(*tc));
- tc->gen = gen;
+ tc->dev = dev;
tc_init_inst_templ(tc);
#ifndef TOY_COMPILER_H
#define TOY_COMPILER_H
+#include "util/u_slab.h"
#include "brw_defines.h"
-#include "util/u_slab.h"
#include "ilo_common.h"
#include "toy_compiler_reg.h"
* Toy compiler.
*/
struct toy_compiler {
- int gen;
+ const struct ilo_dev_info *dev;
struct toy_inst templ;
struct util_slab_mempool mempool;
}
void
-toy_compiler_init(struct toy_compiler *tc, int gen);
+toy_compiler_init(struct toy_compiler *tc, const struct ilo_dev_info *dev);
void
toy_compiler_cleanup(struct toy_compiler *tc);
}
brw_disasm(stderr, (struct brw_instruction *) &instructions[i],
- ILO_GEN_GET_MAJOR(tc->gen));
+ ILO_GEN_GET_MAJOR(tc->dev->gen));
}
}
assert(sampler_index < 16);
assert(binding_table_index < 256);
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
ctrl = simd_mode << 17 |
message_type << 12 |
sampler_index << 8 |
{
uint32_t ctrl;
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
assert(!send_write_commit_message);
assert((message_specific_control & 0x3f00) == message_specific_control);
const bool header_present = true;
uint32_t ctrl;
- assert(tc->gen >= ILO_GEN(7));
+ assert(tc->dev->gen >= ILO_GEN(7));
assert(num_registers == 1 || num_registers == 2 || num_registers == 4);
ctrl = 1 << 18 |
const bool header_present = true;
uint32_t ctrl;
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
const bool per_slot_offset = false;
ctrl = per_slot_offset << 16 |
dist--;
}
- if (tc->gen >= ILO_GEN(7))
+ if (tc->dev->gen >= ILO_GEN(7))
inst->src[1] = tsrc_imm_w(dist * 2);
else
inst->dst = tdst_imm_w(dist * 2);
/* the following instruction */
jip = (dist + 1) * 2;
- if (tc->gen == ILO_GEN(6)) {
+ if (tc->dev->gen == ILO_GEN(6)) {
uip = jip;
break;
}
dist++;
}
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
/* what should the type be? */
inst->dst.type = TOY_TYPE_D;
inst->src[0].type = TOY_TYPE_D;
if (!found)
dist = 1;
- if (tc->gen >= ILO_GEN(7))
+ if (tc->dev->gen >= ILO_GEN(7))
inst->src[1] = tsrc_imm_w(dist * 2);
else
inst->dst = tdst_imm_w(dist * 2);
}
else {
/* the following instruction */
- if (tc->gen == ILO_GEN(6) && inst->opcode == BRW_OPCODE_BREAK)
+ if (tc->dev->gen == ILO_GEN(6) && inst->opcode == BRW_OPCODE_BREAK)
dist++;
uip = dist * 2;
*
* "INT DIV function does not support SIMD16."
*/
- if (tc->gen < ILO_GEN(7) ||
+ if (tc->dev->gen < ILO_GEN(7) ||
inst->cond_modifier == BRW_MATH_FUNCTION_INT_DIV_QUOTIENT ||
inst->cond_modifier == BRW_MATH_FUNCTION_INT_DIV_REMAINDER) {
struct toy_inst *inst2;
}
break;
case BRW_OPCODE_IF:
- if (tc->gen >= ILO_GEN(7) &&
+ if (tc->dev->gen >= ILO_GEN(7) &&
inst->cond_modifier != BRW_CONDITIONAL_NONE) {
struct toy_inst *inst2;
}
/* MRF to GRF */
- if (tc->gen >= ILO_GEN(7)) {
+ if (tc->dev->gen >= ILO_GEN(7)) {
for (i = 0; i < Elements(inst->src); i++) {
if (inst->src[i].file != TOY_FILE_MRF)
continue;