diff options
author | Marek Olšák <[email protected]> | 2020-03-31 10:03:55 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-27 12:49:53 +0000 |
commit | ad5da3e63ee368e3fa420d4785c698273614683b (patch) | |
tree | 2d8f5e0e32c9671cd7c1f851b0ea0eb307ef62c8 /src/compiler | |
parent | 531728d6cbf0eb7d87698b9f03d0083ca0e2a7c0 (diff) |
mesa: replace GLenum target with gl_shader_stage in NewProgram
So that the GLSL compiler doesn't have to use the GLenum conversion
functions.
Reviewed-by: Timothy Arceri <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4756>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/linker.cpp | 4 | ||||
-rw-r--r-- | src/compiler/glsl/serialize.cpp | 3 | ||||
-rw-r--r-- | src/compiler/glsl/standalone.cpp | 24 |
3 files changed, 8 insertions, 23 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 8a876fcecee..b3175090c71 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2467,9 +2467,7 @@ link_intrastage_shaders(void *mem_ctx, /* Create program and attach it to the linked shader */ struct gl_program *gl_prog = - ctx->Driver.NewProgram(ctx, - _mesa_shader_stage_to_program(shader_list[0]->Stage), - prog->Name, false); + ctx->Driver.NewProgram(ctx, shader_list[0]->Stage, prog->Name, false); if (!gl_prog) { prog->data->LinkStatus = LINKING_FAILURE; _mesa_delete_linked_shader(ctx, linked); diff --git a/src/compiler/glsl/serialize.cpp b/src/compiler/glsl/serialize.cpp index 11cae46dd8b..d4aacc1cb95 100644 --- a/src/compiler/glsl/serialize.cpp +++ b/src/compiler/glsl/serialize.cpp @@ -1222,8 +1222,7 @@ create_linked_shader_and_program(struct gl_context *ctx, struct gl_linked_shader *linked = rzalloc(NULL, struct gl_linked_shader); linked->Stage = stage; - glprog = ctx->Driver.NewProgram(ctx, _mesa_shader_stage_to_program(stage), - prog->Name, false); + glprog = ctx->Driver.NewProgram(ctx, stage, prog->Name, false); glprog->info.stage = stage; linked->Program = glprog; diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp index 4b473501622..9a7f7d58ed6 100644 --- a/src/compiler/glsl/standalone.cpp +++ b/src/compiler/glsl/standalone.cpp @@ -99,33 +99,21 @@ private: }; static void -init_gl_program(struct gl_program *prog, bool is_arb_asm, GLenum target) +init_gl_program(struct gl_program *prog, bool is_arb_asm, gl_shader_stage stage) { prog->RefCount = 1; prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; prog->is_arb_asm = is_arb_asm; - prog->info.stage = (gl_shader_stage)_mesa_program_enum_to_shader_stage(target); + prog->info.stage = stage; } static struct gl_program * -new_program(UNUSED struct gl_context *ctx, GLenum target, +new_program(UNUSED struct gl_context *ctx, gl_shader_stage stage, UNUSED GLuint id, bool is_arb_asm) { - switch (target) { - case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ - case GL_GEOMETRY_PROGRAM_NV: - case GL_TESS_CONTROL_PROGRAM_NV: - case GL_TESS_EVALUATION_PROGRAM_NV: - case GL_FRAGMENT_PROGRAM_ARB: - case GL_COMPUTE_PROGRAM_NV: { - struct gl_program *prog = rzalloc(NULL, struct gl_program); - init_gl_program(prog, is_arb_asm, target); - return prog; - } - default: - printf("bad target in new_program\n"); - return NULL; - } + struct gl_program *prog = rzalloc(NULL, struct gl_program); + init_gl_program(prog, is_arb_asm, stage); + return prog; } static const struct standalone_options *options; |