summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-02-04 10:46:53 +1100
committerTimothy Arceri <[email protected]>2017-02-09 12:22:56 +1100
commita3fd8bb8c58e35ef06928fe0c565480b0e8f6343 (patch)
treec69b33074384b952b1b2f3daad7bb307e9e29f67 /src/mesa/main
parentac5845453c655a08ecabe3a891a3d2d9fea39866 (diff)
st/mesa/i965: create link status enum
For the on-disk shader cache we want to be able to differentiate between a program that was linked and one that was loaded from cache. V2: - don't return the new enum directly to the application when queried, instead return GL_TRUE or GL_FALSE as required. Fixes google-chrome corruptions when using cache. Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/main')
-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
4 files changed, 19 insertions, 8 deletions
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;