Lines Matching refs:shProg
310 struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name); in is_program() local
311 return shProg ? GL_TRUE : GL_FALSE; in is_program()
327 attach_shader(struct gl_context *ctx, struct gl_shader_program *shProg, in attach_shader() argument
330 GLuint n = shProg->NumShaders; in attach_shader()
332 shProg->Shaders = realloc(shProg->Shaders, in attach_shader()
334 if (!shProg->Shaders) { in attach_shader()
340 shProg->Shaders[n] = NULL; /* since realloc() didn't zero the new space */ in attach_shader()
341 _mesa_reference_shader(ctx, &shProg->Shaders[n], sh); in attach_shader()
342 shProg->NumShaders++; in attach_shader()
349 struct gl_shader_program *shProg; in attach_shader_err() local
355 shProg = _mesa_lookup_shader_program_err(ctx, program, caller); in attach_shader_err()
356 if (!shProg) in attach_shader_err()
364 n = shProg->NumShaders; in attach_shader_err()
366 if (shProg->Shaders[i] == sh) { in attach_shader_err()
376 shProg->Shaders[i]->Stage == sh->Stage) { in attach_shader_err()
390 attach_shader(ctx, shProg, sh); in attach_shader_err()
396 struct gl_shader_program *shProg; in attach_shader_no_error() local
399 shProg = _mesa_lookup_shader_program(ctx, program); in attach_shader_no_error()
402 attach_shader(ctx, shProg, sh); in attach_shader_no_error()
439 struct gl_shader_program *shProg; in create_shader_program() local
445 shProg = _mesa_new_shader_program(name); in create_shader_program()
447 _mesa_HashInsertLocked(ctx->Shared->ShaderObjects, name, shProg, true); in create_shader_program()
449 assert(shProg->RefCount == 1); in create_shader_program()
473 struct gl_shader_program *shProg; in delete_shader_program() local
475 shProg = _mesa_lookup_shader_program_err(ctx, name, "glDeleteProgram"); in delete_shader_program()
476 if (!shProg) in delete_shader_program()
479 if (!shProg->DeletePending) { in delete_shader_program()
480 shProg->DeletePending = GL_TRUE; in delete_shader_program()
483 _mesa_reference_shader_program(ctx, &shProg, NULL); in delete_shader_program()
510 struct gl_shader_program *shProg; in detach_shader() local
515 shProg = _mesa_lookup_shader_program_err(ctx, program, "glDetachShader"); in detach_shader()
516 if (!shProg) in detach_shader()
519 shProg = _mesa_lookup_shader_program(ctx, program); in detach_shader()
522 n = shProg->NumShaders; in detach_shader()
525 if (shProg->Shaders[i]->Name == shader) { in detach_shader()
530 _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL); in detach_shader()
540 newList[j] = shProg->Shaders[j]; in detach_shader()
543 newList[j++] = shProg->Shaders[i]; in detach_shader()
547 free(shProg->Shaders); in detach_shader()
548 shProg->Shaders = newList; in detach_shader()
549 shProg->NumShaders = n - 1; in detach_shader()
553 for (j = 0; j < shProg->NumShaders; j++) { in detach_shader()
554 assert(shProg->Shaders[j]->Stage == MESA_SHADER_VERTEX || in detach_shader()
555 shProg->Shaders[j]->Stage == MESA_SHADER_TESS_CTRL || in detach_shader()
556 shProg->Shaders[j]->Stage == MESA_SHADER_TESS_EVAL || in detach_shader()
557 shProg->Shaders[j]->Stage == MESA_SHADER_GEOMETRY || in detach_shader()
558 shProg->Shaders[j]->Stage == MESA_SHADER_FRAGMENT); in detach_shader()
559 assert(shProg->Shaders[j]->RefCount > 0); in detach_shader()
603 struct gl_shader_program *shProg; in get_attached_shaders() local
610 shProg = in get_attached_shaders()
613 if (shProg) { in get_attached_shaders()
615 for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) { in get_attached_shaders()
617 objOut[i] = shProg->Shaders[i]->Name; in get_attached_shaders()
621 handleOut[i] = (GLhandleARB) shProg->Shaders[i]->Name; in get_attached_shaders()
661 check_gs_query(struct gl_context *ctx, const struct gl_shader_program *shProg) in check_gs_query() argument
663 if (shProg->data->LinkStatus && in check_gs_query()
664 shProg->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) { in check_gs_query()
686 check_tcs_query(struct gl_context *ctx, const struct gl_shader_program *shProg) in check_tcs_query() argument
688 if (shProg->data->LinkStatus && in check_tcs_query()
689 shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL] != NULL) { in check_tcs_query()
712 check_tes_query(struct gl_context *ctx, const struct gl_shader_program *shProg) in check_tes_query() argument
714 if (shProg->data->LinkStatus && in check_tes_query()
715 shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL] != NULL) { in check_tes_query()
761 struct gl_shader_program *shProg in get_programiv() local
785 if (!shProg) { in get_programiv()
791 *params = shProg->DeletePending; in get_programiv()
794 *params = get_shader_program_completion_status(ctx, shProg); in get_programiv()
797 *params = shProg->data->LinkStatus ? GL_TRUE : GL_FALSE; in get_programiv()
800 *params = shProg->data->Validated; in get_programiv()
803 *params = (shProg->data->InfoLog && shProg->data->InfoLog[0] != '\0') ? in get_programiv()
804 strlen(shProg->data->InfoLog) + 1 : 0; in get_programiv()
807 *params = shProg->NumShaders; in get_programiv()
810 *params = _mesa_count_active_attribs(shProg); in get_programiv()
813 *params = _mesa_longest_attribute_name_length(shProg); in get_programiv()
816 _mesa_get_program_interfaceiv(shProg, GL_UNIFORM, GL_ACTIVE_RESOURCES, in get_programiv()
821 _mesa_get_program_interfaceiv(shProg, GL_UNIFORM, GL_MAX_NAME_LENGTH, in get_programiv()
833 if (shProg->last_vert_prog && in get_programiv()
834 shProg->last_vert_prog->sh.LinkedTransformFeedback->NumVarying > 0) in get_programiv()
836 shProg->last_vert_prog->sh.LinkedTransformFeedback->NumVarying; in get_programiv()
838 *params = shProg->TransformFeedback.NumVarying; in get_programiv()
844 _mesa_get_program_interfaceiv(shProg, GL_TRANSFORM_FEEDBACK_VARYING, in get_programiv()
851 *params = shProg->TransformFeedback.BufferMode; in get_programiv()
856 if (check_gs_query(ctx, shProg)) { in get_programiv()
857 *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]-> in get_programiv()
866 if (check_gs_query(ctx, shProg)) { in get_programiv()
867 *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]-> in get_programiv()
874 if (check_gs_query(ctx, shProg)) { in get_programiv()
875 *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]-> in get_programiv()
882 if (check_gs_query(ctx, shProg)) { in get_programiv()
883 *params = shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]-> in get_programiv()
891 _mesa_get_program_interfaceiv(shProg, GL_UNIFORM_BLOCK, in get_programiv()
899 *params = shProg->data->NumUniformBlocks; in get_programiv()
911 *params = shProg->BinaryRetrievableHint; in get_programiv()
914 if (ctx->Const.NumProgramBinaryFormats == 0 || !shProg->data->LinkStatus) { in get_programiv()
917 _mesa_get_program_binary_length(ctx, shProg, params); in get_programiv()
924 *params = shProg->data->NumAtomicBuffers; in get_programiv()
930 if (!shProg->data->LinkStatus) { in get_programiv()
935 if (shProg->_LinkedShaders[MESA_SHADER_COMPUTE] == NULL) { in get_programiv()
941 params[i] = shProg->_LinkedShaders[MESA_SHADER_COMPUTE]-> in get_programiv()
947 *params = (shProg->data->LinkStatus == LINKING_FAILURE) ? 0 : shProg->SeparateShader; in get_programiv()
954 if (check_tcs_query(ctx, shProg)) { in get_programiv()
955 *params = shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]-> in get_programiv()
962 if (check_tes_query(ctx, shProg)) { in get_programiv()
964 shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]; in get_programiv()
984 if (check_tes_query(ctx, shProg)) { in get_programiv()
986 shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]; in get_programiv()
1006 if (check_tes_query(ctx, shProg)) { in get_programiv()
1007 *params = shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]-> in get_programiv()
1014 if (check_tes_query(ctx, shProg)) { in get_programiv()
1015 *params = shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]-> in get_programiv()
1076 struct gl_shader_program *shProg; in get_program_info_log() local
1089 shProg = _mesa_lookup_shader_program_err(ctx, program, in get_program_info_log()
1091 if (!shProg) { in get_program_info_log()
1095 _mesa_copy_string(infoLog, bufSize, length, shProg->data->InfoLog); in get_program_info_log()
1275 struct gl_shader_program *shProg; member
1287 obj->CurrentProgram[stage]->Id == params->shProg->Name) { in update_programs_in_pipeline()
1288 struct gl_program *prog = params->shProg->_LinkedShaders[stage]->Program; in update_programs_in_pipeline()
1289 _mesa_use_program(params->ctx, stage, params->shProg, prog, obj); in update_programs_in_pipeline()
1299 link_program(struct gl_context *ctx, struct gl_shader_program *shProg, in link_program() argument
1302 if (!shProg) in link_program()
1311 if (_mesa_transform_feedback_is_using_program(ctx, shProg)) { in link_program()
1322 ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) { in link_program()
1330 _mesa_glsl_link_shader(ctx, shProg); in link_program()
1342 if (shProg->data->LinkStatus) { in link_program()
1347 if (shProg->_LinkedShaders[stage]) in link_program()
1348 prog = shProg->_LinkedShaders[stage]->Program; in link_program()
1350 _mesa_use_program(ctx, stage, shProg, prog, ctx->_Shader); in link_program()
1356 .shProg = shProg in link_program()
1366 if (shProg->Name != 0 && shProg->Name != ~0 && capture_path != NULL) { in link_program()
1373 capture_path, shProg->Name, i); in link_program()
1376 capture_path, shProg->Name); in link_program()
1390 shProg->IsES ? " ES" : "", in link_program()
1391 shProg->data->Version / 100, shProg->data->Version % 100); in link_program()
1392 if (shProg->SeparateShader) in link_program()
1396 for (unsigned i = 0; i < shProg->NumShaders; i++) { in link_program()
1398 _mesa_shader_stage_to_string(shProg->Shaders[i]->Stage), in link_program()
1399 shProg->Shaders[i]->Source); in link_program()
1410 if (shProg->data->LinkStatus == LINKING_FAILURE && in link_program()
1413 shProg->Name, shProg->data->InfoLog); in link_program()
1419 shProg->BinaryRetrievableHint = shProg->BinaryRetrievableHintPending; in link_program()
1426 shProg->NumShaders, shProg->Name, in link_program()
1427 shProg->data->LinkStatus ? "Success" : "Failed"); in link_program()
1429 for (i = 0; i < shProg->NumShaders; i++) { in link_program()
1431 shProg->Shaders[i]->Name, in link_program()
1432 shProg->Shaders[i]->Stage); in link_program()
1439 link_program_error(struct gl_context *ctx, struct gl_shader_program *shProg) in link_program_error() argument
1441 link_program(ctx, shProg, false); in link_program_error()
1446 link_program_no_error(struct gl_context *ctx, struct gl_shader_program *shProg) in link_program_no_error() argument
1448 link_program(ctx, shProg, true); in link_program_no_error()
1453 _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg) in _mesa_link_program() argument
1455 link_program_error(ctx, shProg); in _mesa_link_program()
1463 print_shader_info(const struct gl_shader_program *shProg) in print_shader_info() argument
1467 printf("Mesa: glUseProgram(%u)\n", shProg->Name); in print_shader_info()
1468 for (i = 0; i < shProg->NumShaders; i++) { in print_shader_info()
1470 _mesa_shader_stage_to_string(shProg->Shaders[i]->Stage), in print_shader_info()
1471 shProg->Shaders[i]->Name); in print_shader_info()
1473 if (shProg->_LinkedShaders[MESA_SHADER_VERTEX]) in print_shader_info()
1475 shProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program->Id); in print_shader_info()
1476 if (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) in print_shader_info()
1478 shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program->Id); in print_shader_info()
1479 if (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]) in print_shader_info()
1481 shProg->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->Id); in print_shader_info()
1482 if (shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]) in print_shader_info()
1484 shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]->Program->Id); in print_shader_info()
1485 if (shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]) in print_shader_info()
1487 shProg->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program->Id); in print_shader_info()
1495 _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg, in _mesa_active_program() argument
1498 if ((shProg != NULL) && !shProg->data->LinkStatus) { in _mesa_active_program()
1500 "%s(program %u not linked)", caller, shProg->Name); in _mesa_active_program()
1504 if (ctx->Shader.ActiveProgram != shProg) { in _mesa_active_program()
1505 _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, shProg); in _mesa_active_program()
1516 struct gl_shader_program *shProg) in _mesa_use_shader_program() argument
1520 if (shProg && shProg->_LinkedShaders[i]) in _mesa_use_shader_program()
1521 new_prog = shProg->_LinkedShaders[i]->Program; in _mesa_use_shader_program()
1522 _mesa_use_program(ctx, i, shProg, new_prog, &ctx->Shader); in _mesa_use_shader_program()
1524 _mesa_active_program(ctx, shProg, "glUseProgram"); in _mesa_use_shader_program()
1534 validate_shader_program(const struct gl_shader_program *shProg, in validate_shader_program() argument
1537 if (!shProg->data->LinkStatus) { in validate_shader_program()
1560 if (!_mesa_sampler_uniforms_are_valid(shProg, errMsg, 100)) in validate_shader_program()
1573 struct gl_shader_program *shProg; in validate_program() local
1576 shProg = _mesa_lookup_shader_program_err(ctx, program, "glValidateProgram"); in validate_program()
1577 if (!shProg) { in validate_program()
1581 shProg->data->Validated = validate_shader_program(shProg, errMsg); in validate_program()
1582 if (!shProg->data->Validated) { in validate_program()
1584 if (shProg->data->InfoLog) { in validate_program()
1585 ralloc_free(shProg->data->InfoLog); in validate_program()
1587 shProg->data->InfoLog = ralloc_strdup(shProg->data, errMsg); in validate_program()
1911 struct gl_shader_program *shProg = in _mesa_LinkProgram_no_error() local
1913 link_program_no_error(ctx, shProg); in _mesa_LinkProgram_no_error()
1925 struct gl_shader_program *shProg = in _mesa_LinkProgram() local
1927 link_program_error(ctx, shProg); in _mesa_LinkProgram()
2190 struct gl_shader_program *shProg = NULL; in use_program() local
2197 shProg = _mesa_lookup_shader_program(ctx, program); in use_program()
2207 shProg = in use_program()
2209 if (!shProg) in use_program()
2212 if (!shProg->data->LinkStatus) { in use_program()
2220 print_shader_info(shProg); in use_program()
2234 if (shProg) { in use_program()
2238 _mesa_use_shader_program(ctx, shProg); in use_program()
2241 _mesa_use_shader_program(ctx, shProg); in use_program()
2411 struct gl_shader_program *shProg; in _mesa_GetProgramBinary() local
2420 shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetProgramBinary"); in _mesa_GetProgramBinary()
2421 if (!shProg) in _mesa_GetProgramBinary()
2441 if (!shProg->data->LinkStatus) { in _mesa_GetProgramBinary()
2444 shProg->Name); in _mesa_GetProgramBinary()
2454 _mesa_get_program_binary(ctx, shProg, bufSize, length, binaryFormat, in _mesa_GetProgramBinary()
2464 struct gl_shader_program *shProg; in _mesa_ProgramBinary() local
2467 shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramBinary"); in _mesa_ProgramBinary()
2468 if (!shProg) in _mesa_ProgramBinary()
2471 _mesa_clear_shader_program_data(ctx, shProg); in _mesa_ProgramBinary()
2472 shProg->data = _mesa_create_shader_program_data(); in _mesa_ProgramBinary()
2498 shProg->data->LinkStatus = LINKING_FAILURE; in _mesa_ProgramBinary()
2501 _mesa_program_binary(ctx, shProg, binaryFormat, binary, length); in _mesa_ProgramBinary()
2507 program_parameteri(struct gl_context *ctx, struct gl_shader_program *shProg, in program_parameteri() argument
2549 shProg->BinaryRetrievableHintPending = value; in program_parameteri()
2559 shProg->SeparateShader = value; in program_parameteri()
2584 struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); in _mesa_ProgramParameteri_no_error() local
2585 program_parameteri(ctx, shProg, pname, value, true); in _mesa_ProgramParameteri_no_error()
2592 struct gl_shader_program *shProg; in _mesa_ProgramParameteri() local
2595 shProg = _mesa_lookup_shader_program_err(ctx, program, in _mesa_ProgramParameteri()
2597 if (!shProg) in _mesa_ProgramParameteri()
2600 program_parameteri(ctx, shProg, pname, value, false); in _mesa_ProgramParameteri()
2606 struct gl_shader_program *shProg, struct gl_program *prog, in _mesa_use_program() argument
2624 shProg); in _mesa_use_program()
2698 struct gl_shader_program *shProg; in _mesa_CreateShaderProgramv() local
2701 shProg = _mesa_lookup_shader_program(ctx, program); in _mesa_CreateShaderProgramv()
2703 shProg->SeparateShader = GL_TRUE; in _mesa_CreateShaderProgramv()
2708 _mesa_link_program(ctx, shProg); in _mesa_CreateShaderProgramv()
2715 shProg->data->LinkStatus = LINKING_FAILURE; in _mesa_CreateShaderProgramv()
2720 ralloc_strcat(&shProg->data->InfoLog, sh->InfoLog); in _mesa_CreateShaderProgramv()
2814 struct gl_shader_program *shProg; in _mesa_GetSubroutineUniformLocation() local
2823 shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); in _mesa_GetSubroutineUniformLocation()
2824 if (!shProg) in _mesa_GetSubroutineUniformLocation()
2828 if (!shProg->_LinkedShaders[stage]) { in _mesa_GetSubroutineUniformLocation()
2834 return _mesa_program_resource_location(shProg, resource_type, name); in _mesa_GetSubroutineUniformLocation()
2843 struct gl_shader_program *shProg; in _mesa_GetSubroutineIndex() local
2853 shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); in _mesa_GetSubroutineIndex()
2854 if (!shProg) in _mesa_GetSubroutineIndex()
2858 if (!shProg->_LinkedShaders[stage]) { in _mesa_GetSubroutineIndex()
2864 res = _mesa_program_resource_find_name(shProg, resource_type, name, NULL); in _mesa_GetSubroutineIndex()
2869 return _mesa_program_resource_index(shProg, res); in _mesa_GetSubroutineIndex()
2879 struct gl_shader_program *shProg; in _mesa_GetActiveSubroutineUniformiv() local
2892 shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); in _mesa_GetActiveSubroutineUniformiv()
2893 if (!shProg) in _mesa_GetActiveSubroutineUniformiv()
2899 sh = shProg->_LinkedShaders[stage]; in _mesa_GetActiveSubroutineUniformiv()
2905 struct gl_program *p = shProg->_LinkedShaders[stage]->Program; in _mesa_GetActiveSubroutineUniformiv()
2913 res = _mesa_program_resource_find_index(shProg, resource_type, index); in _mesa_GetActiveSubroutineUniformiv()
2921 res = _mesa_program_resource_find_index(shProg, resource_type, index); in _mesa_GetActiveSubroutineUniformiv()
2938 res = _mesa_program_resource_find_index(shProg, resource_type, index); in _mesa_GetActiveSubroutineUniformiv()
2945 res = _mesa_program_resource_find_index(shProg, resource_type, index); in _mesa_GetActiveSubroutineUniformiv()
2965 struct gl_shader_program *shProg; in _mesa_GetActiveSubroutineUniformName() local
2974 shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); in _mesa_GetActiveSubroutineUniformName()
2975 if (!shProg) in _mesa_GetActiveSubroutineUniformName()
2979 if (!shProg->_LinkedShaders[stage]) { in _mesa_GetActiveSubroutineUniformName()
2986 _mesa_get_program_resource_name(shProg, resource_type, in _mesa_GetActiveSubroutineUniformName()
2999 struct gl_shader_program *shProg; in _mesa_GetActiveSubroutineName() local
3008 shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); in _mesa_GetActiveSubroutineName()
3009 if (!shProg) in _mesa_GetActiveSubroutineName()
3013 if (!shProg->_LinkedShaders[stage]) { in _mesa_GetActiveSubroutineName()
3018 _mesa_get_program_resource_name(shProg, resource_type, in _mesa_GetActiveSubroutineName()
3133 struct gl_shader_program *shProg; in _mesa_GetProgramStageiv() local
3142 shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); in _mesa_GetProgramStageiv()
3143 if (!shProg) in _mesa_GetProgramStageiv()
3147 sh = shProg->_LinkedShaders[stage]; in _mesa_GetProgramStageiv()
3190 res = _mesa_program_resource_find_index(shProg, resource_type, i); in _mesa_GetProgramStageiv()
3209 res = _mesa_program_resource_find_index(shProg, resource_type, i); in _mesa_GetProgramStageiv()