i965: Clean up brwNewProgram().
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 18 Aug 2017 06:48:07 +0000 (23:48 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 23 Aug 2017 18:55:17 +0000 (11:55 -0700)
All shader stages do the exact same thing, so we don't need the switch
statement, or the redundant FS case.  I believe these used to be
different before Tim eliminated the (e.g.) brw_vertex_program
subclasses.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/drivers/dri/i965/brw_program.c

index 94d8d8b978a8aae9153c755c865465efadc8a7e7..257a99bc94684c9bcc7e3257ee22e2caca096211 100644 (file)
@@ -138,38 +138,15 @@ static struct gl_program *brwNewProgram(struct gl_context *ctx, GLenum target,
                                         GLuint id, bool is_arb_asm)
 {
    struct brw_context *brw = brw_context(ctx);
+   struct brw_program *prog = rzalloc(NULL, struct brw_program);
 
-   switch (target) {
-   case GL_VERTEX_PROGRAM_ARB:
-   case GL_TESS_CONTROL_PROGRAM_NV:
-   case GL_TESS_EVALUATION_PROGRAM_NV:
-   case GL_GEOMETRY_PROGRAM_NV:
-   case GL_COMPUTE_PROGRAM_NV: {
-      struct brw_program *prog = rzalloc(NULL, struct brw_program);
-      if (prog) {
-        prog->id = get_new_program_id(brw->screen);
-
-         return _mesa_init_gl_program(&prog->program, target, id, is_arb_asm);
-      }
-      else
-        return NULL;
-   }
-
-   case GL_FRAGMENT_PROGRAM_ARB: {
-      struct brw_program *prog = rzalloc(NULL, struct brw_program);
+   if (prog) {
+      prog->id = get_new_program_id(brw->screen);
 
-      if (prog) {
-        prog->id = get_new_program_id(brw->screen);
-
-         return _mesa_init_gl_program(&prog->program, target, id, is_arb_asm);
-      }
-      else
-        return NULL;
+      return _mesa_init_gl_program(&prog->program, target, id, is_arb_asm);
    }
 
-   default:
-      unreachable("Unsupported target in brwNewProgram()");
-   }
+   return NULL;
 }
 
 static void brwDeleteProgram( struct gl_context *ctx,