• Home
  • Raw
  • Download

Lines Matching refs:ureg

247 static void set_bad( struct ureg_program *ureg )  in set_bad()  argument
249 tokens_error(&ureg->domain[0]); in set_bad()
254 static union tgsi_any_token *get_tokens( struct ureg_program *ureg, in get_tokens() argument
258 struct ureg_tokens *tokens = &ureg->domain[domain]; in get_tokens()
270 static union tgsi_any_token *retrieve_token( struct ureg_program *ureg, in retrieve_token() argument
274 if (ureg->domain[domain].tokens == error_tokens) in retrieve_token()
277 return &ureg->domain[domain].tokens[nr]; in retrieve_token()
282 ureg_property(struct ureg_program *ureg, unsigned name, unsigned value) in ureg_property() argument
284 assert(name < ARRAY_SIZE(ureg->properties)); in ureg_property()
285 ureg->properties[name] = value; in ureg_property()
289 ureg_DECL_fs_input_centroid_layout(struct ureg_program *ureg, in ureg_DECL_fs_input_centroid_layout() argument
304 for (i = 0; i < ureg->nr_inputs; i++) { in ureg_DECL_fs_input_centroid_layout()
305 if (ureg->input[i].semantic_name == semantic_name && in ureg_DECL_fs_input_centroid_layout()
306 ureg->input[i].semantic_index == semantic_index) { in ureg_DECL_fs_input_centroid_layout()
307 assert(ureg->input[i].interp == interp_mode); in ureg_DECL_fs_input_centroid_layout()
308 assert(ureg->input[i].interp_location == interp_location); in ureg_DECL_fs_input_centroid_layout()
309 if (ureg->input[i].array_id == array_id) { in ureg_DECL_fs_input_centroid_layout()
310 ureg->input[i].usage_mask |= usage_mask; in ureg_DECL_fs_input_centroid_layout()
311 ureg->input[i].last = MAX2(ureg->input[i].last, ureg->input[i].first + array_size - 1); in ureg_DECL_fs_input_centroid_layout()
312 ureg->nr_input_regs = MAX2(ureg->nr_input_regs, ureg->input[i].last + 1); in ureg_DECL_fs_input_centroid_layout()
315 assert((ureg->input[i].usage_mask & usage_mask) == 0); in ureg_DECL_fs_input_centroid_layout()
319 if (ureg->nr_inputs < UREG_MAX_INPUT) { in ureg_DECL_fs_input_centroid_layout()
321 ureg->input[i].semantic_name = semantic_name; in ureg_DECL_fs_input_centroid_layout()
322 ureg->input[i].semantic_index = semantic_index; in ureg_DECL_fs_input_centroid_layout()
323 ureg->input[i].interp = interp_mode; in ureg_DECL_fs_input_centroid_layout()
324 ureg->input[i].interp_location = interp_location; in ureg_DECL_fs_input_centroid_layout()
325 ureg->input[i].first = index; in ureg_DECL_fs_input_centroid_layout()
326 ureg->input[i].last = index + array_size - 1; in ureg_DECL_fs_input_centroid_layout()
327 ureg->input[i].array_id = array_id; in ureg_DECL_fs_input_centroid_layout()
328 ureg->input[i].usage_mask = usage_mask; in ureg_DECL_fs_input_centroid_layout()
329 ureg->nr_input_regs = MAX2(ureg->nr_input_regs, index + array_size); in ureg_DECL_fs_input_centroid_layout()
330 ureg->nr_inputs++; in ureg_DECL_fs_input_centroid_layout()
332 set_bad(ureg); in ureg_DECL_fs_input_centroid_layout()
336 return ureg_src_array_register(TGSI_FILE_INPUT, ureg->input[i].first, in ureg_DECL_fs_input_centroid_layout()
341 ureg_DECL_fs_input_centroid(struct ureg_program *ureg, in ureg_DECL_fs_input_centroid() argument
349 return ureg_DECL_fs_input_centroid_layout(ureg, in ureg_DECL_fs_input_centroid()
352 ureg->nr_input_regs, TGSI_WRITEMASK_XYZW, array_id, array_size); in ureg_DECL_fs_input_centroid()
357 ureg_DECL_vs_input( struct ureg_program *ureg, in ureg_DECL_vs_input() argument
360 assert(ureg->processor == PIPE_SHADER_VERTEX); in ureg_DECL_vs_input()
361 assert(index / 32 < ARRAY_SIZE(ureg->vs_inputs)); in ureg_DECL_vs_input()
363 ureg->vs_inputs[index/32] |= 1 << (index % 32); in ureg_DECL_vs_input()
369 ureg_DECL_input_layout(struct ureg_program *ureg, in ureg_DECL_input_layout() argument
377 return ureg_DECL_fs_input_centroid_layout(ureg, in ureg_DECL_input_layout()
385 ureg_DECL_input(struct ureg_program *ureg, in ureg_DECL_input() argument
391 return ureg_DECL_fs_input_centroid(ureg, semantic_name, semantic_index, in ureg_DECL_input()
399 ureg_DECL_system_value(struct ureg_program *ureg, in ureg_DECL_system_value() argument
405 for (i = 0; i < ureg->nr_system_values; i++) { in ureg_DECL_system_value()
406 if (ureg->system_value[i].semantic_name == semantic_name && in ureg_DECL_system_value()
407 ureg->system_value[i].semantic_index == semantic_index) { in ureg_DECL_system_value()
412 if (ureg->nr_system_values < UREG_MAX_SYSTEM_VALUE) { in ureg_DECL_system_value()
413 ureg->system_value[ureg->nr_system_values].semantic_name = semantic_name; in ureg_DECL_system_value()
414 ureg->system_value[ureg->nr_system_values].semantic_index = semantic_index; in ureg_DECL_system_value()
415 i = ureg->nr_system_values; in ureg_DECL_system_value()
416 ureg->nr_system_values++; in ureg_DECL_system_value()
418 set_bad(ureg); in ureg_DECL_system_value()
427 ureg_DECL_output_layout(struct ureg_program *ureg, in ureg_DECL_output_layout() argument
445 for (i = 0; i < ureg->nr_outputs; i++) { in ureg_DECL_output_layout()
446 if (ureg->output[i].semantic_name == semantic_name && in ureg_DECL_output_layout()
447 ureg->output[i].semantic_index == semantic_index) { in ureg_DECL_output_layout()
448 if (ureg->output[i].array_id == array_id) { in ureg_DECL_output_layout()
449 ureg->output[i].usage_mask |= usage_mask; in ureg_DECL_output_layout()
450ureg->output[i].last = MAX2(ureg->output[i].last, ureg->output[i].first + array_size - 1); in ureg_DECL_output_layout()
451 ureg->nr_output_regs = MAX2(ureg->nr_output_regs, ureg->output[i].last + 1); in ureg_DECL_output_layout()
454 assert((ureg->output[i].usage_mask & usage_mask) == 0); in ureg_DECL_output_layout()
458 if (ureg->nr_outputs < UREG_MAX_OUTPUT) { in ureg_DECL_output_layout()
459 ureg->output[i].semantic_name = semantic_name; in ureg_DECL_output_layout()
460 ureg->output[i].semantic_index = semantic_index; in ureg_DECL_output_layout()
461 ureg->output[i].usage_mask = usage_mask; in ureg_DECL_output_layout()
462 ureg->output[i].first = index; in ureg_DECL_output_layout()
463 ureg->output[i].last = index + array_size - 1; in ureg_DECL_output_layout()
464 ureg->output[i].array_id = array_id; in ureg_DECL_output_layout()
465 ureg->output[i].invariant = invariant; in ureg_DECL_output_layout()
466 ureg->nr_output_regs = MAX2(ureg->nr_output_regs, index + array_size); in ureg_DECL_output_layout()
467 ureg->nr_outputs++; in ureg_DECL_output_layout()
470 set_bad( ureg ); in ureg_DECL_output_layout()
475 ureg->output[i].streams |= streams; in ureg_DECL_output_layout()
477 return ureg_dst_array_register(TGSI_FILE_OUTPUT, ureg->output[i].first, in ureg_DECL_output_layout()
483 ureg_DECL_output_masked(struct ureg_program *ureg, in ureg_DECL_output_masked() argument
490 return ureg_DECL_output_layout(ureg, name, index, 0, in ureg_DECL_output_masked()
491 ureg->nr_output_regs, usage_mask, array_id, in ureg_DECL_output_masked()
497 ureg_DECL_output(struct ureg_program *ureg, in ureg_DECL_output() argument
501 return ureg_DECL_output_masked(ureg, name, index, TGSI_WRITEMASK_XYZW, in ureg_DECL_output()
506 ureg_DECL_output_array(struct ureg_program *ureg, in ureg_DECL_output_array() argument
512 return ureg_DECL_output_masked(ureg, semantic_name, semantic_index, in ureg_DECL_output_array()
529 ureg_DECL_constant2D(struct ureg_program *ureg, in ureg_DECL_constant2D() argument
534 struct const_decl *decl = &ureg->const_decls[index2D]; in ureg_DECL_constant2D()
553 ureg_DECL_constant(struct ureg_program *ureg, in ureg_DECL_constant() argument
556 struct const_decl *decl = &ureg->const_decls[0]; in ureg_DECL_constant()
616 ureg_DECL_hw_atomic(struct ureg_program *ureg, in ureg_DECL_hw_atomic() argument
622 struct hw_atomic_decl *decl = &ureg->hw_atomic_decls[buffer_id]; in ureg_DECL_hw_atomic()
631 set_bad(ureg); in ureg_DECL_hw_atomic()
635 static struct ureg_dst alloc_temporary( struct ureg_program *ureg, in alloc_temporary() argument
642 for (i = util_bitmask_get_first_index(ureg->free_temps); in alloc_temporary()
644 i = util_bitmask_get_next_index(ureg->free_temps, i + 1)) { in alloc_temporary()
645 if (util_bitmask_get(ureg->local_temps, i) == local) in alloc_temporary()
652 i = ureg->nr_temps++; in alloc_temporary()
655 util_bitmask_set(ureg->local_temps, i); in alloc_temporary()
658 if (!i || util_bitmask_get(ureg->local_temps, i - 1) != local) in alloc_temporary()
659 util_bitmask_set(ureg->decl_temps, i); in alloc_temporary()
662 util_bitmask_clear(ureg->free_temps, i); in alloc_temporary()
667 struct ureg_dst ureg_DECL_temporary( struct ureg_program *ureg ) in ureg_DECL_temporary() argument
669 return alloc_temporary(ureg, FALSE); in ureg_DECL_temporary()
672 struct ureg_dst ureg_DECL_local_temporary( struct ureg_program *ureg ) in ureg_DECL_local_temporary() argument
674 return alloc_temporary(ureg, TRUE); in ureg_DECL_local_temporary()
677 struct ureg_dst ureg_DECL_array_temporary( struct ureg_program *ureg, in ureg_DECL_array_temporary() argument
681 unsigned i = ureg->nr_temps; in ureg_DECL_array_temporary()
685 util_bitmask_set(ureg->local_temps, i); in ureg_DECL_array_temporary()
688 util_bitmask_set(ureg->decl_temps, i); in ureg_DECL_array_temporary()
690 ureg->nr_temps += size; in ureg_DECL_array_temporary()
693 util_bitmask_set(ureg->decl_temps, ureg->nr_temps); in ureg_DECL_array_temporary()
695 if (ureg->nr_array_temps < UREG_MAX_ARRAY_TEMPS) { in ureg_DECL_array_temporary()
696 ureg->array_temps[ureg->nr_array_temps++] = i; in ureg_DECL_array_temporary()
697 dst.ArrayID = ureg->nr_array_temps; in ureg_DECL_array_temporary()
703 void ureg_release_temporary( struct ureg_program *ureg, in ureg_release_temporary() argument
707 util_bitmask_set(ureg->free_temps, tmp.Index); in ureg_release_temporary()
713 struct ureg_dst ureg_DECL_address( struct ureg_program *ureg ) in ureg_DECL_address() argument
715 if (ureg->nr_addrs < UREG_MAX_ADDR) in ureg_DECL_address()
716 return ureg_dst_register( TGSI_FILE_ADDRESS, ureg->nr_addrs++ ); in ureg_DECL_address()
724 struct ureg_src ureg_DECL_sampler( struct ureg_program *ureg, in ureg_DECL_sampler() argument
729 for (i = 0; i < ureg->nr_samplers; i++) in ureg_DECL_sampler()
730 if (ureg->sampler[i].Index == (int)nr) in ureg_DECL_sampler()
731 return ureg->sampler[i]; in ureg_DECL_sampler()
734 ureg->sampler[i] = ureg_src_register( TGSI_FILE_SAMPLER, nr ); in ureg_DECL_sampler()
735 ureg->nr_samplers++; in ureg_DECL_sampler()
736 return ureg->sampler[i]; in ureg_DECL_sampler()
740 return ureg->sampler[0]; in ureg_DECL_sampler()
747 ureg_DECL_sampler_view(struct ureg_program *ureg, in ureg_DECL_sampler_view() argument
758 for (i = 0; i < ureg->nr_sampler_views; i++) { in ureg_DECL_sampler_view()
759 if (ureg->sampler_view[i].index == index) { in ureg_DECL_sampler_view()
765 ureg->sampler_view[i].index = index; in ureg_DECL_sampler_view()
766 ureg->sampler_view[i].target = target; in ureg_DECL_sampler_view()
767 ureg->sampler_view[i].return_type_x = return_type_x; in ureg_DECL_sampler_view()
768 ureg->sampler_view[i].return_type_y = return_type_y; in ureg_DECL_sampler_view()
769 ureg->sampler_view[i].return_type_z = return_type_z; in ureg_DECL_sampler_view()
770 ureg->sampler_view[i].return_type_w = return_type_w; in ureg_DECL_sampler_view()
771 ureg->nr_sampler_views++; in ureg_DECL_sampler_view()
782 ureg_DECL_image(struct ureg_program *ureg, in ureg_DECL_image() argument
792 for (i = 0; i < ureg->nr_images; i++) in ureg_DECL_image()
793 if (ureg->image[i].index == index) in ureg_DECL_image()
797 ureg->image[i].index = index; in ureg_DECL_image()
798 ureg->image[i].target = target; in ureg_DECL_image()
799 ureg->image[i].wr = wr; in ureg_DECL_image()
800 ureg->image[i].raw = raw; in ureg_DECL_image()
801 ureg->image[i].format = format; in ureg_DECL_image()
802 ureg->nr_images++; in ureg_DECL_image()
812 struct ureg_src ureg_DECL_buffer(struct ureg_program *ureg, unsigned nr, in ureg_DECL_buffer() argument
818 for (i = 0; i < ureg->nr_buffers; i++) in ureg_DECL_buffer()
819 if (ureg->buffer[i].index == nr) in ureg_DECL_buffer()
823 ureg->buffer[i].index = nr; in ureg_DECL_buffer()
824 ureg->buffer[i].atomic = atomic; in ureg_DECL_buffer()
825 ureg->nr_buffers++; in ureg_DECL_buffer()
835 struct ureg_src ureg_DECL_memory(struct ureg_program *ureg, in ureg_DECL_memory() argument
840 ureg->use_memory[memory_type] = true; in ureg_DECL_memory()
930 decl_immediate( struct ureg_program *ureg, in decl_immediate() argument
942 for (i = 0; i < ureg->nr_immediates; i++) { in decl_immediate()
943 if (ureg->immediate[i].type != type) { in decl_immediate()
949 ureg->immediate[i].value.u, in decl_immediate()
950 &ureg->immediate[i].nr, in decl_immediate()
956 if (ureg->nr_immediates < UREG_MAX_IMMEDIATE) { in decl_immediate()
957 i = ureg->nr_immediates++; in decl_immediate()
958 ureg->immediate[i].type = type; in decl_immediate()
962 ureg->immediate[i].value.u, in decl_immediate()
963 &ureg->immediate[i].nr, in decl_immediate()
969 set_bad(ureg); in decl_immediate()
995 ureg_DECL_immediate( struct ureg_program *ureg, in ureg_DECL_immediate() argument
1009 return decl_immediate(ureg, fu.u, nr, TGSI_IMM_FLOAT32); in ureg_DECL_immediate()
1013 ureg_DECL_immediate_f64( struct ureg_program *ureg, in ureg_DECL_immediate_f64() argument
1028 return decl_immediate(ureg, fu.u, nr, TGSI_IMM_FLOAT64); in ureg_DECL_immediate_f64()
1032 ureg_DECL_immediate_uint( struct ureg_program *ureg, in ureg_DECL_immediate_uint() argument
1036 return decl_immediate(ureg, v, nr, TGSI_IMM_UINT32); in ureg_DECL_immediate_uint()
1041 ureg_DECL_immediate_block_uint( struct ureg_program *ureg, in ureg_DECL_immediate_block_uint() argument
1048 if (ureg->nr_immediates + (nr + 3) / 4 > UREG_MAX_IMMEDIATE) { in ureg_DECL_immediate_block_uint()
1049 set_bad(ureg); in ureg_DECL_immediate_block_uint()
1053 index = ureg->nr_immediates; in ureg_DECL_immediate_block_uint()
1054 ureg->nr_immediates += (nr + 3) / 4; in ureg_DECL_immediate_block_uint()
1056 for (i = index; i < ureg->nr_immediates; i++) { in ureg_DECL_immediate_block_uint()
1057 ureg->immediate[i].type = TGSI_IMM_UINT32; in ureg_DECL_immediate_block_uint()
1058 ureg->immediate[i].nr = nr > 4 ? 4 : nr; in ureg_DECL_immediate_block_uint()
1059 memcpy(ureg->immediate[i].value.u, in ureg_DECL_immediate_block_uint()
1061 ureg->immediate[i].nr * sizeof(uint)); in ureg_DECL_immediate_block_uint()
1070 ureg_DECL_immediate_int( struct ureg_program *ureg, in ureg_DECL_immediate_int() argument
1074 return decl_immediate(ureg, (const unsigned *)v, nr, TGSI_IMM_INT32); in ureg_DECL_immediate_int()
1078 ureg_DECL_immediate_uint64( struct ureg_program *ureg, in ureg_DECL_immediate_uint64() argument
1093 return decl_immediate(ureg, fu.u, nr, TGSI_IMM_UINT64); in ureg_DECL_immediate_uint64()
1097 ureg_DECL_immediate_int64( struct ureg_program *ureg, in ureg_DECL_immediate_int64() argument
1112 return decl_immediate(ureg, fu.u, nr, TGSI_IMM_INT64); in ureg_DECL_immediate_int64()
1116 ureg_emit_src( struct ureg_program *ureg, in ureg_emit_src() argument
1122 union tgsi_any_token *out = get_tokens( ureg, DOMAIN_INSN, size ); in ureg_emit_src()
1145 if (!ureg->supports_any_inout_decl_range && in ureg_emit_src()
1165 if (!ureg->supports_any_inout_decl_range && in ureg_emit_src()
1182 ureg_emit_dst( struct ureg_program *ureg, in ureg_emit_dst() argument
1188 union tgsi_any_token *out = get_tokens( ureg, DOMAIN_INSN, size ); in ureg_emit_dst()
1209 if (!ureg->supports_any_inout_decl_range && in ureg_emit_dst()
1229 if (!ureg->supports_any_inout_decl_range && in ureg_emit_dst()
1260 ureg_emit_insn(struct ureg_program *ureg, in ureg_emit_insn() argument
1273 out = get_tokens( ureg, DOMAIN_INSN, count ); in ureg_emit_insn()
1277 out[0].insn.Precise = precise || ureg->precise; in ureg_emit_insn()
1281 result.insn_token = ureg->domain[DOMAIN_INSN].count - count; in ureg_emit_insn()
1284 ureg->nr_instructions++; in ureg_emit_insn()
1297 ureg_emit_label(struct ureg_program *ureg, in ureg_emit_label() argument
1306 out = get_tokens( ureg, DOMAIN_INSN, 1 ); in ureg_emit_label()
1309 insn = retrieve_token( ureg, DOMAIN_INSN, extended_token ); in ureg_emit_label()
1312 *label_token = ureg->domain[DOMAIN_INSN].count - 1; in ureg_emit_label()
1319 ureg_get_instruction_number( struct ureg_program *ureg ) in ureg_get_instruction_number() argument
1321 return ureg->nr_instructions; in ureg_get_instruction_number()
1328 ureg_fixup_label(struct ureg_program *ureg, in ureg_fixup_label() argument
1332 union tgsi_any_token *out = retrieve_token( ureg, DOMAIN_INSN, label_token ); in ureg_fixup_label()
1339 ureg_emit_texture(struct ureg_program *ureg, in ureg_emit_texture() argument
1346 out = get_tokens( ureg, DOMAIN_INSN, 1 ); in ureg_emit_texture()
1347 insn = retrieve_token( ureg, DOMAIN_INSN, extended_token ); in ureg_emit_texture()
1358 ureg_emit_texture_offset(struct ureg_program *ureg, in ureg_emit_texture_offset() argument
1363 out = get_tokens( ureg, DOMAIN_INSN, 1); in ureg_emit_texture_offset()
1370 ureg_emit_memory(struct ureg_program *ureg, in ureg_emit_memory() argument
1378 out = get_tokens( ureg, DOMAIN_INSN, 1 ); in ureg_emit_memory()
1379 insn = retrieve_token( ureg, DOMAIN_INSN, extended_token ); in ureg_emit_memory()
1390 ureg_fixup_insn_size(struct ureg_program *ureg, in ureg_fixup_insn_size() argument
1393 union tgsi_any_token *out = retrieve_token( ureg, DOMAIN_INSN, insn ); in ureg_fixup_insn_size()
1396 out->insn.NrTokens = ureg->domain[DOMAIN_INSN].count - insn - 1; in ureg_fixup_insn_size()
1401 ureg_insn(struct ureg_program *ureg, in ureg_insn() argument
1419 insn = ureg_emit_insn(ureg, in ureg_insn()
1427 ureg_emit_dst( ureg, dst[i] ); in ureg_insn()
1430 ureg_emit_src( ureg, src[i] ); in ureg_insn()
1432 ureg_fixup_insn_size( ureg, insn.insn_token ); in ureg_insn()
1436 ureg_tex_insn(struct ureg_program *ureg, in ureg_tex_insn() argument
1457 insn = ureg_emit_insn(ureg, in ureg_tex_insn()
1464 ureg_emit_texture( ureg, insn.extended_token, target, return_type, in ureg_tex_insn()
1468 ureg_emit_texture_offset( ureg, &texoffsets[i]); in ureg_tex_insn()
1471 ureg_emit_dst( ureg, dst[i] ); in ureg_tex_insn()
1474 ureg_emit_src( ureg, src[i] ); in ureg_tex_insn()
1476 ureg_fixup_insn_size( ureg, insn.insn_token ); in ureg_tex_insn()
1481 ureg_memory_insn(struct ureg_program *ureg, in ureg_memory_insn() argument
1494 insn = ureg_emit_insn(ureg, in ureg_memory_insn()
1501 ureg_emit_memory(ureg, insn.extended_token, qualifier, texture, format); in ureg_memory_insn()
1504 ureg_emit_dst(ureg, dst[i]); in ureg_memory_insn()
1507 ureg_emit_src(ureg, src[i]); in ureg_memory_insn()
1509 ureg_fixup_insn_size(ureg, insn.insn_token); in ureg_memory_insn()
1514 emit_decl_semantic(struct ureg_program *ureg, in emit_decl_semantic() argument
1525 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, array_id ? 4 : 3); in emit_decl_semantic()
1555 emit_decl_atomic_2d(struct ureg_program *ureg, in emit_decl_atomic_2d() argument
1561 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, array_id ? 4 : 3); in emit_decl_atomic_2d()
1585 emit_decl_fs(struct ureg_program *ureg, in emit_decl_fs() argument
1596 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, in emit_decl_fs()
1627 emit_decl_temps( struct ureg_program *ureg, in emit_decl_temps() argument
1632 union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, in emit_decl_temps()
1653 static void emit_decl_range( struct ureg_program *ureg, in emit_decl_range() argument
1658 union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 ); in emit_decl_range()
1673 emit_decl_range2D(struct ureg_program *ureg, in emit_decl_range2D() argument
1679 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3); in emit_decl_range2D()
1697 emit_decl_sampler_view(struct ureg_program *ureg, in emit_decl_sampler_view() argument
1705 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3); in emit_decl_sampler_view()
1726 emit_decl_image(struct ureg_program *ureg, in emit_decl_image() argument
1733 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3); in emit_decl_image()
1753 emit_decl_buffer(struct ureg_program *ureg, in emit_decl_buffer() argument
1757 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 2); in emit_decl_buffer()
1772 emit_decl_memory(struct ureg_program *ureg, unsigned memory_type) in emit_decl_memory() argument
1774 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 2); in emit_decl_memory()
1789 emit_immediate( struct ureg_program *ureg, in emit_immediate() argument
1793 union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 5 ); in emit_immediate()
1808 emit_property(struct ureg_program *ureg, in emit_property() argument
1812 union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 2); in emit_property()
1846 static void emit_decls( struct ureg_program *ureg ) in emit_decls() argument
1850 for (i = 0; i < ARRAY_SIZE(ureg->properties); i++) in emit_decls()
1851 if (ureg->properties[i] != ~0u) in emit_decls()
1852 emit_property(ureg, i, ureg->properties[i]); in emit_decls()
1857 qsort(ureg->input, ureg->nr_inputs, sizeof(ureg->input[0]), input_sort); in emit_decls()
1859 if (ureg->processor == PIPE_SHADER_VERTEX) { in emit_decls()
1861 if (ureg->vs_inputs[i/32] & (1u << (i%32))) { in emit_decls()
1862 emit_decl_range( ureg, TGSI_FILE_INPUT, i, 1 ); in emit_decls()
1865 } else if (ureg->processor == PIPE_SHADER_FRAGMENT) { in emit_decls()
1866 if (ureg->supports_any_inout_decl_range) { in emit_decls()
1867 for (i = 0; i < ureg->nr_inputs; i++) { in emit_decls()
1868 emit_decl_fs(ureg, in emit_decls()
1870 ureg->input[i].first, in emit_decls()
1871 ureg->input[i].last, in emit_decls()
1872 ureg->input[i].semantic_name, in emit_decls()
1873 ureg->input[i].semantic_index, in emit_decls()
1874 ureg->input[i].interp, in emit_decls()
1875 ureg->input[i].interp_location, in emit_decls()
1876 ureg->input[i].array_id, in emit_decls()
1877 ureg->input[i].usage_mask); in emit_decls()
1881 for (i = 0; i < ureg->nr_inputs; i++) { in emit_decls()
1882 for (j = ureg->input[i].first; j <= ureg->input[i].last; j++) { in emit_decls()
1883 emit_decl_fs(ureg, in emit_decls()
1886 ureg->input[i].semantic_name, in emit_decls()
1887 ureg->input[i].semantic_index + in emit_decls()
1888 (j - ureg->input[i].first), in emit_decls()
1889 ureg->input[i].interp, in emit_decls()
1890 ureg->input[i].interp_location, 0, in emit_decls()
1891 ureg->input[i].usage_mask); in emit_decls()
1896 if (ureg->supports_any_inout_decl_range) { in emit_decls()
1897 for (i = 0; i < ureg->nr_inputs; i++) { in emit_decls()
1898 emit_decl_semantic(ureg, in emit_decls()
1900 ureg->input[i].first, in emit_decls()
1901 ureg->input[i].last, in emit_decls()
1902 ureg->input[i].semantic_name, in emit_decls()
1903 ureg->input[i].semantic_index, in emit_decls()
1906 ureg->input[i].array_id, in emit_decls()
1911 for (i = 0; i < ureg->nr_inputs; i++) { in emit_decls()
1912 for (j = ureg->input[i].first; j <= ureg->input[i].last; j++) { in emit_decls()
1913 emit_decl_semantic(ureg, in emit_decls()
1916 ureg->input[i].semantic_name, in emit_decls()
1917 ureg->input[i].semantic_index + in emit_decls()
1918 (j - ureg->input[i].first), in emit_decls()
1926 for (i = 0; i < ureg->nr_system_values; i++) { in emit_decls()
1927 emit_decl_semantic(ureg, in emit_decls()
1931 ureg->system_value[i].semantic_name, in emit_decls()
1932 ureg->system_value[i].semantic_index, in emit_decls()
1940 qsort(ureg->output, ureg->nr_outputs, sizeof(ureg->output[0]), output_sort); in emit_decls()
1942 if (ureg->supports_any_inout_decl_range) { in emit_decls()
1943 for (i = 0; i < ureg->nr_outputs; i++) { in emit_decls()
1944 emit_decl_semantic(ureg, in emit_decls()
1946 ureg->output[i].first, in emit_decls()
1947 ureg->output[i].last, in emit_decls()
1948 ureg->output[i].semantic_name, in emit_decls()
1949 ureg->output[i].semantic_index, in emit_decls()
1950 ureg->output[i].streams, in emit_decls()
1951 ureg->output[i].usage_mask, in emit_decls()
1952 ureg->output[i].array_id, in emit_decls()
1953 ureg->output[i].invariant); in emit_decls()
1957 for (i = 0; i < ureg->nr_outputs; i++) { in emit_decls()
1958 for (j = ureg->output[i].first; j <= ureg->output[i].last; j++) { in emit_decls()
1959 emit_decl_semantic(ureg, in emit_decls()
1962 ureg->output[i].semantic_name, in emit_decls()
1963 ureg->output[i].semantic_index + in emit_decls()
1964 (j - ureg->output[i].first), in emit_decls()
1965 ureg->output[i].streams, in emit_decls()
1966 ureg->output[i].usage_mask, in emit_decls()
1968 ureg->output[i].invariant); in emit_decls()
1973 for (i = 0; i < ureg->nr_samplers; i++) { in emit_decls()
1974 emit_decl_range( ureg, in emit_decls()
1976 ureg->sampler[i].Index, 1 ); in emit_decls()
1979 for (i = 0; i < ureg->nr_sampler_views; i++) { in emit_decls()
1980 emit_decl_sampler_view(ureg, in emit_decls()
1981 ureg->sampler_view[i].index, in emit_decls()
1982 ureg->sampler_view[i].target, in emit_decls()
1983 ureg->sampler_view[i].return_type_x, in emit_decls()
1984 ureg->sampler_view[i].return_type_y, in emit_decls()
1985 ureg->sampler_view[i].return_type_z, in emit_decls()
1986 ureg->sampler_view[i].return_type_w); in emit_decls()
1989 for (i = 0; i < ureg->nr_images; i++) { in emit_decls()
1990 emit_decl_image(ureg, in emit_decls()
1991 ureg->image[i].index, in emit_decls()
1992 ureg->image[i].target, in emit_decls()
1993 ureg->image[i].format, in emit_decls()
1994 ureg->image[i].wr, in emit_decls()
1995 ureg->image[i].raw); in emit_decls()
1998 for (i = 0; i < ureg->nr_buffers; i++) { in emit_decls()
1999 emit_decl_buffer(ureg, ureg->buffer[i].index, ureg->buffer[i].atomic); in emit_decls()
2003 if (ureg->use_memory[i]) in emit_decls()
2004 emit_decl_memory(ureg, i); in emit_decls()
2008 struct const_decl *decl = &ureg->const_decls[i]; in emit_decls()
2014 emit_decl_range2D(ureg, in emit_decls()
2024 struct hw_atomic_decl *decl = &ureg->hw_atomic_decls[i]; in emit_decls()
2035 emit_decl_atomic_2d(ureg, in emit_decls()
2044 if (ureg->nr_temps) { in emit_decls()
2046 for (i = 0; i < ureg->nr_temps;) { in emit_decls()
2047 boolean local = util_bitmask_get(ureg->local_temps, i); in emit_decls()
2049 i = util_bitmask_get_next_index(ureg->decl_temps, i + 1); in emit_decls()
2051 i = ureg->nr_temps; in emit_decls()
2053 if (array < ureg->nr_array_temps && ureg->array_temps[array] == first) in emit_decls()
2054 emit_decl_temps( ureg, first, i - 1, local, ++array ); in emit_decls()
2056 emit_decl_temps( ureg, first, i - 1, local, 0 ); in emit_decls()
2060 if (ureg->nr_addrs) { in emit_decls()
2061 emit_decl_range( ureg, in emit_decls()
2063 0, ureg->nr_addrs ); in emit_decls()
2066 for (i = 0; i < ureg->nr_immediates; i++) { in emit_decls()
2067 emit_immediate( ureg, in emit_decls()
2068 ureg->immediate[i].value.u, in emit_decls()
2069 ureg->immediate[i].type ); in emit_decls()
2076 static void copy_instructions( struct ureg_program *ureg ) in copy_instructions() argument
2078 unsigned nr_tokens = ureg->domain[DOMAIN_INSN].count; in copy_instructions()
2079 union tgsi_any_token *out = get_tokens( ureg, in copy_instructions()
2084 ureg->domain[DOMAIN_INSN].tokens, in copy_instructions()
2090 fixup_header_size(struct ureg_program *ureg) in fixup_header_size() argument
2092 union tgsi_any_token *out = retrieve_token( ureg, DOMAIN_DECL, 0 ); in fixup_header_size()
2094 out->header.BodySize = ureg->domain[DOMAIN_DECL].count - 2; in fixup_header_size()
2099 emit_header( struct ureg_program *ureg ) in emit_header() argument
2101 union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 ); in emit_header()
2106 out[1].processor.Processor = ureg->processor; in emit_header()
2111 const struct tgsi_token *ureg_finalize( struct ureg_program *ureg ) in ureg_finalize() argument
2115 switch (ureg->processor) { in ureg_finalize()
2118 ureg_property(ureg, TGSI_PROPERTY_NEXT_SHADER, in ureg_finalize()
2119 ureg->next_shader_processor == -1 ? in ureg_finalize()
2121 ureg->next_shader_processor); in ureg_finalize()
2127 emit_header( ureg ); in ureg_finalize()
2128 emit_decls( ureg ); in ureg_finalize()
2129 copy_instructions( ureg ); in ureg_finalize()
2130 fixup_header_size( ureg ); in ureg_finalize()
2132 if (ureg->domain[0].tokens == error_tokens || in ureg_finalize()
2133 ureg->domain[1].tokens == error_tokens) { in ureg_finalize()
2139 tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token; in ureg_finalize()
2143 ureg->domain[DOMAIN_DECL].count); in ureg_finalize()
2150 for (unsigned i = 0; i < ARRAY_SIZE(ureg->const_decls); i++) { in ureg_finalize()
2151 for (unsigned j = 0; j < ureg->const_decls[i].nr_constant_ranges; j++) { in ureg_finalize()
2152 if (ureg->const_decls[i].constant_range[j].last > 4096) { in ureg_finalize()
2171 void *ureg_create_shader( struct ureg_program *ureg, in ureg_create_shader() argument
2177 pipe_shader_state_from_tgsi(&state, ureg_finalize(ureg)); in ureg_create_shader()
2184 switch (ureg->processor) { in ureg_create_shader()
2201 const struct tgsi_token *ureg_get_tokens( struct ureg_program *ureg, in ureg_get_tokens() argument
2206 ureg_finalize(ureg); in ureg_get_tokens()
2208 tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token; in ureg_get_tokens()
2211 *nr_tokens = ureg->domain[DOMAIN_DECL].count; in ureg_get_tokens()
2213 ureg->domain[DOMAIN_DECL].tokens = NULL; in ureg_get_tokens()
2214 ureg->domain[DOMAIN_DECL].size = 0; in ureg_get_tokens()
2215 ureg->domain[DOMAIN_DECL].order = 0; in ureg_get_tokens()
2216 ureg->domain[DOMAIN_DECL].count = 0; in ureg_get_tokens()
2240 struct ureg_program *ureg = CALLOC_STRUCT( ureg_program ); in ureg_create_with_screen() local
2241 if (!ureg) in ureg_create_with_screen()
2244 ureg->processor = processor; in ureg_create_with_screen()
2245 ureg->supports_any_inout_decl_range = in ureg_create_with_screen()
2249 ureg->next_shader_processor = -1; in ureg_create_with_screen()
2251 for (i = 0; i < ARRAY_SIZE(ureg->properties); i++) in ureg_create_with_screen()
2252 ureg->properties[i] = ~0; in ureg_create_with_screen()
2254 ureg->free_temps = util_bitmask_create(); in ureg_create_with_screen()
2255 if (ureg->free_temps == NULL) in ureg_create_with_screen()
2258 ureg->local_temps = util_bitmask_create(); in ureg_create_with_screen()
2259 if (ureg->local_temps == NULL) in ureg_create_with_screen()
2262 ureg->decl_temps = util_bitmask_create(); in ureg_create_with_screen()
2263 if (ureg->decl_temps == NULL) in ureg_create_with_screen()
2266 return ureg; in ureg_create_with_screen()
2269 util_bitmask_destroy(ureg->local_temps); in ureg_create_with_screen()
2271 util_bitmask_destroy(ureg->free_temps); in ureg_create_with_screen()
2273 FREE(ureg); in ureg_create_with_screen()
2280 ureg_set_next_shader_processor(struct ureg_program *ureg, unsigned processor) in ureg_set_next_shader_processor() argument
2282 ureg->next_shader_processor = processor; in ureg_set_next_shader_processor()
2287 ureg_get_nr_outputs( const struct ureg_program *ureg ) in ureg_get_nr_outputs() argument
2289 if (!ureg) in ureg_get_nr_outputs()
2291 return ureg->nr_outputs; in ureg_get_nr_outputs()
2295 ureg_setup_clipdist_info(struct ureg_program *ureg, in ureg_setup_clipdist_info() argument
2299 ureg_property(ureg, TGSI_PROPERTY_NUM_CLIPDIST_ENABLED, in ureg_setup_clipdist_info()
2302 ureg_property(ureg, TGSI_PROPERTY_NUM_CULLDIST_ENABLED, in ureg_setup_clipdist_info()
2307 ureg_setup_tess_ctrl_shader(struct ureg_program *ureg, in ureg_setup_tess_ctrl_shader() argument
2310 ureg_property(ureg, TGSI_PROPERTY_TCS_VERTICES_OUT, in ureg_setup_tess_ctrl_shader()
2315 ureg_setup_tess_eval_shader(struct ureg_program *ureg, in ureg_setup_tess_eval_shader() argument
2318 …ureg_property(ureg, TGSI_PROPERTY_TES_PRIM_MODE, u_tess_prim_from_shader(info->tess._primitive_mod… in ureg_setup_tess_eval_shader()
2326 ureg_property(ureg, TGSI_PROPERTY_TES_SPACING, in ureg_setup_tess_eval_shader()
2329 ureg_property(ureg, TGSI_PROPERTY_TES_VERTEX_ORDER_CW, in ureg_setup_tess_eval_shader()
2331 ureg_property(ureg, TGSI_PROPERTY_TES_POINT_MODE, in ureg_setup_tess_eval_shader()
2336 ureg_setup_geometry_shader(struct ureg_program *ureg, in ureg_setup_geometry_shader() argument
2339 ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, in ureg_setup_geometry_shader()
2341 ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, in ureg_setup_geometry_shader()
2343 ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES, in ureg_setup_geometry_shader()
2345 ureg_property(ureg, TGSI_PROPERTY_GS_INVOCATIONS, in ureg_setup_geometry_shader()
2350 ureg_setup_fragment_shader(struct ureg_program *ureg, in ureg_setup_fragment_shader() argument
2354 ureg_property(ureg, TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL, 1); in ureg_setup_fragment_shader()
2357 ureg_property(ureg, TGSI_PROPERTY_FS_POST_DEPTH_COVERAGE, 1); in ureg_setup_fragment_shader()
2363 ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, in ureg_setup_fragment_shader()
2367 ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, in ureg_setup_fragment_shader()
2371 ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, in ureg_setup_fragment_shader()
2375 ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, in ureg_setup_fragment_shader()
2384 ureg_property(ureg, TGSI_PROPERTY_FS_BLEND_EQUATION_ADVANCED, in ureg_setup_fragment_shader()
2390 ureg_setup_compute_shader(struct ureg_program *ureg, in ureg_setup_compute_shader() argument
2393 ureg_property(ureg, TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH, in ureg_setup_compute_shader()
2395 ureg_property(ureg, TGSI_PROPERTY_CS_FIXED_BLOCK_HEIGHT, in ureg_setup_compute_shader()
2397 ureg_property(ureg, TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH, in ureg_setup_compute_shader()
2401 ureg_DECL_memory(ureg, TGSI_MEMORY_TYPE_SHARED); in ureg_setup_compute_shader()
2405 ureg_setup_shader_info(struct ureg_program *ureg, in ureg_setup_shader_info() argument
2409 ureg_property(ureg, TGSI_PROPERTY_LAYER_VIEWPORT_RELATIVE, 1); in ureg_setup_shader_info()
2413 ureg_setup_clipdist_info(ureg, info); in ureg_setup_shader_info()
2414 ureg_set_next_shader_processor(ureg, pipe_shader_type_from_mesa(info->next_stage)); in ureg_setup_shader_info()
2417 ureg_setup_tess_ctrl_shader(ureg, info); in ureg_setup_shader_info()
2420 ureg_setup_tess_eval_shader(ureg, info); in ureg_setup_shader_info()
2421 ureg_setup_clipdist_info(ureg, info); in ureg_setup_shader_info()
2422 ureg_set_next_shader_processor(ureg, pipe_shader_type_from_mesa(info->next_stage)); in ureg_setup_shader_info()
2425 ureg_setup_geometry_shader(ureg, info); in ureg_setup_shader_info()
2426 ureg_setup_clipdist_info(ureg, info); in ureg_setup_shader_info()
2429 ureg_setup_fragment_shader(ureg, info); in ureg_setup_shader_info()
2432 ureg_setup_compute_shader(ureg, info); in ureg_setup_shader_info()
2440 void ureg_destroy( struct ureg_program *ureg ) in ureg_destroy() argument
2444 for (i = 0; i < ARRAY_SIZE(ureg->domain); i++) { in ureg_destroy()
2445 if (ureg->domain[i].tokens && in ureg_destroy()
2446 ureg->domain[i].tokens != error_tokens) in ureg_destroy()
2447 FREE(ureg->domain[i].tokens); in ureg_destroy()
2450 util_bitmask_destroy(ureg->free_temps); in ureg_destroy()
2451 util_bitmask_destroy(ureg->local_temps); in ureg_destroy()
2452 util_bitmask_destroy(ureg->decl_temps); in ureg_destroy()
2454 FREE(ureg); in ureg_destroy()
2457 void ureg_set_precise( struct ureg_program *ureg, bool precise ) in ureg_set_precise() argument
2459 ureg->precise = precise; in ureg_set_precise()