fprintf(stderr, "deferring compile of shader: %s\n",
_mesa_sha1_format(buf, shader->sha1));
}
- shader->CompileStatus = true;
+ shader->CompileStatus = compile_skipped;
free((void *)shader->FallbackSource);
shader->FallbackSource = NULL;
set_shader_inout_layout(shader, state);
shader->symbols = new(shader->ir) glsl_symbol_table;
- shader->CompileStatus = !state->error;
+ shader->CompileStatus = state->error ? compile_failure : compile_success;
shader->InfoLog = state->info_log;
shader->Version = state->language_version;
shader->IsES = state->es_shader;
sh = _mesa_new_shader(name, stage);
sh->Source = strdup(source);
- sh->CompileStatus = false;
+ sh->CompileStatus = compile_failure;
_mesa_compile_shader(ctx, sh);
if (!sh->CompileStatus) {
reparent_ir(p.shader->ir, p.shader->ir);
- p.shader->CompileStatus = true;
+ p.shader->CompileStatus = compile_success;
p.shader->Version = state->language_version;
p.shader_program->Shaders =
(gl_shader **)malloc(sizeof(*p.shader_program->Shaders));
return external_samplers;
}
+/**
+ * Compile status enum. compile_skipped is used to indicate the compile
+ * was skipped due to the shader matching one that's been seen before by
+ * the on-disk cache.
+ */
+enum gl_compile_status
+{
+ compile_failure = 0,
+ compile_success,
+ compile_skipped
+};
+
/**
* A GLSL shader object.
*/
GLchar *Label; /**< GL_KHR_debug */
unsigned char sha1[20]; /**< SHA1 hash of pre-processed source */
GLboolean DeletePending;
- GLboolean CompileStatus;
+ enum gl_compile_status CompileStatus;
bool IsES; /**< True if this shader uses GLSL ES */
#ifdef DEBUG
*params = shader->DeletePending;
break;
case GL_COMPILE_STATUS:
- *params = shader->CompileStatus;
+ *params = shader->CompileStatus ? GL_TRUE : GL_FALSE;
break;
case GL_INFO_LOG_LENGTH:
*params = (shader->InfoLog && shader->InfoLog[0] != '\0') ?
{
assert(sh);
- if (sh->CompileStatus == GL_TRUE && !sh->FallbackSource) {
+ if (sh->CompileStatus == compile_skipped && !sh->FallbackSource) {
/* If shader was previously compiled back-up the source in case of cache
* fallback.
*/
/* If the user called glCompileShader without first calling
* glShaderSource, we should fail to compile, but not raise a GL_ERROR.
*/
- sh->CompileStatus = GL_FALSE;
+ sh->CompileStatus = compile_failure;
} else {
if (ctx->_Shader->Flags & GLSL_DUMP) {
_mesa_log("GLSL source for %s shader %d:\n",