[Mesa-dev] [PATCH 2/3] mesa: change gl_link_status enums to uppercase

Brian Paul brianp at vmware.com
Fri Jan 26 16:39:17 UTC 2018


follow the convention of other enums.
---
 src/compiler/glsl/linker.cpp               |  6 +++---
 src/compiler/glsl/shader_cache.cpp         |  2 +-
 src/compiler/glsl/standalone.cpp           |  2 +-
 src/mesa/drivers/dri/i965/brw_cs.c         |  4 ++--
 src/mesa/drivers/dri/i965/brw_disk_cache.c |  2 +-
 src/mesa/drivers/dri/i965/brw_link.cpp     |  2 +-
 src/mesa/drivers/dri/i965/brw_tcs.c        |  2 +-
 src/mesa/drivers/dri/i965/brw_tes.c        |  2 +-
 src/mesa/drivers/dri/i965/brw_vs.c         |  2 +-
 src/mesa/drivers/dri/i965/brw_wm.c         |  2 +-
 src/mesa/main/mtypes.h                     | 10 +++++-----
 src/mesa/main/program_binary.c             |  6 +++---
 src/mesa/main/program_resource.c           |  2 +-
 src/mesa/main/shaderapi.c                  |  8 ++++----
 src/mesa/main/uniforms.c                   |  2 +-
 src/mesa/program/ir_to_mesa.cpp            | 12 ++++++------
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  2 +-
 src/mesa/state_tracker/st_shader_cache.c   |  2 +-
 18 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 39fc345..ce10193 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -456,7 +456,7 @@ linker_error(gl_shader_program *prog, const char *fmt, ...)
    ralloc_vasprintf_append(&prog->data->InfoLog, fmt, ap);
    va_end(ap);
 
-   prog->data->LinkStatus = linking_failure;
+   prog->data->LinkStatus = LINKING_FAILURE;
 }
 
 
@@ -2282,7 +2282,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 = linking_failure;
+      prog->data->LinkStatus = LINKING_FAILURE;
       _mesa_delete_linked_shader(ctx, linked);
       return NULL;
    }
@@ -4748,7 +4748,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 = linking_success; /* 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/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index bdc045e..bf884af 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -248,7 +248,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
    }
 
    /* This is used to flag a shader retrieved from cache */
-   prog->data->LinkStatus = linking_skipped;
+   prog->data->LinkStatus = LINKING_SKIPPED;
 
    /* Since the program load was successful, CompileStatus of all shaders at
     * this point should normally be compile_skipped. However because of how
diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp
index 6ece074..c989aef 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -520,7 +520,7 @@ standalone_compile_shader(const struct standalone_options *_options,
       } else {
          const gl_shader_stage stage = whole_program->Shaders[0]->Stage;
 
-         whole_program->data->LinkStatus = linking_success;
+         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 71d0bea..e3f8fc6 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -62,7 +62,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 = linking_failure;
+      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);
@@ -94,7 +94,7 @@ brw_codegen_cs_prog(struct brw_context *brw,
                             &prog_data, cp->program.nir, st_index,
                             &error_str);
    if (program == NULL) {
-      cp->program.sh.data->LinkStatus = linking_failure;
+      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_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c
index 65bb527..7d965f6 100644
--- a/src/mesa/drivers/dri/i965/brw_disk_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c
@@ -263,7 +263,7 @@ brw_disk_cache_upload_program(struct brw_context *brw, gl_shader_stage stage)
    if (brw->ctx._Shader->Flags & GLSL_CACHE_FALLBACK)
       goto fail;
 
-   if (prog->sh.data->LinkStatus != linking_skipped)
+   if (prog->sh.data->LinkStatus != LINKING_SKIPPED)
       goto fail;
 
    if (!read_and_upload(brw, cache, prog, stage))
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 6426767..fc35c00 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -225,7 +225,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
    unsigned int stage;
    struct shader_info *infos[MESA_SHADER_STAGES] = { 0, };
 
-   if (shProg->data->LinkStatus == linking_skipped)
+   if (shProg->data->LinkStatus == LINKING_SKIPPED)
       return GL_TRUE;
 
    for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 4424efe..931ef64 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -232,7 +232,7 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp,
                       &error_str);
    if (program == NULL) {
       if (tep) {
-         tep->program.sh.data->LinkStatus = linking_failure;
+         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 4222d42..2f3697c 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -106,7 +106,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, &error_str);
    if (program == NULL) {
-      tep->program.sh.data->LinkStatus = linking_failure;
+      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 985d0bf..22c7493 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -224,7 +224,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
                             st_index, &error_str);
    if (program == NULL) {
       if (!vp->program.is_arb_asm) {
-         vp->program.sh.data->LinkStatus = linking_failure;
+         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 0072bdd..cfc2d47 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -181,7 +181,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
 
    if (program == NULL) {
       if (!fp->program.is_arb_asm) {
-         fp->program.sh.data->LinkStatus = linking_failure;
+         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 cbbdb37..54159bb 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2587,7 +2587,7 @@ struct gl_linked_shader
 
 
 /**
- * Compile status enum. compile_skipped is used to indicate the compile
+ * 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.
  */
@@ -2879,14 +2879,14 @@ struct gl_program_resource
 };
 
 /**
- * Link status enum. linking_skipped is used to indicate linking
+ * 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
+   LINKING_FAILURE = 0,
+   LINKING_SUCCESS,
+   LINKING_SKIPPED
 };
 
 /**
diff --git a/src/mesa/main/program_binary.c b/src/mesa/main/program_binary.c
index 2786487..3df7005 100644
--- a/src/mesa/main/program_binary.c
+++ b/src/mesa/main/program_binary.c
@@ -275,7 +275,7 @@ _mesa_program_binary(struct gl_context *ctx, struct gl_shader_program *sh_prog,
                                                     binary, length);
 
    if (payload == NULL) {
-      sh_prog->data->LinkStatus = linking_failure;
+      sh_prog->data->LinkStatus = LINKING_FAILURE;
       return;
    }
 
@@ -283,9 +283,9 @@ _mesa_program_binary(struct gl_context *ctx, struct gl_shader_program *sh_prog,
    blob_reader_init(&blob, payload, length - header_size);
 
    if (!read_program_payload(ctx, &blob, binary_format, sh_prog)) {
-      sh_prog->data->LinkStatus = linking_failure;
+      sh_prog->data->LinkStatus = LINKING_FAILURE;
       return;
    }
 
-   sh_prog->data->LinkStatus = linking_success;
+   sh_prog->data->LinkStatus = LINKING_SUCCESS;
 }
diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c
index 5fa5d75..41024d6 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 == linking_failure) {
+   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 91b1f49..d0d2ef9 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -870,7 +870,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 == linking_failure) ? 0 : shProg->SeparateShader;
+      *params = (shProg->data->LinkStatus == LINKING_FAILURE) ? 0 : shProg->SeparateShader;
       return;
 
    /* ARB_tessellation_shader */
@@ -1252,7 +1252,7 @@ link_program(struct gl_context *ctx, struct gl_shader_program *shProg,
       ralloc_free(filename);
    }
 
-   if (shProg->data->LinkStatus == linking_failure &&
+   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);
@@ -2304,7 +2304,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 = linking_failure;
+      shProg->data->LinkStatus = LINKING_FAILURE;
       _mesa_error(ctx, GL_INVALID_ENUM, "glProgramBinary");
    } else {
       _mesa_program_binary(ctx, shProg, binaryFormat, binary, length);
@@ -2521,7 +2521,7 @@ _mesa_CreateShaderProgramv(GLenum type, GLsizei count,
 	    /* Possibly... */
 	    if (active-user-defined-varyings-in-linked-program) {
 	       append-error-to-info-log;
-               shProg->data->LinkStatus = linking_failure;
+               shProg->data->LinkStatus = LINKING_FAILURE;
 	    }
 #endif
 	 }
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index ddfe906..64124e2 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -1016,7 +1016,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 == linking_failure) {
+   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 321d887..660e2c1 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3088,7 +3088,7 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 
    prog->data = _mesa_create_shader_program_data();
 
-   prog->data->LinkStatus = linking_success;
+   prog->data->LinkStatus = LINKING_SUCCESS;
 
    for (i = 0; i < prog->NumShaders; i++) {
       if (!prog->Shaders[i]->CompileStatus) {
@@ -3114,21 +3114,21 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
       link_shaders(ctx, prog);
    }
 
-   /* If LinkStatus is linking_success, then reset sampler validated to true.
+   /* If LinkStatus is LINKING_SUCCESS, then reset sampler validated to true.
     * Validation happens via the LinkShader call below. If LinkStatus is
-    * linking_skipped, then SamplersValidated will have been restored from the
+    * LINKING_SKIPPED, then SamplersValidated will have been restored from the
     * shader cache.
     */
-   if (prog->data->LinkStatus == linking_success) {
+   if (prog->data->LinkStatus == LINKING_SUCCESS) {
       prog->SamplersValidated = GL_TRUE;
    }
 
    if (prog->data->LinkStatus && !ctx->Driver.LinkShader(ctx, prog)) {
-      prog->data->LinkStatus = linking_failure;
+      prog->data->LinkStatus = LINKING_FAILURE;
    }
 
    /* Return early if we are loading the shader from on-disk cache */
-   if (prog->data->LinkStatus == linking_skipped)
+   if (prog->data->LinkStatus == LINKING_SKIPPED)
       return;
 
    if (ctx->_Shader->Flags & GLSL_DUMP) {
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e855b32..094c79a 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -363,7 +363,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 = linking_failure;
+   prog->data->LinkStatus = LINKING_FAILURE;
 }
 
 int
diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c
index a971b0d..b1b9d27 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -289,7 +289,7 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
    /* If we didn't load the GLSL metadata from cache then we could not have
     * loaded the tgsi either.
     */
-   if (prog->data->LinkStatus != linking_skipped)
+   if (prog->data->LinkStatus != LINKING_SKIPPED)
       return false;
 
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
-- 
2.7.4



More information about the mesa-dev mailing list