+ emit(p, "\n\n\n");
+
+ /* Mesa's program_parameter struct:
+ */
+ emit(p,
+ "struct program_parameter\n"
+ "{\n"
+ " const char *Name;\n"
+ " int Type;\n"
+ " int StateIndexes[6];\n"
+ " float Values[4];\n"
+ "};\n");
+
+
+ /* Texture samplers, not written yet:
+ */
+ emit(p, "extern void TEX( void *ctx, const float *txc, int unit, float *rslt );\n"
+ "extern void TXB( void *ctx, const float *txc, int unit, float *rslt );\n"
+ "extern void TXP( void *ctx, const float *txc, int unit, float *rslt );\n");
+
+ /* Resort to the standard math library (float versions):
+ */
+ emit(p, "extern float fabsf( float );\n"
+ "extern float cosf( float );\n"
+ "extern float sinf( float );\n"
+ "extern float expf( float );\n"
+ "extern float powf( float, float );\n"
+ "extern float floorf( float );\n");
+
+ /* These ones we have fast code in Mesa for:
+ */
+ emit(p, "extern float LOG2( float );\n"
+ "extern float _mesa_inv_sqrtf( float );\n");
+
+ /* The usual macros, not really needed, but handy:
+ */
+ emit(p, "#define MIN2(x,y) ((x)<(y)?(x):(y))\n"
+ "#define MAX2(x,y) ((x)<(y)?(x):(y))\n"
+ "#define SATURATE(x) ((x)>1.0?1.0:((x)<0.0?0.0:(x)))\n");
+
+ /* Our function!
+ */
+ emit(p, "int run_program( void *ctx, \n"
+ " const float (*local_param)[4], \n"
+ " const float (*env_param)[4], \n"
+ " const struct program_parameter *state_param, \n"
+ " const float (*interp)[4], \n"
+ " float (*outputs)[4])\n"