Lines Matching refs:prog
224 gl_shader_program *prog; member in __anon3603d7b40111::array_resize_visitor
228 gl_shader_program *prog, in array_resize_visitor() argument
232 this->prog = prog; in array_resize_visitor()
255 linker_error(this->prog, "size of array %s declared as %u, " in visit()
266 linker_error(this->prog, "%s shader accesses element %i of " in visit()
414 linker_error(gl_shader_program *prog, const char *fmt, ...) in linker_error() argument
418 ralloc_strcat(&prog->data->InfoLog, "error: "); in linker_error()
420 ralloc_vasprintf_append(&prog->data->InfoLog, fmt, ap); in linker_error()
423 prog->data->LinkStatus = false; in linker_error()
428 linker_warning(gl_shader_program *prog, const char *fmt, ...) in linker_warning() argument
432 ralloc_strcat(&prog->data->InfoLog, "warning: "); in linker_warning()
434 ralloc_vasprintf_append(&prog->data->InfoLog, fmt, ap); in linker_warning()
547 analyze_clip_cull_usage(struct gl_shader_program *prog, in analyze_clip_cull_usage() argument
556 if (prog->data->Version >= (prog->IsES ? 300 : 130)) { in analyze_clip_cull_usage()
582 if (!prog->IsES) { in analyze_clip_cull_usage()
588 linker_error(prog, "%s shader writes to both `gl_ClipVertex' " in analyze_clip_cull_usage()
594 linker_error(prog, "%s shader writes to both `gl_ClipVertex' " in analyze_clip_cull_usage()
622 linker_error(prog, "%s shader: the combined size of " in analyze_clip_cull_usage()
642 validate_vertex_shader_executable(struct gl_shader_program *prog, in validate_vertex_shader_executable() argument
675 if (prog->data->Version < (prog->IsES ? 300 : 140)) { in validate_vertex_shader_executable()
679 if (prog->IsES) { in validate_vertex_shader_executable()
680 linker_warning(prog, in validate_vertex_shader_executable()
684 linker_error(prog, in validate_vertex_shader_executable()
691 analyze_clip_cull_usage(prog, shader, ctx, in validate_vertex_shader_executable()
692 &prog->Vert.ClipDistanceArraySize, in validate_vertex_shader_executable()
693 &prog->Vert.CullDistanceArraySize); in validate_vertex_shader_executable()
697 validate_tess_eval_shader_executable(struct gl_shader_program *prog, in validate_tess_eval_shader_executable() argument
704 analyze_clip_cull_usage(prog, shader, ctx, in validate_tess_eval_shader_executable()
705 &prog->TessEval.ClipDistanceArraySize, in validate_tess_eval_shader_executable()
706 &prog->TessEval.CullDistanceArraySize); in validate_tess_eval_shader_executable()
716 validate_fragment_shader_executable(struct gl_shader_program *prog, in validate_fragment_shader_executable() argument
729 linker_error(prog, "fragment shader writes to both " in validate_fragment_shader_executable()
743 validate_geometry_shader_executable(struct gl_shader_program *prog, in validate_geometry_shader_executable() argument
751 prog->Geom.VerticesIn = num_vertices; in validate_geometry_shader_executable()
753 analyze_clip_cull_usage(prog, shader, ctx, in validate_geometry_shader_executable()
754 &prog->Geom.ClipDistanceArraySize, in validate_geometry_shader_executable()
755 &prog->Geom.CullDistanceArraySize); in validate_geometry_shader_executable()
764 struct gl_shader_program *prog) in validate_geometry_shader_emissions() argument
766 struct gl_linked_shader *sh = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]; in validate_geometry_shader_emissions()
772 linker_error(prog, "Invalid call %s(%d). Accepted values for the " in validate_geometry_shader_emissions()
778 prog->Geom.UsesStreams = emit_vertex.uses_streams(); in validate_geometry_shader_emissions()
779 prog->Geom.UsesEndPrimitive = emit_vertex.uses_end_primitive(); in validate_geometry_shader_emissions()
805 if (prog->Geom.UsesStreams && sh->info.Geom.OutputType != GL_POINTS) { in validate_geometry_shader_emissions()
806 linker_error(prog, "EmitStreamVertex(n) and EndStreamPrimitive(n) " in validate_geometry_shader_emissions()
813 validate_intrastage_arrays(struct gl_shader_program *prog, in validate_intrastage_arrays() argument
827 linker_error(prog, "%s `%s' declared as type " in validate_intrastage_arrays()
839 linker_error(prog, "%s `%s' declared as type " in validate_intrastage_arrays()
866 cross_validate_globals(struct gl_shader_program *prog, in cross_validate_globals() argument
900 if (!validate_intrastage_arrays(prog, var, existing)) { in cross_validate_globals()
916 linker_error(prog, "%s `%s' declared as type " in cross_validate_globals()
930 linker_error(prog, "explicit locations for %s " in cross_validate_globals()
937 linker_error(prog, "explicit components for %s `%s' have " in cross_validate_globals()
965 linker_error(prog, "explicit bindings for %s " in cross_validate_globals()
977 linker_error(prog, "offset specifications for %s " in cross_validate_globals()
1000 linker_error(prog, in cross_validate_globals()
1007 linker_error(prog, in cross_validate_globals()
1034 linker_error(prog, "initializers for %s " in cross_validate_globals()
1052 linker_error(prog, in cross_validate_globals()
1061 linker_error(prog, "declarations for %s `%s' have " in cross_validate_globals()
1067 linker_error(prog, "declarations for %s `%s' have " in cross_validate_globals()
1073 linker_error(prog, "declarations for %s `%s` have " in cross_validate_globals()
1079 linker_error(prog, "declarations for %s `%s` have " in cross_validate_globals()
1092 if (prog->IsES && (prog->data->Version != 310 || in cross_validate_globals()
1095 linker_error(prog, "declarations for %s `%s` have " in cross_validate_globals()
1110 cross_validate_uniforms(struct gl_shader_program *prog) in cross_validate_uniforms() argument
1114 if (prog->_LinkedShaders[i] == NULL) in cross_validate_uniforms()
1117 cross_validate_globals(prog, prog->_LinkedShaders[i]->ir, &variables, in cross_validate_uniforms()
1127 interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog, in interstage_cross_validate_uniform_blocks() argument
1132 unsigned *num_blks = validate_ssbo ? &prog->data->NumShaderStorageBlocks : in interstage_cross_validate_uniform_blocks()
1133 &prog->data->NumUniformBlocks; in interstage_cross_validate_uniform_blocks()
1137 if (prog->_LinkedShaders[i]) { in interstage_cross_validate_uniform_blocks()
1140 prog->_LinkedShaders[i]->Program->info.num_ssbos; in interstage_cross_validate_uniform_blocks()
1143 prog->_LinkedShaders[i]->Program->info.num_ubos; in interstage_cross_validate_uniform_blocks()
1149 struct gl_linked_shader *sh = prog->_LinkedShaders[i]; in interstage_cross_validate_uniform_blocks()
1161 sh_num_blocks = prog->_LinkedShaders[i]->Program->info.num_ssbos; in interstage_cross_validate_uniform_blocks()
1164 sh_num_blocks = prog->_LinkedShaders[i]->Program->info.num_ubos; in interstage_cross_validate_uniform_blocks()
1169 int index = link_cross_validate_uniform_block(prog, &blks, num_blks, in interstage_cross_validate_uniform_blocks()
1173 linker_error(prog, "buffer block `%s' has mismatching " in interstage_cross_validate_uniform_blocks()
1200 struct gl_linked_shader *sh = prog->_LinkedShaders[i]; in interstage_cross_validate_uniform_blocks()
1217 prog->data->ShaderStorageBlocks = blks; in interstage_cross_validate_uniform_blocks()
1219 prog->data->UniformBlocks = blks; in interstage_cross_validate_uniform_blocks()
1602 struct gl_shader_program *prog, in link_xfb_stride_layout_qualifiers() argument
1620 linker_error(prog, in link_xfb_stride_layout_qualifiers()
1638 prog->TransformFeedback.BufferStride[j] = in link_xfb_stride_layout_qualifiers()
1642 if (prog->TransformFeedback.BufferStride[j] % 4) { in link_xfb_stride_layout_qualifiers()
1643 linker_error(prog, "invalid qualifier xfb_stride=%d must be a " in link_xfb_stride_layout_qualifiers()
1646 prog->TransformFeedback.BufferStride[j]); in link_xfb_stride_layout_qualifiers()
1650 if (prog->TransformFeedback.BufferStride[j] / 4 > in link_xfb_stride_layout_qualifiers()
1652 linker_error(prog, in link_xfb_stride_layout_qualifiers()
1667 link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, in link_tcs_out_layout_qualifiers() argument
1694 linker_error(prog, "tessellation control shader defined with " in link_tcs_out_layout_qualifiers()
1710 linker_error(prog, "tessellation control shader didn't declare " in link_tcs_out_layout_qualifiers()
1724 link_tes_in_layout_qualifiers(struct gl_shader_program *prog, in link_tes_in_layout_qualifiers() argument
1758 linker_error(prog, "tessellation evaluation shader defined with " in link_tes_in_layout_qualifiers()
1769 linker_error(prog, "tessellation evaluation shader defined with " in link_tes_in_layout_qualifiers()
1780 linker_error(prog, "tessellation evaluation shader defined with " in link_tes_in_layout_qualifiers()
1792 linker_error(prog, "tessellation evaluation shader defined with " in link_tes_in_layout_qualifiers()
1807 linker_error(prog, in link_tes_in_layout_qualifiers()
1830 link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, in link_fs_inout_layout_qualifiers() argument
1841 (prog->data->Version < 150 && in link_fs_inout_layout_qualifiers()
1842 !prog->ARB_fragment_coord_conventions_enable)) in link_fs_inout_layout_qualifiers()
1859 linker_error(prog, "fragment shader defined with conflicting " in link_fs_inout_layout_qualifiers()
1874 linker_error(prog, "fragment shader defined with conflicting " in link_fs_inout_layout_qualifiers()
1913 link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, in link_gs_inout_layout_qualifiers() argument
1927 prog->data->Version < 150) in link_gs_inout_layout_qualifiers()
1947 linker_error(prog, "geometry shader defined with conflicting " in link_gs_inout_layout_qualifiers()
1958 linker_error(prog, "geometry shader defined with conflicting " in link_gs_inout_layout_qualifiers()
1969 linker_error(prog, "geometry shader defined with conflicting " in link_gs_inout_layout_qualifiers()
1982 linker_error(prog, "geometry shader defined with conflicting " in link_gs_inout_layout_qualifiers()
1997 linker_error(prog, in link_gs_inout_layout_qualifiers()
2003 linker_error(prog, in link_gs_inout_layout_qualifiers()
2009 linker_error(prog, in link_gs_inout_layout_qualifiers()
2025 link_cs_input_layout_qualifiers(struct gl_shader_program *prog, in link_cs_input_layout_qualifiers() argument
2059 linker_error(prog, "compute shader defined with conflicting " in link_cs_input_layout_qualifiers()
2078 linker_error(prog, "compute shader defined with both fixed and " in link_cs_input_layout_qualifiers()
2092 linker_error(prog, "compute shader must contain a fixed or a variable " in link_cs_input_layout_qualifiers()
2097 prog->Comp.LocalSize[i] = linked_shader->info.Comp.LocalSize[i]; in link_cs_input_layout_qualifiers()
2099 prog->Comp.LocalSizeVariable = in link_cs_input_layout_qualifiers()
2114 struct gl_shader_program *prog, in link_intrastage_shaders() argument
2130 cross_validate_globals(prog, shader_list[i]->ir, &variables, false); in link_intrastage_shaders()
2133 if (!prog->data->LinkStatus) in link_intrastage_shaders()
2138 validate_intrastage_interface_blocks(prog, (const gl_shader **)shader_list, in link_intrastage_shaders()
2140 if (!prog->data->LinkStatus) in link_intrastage_shaders()
2171 linker_error(prog, "function `%s' is multiply defined\n", in link_intrastage_shaders()
2199 linker_error(prog, "%s shader lacks `main'\n", in link_intrastage_shaders()
2211 prog->Name, false); in link_intrastage_shaders()
2213 prog->data->LinkStatus = false; in link_intrastage_shaders()
2218 _mesa_reference_shader_program_data(ctx, &gl_prog->sh.data, prog->data); in link_intrastage_shaders()
2226 link_fs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders); in link_intrastage_shaders()
2227 link_tcs_out_layout_qualifiers(prog, linked, shader_list, num_shaders); in link_intrastage_shaders()
2228 link_tes_in_layout_qualifiers(prog, linked, shader_list, num_shaders); in link_intrastage_shaders()
2229 link_gs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders); in link_intrastage_shaders()
2230 link_cs_input_layout_qualifiers(prog, linked, shader_list, num_shaders); in link_intrastage_shaders()
2231 link_xfb_stride_layout_qualifiers(ctx, prog, linked, shader_list, in link_intrastage_shaders()
2259 if (!link_function_calls(prog, linked, shader_list, num_shaders)) { in link_intrastage_shaders()
2273 link_uniform_blocks(mem_ctx, ctx, prog, linked, &ubo_blocks, in link_intrastage_shaders()
2276 if (!prog->data->LinkStatus) { in link_intrastage_shaders()
2307 array_resize_visitor input_resize_visitor(num_vertices, prog, in link_intrastage_shaders()
2346 update_array_sizes(struct gl_shader_program *prog) in update_array_sizes() argument
2349 if (prog->_LinkedShaders[i] == NULL) in update_array_sizes()
2354 foreach_in_list(ir_instruction, node, prog->_LinkedShaders[i]->ir) { in update_array_sizes()
2377 if (prog->_LinkedShaders[j] == NULL) in update_array_sizes()
2380 foreach_in_list(ir_instruction, node2, prog->_LinkedShaders[j]->ir) { in update_array_sizes()
2416 v.run(prog->_LinkedShaders[i]->ir); in update_array_sizes()
2427 struct gl_shader_program *prog) in resize_tes_inputs() argument
2429 if (prog->_LinkedShaders[MESA_SHADER_TESS_EVAL] == NULL) in resize_tes_inputs()
2432 gl_linked_shader *const tcs = prog->_LinkedShaders[MESA_SHADER_TESS_CTRL]; in resize_tes_inputs()
2433 gl_linked_shader *const tes = prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]; in resize_tes_inputs()
2443 array_resize_visitor input_resize_visitor(num_vertices, prog, in resize_tes_inputs()
2527 gl_shader_program *prog, in assign_attribute_or_color_locations() argument
2548 gl_linked_shader *const sh = prog->_LinkedShaders[target_index]; in assign_attribute_or_color_locations()
2611 linker_error(prog, in assign_attribute_or_color_locations()
2622 if (prog->AttributeBindings->get(binding, var->name)) { in assign_attribute_or_color_locations()
2635 if (prog->FragDataBindings->get(binding, name)) { in assign_attribute_or_color_locations()
2640 if (prog->FragDataIndexBindings->get(index, name)) { in assign_attribute_or_color_locations()
2671 linker_error(prog, in assign_attribute_or_color_locations()
2768 linker_error(prog, in assign_attribute_or_color_locations()
2779 if (target_index == MESA_SHADER_FRAGMENT && !prog->IsES) { in assign_attribute_or_color_locations()
2803 linker_error(prog, "types do not match for aliased" in assign_attribute_or_color_locations()
2816 linker_error(prog, "overlapping component is " in assign_attribute_or_color_locations()
2826 (prog->IsES && prog->data->Version >= 300)) { in assign_attribute_or_color_locations()
2827 linker_error(prog, "overlapping location is assigned " in assign_attribute_or_color_locations()
2832 linker_warning(prog, "overlapping location is assigned " in assign_attribute_or_color_locations()
2871 linker_error(prog, "too many %s (max %u)", in assign_attribute_or_color_locations()
2887 linker_error(prog, in assign_attribute_or_color_locations()
2926 linker_error(prog, in assign_attribute_or_color_locations()
2951 linker_error(prog, in assign_attribute_or_color_locations()
3014 store_fragdepth_layout(struct gl_shader_program *prog) in store_fragdepth_layout() argument
3016 if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) { in store_fragdepth_layout()
3020 struct exec_list *ir = prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir; in store_fragdepth_layout()
3039 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_NONE; in store_fragdepth_layout()
3042 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_ANY; in store_fragdepth_layout()
3045 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_GREATER; in store_fragdepth_layout()
3048 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_LESS; in store_fragdepth_layout()
3051 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_UNCHANGED; in store_fragdepth_layout()
3065 check_resources(struct gl_context *ctx, struct gl_shader_program *prog) in check_resources() argument
3071 struct gl_linked_shader *sh = prog->_LinkedShaders[i]; in check_resources()
3078 linker_error(prog, "Too many %s shader texture samplers\n", in check_resources()
3085 linker_warning(prog, "Too many %s shader default uniform block " in check_resources()
3091 linker_error(prog, "Too many %s shader default uniform block " in check_resources()
3100 linker_warning(prog, "Too many %s shader uniform components, " in check_resources()
3105 linker_error(prog, "Too many %s shader uniform components\n", in check_resources()
3116 linker_error(prog, "Too many %s uniform blocks (%d/%d)\n", in check_resources()
3124 linker_error(prog, "Too many %s shader storage blocks (%d/%d)\n", in check_resources()
3131 linker_error(prog, "Too many combined uniform blocks (%d/%d)\n", in check_resources()
3136 linker_error(prog, "Too many combined shader storage blocks (%d/%d)\n", in check_resources()
3141 for (unsigned i = 0; i < prog->data->NumUniformBlocks; i++) { in check_resources()
3142 if (prog->data->UniformBlocks[i].UniformBufferSize > in check_resources()
3144 linker_error(prog, "Uniform block %s too big (%d/%d)\n", in check_resources()
3145 prog->data->UniformBlocks[i].Name, in check_resources()
3146 prog->data->UniformBlocks[i].UniformBufferSize, in check_resources()
3151 for (unsigned i = 0; i < prog->data->NumShaderStorageBlocks; i++) { in check_resources()
3152 if (prog->data->ShaderStorageBlocks[i].UniformBufferSize > in check_resources()
3154 linker_error(prog, "Shader storage block %s too big (%d/%d)\n", in check_resources()
3155 prog->data->ShaderStorageBlocks[i].Name, in check_resources()
3156 prog->data->ShaderStorageBlocks[i].UniformBufferSize, in check_resources()
3163 link_calculate_subroutine_compat(struct gl_shader_program *prog) in link_calculate_subroutine_compat() argument
3165 unsigned mask = prog->data->linked_stages; in link_calculate_subroutine_compat()
3168 struct gl_program *p = prog->_LinkedShaders[i]->Program; in link_calculate_subroutine_compat()
3181 …linker_error(prog, "subroutine uniform %s defined but no valid functions found\n", uni->type->name… in link_calculate_subroutine_compat()
3199 check_subroutine_resources(struct gl_shader_program *prog) in check_subroutine_resources() argument
3201 unsigned mask = prog->data->linked_stages; in check_subroutine_resources()
3204 struct gl_program *p = prog->_LinkedShaders[i]->Program; in check_subroutine_resources()
3207 linker_error(prog, "Too many %s shader subroutine uniforms\n", in check_subroutine_resources()
3216 check_image_resources(struct gl_context *ctx, struct gl_shader_program *prog) in check_image_resources() argument
3226 struct gl_linked_shader *sh = prog->_LinkedShaders[i]; in check_image_resources()
3230 linker_error(prog, "Too many %s shader image uniforms (%u > %u)\n", in check_image_resources()
3250 linker_error(prog, "Too many combined image uniforms\n"); in check_image_resources()
3254 linker_error(prog, "Too many combined image uniforms, shader storage " in check_image_resources()
3265 reserve_explicit_locations(struct gl_shader_program *prog, in reserve_explicit_locations() argument
3273 if (max_loc + 1 > prog->NumUniformRemapTable) { in reserve_explicit_locations()
3274 prog->UniformRemapTable = in reserve_explicit_locations()
3275 reralloc(prog, prog->UniformRemapTable, in reserve_explicit_locations()
3279 if (!prog->UniformRemapTable) { in reserve_explicit_locations()
3280 linker_error(prog, "Out of memory during linking.\n"); in reserve_explicit_locations()
3285 for (unsigned i = prog->NumUniformRemapTable; i < max_loc + 1; i++) in reserve_explicit_locations()
3286 prog->UniformRemapTable[i] = NULL; in reserve_explicit_locations()
3288 prog->NumUniformRemapTable = max_loc + 1; in reserve_explicit_locations()
3295 if (prog->UniformRemapTable[loc] == INACTIVE_UNIFORM_EXPLICIT_LOCATION) { in reserve_explicit_locations()
3310 linker_error(prog, in reserve_explicit_locations()
3320 prog->UniformRemapTable[loc] = INACTIVE_UNIFORM_EXPLICIT_LOCATION; in reserve_explicit_locations()
3330 reserve_subroutine_explicit_locations(struct gl_shader_program *prog, in reserve_subroutine_explicit_locations() argument
3345 linker_error(prog, "Out of memory during linking.\n"); in reserve_subroutine_explicit_locations()
3367 linker_error(prog, in reserve_subroutine_explicit_locations()
3389 struct gl_shader_program *prog) in check_explicit_uniform_locations() argument
3400 linker_error(prog, "Out of memory during linking.\n"); in check_explicit_uniform_locations()
3405 unsigned mask = prog->data->linked_stages; in check_explicit_uniform_locations()
3408 struct gl_program *p = prog->_LinkedShaders[i]->Program; in check_explicit_uniform_locations()
3410 foreach_in_list(ir_instruction, node, prog->_LinkedShaders[i]->ir) { in check_explicit_uniform_locations()
3418 ret = reserve_subroutine_explicit_locations(prog, p, var); in check_explicit_uniform_locations()
3420 int slots = reserve_explicit_locations(prog, uniform_map, in check_explicit_uniform_locations()
3437 for (unsigned i = 0; i < prog->NumUniformRemapTable; i++) { in check_explicit_uniform_locations()
3439 if (prog->UniformRemapTable[i] == NULL) { in check_explicit_uniform_locations()
3442 current_block = rzalloc(prog, struct empty_uniform_block); in check_explicit_uniform_locations()
3444 exec_list_push_tail(&prog->EmptyUniformLocations, in check_explicit_uniform_locations()
3533 add_program_resource(struct gl_shader_program *prog, in add_program_resource() argument
3543 prog->ProgramResourceList = in add_program_resource()
3544 reralloc(prog, in add_program_resource()
3545 prog->ProgramResourceList, in add_program_resource()
3547 prog->NumProgramResourceList + 1); in add_program_resource()
3549 if (!prog->ProgramResourceList) { in add_program_resource()
3550 linker_error(prog, "Out of memory during linking.\n"); in add_program_resource()
3555 &prog->ProgramResourceList[prog->NumProgramResourceList]; in add_program_resource()
3561 prog->NumProgramResourceList++; in add_program_resource()
4377 struct gl_shader_program *prog) in validate_sampler_array_indexing() argument
4381 if (prog->_LinkedShaders[i] == NULL) in validate_sampler_array_indexing()
4388 v.run(prog->_LinkedShaders[i]->ir); in validate_sampler_array_indexing()
4394 linker_error(prog, msg, prog->IsES ? "ES" : "", in validate_sampler_array_indexing()
4395 prog->data->Version); in validate_sampler_array_indexing()
4398 linker_warning(prog, msg, prog->IsES ? "ES" : "", in validate_sampler_array_indexing()
4399 prog->data->Version); in validate_sampler_array_indexing()
4407 link_assign_subroutine_types(struct gl_shader_program *prog) in link_assign_subroutine_types() argument
4409 unsigned mask = prog->data->linked_stages; in link_assign_subroutine_types()
4412 gl_program *p = prog->_LinkedShaders[i]->Program; in link_assign_subroutine_types()
4415 foreach_in_list(ir_instruction, node, prog->_LinkedShaders[i]->ir) { in link_assign_subroutine_types()
4429 linker_error(prog, "Too many subroutine functions declared.\n"); in link_assign_subroutine_types()
4451 linker_error(prog, "each subroutine index qualifier in the " in link_assign_subroutine_types()
4494 disable_varying_optimizations_for_sso(struct gl_shader_program *prog) in disable_varying_optimizations_for_sso() argument
4497 assert(prog->SeparateShader); in disable_varying_optimizations_for_sso()
4504 if (!prog->_LinkedShaders[i]) in disable_varying_optimizations_for_sso()
4515 gl_linked_shader *sh = prog->_LinkedShaders[stage]; in disable_varying_optimizations_for_sso()
4544 struct gl_shader_program *prog, void *mem_ctx) in link_varyings_and_uniforms() argument
4553 if (prog->_LinkedShaders[i] != NULL) { in link_varyings_and_uniforms()
4554 link_invalidate_variable_locations(prog->_LinkedShaders[i]->ir); in link_varyings_and_uniforms()
4560 if (prog->_LinkedShaders[i] == NULL) in link_varyings_and_uniforms()
4563 match_explicit_outputs_to_inputs(prog->_LinkedShaders[prev], in link_varyings_and_uniforms()
4564 prog->_LinkedShaders[i]); in link_varyings_and_uniforms()
4568 if (!assign_attribute_or_color_locations(mem_ctx, prog, &ctx->Const, in link_varyings_and_uniforms()
4573 if (!assign_attribute_or_color_locations(mem_ctx, prog, &ctx->Const, in link_varyings_and_uniforms()
4588 if (prog->_LinkedShaders[i]) { in link_varyings_and_uniforms()
4590 process_xfb_layout_qualifiers(mem_ctx, prog->_LinkedShaders[i], in link_varyings_and_uniforms()
4598 num_tfeedback_decls = prog->TransformFeedback.NumVarying; in link_varyings_and_uniforms()
4599 varying_names = prog->TransformFeedback.VaryingNames; in link_varyings_and_uniforms()
4605 prog->xfb_program = prog->_LinkedShaders[last]->Program; in link_varyings_and_uniforms()
4607 if (prog->_LinkedShaders[i] == NULL) in link_varyings_and_uniforms()
4610 prog->xfb_program = prog->_LinkedShaders[i]->Program; in link_varyings_and_uniforms()
4623 linker_error(prog, "Transform feedback varyings specified, but " in link_varyings_and_uniforms()
4631 if (!parse_tfeedback_decls(ctx, prog, mem_ctx, num_tfeedback_decls, in link_varyings_and_uniforms()
4643 (num_tfeedback_decls != 0 || prog->SeparateShader)) { in link_varyings_and_uniforms()
4645 reserved_varying_slot(prog->_LinkedShaders[last], ir_var_shader_out); in link_varyings_and_uniforms()
4646 if (!assign_varying_locations(ctx, mem_ctx, prog, in link_varyings_and_uniforms()
4647 prog->_LinkedShaders[last], NULL, in link_varyings_and_uniforms()
4655 remove_unused_shader_inputs_and_outputs(prog->SeparateShader, in link_varyings_and_uniforms()
4656 prog->_LinkedShaders[first], in link_varyings_and_uniforms()
4658 remove_unused_shader_inputs_and_outputs(prog->SeparateShader, in link_varyings_and_uniforms()
4659 prog->_LinkedShaders[last], in link_varyings_and_uniforms()
4664 gl_linked_shader *const sh = prog->_LinkedShaders[last]; in link_varyings_and_uniforms()
4670 if (prog->SeparateShader) { in link_varyings_and_uniforms()
4677 if (!assign_varying_locations(ctx, mem_ctx, prog, in link_varyings_and_uniforms()
4693 if (prog->_LinkedShaders[i] == NULL && i != 0) in link_varyings_and_uniforms()
4696 gl_linked_shader *const sh_i = prog->_LinkedShaders[i]; in link_varyings_and_uniforms()
4697 gl_linked_shader *const sh_next = prog->_LinkedShaders[next]; in link_varyings_and_uniforms()
4708 if (!assign_varying_locations(ctx, mem_ctx, prog, sh_i, sh_next, in link_varyings_and_uniforms()
4717 if (!check_against_output_limit(ctx, prog, sh_i, slots_used)) { in link_varyings_and_uniforms()
4723 if (!check_against_input_limit(ctx, prog, sh_next, slots_used)) in link_varyings_and_uniforms()
4731 if (!store_tfeedback_info(ctx, prog, num_tfeedback_decls, tfeedback_decls, in link_varyings_and_uniforms()
4735 update_array_sizes(prog); in link_varyings_and_uniforms()
4736 link_assign_uniform_locations(prog, ctx, num_explicit_uniform_locs); in link_varyings_and_uniforms()
4737 link_assign_atomic_counter_resources(ctx, prog); in link_varyings_and_uniforms()
4739 link_calculate_subroutine_compat(prog); in link_varyings_and_uniforms()
4740 check_resources(ctx, prog); in link_varyings_and_uniforms()
4741 check_subroutine_resources(prog); in link_varyings_and_uniforms()
4742 check_image_resources(ctx, prog); in link_varyings_and_uniforms()
4743 link_check_atomic_counter_resources(ctx, prog); in link_varyings_and_uniforms()
4745 if (!prog->data->LinkStatus) in link_varyings_and_uniforms()
4749 if (prog->_LinkedShaders[i] == NULL) in link_varyings_and_uniforms()
4756 lower_ubo_reference(prog->_LinkedShaders[i], in link_varyings_and_uniforms()
4760 lower_shared_reference(prog->_LinkedShaders[i], in link_varyings_and_uniforms()
4761 &prog->Comp.SharedSize); in link_varyings_and_uniforms()
4763 lower_vector_derefs(prog->_LinkedShaders[i]); in link_varyings_and_uniforms()
4764 do_vec_index_to_swizzle(prog->_LinkedShaders[i]->ir); in link_varyings_and_uniforms()
4771 link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) in link_shaders() argument
4773 prog->data->LinkStatus = true; /* All error paths will set this to false */ in link_shaders()
4774 prog->data->Validated = false; in link_shaders()
4789 if (prog->NumShaders == 0) { in link_shaders()
4791 linker_error(prog, "no shaders attached to the program\n"); in link_shaders()
4799 prog->ARB_fragment_coord_conventions_enable = false; in link_shaders()
4808 calloc(prog->NumShaders, sizeof(struct gl_shader *)); in link_shaders()
4814 for (unsigned i = 0; i < prog->NumShaders; i++) { in link_shaders()
4815 min_version = MIN2(min_version, prog->Shaders[i]->Version); in link_shaders()
4816 max_version = MAX2(max_version, prog->Shaders[i]->Version); in link_shaders()
4818 if (prog->Shaders[i]->IsES != prog->Shaders[0]->IsES) { in link_shaders()
4819 linker_error(prog, "all shaders must use same shading " in link_shaders()
4824 if (prog->Shaders[i]->info.ARB_fragment_coord_conventions_enable) { in link_shaders()
4825 prog->ARB_fragment_coord_conventions_enable = true; in link_shaders()
4828 gl_shader_stage shader_type = prog->Shaders[i]->Stage; in link_shaders()
4829 shader_list[shader_type][num_shaders[shader_type]] = prog->Shaders[i]; in link_shaders()
4836 if (prog->Shaders[0]->IsES && min_version != max_version) { in link_shaders()
4837 linker_error(prog, "all shaders must use same shading " in link_shaders()
4842 prog->data->Version = max_version; in link_shaders()
4843 prog->IsES = prog->Shaders[0]->IsES; in link_shaders()
4847 if (!prog->SeparateShader) { in link_shaders()
4850 linker_error(prog, "Geometry shader must be linked with " in link_shaders()
4856 linker_error(prog, "Tessellation evaluation shader must be linked " in link_shaders()
4862 linker_error(prog, "Tessellation control shader must be linked with " in link_shaders()
4885 linker_error(prog, "Tessellation control shader must be linked with " in link_shaders()
4893 num_shaders[MESA_SHADER_COMPUTE] != prog->NumShaders) { in link_shaders()
4894 linker_error(prog, "Compute shaders may not be linked with any other " in link_shaders()
4903 link_intrastage_shaders(mem_ctx, ctx, prog, shader_list[stage], in link_shaders()
4906 if (!prog->data->LinkStatus) { in link_shaders()
4914 validate_vertex_shader_executable(prog, sh, ctx); in link_shaders()
4920 validate_tess_eval_shader_executable(prog, sh, ctx); in link_shaders()
4923 validate_geometry_shader_executable(prog, sh, ctx); in link_shaders()
4926 validate_fragment_shader_executable(prog, sh); in link_shaders()
4929 if (!prog->data->LinkStatus) { in link_shaders()
4935 prog->_LinkedShaders[stage] = sh; in link_shaders()
4936 prog->data->linked_stages |= 1 << stage; in link_shaders()
4941 prog->LastClipDistanceArraySize = prog->Geom.ClipDistanceArraySize; in link_shaders()
4942 prog->LastCullDistanceArraySize = prog->Geom.CullDistanceArraySize; in link_shaders()
4944 prog->LastClipDistanceArraySize = prog->TessEval.ClipDistanceArraySize; in link_shaders()
4945 prog->LastCullDistanceArraySize = prog->TessEval.CullDistanceArraySize; in link_shaders()
4947 prog->LastClipDistanceArraySize = prog->Vert.ClipDistanceArraySize; in link_shaders()
4948 prog->LastCullDistanceArraySize = prog->Vert.CullDistanceArraySize; in link_shaders()
4950 prog->LastClipDistanceArraySize = 0; /* Not used */ in link_shaders()
4951 prog->LastCullDistanceArraySize = 0; /* Not used */ in link_shaders()
4958 cross_validate_uniforms(prog); in link_shaders()
4959 if (!prog->data->LinkStatus) in link_shaders()
4969 if (!prog->_LinkedShaders[i]) in link_shaders()
4976 num_explicit_uniform_locs = check_explicit_uniform_locations(ctx, prog); in link_shaders()
4977 link_assign_subroutine_types(prog); in link_shaders()
4979 if (!prog->data->LinkStatus) in link_shaders()
4982 resize_tes_inputs(ctx, prog); in link_shaders()
4989 if (prog->_LinkedShaders[i] == NULL) in link_shaders()
4992 validate_interstage_inout_blocks(prog, prog->_LinkedShaders[prev], in link_shaders()
4993 prog->_LinkedShaders[i]); in link_shaders()
4994 if (!prog->data->LinkStatus) in link_shaders()
4997 cross_validate_outputs_to_inputs(prog, in link_shaders()
4998 prog->_LinkedShaders[prev], in link_shaders()
4999 prog->_LinkedShaders[i]); in link_shaders()
5000 if (!prog->data->LinkStatus) in link_shaders()
5007 validate_interstage_uniform_blocks(prog, prog->_LinkedShaders); in link_shaders()
5008 if (!prog->data->LinkStatus) in link_shaders()
5012 if (prog->_LinkedShaders[i] != NULL) in link_shaders()
5013 lower_named_interface_blocks(mem_ctx, prog->_LinkedShaders[i]); in link_shaders()
5022 if (max_version >= (prog->IsES ? 300 : 130)) { in link_shaders()
5023 struct gl_linked_shader *sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; in link_shaders()
5029 if (prog->SeparateShader) in link_shaders()
5030 disable_varying_optimizations_for_sso(prog); in link_shaders()
5033 if (!interstage_cross_validate_uniform_blocks(prog, false)) in link_shaders()
5037 if (!interstage_cross_validate_uniform_blocks(prog, true)) in link_shaders()
5045 if (prog->_LinkedShaders[i] == NULL) in link_shaders()
5048 detect_recursion_linked(prog, prog->_LinkedShaders[i]->ir); in link_shaders()
5049 if (!prog->data->LinkStatus) in link_shaders()
5053 lower_clip_cull_distance(prog, prog->_LinkedShaders[i]); in link_shaders()
5057 lower_tess_level(prog->_LinkedShaders[i]); in link_shaders()
5062 do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, in link_shaders()
5067 while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, in link_shaders()
5073 lower_const_arrays_to_uniforms(prog->_LinkedShaders[i]->ir, i); in link_shaders()
5074 propagate_invariance(prog->_LinkedShaders[i]->ir); in link_shaders()
5081 if ((!prog->IsES && prog->data->Version < 130) || in link_shaders()
5082 (prog->IsES && prog->data->Version < 300)) { in link_shaders()
5083 if (!validate_sampler_array_indexing(ctx, prog)) in link_shaders()
5088 validate_geometry_shader_emissions(ctx, prog); in link_shaders()
5090 store_fragdepth_layout(prog); in link_shaders()
5093 prog, mem_ctx)) in link_shaders()
5122 if (!prog->SeparateShader && ctx->API == API_OPENGLES2 && in link_shaders()
5124 if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) { in link_shaders()
5125 linker_error(prog, "program lacks a vertex shader\n"); in link_shaders()
5126 } else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) { in link_shaders()
5127 linker_error(prog, "program lacks a fragment shader\n"); in link_shaders()
5134 if (prog->_LinkedShaders[i] == NULL) in link_shaders()
5140 validate_ir_tree(prog->_LinkedShaders[i]->ir); in link_shaders()
5143 reparent_ir(prog->_LinkedShaders[i]->ir, prog->_LinkedShaders[i]->ir); in link_shaders()
5150 delete prog->_LinkedShaders[i]->symbols; in link_shaders()
5151 prog->_LinkedShaders[i]->symbols = NULL; in link_shaders()