Home | History | Annotate | Download | only in shader

Lines Matching defs:fcc

71 fetch_position(struct fs_compile_context *fcc, struct toy_dst dst)
73 struct toy_compiler *tc = &fcc->tc;
75 tsrc(TOY_FILE_GRF, fcc->payloads[0].source_depth, 0);
77 tsrc(TOY_FILE_GRF, fcc->payloads[0].source_w, 0);
79 (fcc->variant->u.fs.fb_height) ? fcc->variant->u.fs.fb_height : 1;
81 (fcc->tgsi.props.fs_coord_origin == TGSI_FS_COORD_ORIGIN_UPPER_LEFT);
83 (fcc->tgsi.props.fs_coord_pixel_center ==
134 fetch_face(struct fs_compile_context *fcc, struct toy_dst dst)
136 struct toy_compiler *tc = &fcc->tc;
159 fetch_attr(struct fs_compile_context *fcc, struct toy_dst dst, int slot)
161 struct toy_compiler *tc = &fcc->tc;
168 grf = fcc->first_attr_grf + slot * 2;
170 switch (fcc->tgsi.inputs[slot].interp) {
175 if (fcc->tgsi.inputs[slot].centroid)
176 interp = fcc->payloads[0].interp_nonperspective_centroid;
178 interp = fcc->payloads[0].interp_nonperspective_pixel;
181 if (fcc->variant->u.fs.flatshade) {
187 if (fcc->tgsi.inputs[slot].centroid)
188 interp = fcc->payloads[0].interp_perspective_centroid;
190 interp = fcc->payloads[0].interp_perspective_pixel;
194 interp = fcc->payloads[0].interp_perspective_pixel;
225 if (fcc->tgsi.inputs[slot].semantic_name == TGSI_SEMANTIC_FOG) {
233 fs_lower_opcode_tgsi_in(struct fs_compile_context *fcc,
240 slot = toy_tgsi_find_input(&fcc->tgsi, idx);
244 switch (fcc->tgsi.inputs[slot].semantic_name) {
246 fetch_position(fcc, dst);
249 fetch_face(fcc, dst);
252 fetch_attr(fcc, dst, slot);
258 fs_lower_opcode_tgsi_indirect_const(struct fs_compile_context *fcc,
263 tdst_ud(tdst(TOY_FILE_MRF, fcc->first_free_mrf, 0));
264 struct toy_compiler *tc = &fcc->tc;
297 fcc->shader->bt.const_base + dim);
314 fs_lower_opcode_tgsi_const_pcb(struct fs_compile_context *fcc,
318 const int grf = fcc->first_const_grf + idx.val32 / 2;
324 if (!fcc->variant->use_pcb || dim != 0 || idx.file != TOY_FILE_IMM ||
325 grf >= fcc->first_attr_grf)
333 tc_MOV(&fcc->tc, tdst_d(real_dst[i]), tsrc_d(tsrc_offset(src, 0, i)));
340 fs_lower_opcode_tgsi_const_gen6(struct fs_compile_context *fcc,
344 tdst_ud(tdst(TOY_FILE_MRF, fcc->first_free_mrf, 0));
346 tdst_ud(tdst(TOY_FILE_MRF, fcc->first_free_mrf, 2 * 4));
348 struct toy_compiler *tc = &fcc->tc;
355 if (fs_lower_opcode_tgsi_const_pcb(fcc, dst, dim, idx))
373 msg_type, msg_ctrl, fcc->shader->bt.const_base + dim);
377 tc_SEND(tc, tmp, tsrc_from(header), desc, fcc->const_cache);
390 fs_lower_opcode_tgsi_const_gen7(struct fs_compile_context *fcc,
393 struct toy_compiler *tc = &fcc->tc;
395 tdst_ud(tdst(TOY_FILE_MRF, fcc->first_free_mrf, 0));
401 if (fs_lower_opcode_tgsi_const_pcb(fcc, dst, dim, idx))
420 fcc->shader->bt.const_base + dim);
438 fs_lower_opcode_tgsi_imm(struct fs_compile_context *fcc,
445 imm = toy_tgsi_get_imm(&fcc->tgsi, idx, NULL);
450 tc_MOV(&fcc->tc, tdst_ud(real_dst[ch]), tsrc_imm_ud(imm[ch]));
454 fs_lower_opcode_tgsi_sv(struct fs_compile_context *fcc,
457 struct toy_compiler *tc = &fcc->tc;
458 const struct toy_tgsi *tgsi = &fcc->tgsi;
479 fs_lower_opcode_tgsi_direct(struct fs_compile_context *fcc,
482 struct toy_compiler *tc = &fcc->tc;
493 fs_lower_opcode_tgsi_in(fcc, inst->dst, dim, idx);
497 fs_lower_opcode_tgsi_const_gen7(fcc, inst->dst, dim, inst->src[1]);
499 fs_lower_opcode_tgsi_const_gen6(fcc, inst->dst, dim, inst->src[1]);
502 fs_lower_opcode_tgsi_sv(fcc, inst->dst, dim, idx);
506 fs_lower_opcode_tgsi_imm(fcc, inst->dst, idx);
517 fs_lower_opcode_tgsi_indirect(struct fs_compile_context *fcc,
520 struct toy_compiler *tc = &fcc->tc;
550 fs_lower_opcode_tgsi_indirect_const(fcc, inst->dst, dim, indirect_idx);
717 fs_prepare_tgsi_sampling(struct fs_compile_context *fcc,
722 struct toy_compiler *tc = &fcc->tc;
983 binding_table_index = fcc->shader->bt.tex_base + sampler_index;
1097 fs_lower_opcode_tgsi_sampling(struct fs_compile_context *fcc,
1100 struct toy_compiler *tc = &fcc->tc;
1107 desc = fs_prepare_tgsi_sampling(fcc, inst,
1108 fcc->first_free_mrf,
1109 fcc->variant->saturate_tex_coords,
1124 inst->src[0] = tsrc(TOY_FILE_MRF, fcc->first_free_mrf, 0);
1139 assert(sampler_index < fcc->variant->num_sampler_views);
1140 fcc->variant->sampler_view_swizzles[sampler_index].r;
1141 swizzles[1] = fcc->variant->sampler_view_swizzles[sampler_index].g;
1142 swizzles[2] = fcc->variant->sampler_view_swizzles[sampler_index].b;
1143 swizzles[3] = fcc->variant->sampler_view_swizzles[sampler_index].a;
1281 fs_lower_virtual_opcodes(struct fs_compile_context *fcc)
1283 struct toy_compiler *tc = &fcc->tc;
1294 fs_lower_opcode_tgsi_direct(fcc, inst);
1298 fs_lower_opcode_tgsi_indirect(fcc, inst);
1323 fs_lower_opcode_tgsi_sampling(fcc, inst);
1366 fs_compile(struct fs_compile_context *fcc)
1368 struct toy_compiler *tc = &fcc->tc;
1369 struct ilo_shader *sh = fcc->shader;
1371 fs_lower_virtual_opcodes(fcc);
1375 fcc->first_free_grf,
1376 fcc->last_free_grf,
1377 fcc->num_grf_per_vrf);
1442 fs_write_fb(struct fs_compile_context *fcc)
1444 struct toy_compiler *tc = &fcc->tc;
1445 int base_mrf = fcc->first_free_mrf;
1456 for (i = 0; i < fcc->tgsi.num_outputs; i++) {
1457 if (fcc->tgsi.outputs[i].semantic_name == TGSI_SEMANTIC_COLOR) {
1458 assert(fcc->tgsi.outputs[i].semantic_index < ARRAY_SIZE(color_slots));
1459 color_slots[fcc->tgsi.outputs[i].semantic_index] = i;
1461 else if (fcc->tgsi.outputs[i].semantic_name == TGSI_SEMANTIC_POSITION) {
1466 num_cbufs = fcc->variant->u.fs.num_cbufs;
1472 if (fcc->tgsi.uses_kill || num_cbufs > 1) {
1478 base_mrf += fcc->num_grf_per_vrf;
1481 if (fcc->dispatch_mode == GEN6_PS_DISPATCH_8) {
1484 base_mrf += fcc->num_grf_per_vrf;
1492 color_slots[(fcc->tgsi.props.fs_color0_writes_all_cbufs) ? 0 : cbuf];
1498 fcc->tgsi.outputs[slot].undefined_mask;
1499 const int index = fcc->tgsi.outputs[slot].index;
1501 vrf = toy_tgsi_get_vrf(&fcc->tgsi, TGSI_FILE_OUTPUT, 0, index);
1519 mrf += fcc->num_grf_per_vrf;
1528 mrf += fcc->num_grf_per_vrf;
1543 const int index = fcc->tgsi.outputs[pos_slot].index;
1548 vrf = toy_tgsi_get_vrf(&fcc->tgsi, TGSI_FILE_OUTPUT, 0, index);
1561 mrf += fcc->num_grf_per_vrf;
1564 msg_type = (fcc->dispatch_mode == GEN6_PS_DISPATCH_16) ?
1572 mrf - fcc->first_free_mrf, 0,
1575 ctrl, fcc->shader->bt.rt_base + cbuf);
1578 tsrc(TOY_FILE_MRF, fcc->first_free_mrf, 0), desc);
1664 fs_setup_payloads(struct fs_compile_context *fcc)
1666 const struct ilo_shader *sh = fcc->shader;
1675 grf += (fcc->dispatch_mode == GEN6_PS_DISPATCH_32) ? 2 : 1;
1677 for (i = 0; i < ARRAY_SIZE(fcc->payloads); i++) {
1679 (fcc->dispatch_mode == GEN6_PS_DISPATCH_8) ? 1 : 2;
1684 fcc->payloads[i].interp_perspective_pixel = grf;
1689 fcc->payloads[i].interp_perspective_centroid = grf;
1694 fcc->payloads[i].interp_perspective_sample = grf;
1699 fcc
1704 fcc->payloads[i].interp_nonperspective_centroid = grf;
1709 fcc->payloads[i].interp_nonperspective_sample = grf;
1715 fcc->payloads[i].source_depth = grf;
1721 fcc->payloads[i].source_w = grf;
1727 fcc->payloads[i].pos_offset = grf;
1731 if (fcc->dispatch_mode != GEN6_PS_DISPATCH_32)
1774 fs_setup(struct fs_compile_context *fcc,
1780 memset(fcc, 0, sizeof(*fcc));
1782 fcc->shader = CALLOC_STRUCT(ilo_shader);
1783 if (!fcc->shader)
1786 fcc->variant = variant;
1788 toy_compiler_init(&fcc->tc, state->info.dev);
1790 fcc->dispatch_mode = GEN6_PS_DISPATCH_8;
1792 fcc->tc.templ.access_mode = GEN6_ALIGN_1;
1793 if (fcc->dispatch_mode == GEN6_PS_DISPATCH_16) {
1794 fcc->tc.templ.qtr_ctrl = GEN6_QTRCTRL_1H;
1795 fcc->tc.templ.exec_size = GEN6_EXECSIZE_16;
1798 fcc->tc.templ.qtr_ctrl = GEN6_QTRCTRL_1Q;
1799 fcc->tc.templ.exec_size = GEN6_EXECSIZE_8;
1802 fcc->tc.rect_linear_width = 8;
1808 fcc->const_cache = GEN6_SFID_DP_CC;
1810 if (!fs_setup_tgsi(&fcc->tc, state->info.tokens, &fcc->tgsi)) {
1811 toy_compiler_cleanup(&fcc->tc);
1812 FREE(fcc->shader);
1816 fs_setup_shader_in(fcc->shader, &fcc->tgsi, fcc->variant->u.fs.flatshade);
1817 fs_setup_shader_out(fcc->shader, &fcc->tgsi);
1819 if (fcc->variant->use_pcb && !fcc->tgsi.const_indirect) {
1820 num_consts = (fcc->tgsi.const_count + 1) / 2;
1839 fcc->shader->skip_cbuf0_upload = (!fcc->tgsi.const_count || num_consts);
1840 fcc->shader->pcb.cbuf0_size = num_consts * (sizeof(float) * 8);
1842 fcc->first_const_grf = fs_setup_payloads(fcc);
1843 fcc->first_attr_grf = fcc->first_const_grf + num_consts;
1844 fcc->first_free_grf = fcc->first_attr_grf + fcc->shader->in.count * 2;
1845 fcc->last_free_grf = 127;
1848 fcc->first_free_mrf = 1;
1849 fcc->last_free_mrf = 15;
1852 fcc->num_grf_per_vrf =
1853 (fcc->dispatch_mode == GEN6_PS_DISPATCH_16) ? 2 : 1;
1855 if (ilo_dev_gen(fcc->tc.dev) >= ILO_GEN(7)) {
1856 fcc->last_free_grf -= 15;
1857 fcc->first_free_mrf = fcc->last_free_grf + 1;
1858 fcc->last_free_mrf = fcc->first_free_mrf + 14;
1861 fcc->shader->in.start_grf = fcc->first_const_grf;
1862 fcc->shader->has_kill = fcc->tgsi.uses_kill;
1863 fcc->shader->dispatch_16 =
1864 (fcc->dispatch_mode == GEN6_PS_DISPATCH_16);
1866 fcc->shader->bt.rt_base = 0;
1867 fcc->shader->bt.rt_count = fcc->variant->u.fs.num_cbufs;
1869 if (!fcc->shader->bt.rt_count)
1870 fcc->shader->bt.rt_count = 1;
1872 fcc->shader->bt.tex_base = fcc->shader->bt.rt_base +
1873 fcc->shader->bt.rt_count;
1874 fcc->shader->bt.tex_count = fcc->variant->num_sampler_views;
1876 fcc->shader->bt.const_base = fcc->shader->bt.tex_base +
1877 fcc->shader->bt.tex_count;
1878 fcc->shader->bt.const_count = state->info.constant_buffer_count;
1880 fcc->shader->bt.total_count = fcc->shader->bt.const_base +
1881 fcc->shader->bt.const_count;
1893 struct fs_compile_context fcc;
1895 if (!fs_setup(&fcc, state, variant))
1898 fs_write_fb(&fcc);
1900 if (!fs_compile(&fcc)) {
1901 FREE(fcc.shader);
1902 fcc.shader = NULL;
1905 toy_tgsi_cleanup(&fcc.tgsi);
1906 toy_compiler_cleanup(&fcc.tc);
1908 return fcc.shader;