ralloc_vasprintf_append(&prog->data->InfoLog, fmt, ap);
va_end(ap);
- prog->data->LinkStatus = false;
+ prog->data->LinkStatus = linking_failure;
}
_mesa_shader_stage_to_program(shader_list[0]->Stage),
prog->Name, false);
if (!gl_prog) {
- prog->data->LinkStatus = false;
+ prog->data->LinkStatus = linking_failure;
_mesa_delete_linked_shader(ctx, linked);
return NULL;
}
void
link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
{
- prog->data->LinkStatus = true; /* All error paths will set this to false */
+ prog->data->LinkStatus = linking_success; /* All error paths will set this to false */
prog->data->Validated = false;
/* Section 7.3 (Program Objects) of the OpenGL 4.5 Core Profile spec says:
} else {
const gl_shader_stage stage = whole_program->Shaders[0]->Stage;
- whole_program->data->LinkStatus = GL_TRUE;
+ whole_program->data->LinkStatus = linking_success;
whole_program->_LinkedShaders[stage] =
link_intrastage_shaders(whole_program /* mem_ctx */,
ctx,
memset(&prog_data, 0, sizeof(prog_data));
if (cp->program.info.cs.shared_size > 64 * 1024) {
- cp->program.sh.data->LinkStatus = false;
+ cp->program.sh.data->LinkStatus = linking_failure;
const char *error_str =
"Compute shader used more than 64KB of shared variables";
ralloc_strcat(&cp->program.sh.data->InfoLog, error_str);
&prog_data, cp->program.nir, st_index,
&program_size, &error_str);
if (program == NULL) {
- cp->program.sh.data->LinkStatus = false;
+ cp->program.sh.data->LinkStatus = linking_failure;
ralloc_strcat(&cp->program.sh.data->InfoLog, error_str);
_mesa_problem(NULL, "Failed to compile compute shader: %s\n", error_str);
&program_size, &error_str);
if (program == NULL) {
if (tep) {
- tep->program.sh.data->LinkStatus = false;
+ tep->program.sh.data->LinkStatus = linking_failure;
ralloc_strcat(&tep->program.sh.data->InfoLog, error_str);
}
brw_compile_tes(compiler, brw, mem_ctx, key, &input_vue_map, &prog_data,
nir, &tep->program, st_index, &program_size, &error_str);
if (program == NULL) {
- tep->program.sh.data->LinkStatus = false;
+ tep->program.sh.data->LinkStatus = linking_failure;
ralloc_strcat(&tep->program.sh.data->InfoLog, error_str);
_mesa_problem(NULL, "Failed to compile tessellation evaluation shader: "
st_index, &program_size, &error_str);
if (program == NULL) {
if (!vp->program.is_arb_asm) {
- vp->program.sh.data->LinkStatus = false;
+ vp->program.sh.data->LinkStatus = linking_failure;
ralloc_strcat(&vp->program.sh.data->InfoLog, error_str);
}
if (program == NULL) {
if (!fp->program.is_arb_asm) {
- fp->program.sh.data->LinkStatus = false;
+ fp->program.sh.data->LinkStatus = linking_failure;
ralloc_strcat(&fp->program.sh.data->InfoLog, error_str);
}
};
/**
+ * Link status enum. linking_skipped is used to indicate linking
+ * was skipped due to the shader being loaded from the on-disk cache.
+ */
+enum gl_link_status
+{
+ linking_failure = 0,
+ linking_success,
+ linking_skipped
+};
+
+/**
* A data structure to be shared by gl_shader_program and gl_program.
*/
struct gl_shader_program_data
struct gl_program_resource *ProgramResourceList;
unsigned NumProgramResourceList;
- GLboolean LinkStatus; /**< GL_LINK_STATUS */
+ enum gl_link_status LinkStatus; /**< GL_LINK_STATUS */
GLboolean Validated;
GLchar *InfoLog;
if (!prog)
return NULL;
- if (prog->data->LinkStatus == GL_FALSE) {
+ if (prog->data->LinkStatus == linking_failure) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)",
caller);
return NULL;
*params = shProg->DeletePending;
return;
case GL_LINK_STATUS:
- *params = shProg->data->LinkStatus;
+ *params = shProg->data->LinkStatus ? GL_TRUE : GL_FALSE;
return;
case GL_VALIDATE_STATUS:
*params = shProg->data->Validated;
}
case GL_PROGRAM_SEPARABLE:
/* If the program has not been linked, return initial value 0. */
- *params = (shProg->data->LinkStatus == GL_FALSE) ? 0 : shProg->SeparateShader;
+ *params = (shProg->data->LinkStatus == linking_failure) ? 0 : shProg->SeparateShader;
return;
/* ARB_tessellation_shader */
ralloc_free(filename);
}
- if (shProg->data->LinkStatus == GL_FALSE &&
+ if (shProg->data->LinkStatus == linking_failure &&
(ctx->_Shader->Flags & GLSL_REPORT_ERRORS)) {
_mesa_debug(ctx, "Error linking program %u:\n%s\n",
shProg->Name, shProg->data->InfoLog);
* Since any value of binaryFormat passed "is not one of those specified as
* allowable for [this] command, an INVALID_ENUM error is generated."
*/
- shProg->data->LinkStatus = GL_FALSE;
+ shProg->data->LinkStatus = linking_failure;
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramBinary");
}
/* Possibly... */
if (active-user-defined-varyings-in-linked-program) {
append-error-to-info-log;
- shProg->data->LinkStatus = GL_FALSE;
+ shProg->data->LinkStatus = linking_failure;
}
#endif
}
* "If program has not been successfully linked, the error
* INVALID_OPERATION is generated."
*/
- if (shProg->data->LinkStatus == GL_FALSE) {
+ if (shProg->data->LinkStatus == linking_failure) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetUniformLocation(program not linked)");
return -1;
_mesa_clear_shader_program_data(ctx, prog);
- prog->data->LinkStatus = GL_TRUE;
+ prog->data->LinkStatus = linking_success;
for (i = 0; i < prog->NumShaders; i++) {
if (!prog->Shaders[i]->CompileStatus) {
if (prog->data->LinkStatus) {
if (!ctx->Driver.LinkShader(ctx, prog)) {
- prog->data->LinkStatus = GL_FALSE;
+ prog->data->LinkStatus = linking_failure;
}
}
ralloc_vasprintf_append(&prog->data->InfoLog, fmt, args);
va_end(args);
- prog->data->LinkStatus = GL_FALSE;
+ prog->data->LinkStatus = linking_failure;
}
static int