summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-08-08 13:19:49 -0600
committerBrian Paul <[email protected]>2014-08-11 09:44:50 -0600
commitd8f7577d5f018d84e4f474df05b2a20cf70c0479 (patch)
treece551fc48f643d24f7b963d21aa010ac62af0f7e /src/mesa/program
parent53b13b2eadb866c7752ffb8a1f58dab0e0f25025 (diff)
mesa: simplify/rename _mesa_init_program_struct()
No need to return a value. Remove unused ctx parameter. Remove _mesa_ prefix since it's static. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/program.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index aedce3e3c5e..9886b751fcd 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -226,27 +226,24 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
/**
- * Initialize a new vertex/fragment program object.
+ * Initialize a new gl_program object.
*/
-static struct gl_program *
-_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
- GLenum target, GLuint id)
+static void
+init_program_struct(struct gl_program *prog, GLenum target, GLuint id)
{
- (void) ctx;
- if (prog) {
- GLuint i;
- memset(prog, 0, sizeof(*prog));
- prog->Id = id;
- prog->Target = target;
- prog->RefCount = 1;
- prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
-
- /* default mapping from samplers to texture units */
- for (i = 0; i < MAX_SAMPLERS; i++)
- prog->SamplerUnits[i] = i;
- }
+ GLuint i;
- return prog;
+ assert(prog);
+
+ memset(prog, 0, sizeof(*prog));
+ prog->Id = id;
+ prog->Target = target;
+ prog->RefCount = 1;
+ prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB;
+
+ /* default mapping from samplers to texture units */
+ for (i = 0; i < MAX_SAMPLERS; i++)
+ prog->SamplerUnits[i] = i;
}
@@ -257,10 +254,11 @@ struct gl_program *
_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog,
GLenum target, GLuint id)
{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
+ if (prog) {
+ init_program_struct(&prog->Base, target, id);
+ return &prog->Base;
+ }
+ return NULL;
}
@@ -271,10 +269,11 @@ struct gl_program *
_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog,
GLenum target, GLuint id)
{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
+ if (prog) {
+ init_program_struct(&prog->Base, target, id);
+ return &prog->Base;
+ }
+ return NULL;
}
@@ -286,10 +285,11 @@ _mesa_init_compute_program(struct gl_context *ctx,
struct gl_compute_program *prog, GLenum target,
GLuint id)
{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
+ if (prog) {
+ init_program_struct(&prog->Base, target, id);
+ return &prog->Base;
+ }
+ return NULL;
}
@@ -300,10 +300,11 @@ struct gl_program *
_mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog,
GLenum target, GLuint id)
{
- if (prog)
- return _mesa_init_program_struct( ctx, &prog->Base, target, id );
- else
- return NULL;
+ if (prog) {
+ init_program_struct(&prog->Base, target, id);
+ return &prog->Base;
+ }
+ return NULL;
}