summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-18 16:04:55 -0600
committerBrian Paul <[email protected]>2008-05-18 16:04:55 -0600
commitfd59f19cd2388519265dfba3d28e5281df6f4ba0 (patch)
treef31bc18cf5bc0984bdedb946565bde269994b440 /src/mesa
parent88c0a7463328ef47106ea0afbeb148ebd4e6d067 (diff)
Move _mesa_init_glsl_driver_functions() into shader_api.c
This allows making a bunch of functions static, and removes a state tracker dependency on driverfuncs.c cherry-picked from gallium-0.1
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/common/driverfuncs.c37
-rw-r--r--src/mesa/drivers/common/driverfuncs.h4
-rw-r--r--src/mesa/shader/shader_api.c93
-rw-r--r--src/mesa/shader/shader_api.h103
4 files changed, 69 insertions, 168 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 7fe116285c4..e61b9f59cf5 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -262,43 +262,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/**
- * Plug in Mesa's GLSL functions.
- */
-void
-_mesa_init_glsl_driver_functions(struct dd_function_table *driver)
-{
- driver->AttachShader = _mesa_attach_shader;
- driver->BindAttribLocation = _mesa_bind_attrib_location;
- driver->CompileShader = _mesa_compile_shader;
- driver->CreateProgram = _mesa_create_program;
- driver->CreateShader = _mesa_create_shader;
- driver->DeleteProgram2 = _mesa_delete_program2;
- driver->DeleteShader = _mesa_delete_shader;
- driver->DetachShader = _mesa_detach_shader;
- driver->GetActiveAttrib = _mesa_get_active_attrib;
- driver->GetActiveUniform = _mesa_get_active_uniform;
- driver->GetAttachedShaders = _mesa_get_attached_shaders;
- driver->GetAttribLocation = _mesa_get_attrib_location;
- driver->GetHandle = _mesa_get_handle;
- driver->GetProgramiv = _mesa_get_programiv;
- driver->GetProgramInfoLog = _mesa_get_program_info_log;
- driver->GetShaderiv = _mesa_get_shaderiv;
- driver->GetShaderInfoLog = _mesa_get_shader_info_log;
- driver->GetShaderSource = _mesa_get_shader_source;
- driver->GetUniformfv = _mesa_get_uniformfv;
- driver->GetUniformLocation = _mesa_get_uniform_location;
- driver->IsProgram = _mesa_is_program;
- driver->IsShader = _mesa_is_shader;
- driver->LinkProgram = _mesa_link_program;
- driver->ShaderSource = _mesa_shader_source;
- driver->Uniform = _mesa_uniform;
- driver->UniformMatrix = _mesa_uniform_matrix;
- driver->UseProgram = _mesa_use_program;
- driver->ValidateProgram = _mesa_validate_program;
-}
-
-
-/**
* Call the ctx->Driver.* state functions with current values to initialize
* driver state.
* Only the Intel drivers use this so far.
diff --git a/src/mesa/drivers/common/driverfuncs.h b/src/mesa/drivers/common/driverfuncs.h
index 6ed23c4520e..4c90ed12f60 100644
--- a/src/mesa/drivers/common/driverfuncs.h
+++ b/src/mesa/drivers/common/driverfuncs.h
@@ -31,10 +31,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver);
extern void
-_mesa_init_glsl_driver_functions(struct dd_function_table *driver);
-
-
-extern void
_mesa_init_driver_state(GLcontext *ctx);
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 8bb16002679..0bb96a0d6c0 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -53,7 +53,7 @@
/**
* Allocate a new gl_shader_program object, initialize it.
*/
-struct gl_shader_program *
+static struct gl_shader_program *
_mesa_new_shader_program(GLcontext *ctx, GLuint name)
{
struct gl_shader_program *shProg;
@@ -363,7 +363,7 @@ copy_string(GLchar *dst, GLsizei maxLength, GLsizei *length, const GLchar *src)
/**
* Called via ctx->Driver.AttachShader()
*/
-void
+static void
_mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
{
struct gl_shader_program *shProg
@@ -404,7 +404,7 @@ _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
}
-GLint
+static GLint
_mesa_get_attrib_location(GLcontext *ctx, GLuint program,
const GLchar *name)
{
@@ -435,7 +435,7 @@ _mesa_get_attrib_location(GLcontext *ctx, GLuint program,
}
-void
+static void
_mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
const GLchar *name)
{
@@ -481,7 +481,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
}
-GLuint
+static GLuint
_mesa_create_shader(GLcontext *ctx, GLenum type)
{
struct gl_shader *sh;
@@ -505,7 +505,7 @@ _mesa_create_shader(GLcontext *ctx, GLenum type)
}
-GLuint
+static GLuint
_mesa_create_program(GLcontext *ctx)
{
GLuint name;
@@ -526,7 +526,7 @@ _mesa_create_program(GLcontext *ctx)
* Named w/ "2" to indicate OpenGL 2.x vs GL_ARB_fragment_programs's
* DeleteProgramARB.
*/
-void
+static void
_mesa_delete_program2(GLcontext *ctx, GLuint name)
{
/*
@@ -552,7 +552,7 @@ _mesa_delete_program2(GLcontext *ctx, GLuint name)
}
-void
+static void
_mesa_delete_shader(GLcontext *ctx, GLuint shader)
{
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
@@ -567,7 +567,7 @@ _mesa_delete_shader(GLcontext *ctx, GLuint shader)
}
-void
+static void
_mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
{
struct gl_shader_program *shProg
@@ -629,7 +629,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
}
-void
+static void
_mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
GLsizei maxLength, GLsizei *length, GLint *size,
GLenum *type, GLchar *nameOut)
@@ -664,7 +664,7 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
/**
* Called via ctx->Driver.GetActiveUniform().
*/
-void
+static void
_mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
GLsizei maxLength, GLsizei *length, GLint *size,
GLenum *type, GLchar *nameOut)
@@ -712,7 +712,7 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
/**
* Called via ctx->Driver.GetAttachedShaders().
*/
-void
+static void
_mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
GLsizei *count, GLuint *obj)
{
@@ -732,7 +732,7 @@ _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
}
-GLuint
+static GLuint
_mesa_get_handle(GLcontext *ctx, GLenum pname)
{
#if 0
@@ -756,7 +756,7 @@ _mesa_get_handle(GLcontext *ctx, GLenum pname)
}
-void
+static void
_mesa_get_programiv(GLcontext *ctx, GLuint program,
GLenum pname, GLint *params)
{
@@ -806,7 +806,7 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program,
}
-void
+static void
_mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
{
struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
@@ -839,7 +839,7 @@ _mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
}
-void
+static void
_mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
GLsizei *length, GLchar *infoLog)
{
@@ -853,7 +853,7 @@ _mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
}
-void
+static void
_mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
GLsizei *length, GLchar *infoLog)
{
@@ -869,7 +869,7 @@ _mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
/**
* Called via ctx->Driver.GetShaderSource().
*/
-void
+static void
_mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
GLsizei *length, GLchar *sourceOut)
{
@@ -885,7 +885,7 @@ _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
/**
* Called via ctx->Driver.GetUniformfv().
*/
-void
+static void
_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
GLfloat *params)
{
@@ -927,7 +927,7 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
/**
* Called via ctx->Driver.GetUniformLocation().
*/
-GLint
+static GLint
_mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
{
struct gl_shader_program *shProg
@@ -939,7 +939,7 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
}
-GLboolean
+static GLboolean
_mesa_is_program(GLcontext *ctx, GLuint name)
{
struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name);
@@ -947,7 +947,7 @@ _mesa_is_program(GLcontext *ctx, GLuint name)
}
-GLboolean
+static GLboolean
_mesa_is_shader(GLcontext *ctx, GLuint name)
{
struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
@@ -959,7 +959,7 @@ _mesa_is_shader(GLcontext *ctx, GLuint name)
/**
* Called via ctx->Driver.ShaderSource()
*/
-void
+static void
_mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
{
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
@@ -980,7 +980,7 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
/**
* Called via ctx->Driver.CompileShader()
*/
-void
+static void
_mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
{
struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj);
@@ -997,7 +997,7 @@ _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj)
/**
* Called via ctx->Driver.LinkProgram()
*/
-void
+static void
_mesa_link_program(GLcontext *ctx, GLuint program)
{
struct gl_shader_program *shProg;
@@ -1143,7 +1143,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location,
/**
* Called via ctx->Driver.Uniform().
*/
-void
+static void
_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
const GLvoid *values, GLenum type)
{
@@ -1247,7 +1247,7 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program,
/**
* Called by ctx->Driver.UniformMatrix().
*/
-void
+static void
_mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
GLenum matrixType, GLint location, GLsizei count,
GLboolean transpose, const GLfloat *values)
@@ -1292,7 +1292,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
}
-void
+static void
_mesa_validate_program(GLcontext *ctx, GLuint program)
{
struct gl_shader_program *shProg;
@@ -1318,3 +1318,40 @@ _mesa_validate_program(GLcontext *ctx, GLuint program)
image units allowed.
*/
}
+
+
+/**
+ * Plug in Mesa's GLSL functions into the device driver function table.
+ */
+void
+_mesa_init_glsl_driver_functions(struct dd_function_table *driver)
+{
+ driver->AttachShader = _mesa_attach_shader;
+ driver->BindAttribLocation = _mesa_bind_attrib_location;
+ driver->CompileShader = _mesa_compile_shader;
+ driver->CreateProgram = _mesa_create_program;
+ driver->CreateShader = _mesa_create_shader;
+ driver->DeleteProgram2 = _mesa_delete_program2;
+ driver->DeleteShader = _mesa_delete_shader;
+ driver->DetachShader = _mesa_detach_shader;
+ driver->GetActiveAttrib = _mesa_get_active_attrib;
+ driver->GetActiveUniform = _mesa_get_active_uniform;
+ driver->GetAttachedShaders = _mesa_get_attached_shaders;
+ driver->GetAttribLocation = _mesa_get_attrib_location;
+ driver->GetHandle = _mesa_get_handle;
+ driver->GetProgramiv = _mesa_get_programiv;
+ driver->GetProgramInfoLog = _mesa_get_program_info_log;
+ driver->GetShaderiv = _mesa_get_shaderiv;
+ driver->GetShaderInfoLog = _mesa_get_shader_info_log;
+ driver->GetShaderSource = _mesa_get_shader_source;
+ driver->GetUniformfv = _mesa_get_uniformfv;
+ driver->GetUniformLocation = _mesa_get_uniform_location;
+ driver->IsProgram = _mesa_is_program;
+ driver->IsShader = _mesa_is_shader;
+ driver->LinkProgram = _mesa_link_program;
+ driver->ShaderSource = _mesa_shader_source;
+ driver->Uniform = _mesa_uniform;
+ driver->UniformMatrix = _mesa_uniform_matrix;
+ driver->UseProgram = _mesa_use_program;
+ driver->ValidateProgram = _mesa_validate_program;
+}
diff --git a/src/mesa/shader/shader_api.h b/src/mesa/shader/shader_api.h
index 27e5870d705..5521c585b53 100644
--- a/src/mesa/shader/shader_api.h
+++ b/src/mesa/shader/shader_api.h
@@ -41,9 +41,10 @@ _mesa_init_shader_state(GLcontext * ctx);
extern void
_mesa_free_shader_state(GLcontext *ctx);
+/*
extern struct gl_shader_program *
_mesa_new_shader_program(GLcontext *ctx, GLuint name);
-
+*/
extern void
_mesa_clear_shader_program_data(GLcontext *ctx,
struct gl_shader_program *shProg);
@@ -78,108 +79,12 @@ extern struct gl_shader *
_mesa_lookup_shader(GLcontext *ctx, GLuint name);
-/**
- * API/Driver functions
- */
-
-extern void
-_mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader);
-
-extern void
-_mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
- const GLchar *name);
-
-extern void
-_mesa_compile_shader(GLcontext *ctx, GLuint shaderObj);
-
-extern GLuint
-_mesa_create_shader(GLcontext *ctx, GLenum type);
-
-extern GLuint
-_mesa_create_program(GLcontext *ctx);
-
-extern void
-_mesa_delete_program2(GLcontext *ctx, GLuint name);
-
-extern void
-_mesa_delete_shader(GLcontext *ctx, GLuint shader);
-
-extern void
-_mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader);
-
-extern void
-_mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
- GLsizei maxLength, GLsizei *length, GLint *size,
- GLenum *type, GLchar *name);
-
-extern void
-_mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
- GLsizei maxLength, GLsizei *length, GLint *size,
- GLenum *type, GLchar *name);
-
-extern void
-_mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
- GLsizei *count, GLuint *obj);
-
-extern GLint
-_mesa_get_attrib_location(GLcontext *ctx, GLuint program,
- const GLchar *name);
-
-extern GLuint
-_mesa_get_handle(GLcontext *ctx, GLenum pname);
-
-extern void
-_mesa_get_programiv(GLcontext *ctx, GLuint program,
- GLenum pname, GLint *params);
-
-extern void
-_mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog);
-
-extern void
-_mesa_get_shaderiv(GLcontext *ctx, GLuint shader, GLenum pname, GLint *params);
-
-extern void
-_mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog);
-
-extern void
-_mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
- GLsizei *length, GLchar *sourceOut);
-
-extern void
-_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
- GLfloat *params);
-
-extern GLint
-_mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name);
-
-extern GLboolean
-_mesa_is_program(GLcontext *ctx, GLuint name);
-
-extern GLboolean
-_mesa_is_shader(GLcontext *ctx, GLuint name);
-
-extern void
-_mesa_link_program(GLcontext *ctx, GLuint program);
-
-extern void
-_mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source);
-
-extern void
-_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
- const GLvoid *values, GLenum type);
-
-void
-_mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
- GLenum matrixType, GLint location, GLsizei count,
- GLboolean transpose, const GLfloat *values);
-
extern void
_mesa_use_program(GLcontext *ctx, GLuint program);
+
extern void
-_mesa_validate_program(GLcontext *ctx, GLuint program);
+_mesa_init_glsl_driver_functions(struct dd_function_table *driver);
#endif /* SHADER_API_H */