2
#include "pipe/p_compiler.h"
3
#include "pipe/p_context.h"
4
#include "pipe/p_shader_tokens.h"
5
#include "pipe/p_state.h"
6
#include "tgsi/tgsi_text.h"
7
#include "util/u_debug.h"
8
#include "util/u_debug_image.h"
9
#include "util/u_memory.h"
10
#include "frontend/graw.h"
13
/* Helper functions. These are the same for all graw implementations.
16
graw_parse_geometry_shader(struct pipe_context *pipe,
19
struct tgsi_token tokens[1024];
20
struct pipe_shader_state state;
22
if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens)))
25
memset(&state, 0, sizeof state);
26
state.tokens = tokens;
27
return pipe->create_gs_state(pipe, &state);
31
graw_parse_vertex_shader(struct pipe_context *pipe,
34
struct tgsi_token tokens[1024];
35
struct pipe_shader_state state;
37
if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens)))
40
memset(&state, 0, sizeof state);
41
state.tokens = tokens;
42
return pipe->create_vs_state(pipe, &state);
46
graw_parse_fragment_shader(struct pipe_context *pipe,
49
struct tgsi_token tokens[1024];
50
struct pipe_shader_state state;
52
if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens)))
55
memset(&state, 0, sizeof state);
56
state.tokens = tokens;
57
return pipe->create_fs_state(pipe, &state);
60
static char out_filename[256] = "";
63
graw_parse_args(int *argi,
67
if (strcmp(argv[*argi], "-o") == 0) {
68
if (*argi + 1 >= argc) {
72
strncpy(out_filename, argv[*argi + 1], sizeof(out_filename) - 1);
73
out_filename[sizeof(out_filename) - 1] = '\0';
82
graw_save_surface_to_file(struct pipe_context *pipe,
83
struct pipe_surface *surface,
86
if (!filename || !*filename) {
87
filename = out_filename;
88
if (!filename || !*filename) {
93
/* XXX: Make that working in release builds.
95
debug_dump_surface_bmp(pipe, filename, surface);