mesa/st: move new ati fragment shader to mesa
authorDave Airlie <airlied@redhat.com>
Mon, 20 Dec 2021 06:00:43 +0000 (16:00 +1000)
committerMarge Bot <emma+marge@anholt.net>
Wed, 26 Jan 2022 00:42:59 +0000 (00:42 +0000)
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14700>

src/mesa/main/atifragshader.c
src/mesa/state_tracker/st_cb_program.c
src/mesa/state_tracker/st_cb_program.h

index aed8cce..d634097 100644 (file)
@@ -56,6 +56,17 @@ _mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id)
    return s;
 }
 
+static struct gl_program *
+new_ati_fs(struct gl_context *ctx, struct ati_fragment_shader *curProg)
+{
+   struct gl_program *prog = rzalloc(NULL, struct gl_program);
+   if (!prog)
+      return NULL;
+
+   _mesa_init_gl_program(prog, MESA_SHADER_FRAGMENT, curProg->Id, true);
+   prog->ati_fs = curProg;
+   return prog;
+}
 
 /**
  * Delete the given ati fragment shader
@@ -415,8 +426,8 @@ _mesa_EndFragmentShaderATI(void)
    }
 #endif
 
-   struct gl_program *prog = st_new_ati_fs(ctx,
-                                           ctx->ATIFragmentShader.Current);
+   struct gl_program *prog = new_ati_fs(ctx,
+                                        ctx->ATIFragmentShader.Current);
    _mesa_reference_program(ctx, &ctx->ATIFragmentShader.Current->Program,
                            NULL);
    /* Don't use _mesa_reference_program(), just take ownership */
index 7fa0297..6dc8722 100644 (file)
@@ -128,18 +128,6 @@ st_program_string_notify( struct gl_context *ctx,
 }
 
 /**
- * Called in glEndFragmentShaderATI()
- */
-struct gl_program *
-st_new_ati_fs(struct gl_context *ctx, struct ati_fragment_shader *curProg)
-{
-   struct gl_program *prog = st_new_program(ctx, MESA_SHADER_FRAGMENT,
-         curProg->Id, true);
-   prog->ati_fs = curProg;
-   return prog;
-}
-
-/**
  * Plug in the program and shader-related device driver functions.
  */
 void
index c917f0a..fdeebaa 100644 (file)
@@ -40,7 +40,6 @@ void st_delete_program(struct gl_context *ctx, struct gl_program *prog);
 GLboolean st_program_string_notify(struct gl_context *ctx,
                                    GLenum target,
                                    struct gl_program *prog);
-struct gl_program *st_new_ati_fs(struct gl_context *ctx, struct ati_fragment_shader *curProg);
 
 #ifdef __cplusplus
 }