Lines Matching defs:shader

53 get_deref_info(nir_shader *shader, nir_variable *var, nir_deref_instr *deref,
59 const bool is_arrayed = nir_is_arrayed_io(var, shader->info.stage);
69 if (shader->info.stage == MESA_SHADER_TESS_CTRL)
71 else if (shader->info.stage == MESA_SHADER_MESH)
94 set_io_mask(nir_shader *shader, nir_variable *var, int offset, int len,
127 get_deref_info(shader, var, deref, &cross_invocation, &indirect);
131 shader->info.patch_inputs_read |= bitfield;
133 shader->info.patch_inputs_read_indirectly |= bitfield;
135 shader->info.inputs_read |= bitfield;
137 shader->info.inputs_read_indirectly |= bitfield;
140 if (cross_invocation && shader->info.stage == MESA_SHADER_TESS_CTRL)
141 shader->info.tess.tcs_cross_invocation_inputs_read |= bitfield;
143 if (shader->info.stage == MESA_SHADER_FRAGMENT) {
144 shader->info.fs.uses_sample_qualifier |= var->data.sample;
150 shader->info.patch_outputs_read |= bitfield;
152 shader->info.patch_outputs_accessed_indirectly |= bitfield;
154 shader->info.outputs_read |= bitfield;
156 shader->info.outputs_accessed_indirectly |= bitfield;
159 if (cross_invocation && shader->info.stage == MESA_SHADER_TESS_CTRL)
160 shader->info.tess.tcs_cross_invocation_outputs_read |= bitfield;
163 shader->info.patch_outputs_written |= bitfield;
165 shader->info.patch_outputs_accessed_indirectly |= bitfield;
167 shader->info.outputs_written |= bitfield;
169 shader->info.outputs_accessed_indirectly |= bitfield;
173 if (cross_invocation && shader->info.stage == MESA_SHADER_MESH)
174 shader->info.mesh.ms_cross_invocation_output_access |= bitfield;
177 shader->info.outputs_read |= bitfield;
178 if (shader->info.stage == MESA_SHADER_FRAGMENT)
179 shader->info.fs.uses_fbfetch_output = true;
182 if (shader->info.stage == MESA_SHADER_FRAGMENT &&
184 shader->info.fs.color_is_dual_source = true;
191 * represents a shader input or output.
194 mark_whole_variable(nir_shader *shader, nir_variable *var,
199 if (nir_is_arrayed_io(var, shader->info.stage) ||
201 (shader->info.stage == MESA_SHADER_MESH &&
217 set_io_mask(shader, var, 0, slots, deref, is_output_read);
264 * that the variable represents a shader input or output.
270 try_mask_partial_io(nir_shader *shader, nir_variable *var,
274 bool is_arrayed = nir_is_arrayed_io(var, shader->info.stage);
275 bool skip_non_arrayed = shader->info.stage == MESA_SHADER_MESH;
308 set_io_mask(shader, var, offset, len, deref, is_output_read);
467 gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
479 assert((shader->info.stage == MESA_SHADER_TESS_EVAL &&
481 (shader->info.stage == MESA_SHADER_TESS_CTRL &&
503 shader->info.fs.uses_demote = true;
509 * a fragment shader. */
510 if (shader->info.stage == MESA_SHADER_FRAGMENT)
511 shader->info.fs.uses_discard = true;
516 assert(shader->info.stage == MESA_SHADER_FRAGMENT);
517 shader->info.fs.uses_discard = true;
536 if (!try_mask_partial_io(shader, var, deref, is_output_read))
537 mark_whole_variable(shader, var, deref, is_output_read);
541 if (shader->info.stage == MESA_SHADER_VERTEX &&
546 shader->info.vs.double_inputs |= BITFIELD64_BIT(idx);
551 shader->info.writes_memory = true;
563 shader->info.fs.uses_fbfetch_output = true;
571 if (shader->info.stage == MESA_SHADER_TESS_EVAL &&
573 shader->info.patch_inputs_read |= slot_mask;
575 shader->info.patch_inputs_read_indirectly |= slot_mask;
577 shader->info.inputs_read |= slot_mask;
578 shader->info.inputs_read_16bit |= slot_mask_16bit;
580 shader->info.inputs_read_indirectly |= slot_mask;
581 shader->info.inputs_read_indirectly_16bit |= slot_mask_16bit;
585 if (shader->info.stage == MESA_SHADER_TESS_CTRL &&
588 shader->info.tess.tcs_cross_invocation_inputs_read |= slot_mask;
594 if (shader->info.stage == MESA_SHADER_TESS_CTRL &&
596 shader->info.patch_outputs_read |= slot_mask;
598 shader->info.patch_outputs_accessed_indirectly |= slot_mask;
600 shader->info.outputs_read |= slot_mask;
601 shader->info.outputs_read_16bit |= slot_mask_16bit;
603 shader->info.outputs_accessed_indirectly |= slot_mask;
604 shader->info.outputs_accessed_indirectly_16bit |= slot_mask_16bit;
608 if (shader->info.stage == MESA_SHADER_TESS_CTRL &&
611 shader->info.tess.tcs_cross_invocation_outputs_read |= slot_mask;
614 if (shader->info.stage == MESA_SHADER_MESH &&
618 shader->info.mesh.ms_cross_invocation_output_access |= slot_mask;
620 if (shader->info.stage == MESA_SHADER_FRAGMENT &&
622 shader->info.fs.uses_fbfetch_output = true;
628 if (shader->info.stage == MESA_SHADER_TESS_CTRL &&
630 shader->info.patch_outputs_written |= slot_mask;
632 shader->info.patch_outputs_accessed_indirectly |= slot_mask;
634 shader->info.outputs_written |= slot_mask;
635 shader->info.outputs_written_16bit |= slot_mask_16bit;
637 shader->info.outputs_accessed_indirectly |= slot_mask;
638 shader->info.outputs_accessed_indirectly_16bit |= slot_mask_16bit;
642 if (shader->info.stage == MESA_SHADER_MESH &&
646 shader->info.mesh.ms_cross_invocation_output_access |= slot_mask;
648 if (shader->info.stage == MESA_SHADER_FRAGMENT &&
650 shader->info.fs.color_is_dual_source = true;
655 shader->info.inputs_read |=
725 BITSET_SET(shader->info.system_values_read,
732 BITSET_SET(shader->info.system_values_read,
735 BITSET_SET(shader->info.system_values_read,
743 BITSET_SET(shader->info.system_values_read,
746 BITSET_SET(shader->info.system_values_read,
754 BITSET_SET(shader->info.system_values_read,
757 BITSET_SET(shader->info.system_values_read,
760 if (shader->info.stage == MESA_SHADER_FRAGMENT)
761 shader->info.fs.uses_sample_qualifier = true;
769 if (shader->info.stage == MESA_SHADER_FRAGMENT)
770 shader->info.fs.needs_quad_helper_invocations = true;
796 if (shader->info.stage == MESA_SHADER_FRAGMENT)
797 shader->info.fs.needs_all_helper_invocations = true;
798 if (shader->info.stage == MESA_SHADER_COMPUTE)
799 shader->info.cs.uses_wide_subgroup_intrinsics = true;
804 assert(shader->info.stage == MESA_SHADER_GEOMETRY);
805 shader->info.gs.uses_end_primitive = 1;
810 shader->info.gs.active_stream_mask |= 1 << nir_intrinsic_stream_id(instr);
815 shader->info.uses_control_barrier = true;
819 shader->info.uses_control_barrier |=
822 shader->info.uses_memory_barrier |=
833 shader->info.uses_memory_barrier = true;
838 shader->info.writes_memory = true;
844 gather_tex_info(nir_tex_instr *instr, nir_shader *shader)
846 if (shader->info.stage == MESA_SHADER_FRAGMENT &&
848 shader->info.fs.needs_quad_helper_invocations = true;
852 shader->info.uses_texture_gather = true;
860 gather_alu_info(nir_alu_instr *instr, nir_shader *shader)
865 shader->info.uses_fddx_fddy = true;
871 if (shader->info.stage == MESA_SHADER_FRAGMENT)
872 shader->info.fs.needs_quad_helper_invocations = true;
882 shader->info.bit_sizes_float |= nir_src_bit_size(instr->src[i].src);
884 shader->info.bit_sizes_int |= nir_src_bit_size(instr->src[i].src);
887 shader->info.bit_sizes_float |= nir_dest_bit_size(instr->dest.dest);
889 shader->info.bit_sizes_int |= nir_dest_bit_size(instr->dest.dest);
893 gather_func_info(nir_function_impl *func, nir_shader *shader,
905 gather_alu_info(nir_instr_as_alu(instr), shader);
908 gather_intrinsic_info(nir_instr_as_intrinsic(instr), shader, dead_ctx);
911 gather_tex_info(nir_instr_as_tex(instr), shader);
918 gather_func_info(impl, shader, visited_funcs, dead_ctx);
929 nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
931 shader->info.num_textures = 0;
932 shader->info.num_images = 0;
933 shader->info.bit_sizes_float = 0;
934 shader->info.bit_sizes_int = 0;
936 nir_foreach_variable_with_modes(var, shader, nir_var_image | nir_var_uniform) {
944 shader->info.num_textures += glsl_type_get_sampler_count(var->type);
945 shader->info.num_images += glsl_type_get_image_count(var->type);
948 shader->info.inputs_read = 0;
949 shader->info.outputs_written = 0;
950 shader->info.outputs_read = 0;
951 shader->info.inputs_read_16bit = 0;
952 shader->info.outputs_written_16bit = 0;
953 shader->info.outputs_read_16bit = 0;
954 shader->info.inputs_read_indirectly_16bit = 0;
955 shader->info.outputs_accessed_indirectly_16bit = 0;
956 shader->info.patch_outputs_read = 0;
957 shader->info.patch_inputs_read = 0;
958 shader->info.patch_outputs_written = 0;
959 BITSET_ZERO(shader->info.system_values_read);
960 shader->info.inputs_read_indirectly = 0;
961 shader->info.outputs_accessed_indirectly = 0;
962 shader->info.patch_inputs_read_indirectly = 0;
963 shader->info.patch_outputs_accessed_indirectly = 0;
965 if (shader->info.stage == MESA_SHADER_VERTEX) {
966 shader->info.vs.double_inputs = 0;
968 if (shader->info.stage == MESA_SHADER_FRAGMENT) {
969 shader->info.fs.uses_sample_qualifier = false;
970 shader->info.fs.uses_discard = false;
971 shader->info.fs.uses_demote = false;
972 shader->info.fs.color_is_dual_source = false;
973 shader->info.fs.uses_fbfetch_output = false;
974 shader->info.fs.needs_quad_helper_invocations = false;
975 shader->info.fs.needs_all_helper_invocations = false;
977 if (shader->info.stage == MESA_SHADER_TESS_CTRL) {
978 shader->info.tess.tcs_cross_invocation_inputs_read = 0;
979 shader->info.tess.tcs_cross_invocation_outputs_read = 0;
981 if (shader->info.stage == MESA_SHADER_MESH) {
982 shader->info.mesh.ms_cross_invocation_output_access = 0;
985 if (shader->info.stage != MESA_SHADER_FRAGMENT)
986 shader->info.writes_memory = shader->info.has_transform_feedback_varyings;
990 gather_func_info(entrypoint, shader, visited_funcs, dead_ctx);
993 shader->info.per_primitive_outputs = 0;
994 if (shader->info.stage == MESA_SHADER_MESH) {
995 nir_foreach_shader_out_variable(var, shader) {
997 assert(nir_is_arrayed_io(var, shader->info.stage));
1000 shader->info.per_primitive_outputs |= BITFIELD64_RANGE(var->data.location, slots);
1005 shader->info.per_primitive_inputs = 0;
1006 if (shader->info.stage == MESA_SHADER_FRAGMENT) {
1007 nir_foreach_shader_in_variable(var, shader) {
1011 shader->info.per_primitive_inputs |= BITFIELD64_RANGE(var->data.location, slots);
1016 shader->info.ray_queries = 0;
1017 nir_foreach_variable_in_shader(var, shader) {
1021 shader->info.ray_queries += MAX2(glsl_get_aoa_size(var->type), 1);
1023 nir_foreach_function(func, shader) {
1030 shader->info.ray_queries += MAX2(glsl_get_aoa_size(var->type), 1);