From c26751447011a713924b9163a1e0b44fd39c6b1c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 14 May 2010 12:10:09 +0100 Subject: graw: split util code into new file --- src/gallium/targets/graw-xlib/SConscript | 1 + src/gallium/targets/graw-xlib/graw_util.c | 36 +++++++++++++++++++++++++++++++ src/gallium/targets/graw-xlib/graw_xlib.c | 31 -------------------------- 3 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 src/gallium/targets/graw-xlib/graw_util.c (limited to 'src/gallium/targets/graw-xlib') diff --git a/src/gallium/targets/graw-xlib/SConscript b/src/gallium/targets/graw-xlib/SConscript index ad84841922..40332fa4e1 100644 --- a/src/gallium/targets/graw-xlib/SConscript +++ b/src/gallium/targets/graw-xlib/SConscript @@ -25,6 +25,7 @@ env.Append(CPPPATH = [ sources = [ 'graw_xlib.c', + 'graw_util.c', ] if True: diff --git a/src/gallium/targets/graw-xlib/graw_util.c b/src/gallium/targets/graw-xlib/graw_util.c new file mode 100644 index 0000000000..147532cdee --- /dev/null +++ b/src/gallium/targets/graw-xlib/graw_util.c @@ -0,0 +1,36 @@ + +#include "pipe/p_compiler.h" +#include "pipe/p_context.h" +#include "tgsi/tgsi_text.h" +#include "util/u_memory.h" +#include "state_tracker/graw.h" + + +/* Helper functions. These are the same for all graw implementations. + */ +void *graw_parse_vertex_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_vs_state(pipe, &state); +} + +void *graw_parse_fragment_shader(struct pipe_context *pipe, + const char *text) +{ + struct tgsi_token tokens[1024]; + struct pipe_shader_state state; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) + return NULL; + + state.tokens = tokens; + return pipe->create_fs_state(pipe, &state); +} + diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c index d0e3e4bdd6..c9a850136a 100644 --- a/src/gallium/targets/graw-xlib/graw_xlib.c +++ b/src/gallium/targets/graw-xlib/graw_xlib.c @@ -2,7 +2,6 @@ #include "pipe/p_context.h" #include "util/u_debug.h" #include "util/u_memory.h" -#include "tgsi/tgsi_text.h" #include "target-helpers/wrap_screen.h" #include "state_tracker/xlib_sw_winsys.h" @@ -198,33 +197,3 @@ graw_main_loop( void ) } } - - -/* Helper functions. These are the same for all graw implementations. - */ -void *graw_parse_vertex_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[1024]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, Elements(tokens))) - return NULL; - - state.tokens = tokens; - return pipe->create_vs_state(pipe, &state); -} - -void *graw_parse_fragment_shader(struct pipe_context *pipe, - const char *text) -{ - struct tgsi_token tokens[1024]; - struct pipe_shader_state state; - - if (!tgsi_text_translate(text, tokens, Elements(tokens))) - return NULL; - - state.tokens = tokens; - return pipe->create_fs_state(pipe, &state); -} - -- cgit v1.2.3