summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/atifragshader.c25
-rw-r--r--src/mesa/shader/atifragshader.h28
-rw-r--r--src/mesa/shader/prog_execute.c16
-rw-r--r--src/mesa/shader/shader_api.c19
4 files changed, 73 insertions, 15 deletions
diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c
index 870f77e30dc..21bb9589cb0 100644
--- a/src/mesa/shader/atifragshader.c
+++ b/src/mesa/shader/atifragshader.c
@@ -28,13 +28,36 @@
#include "main/macros.h"
#include "main/enums.h"
#include "main/mtypes.h"
+#include "main/dispatch.h"
#include "atifragshader.h"
+#if FEATURE_ATI_fragment_shader
+
#define MESA_DEBUG_ATI_FS 0
static struct ati_fragment_shader DummyShader;
+void
+_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp)
+{
+ SET_GenFragmentShadersATI(disp, _mesa_GenFragmentShadersATI);
+ SET_BindFragmentShaderATI(disp, _mesa_BindFragmentShaderATI);
+ SET_DeleteFragmentShaderATI(disp, _mesa_DeleteFragmentShaderATI);
+ SET_BeginFragmentShaderATI(disp, _mesa_BeginFragmentShaderATI);
+ SET_EndFragmentShaderATI(disp, _mesa_EndFragmentShaderATI);
+ SET_PassTexCoordATI(disp, _mesa_PassTexCoordATI);
+ SET_SampleMapATI(disp, _mesa_SampleMapATI);
+ SET_ColorFragmentOp1ATI(disp, _mesa_ColorFragmentOp1ATI);
+ SET_ColorFragmentOp2ATI(disp, _mesa_ColorFragmentOp2ATI);
+ SET_ColorFragmentOp3ATI(disp, _mesa_ColorFragmentOp3ATI);
+ SET_AlphaFragmentOp1ATI(disp, _mesa_AlphaFragmentOp1ATI);
+ SET_AlphaFragmentOp2ATI(disp, _mesa_AlphaFragmentOp2ATI);
+ SET_AlphaFragmentOp3ATI(disp, _mesa_AlphaFragmentOp3ATI);
+ SET_SetFragmentShaderConstantATI(disp, _mesa_SetFragmentShaderConstantATI);
+}
+
+
/**
* Allocate and initialize a new ATI fragment shader object.
*/
@@ -767,3 +790,5 @@ _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value)
COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value);
}
}
+
+#endif /* FEATURE_ATI_fragment_shader */
diff --git a/src/mesa/shader/atifragshader.h b/src/mesa/shader/atifragshader.h
index e1dc20e6065..31c335ec815 100644
--- a/src/mesa/shader/atifragshader.h
+++ b/src/mesa/shader/atifragshader.h
@@ -60,6 +60,11 @@ struct atifs_setupinst
};
+#if FEATURE_ATI_fragment_shader
+
+extern void
+_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp);
+
extern struct ati_fragment_shader *
_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id);
@@ -120,4 +125,25 @@ _mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
extern void GLAPIENTRY
_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value);
-#endif
+#else /* FEATURE_ATI_fragment_shader */
+
+static INLINE void
+_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp)
+{
+}
+
+static INLINE struct ati_fragment_shader *
+_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id)
+{
+ return NULL;
+}
+
+static INLINE void
+_mesa_delete_ati_fragment_shader(GLcontext *ctx,
+ struct ati_fragment_shader *s)
+{
+}
+
+#endif /* FEATURE_ATI_fragment_shader */
+
+#endif /* ATIFRAGSHADER_H */
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 0067512cfb2..f85c6513f31 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -762,7 +762,7 @@ _mesa_execute_program(GLcontext * ctx,
GLfloat a[4], result[4];
fetch_vector1(&inst->SrcReg[0], machine, a);
result[0] = result[1] = result[2] = result[3]
- = (GLfloat) _mesa_cos(a[0]);
+ = (GLfloat) cos(a[0]);
store_vector4(inst, machine, result);
}
break;
@@ -876,7 +876,7 @@ _mesa_execute_program(GLcontext * ctx,
* result.z = result.x * APPX(result.y)
* We do what the ARB extension says.
*/
- q[2] = (GLfloat) _mesa_pow(2.0, t[0]);
+ q[2] = (GLfloat) pow(2.0, t[0]);
}
q[1] = t[0] - floor_t0;
q[3] = 1.0F;
@@ -887,7 +887,7 @@ _mesa_execute_program(GLcontext * ctx,
{
GLfloat a[4], result[4], val;
fetch_vector1(&inst->SrcReg[0], machine, a);
- val = (GLfloat) _mesa_pow(2.0, a[0]);
+ val = (GLfloat) pow(2.0, a[0]);
/*
if (IS_INF_OR_NAN(val))
val = 1.0e10;
@@ -1009,7 +1009,7 @@ _mesa_execute_program(GLcontext * ctx,
if (a[1] == 0.0 && a[3] == 0.0)
result[2] = 1.0F;
else
- result[2] = (GLfloat) _mesa_pow(a[1], a[3]);
+ result[2] = (GLfloat) pow(a[1], a[3]);
}
else {
result[2] = 0.0F;
@@ -1336,7 +1336,7 @@ _mesa_execute_program(GLcontext * ctx,
fetch_vector1(&inst->SrcReg[0], machine, a);
fetch_vector1(&inst->SrcReg[1], machine, b);
result[0] = result[1] = result[2] = result[3]
- = (GLfloat) _mesa_pow(a[0], b[0]);
+ = (GLfloat) pow(a[0], b[0]);
store_vector4(inst, machine, result);
}
break;
@@ -1393,8 +1393,8 @@ _mesa_execute_program(GLcontext * ctx,
{
GLfloat a[4], result[4];
fetch_vector1(&inst->SrcReg[0], machine, a);
- result[0] = (GLfloat) _mesa_cos(a[0]);
- result[1] = (GLfloat) _mesa_sin(a[0]);
+ result[0] = (GLfloat) cos(a[0]);
+ result[1] = (GLfloat) sin(a[0]);
result[2] = 0.0; /* undefined! */
result[3] = 0.0; /* undefined! */
store_vector4(inst, machine, result);
@@ -1465,7 +1465,7 @@ _mesa_execute_program(GLcontext * ctx,
GLfloat a[4], result[4];
fetch_vector1(&inst->SrcReg[0], machine, a);
result[0] = result[1] = result[2] = result[3]
- = (GLfloat) _mesa_sin(a[0]);
+ = (GLfloat) sin(a[0]);
store_vector4(inst, machine, result);
}
break;
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 4ff032d4ec8..f47f213ac84 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1517,12 +1517,14 @@ static void
_mesa_link_program(GLcontext *ctx, GLuint program)
{
struct gl_shader_program *shProg;
+ struct gl_transform_feedback_object *obj =
+ ctx->TransformFeedback.CurrentObject;
shProg = _mesa_lookup_shader_program_err(ctx, program, "glLinkProgram");
if (!shProg)
return;
- if (ctx->TransformFeedback.Active && shProg == ctx->Shader.CurrentProgram) {
+ if (obj->Active && shProg == ctx->Shader.CurrentProgram) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glLinkProgram(transform feedback active");
return;
@@ -1591,8 +1593,10 @@ void
_mesa_use_program(GLcontext *ctx, GLuint program)
{
struct gl_shader_program *shProg;
+ struct gl_transform_feedback_object *obj =
+ ctx->TransformFeedback.CurrentObject;
- if (ctx->TransformFeedback.Active) {
+ if (obj->Active) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUseProgram(transform feedback active)");
return;
@@ -1749,7 +1753,8 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
/* check that the sampler (tex unit index) is legal */
if (texUnit >= ctx->Const.MaxTextureImageUnits) {
_mesa_error(ctx, GL_INVALID_VALUE,
- "glUniform1(invalid sampler/tex unit index)");
+ "glUniform1(invalid sampler/tex unit index for '%s')",
+ param->Name);
return;
}
@@ -1797,7 +1802,8 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
/* non-array: count must be at most one; count == 0 is handled by the loop below */
if (count > 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glUniform(uniform is not an array)");
+ "glUniform(uniform '%s' is not an array)",
+ param->Name);
return;
}
}
@@ -1860,14 +1866,15 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
return; /* The standard specifies this as a no-op */
if (location < -1) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location)");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location=%d)",
+ location);
return;
}
split_location_offset(&location, &offset);
if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location)");
+ _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location=%d)", location);
return;
}