summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/arbprogram.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/arbprogram.c')
-rw-r--r--src/mesa/main/arbprogram.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index 3f7acda9f32..c0786d4230d 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -36,6 +36,7 @@
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/arbprogram.h"
+#include "main/shaderapi.h"
#include "program/arbprogparse.h"
#include "program/program.h"
#include "program/prog_print.h"
@@ -378,6 +379,27 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
}
fflush(stderr);
}
+
+ /* Capture vp-*.shader_test/fp-*.shader_test files. */
+ const char *capture_path = _mesa_get_shader_capture_path();
+ if (capture_path != NULL) {
+ FILE *file;
+ char filename[PATH_MAX];
+ const char *shader_type =
+ target == GL_FRAGMENT_PROGRAM_ARB ? "fragment" : "vertex";
+
+ _mesa_snprintf(filename, sizeof(filename), "%s/%cp-%u.shader_test",
+ capture_path, shader_type[0], base->Id);
+ file = fopen(filename, "w");
+ if (file) {
+ fprintf(file,
+ "[require]\nGL_ARB_%s_program\n\n[%s program]\n%s\n",
+ shader_type, shader_type, (const char *) string);
+ fclose(file);
+ } else {
+ _mesa_warning(ctx, "Failed to open %s", filename);
+ }
+ }
}