summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/linker.cpp6
-rw-r--r--src/compiler/glsl/standalone.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_cs.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_tes.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c2
-rw-r--r--src/mesa/main/mtypes.h13
-rw-r--r--src/mesa/main/program_resource.c2
-rw-r--r--src/mesa/main/shaderapi.c10
-rw-r--r--src/mesa/main/uniforms.c2
-rw-r--r--src/mesa/program/ir_to_mesa.cpp4
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp2
13 files changed, 32 insertions, 21 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index b768a6e5285..720c22baee0 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -421,7 +421,7 @@ linker_error(gl_shader_program *prog, const char *fmt, ...)
ralloc_vasprintf_append(&prog->data->InfoLog, fmt, ap);
va_end(ap);
- prog->data->LinkStatus = false;
+ prog->data->LinkStatus = linking_failure;
}
@@ -2190,7 +2190,7 @@ link_intrastage_shaders(void *mem_ctx,
_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;
}
@@ -4629,7 +4629,7 @@ linker_optimisation_loop(struct gl_context *ctx, exec_list *ir,
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:
diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp
index 44f2c0f36b1..7a2d3d200f0 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -509,7 +509,7 @@ standalone_compile_shader(const struct standalone_options *_options,
} 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,
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
index 0f8d4ebcb83..16b7945bd7e 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -66,7 +66,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
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);
@@ -119,7 +119,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
&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);
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 858ecf99a84..64bfc40d4d1 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -249,7 +249,7 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp,
&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);
}
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index cb12b9c5a69..3da53579ac0 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -124,7 +124,7 @@ brw_codegen_tes_prog(struct brw_context *brw,
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: "
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index a8225801858..3f11a76506e 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -226,7 +226,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
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);
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index a774720202a..4a07c14e807 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -194,7 +194,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
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);
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a2280e2539f..a845a394c8f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2647,6 +2647,17 @@ struct gl_program_resource
};
/**
+ * 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
@@ -2677,7 +2688,7 @@ 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;
diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c
index 4b5be6f52d8..4eacdfb9e9a 100644
--- a/src/mesa/main/program_resource.c
+++ b/src/mesa/main/program_resource.c
@@ -76,7 +76,7 @@ lookup_linked_program(GLuint program, const char *caller)
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;
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 4667866ca06..4406aaa9803 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -636,7 +636,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
*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;
@@ -815,7 +815,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
}
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 */
@@ -1160,7 +1160,7 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg)
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);
@@ -2095,7 +2095,7 @@ _mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
* 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");
}
@@ -2270,7 +2270,7 @@ _mesa_CreateShaderProgramv(GLenum type, GLsizei count,
/* 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
}
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index a9540551053..8376a9519f6 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -941,7 +941,7 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
* "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;
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index dc5f8016f37..ce58fbbd460 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3096,7 +3096,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
_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) {
@@ -3110,7 +3110,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
if (prog->data->LinkStatus) {
if (!ctx->Driver.LinkShader(ctx, prog)) {
- prog->data->LinkStatus = GL_FALSE;
+ prog->data->LinkStatus = linking_failure;
}
}
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 116f30c9446..fc981ab0b22 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -588,7 +588,7 @@ fail_link(struct gl_shader_program *prog, const char *fmt, ...)
ralloc_vasprintf_append(&prog->data->InfoLog, fmt, args);
va_end(args);
- prog->data->LinkStatus = GL_FALSE;
+ prog->data->LinkStatus = linking_failure;
}
static int