Lines Matching refs:prog

176 linker_error(gl_shader_program *prog, const char *fmt, ...)  in linker_error()  argument
180 ralloc_strcat(&prog->InfoLog, "error: "); in linker_error()
182 ralloc_vasprintf_append(&prog->InfoLog, fmt, ap); in linker_error()
185 prog->LinkStatus = false; in linker_error()
190 linker_warning(gl_shader_program *prog, const char *fmt, ...) in linker_warning() argument
194 ralloc_strcat(&prog->InfoLog, "error: "); in linker_warning()
196 ralloc_vasprintf_append(&prog->InfoLog, fmt, ap); in linker_warning()
264 validate_vertex_shader_executable(struct gl_shader_program *prog, in validate_vertex_shader_executable() argument
293 if (prog->Version < 140) { in validate_vertex_shader_executable()
297 linker_error(prog, "vertex shader does not write to `gl_Position'\n"); in validate_vertex_shader_executable()
302 prog->Vert.ClipDistanceArraySize = 0; in validate_vertex_shader_executable()
304 if (prog->Version >= 130) { in validate_vertex_shader_executable()
317 linker_error(prog, "vertex shader writes to both `gl_ClipVertex' " in validate_vertex_shader_executable()
321 prog->Vert.UsesClipDistance = clip_distance.variable_found(); in validate_vertex_shader_executable()
325 prog->Vert.ClipDistanceArraySize = clip_distance_var->type->length; in validate_vertex_shader_executable()
338 validate_fragment_shader_executable(struct gl_shader_program *prog, in validate_fragment_shader_executable() argument
351 linker_error(prog, "fragment shader writes to both " in validate_fragment_shader_executable()
388 cross_validate_globals(struct gl_shader_program *prog, in cross_validate_globals() argument
437 linker_error(prog, "%s `%s' declared as type " in cross_validate_globals()
449 linker_error(prog, "explicit locations for %s " in cross_validate_globals()
476 linker_error(prog, in cross_validate_globals()
483 linker_error(prog, in cross_validate_globals()
510 linker_error(prog, "initializers for %s " in cross_validate_globals()
538 linker_error(prog, in cross_validate_globals()
554 linker_error(prog, "declarations for %s `%s' have " in cross_validate_globals()
560 linker_error(prog, "declarations for %s `%s' have " in cross_validate_globals()
578 cross_validate_uniforms(struct gl_shader_program *prog) in cross_validate_uniforms() argument
580 return cross_validate_globals(prog, prog->_LinkedShaders, in cross_validate_uniforms()
589 interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog) in interstage_cross_validate_uniform_blocks() argument
593 if (prog->_LinkedShaders[i]) in interstage_cross_validate_uniform_blocks()
594 max_num_uniform_blocks += prog->_LinkedShaders[i]->NumUniformBlocks; in interstage_cross_validate_uniform_blocks()
598 struct gl_shader *sh = prog->_LinkedShaders[i]; in interstage_cross_validate_uniform_blocks()
600 prog->UniformBlockStageIndex[i] = ralloc_array(prog, int, in interstage_cross_validate_uniform_blocks()
603 prog->UniformBlockStageIndex[i][j] = -1; in interstage_cross_validate_uniform_blocks()
609 int index = link_cross_validate_uniform_block(prog, in interstage_cross_validate_uniform_blocks()
610 &prog->UniformBlocks, in interstage_cross_validate_uniform_blocks()
611 &prog->NumUniformBlocks, in interstage_cross_validate_uniform_blocks()
615 linker_error(prog, "uniform block `%s' has mismatching definitions", in interstage_cross_validate_uniform_blocks()
620 prog->UniformBlockStageIndex[i][index] = j; in interstage_cross_validate_uniform_blocks()
631 cross_validate_outputs_to_inputs(struct gl_shader_program *prog, in cross_validate_outputs_to_inputs() argument
692 linker_error(prog, in cross_validate_outputs_to_inputs()
705 linker_error(prog, in cross_validate_outputs_to_inputs()
717 linker_error(prog, in cross_validate_outputs_to_inputs()
729 linker_error(prog, in cross_validate_outputs_to_inputs()
966 struct gl_shader_program *prog, in link_intrastage_shaders() argument
975 if (!cross_validate_globals(prog, shader_list, num_shaders, false)) in link_intrastage_shaders()
990 linker_error(prog, "uniform block `%s' has mismatching definitions", in link_intrastage_shaders()
1029 linker_error(prog, "function `%s' is multiply defined", in link_intrastage_shaders()
1054 linker_error(prog, "%s shader lacks `main'\n", in link_intrastage_shaders()
1111 if (!link_function_calls(prog, linked, linking_shaders, in link_intrastage_shaders()
1156 update_array_sizes(struct gl_shader_program *prog) in update_array_sizes() argument
1159 if (prog->_LinkedShaders[i] == NULL) in update_array_sizes()
1162 foreach_list(node, prog->_LinkedShaders[i]->ir) { in update_array_sizes()
1180 if (prog->_LinkedShaders[j] == NULL) in update_array_sizes()
1183 foreach_list(node2, prog->_LinkedShaders[j]->ir) { in update_array_sizes()
1267 assign_attribute_or_color_locations(gl_shader_program *prog, in assign_attribute_or_color_locations() argument
1279 gl_shader *const sh = prog->_LinkedShaders[target_index]; in assign_attribute_or_color_locations()
1336 linker_error(prog, in assign_attribute_or_color_locations()
1346 if (prog->AttributeBindings->get(binding, var->name)) { in assign_attribute_or_color_locations()
1354 if (prog->FragDataBindings->get(binding, var->name)) { in assign_attribute_or_color_locations()
1358 if (prog->FragDataIndexBindings->get(index, var->name)) { in assign_attribute_or_color_locations()
1414 linker_error(prog, in assign_attribute_or_color_locations()
1464 linker_error(prog, in assign_attribute_or_color_locations()
1509 bool init(struct gl_context *ctx, struct gl_shader_program *prog,
1512 bool assign_location(struct gl_context *ctx, struct gl_shader_program *prog,
1514 bool accumulate_num_outputs(struct gl_shader_program *prog, unsigned *count);
1515 bool store(struct gl_context *ctx, struct gl_shader_program *prog,
1634 tfeedback_decl::init(struct gl_context *ctx, struct gl_shader_program *prog, in init() argument
1674 linker_error(prog, "Cannot parse transform feedback varying %s", input); in init()
1724 struct gl_shader_program *prog, in assign_location() argument
1734 prog->Vert.ClipDistanceArraySize : output_var->type->array_size(); in assign_location()
1739 linker_error(prog, "Transform feedback varying %s has index " in assign_location()
1766 linker_error(prog, "Transform feedback varying %s requested, " in assign_location()
1786 if (prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS && in assign_location()
1789 linker_error(prog, "Transform feedback varying %s exceeds " in assign_location()
1800 tfeedback_decl::accumulate_num_outputs(struct gl_shader_program *prog, in accumulate_num_outputs() argument
1815 linker_error(prog, "Transform feedback varying %s undeclared.", in accumulate_num_outputs()
1837 tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog, in store() argument
1856 if (prog->TransformFeedback.BufferMode == GL_INTERLEAVED_ATTRIBS && in store()
1859 linker_error(prog, "The MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS " in store()
1894 info->Varyings[info->NumVarying].Name = ralloc_strdup(prog, this->orig_name); in store()
1911 parse_tfeedback_decls(struct gl_context *ctx, struct gl_shader_program *prog, in parse_tfeedback_decls() argument
1916 if (!decls[i].init(ctx, prog, mem_ctx, varying_names[i])) in parse_tfeedback_decls()
1937 linker_error(prog, "Transform feedback varying %s specified " in parse_tfeedback_decls()
2050 struct gl_shader_program *prog, in assign_varying_locations() argument
2101 if (!tfeedback_decls[i].assign_location(ctx, prog, output_var)) in assign_varying_locations()
2117 if (prog->Version <= 120) { in assign_varying_locations()
2131 linker_error(prog, "fragment shader varying %s not written " in assign_varying_locations()
2148 if (ctx->API == API_OPENGLES2 || prog->Version == 100) { in assign_varying_locations()
2151 linker_warning(prog, "shader uses too many varying vectors " in assign_varying_locations()
2157 linker_error(prog, "shader uses too many varying vectors " in assign_varying_locations()
2167 linker_warning(prog, "shader uses too many varying components " in assign_varying_locations()
2173 linker_error(prog, "shader uses too many varying components " in assign_varying_locations()
2193 store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog, in store_tfeedback_info() argument
2198 prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS; in store_tfeedback_info()
2200 ralloc_free(prog->LinkedTransformFeedback.Varyings); in store_tfeedback_info()
2201 ralloc_free(prog->LinkedTransformFeedback.Outputs); in store_tfeedback_info()
2203 memset(&prog->LinkedTransformFeedback, 0, in store_tfeedback_info()
2204 sizeof(prog->LinkedTransformFeedback)); in store_tfeedback_info()
2206 prog->LinkedTransformFeedback.Varyings = in store_tfeedback_info()
2207 rzalloc_array(prog, in store_tfeedback_info()
2213 if (!tfeedback_decls[i].accumulate_num_outputs(prog, &num_outputs)) in store_tfeedback_info()
2216 prog->LinkedTransformFeedback.Outputs = in store_tfeedback_info()
2217 rzalloc_array(prog, in store_tfeedback_info()
2226 if (!tfeedback_decls[i].store(ctx, prog, &prog->LinkedTransformFeedback, in store_tfeedback_info()
2241 if (!tfeedback_decls[i].store(ctx, prog, in store_tfeedback_info()
2242 &prog->LinkedTransformFeedback, in store_tfeedback_info()
2249 assert(prog->LinkedTransformFeedback.NumOutputs == num_outputs); in store_tfeedback_info()
2251 prog->LinkedTransformFeedback.NumBuffers = num_buffers; in store_tfeedback_info()
2259 store_fragdepth_layout(struct gl_shader_program *prog) in store_fragdepth_layout() argument
2261 if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) { in store_fragdepth_layout()
2265 struct exec_list *ir = prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir; in store_fragdepth_layout()
2284 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_NONE; in store_fragdepth_layout()
2287 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_ANY; in store_fragdepth_layout()
2290 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_GREATER; in store_fragdepth_layout()
2293 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_LESS; in store_fragdepth_layout()
2296 prog->FragDepthLayout = FRAG_DEPTH_LAYOUT_UNCHANGED; in store_fragdepth_layout()
2310 check_resources(struct gl_context *ctx, struct gl_shader_program *prog) in check_resources() argument
2335 struct gl_shader *sh = prog->_LinkedShaders[i]; in check_resources()
2341 linker_error(prog, "Too many %s shader texture samplers", in check_resources()
2347 linker_warning(prog, "Too many %s shader uniform components, " in check_resources()
2352 linker_error(prog, "Too many %s shader uniform components", in check_resources()
2361 for (unsigned i = 0; i < prog->NumUniformBlocks; i++) { in check_resources()
2363 if (prog->UniformBlockStageIndex[j][i] != -1) { in check_resources()
2370 linker_error(prog, "Too many combined uniform blocks (%d/%d)", in check_resources()
2371 prog->NumUniformBlocks, in check_resources()
2376 linker_error(prog, "Too many %s uniform blocks (%d/%d)", in check_resources()
2386 return prog->LinkStatus; in check_resources()
2390 link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) in link_shaders() argument
2393 unsigned num_tfeedback_decls = prog->TransformFeedback.NumVarying; in link_shaders()
2397 prog->LinkStatus = false; in link_shaders()
2398 prog->Validated = false; in link_shaders()
2399 prog->_Used = false; in link_shaders()
2401 ralloc_free(prog->InfoLog); in link_shaders()
2402 prog->InfoLog = ralloc_strdup(NULL, ""); in link_shaders()
2404 ralloc_free(prog->UniformBlocks); in link_shaders()
2405 prog->UniformBlocks = NULL; in link_shaders()
2406 prog->NumUniformBlocks = 0; in link_shaders()
2408 ralloc_free(prog->UniformBlockStageIndex[i]); in link_shaders()
2409 prog->UniformBlockStageIndex[i] = NULL; in link_shaders()
2420 calloc(2 * prog->NumShaders, sizeof(struct gl_shader *)); in link_shaders()
2421 frag_shader_list = &vert_shader_list[prog->NumShaders]; in link_shaders()
2425 for (unsigned i = 0; i < prog->NumShaders; i++) { in link_shaders()
2426 min_version = MIN2(min_version, prog->Shaders[i]->Version); in link_shaders()
2427 max_version = MAX2(max_version, prog->Shaders[i]->Version); in link_shaders()
2429 switch (prog->Shaders[i]->Type) { in link_shaders()
2431 vert_shader_list[num_vert_shaders] = prog->Shaders[i]; in link_shaders()
2435 frag_shader_list[num_frag_shaders] = prog->Shaders[i]; in link_shaders()
2440 assert(prog->Shaders[i]->Type != GL_GEOMETRY_SHADER); in link_shaders()
2453 linker_error(prog, "all shaders must use same shading " in link_shaders()
2458 prog->Version = max_version; in link_shaders()
2461 if (prog->_LinkedShaders[i] != NULL) in link_shaders()
2462 ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]); in link_shaders()
2464 prog->_LinkedShaders[i] = NULL; in link_shaders()
2471 link_intrastage_shaders(mem_ctx, ctx, prog, vert_shader_list, in link_shaders()
2477 if (!validate_vertex_shader_executable(prog, sh)) in link_shaders()
2480 _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_VERTEX], in link_shaders()
2486 link_intrastage_shaders(mem_ctx, ctx, prog, frag_shader_list, in link_shaders()
2492 if (!validate_fragment_shader_executable(prog, sh)) in link_shaders()
2495 _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_FRAGMENT], in link_shaders()
2503 if (cross_validate_uniforms(prog)) { in link_shaders()
2507 if (prog->_LinkedShaders[prev] != NULL) in link_shaders()
2515 if (prog->_LinkedShaders[i] == NULL) in link_shaders()
2518 if (!cross_validate_outputs_to_inputs(prog, in link_shaders()
2519 prog->_LinkedShaders[prev], in link_shaders()
2520 prog->_LinkedShaders[i])) in link_shaders()
2526 prog->LinkStatus = true; in link_shaders()
2534 struct gl_shader *sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; in link_shaders()
2540 if (!interstage_cross_validate_uniform_blocks(prog)) in link_shaders()
2548 if (prog->_LinkedShaders[i] == NULL) in link_shaders()
2551 detect_recursion_linked(prog, prog->_LinkedShaders[i]->ir); in link_shaders()
2552 if (!prog->LinkStatus) in link_shaders()
2556 lower_clip_distance(prog->_LinkedShaders[i]->ir); in link_shaders()
2560 while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll)) in link_shaders()
2569 if (!assign_attribute_or_color_locations(prog, MESA_SHADER_VERTEX, 16)) { in link_shaders()
2573 …if (!assign_attribute_or_color_locations(prog, MESA_SHADER_FRAGMENT, MAX2(ctx->Const.MaxDrawBuffer… in link_shaders()
2579 if (prog->_LinkedShaders[prev] != NULL) in link_shaders()
2592 linker_error(prog, "Transform feedback varyings specified, but " in link_shaders()
2598 prog->TransformFeedback.NumVarying); in link_shaders()
2599 if (!parse_tfeedback_decls(ctx, prog, mem_ctx, num_tfeedback_decls, in link_shaders()
2600 prog->TransformFeedback.VaryingNames, in link_shaders()
2606 if (prog->_LinkedShaders[i] == NULL) in link_shaders()
2610 ctx, prog, prog->_LinkedShaders[prev], prog->_LinkedShaders[i], in link_shaders()
2623 ctx, prog, prog->_LinkedShaders[prev], NULL, num_tfeedback_decls, in link_shaders()
2628 if (!store_tfeedback_info(ctx, prog, num_tfeedback_decls, tfeedback_decls)) in link_shaders()
2631 if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) { in link_shaders()
2632 demote_shader_inputs_and_outputs(prog->_LinkedShaders[MESA_SHADER_VERTEX], in link_shaders()
2638 while (do_dead_code(prog->_LinkedShaders[MESA_SHADER_VERTEX]->ir, false)) in link_shaders()
2642 if (prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) { in link_shaders()
2643 gl_shader *const sh = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]; in link_shaders()
2652 while (do_dead_code(prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->ir, false)) in link_shaders()
2656 if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) { in link_shaders()
2657 gl_shader *const sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; in link_shaders()
2665 while (do_dead_code(prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir, false)) in link_shaders()
2669 update_array_sizes(prog); in link_shaders()
2670 link_assign_uniform_locations(prog); in link_shaders()
2671 store_fragdepth_layout(prog); in link_shaders()
2673 if (!check_resources(ctx, prog)) in link_shaders()
2680 if (!prog->InternalSeparateShader && in link_shaders()
2681 (ctx->API == API_OPENGLES2 || prog->Version == 100)) { in link_shaders()
2682 if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) { in link_shaders()
2683 linker_error(prog, "program lacks a vertex shader\n"); in link_shaders()
2684 } else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) { in link_shaders()
2685 linker_error(prog, "program lacks a fragment shader\n"); in link_shaders()
2695 if (prog->_LinkedShaders[i] == NULL) in link_shaders()
2699 reparent_ir(prog->_LinkedShaders[i]->ir, prog->_LinkedShaders[i]->ir); in link_shaders()
2706 delete prog->_LinkedShaders[i]->symbols; in link_shaders()
2707 prog->_LinkedShaders[i]->symbols = NULL; in link_shaders()