From 90437330e2886fcd351dd11ee0e5aa3e8b523fdc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 26 Aug 2010 11:37:42 +0100 Subject: graw: Undo late loading of graw drivers. Keith prefers a clean separation between graw applications and implementations, where apps do not link libgallium.a but instead get all functionality they need via graw interface. Although this is not incompatible with late loading of graw drivers, it it would make it very hard to maintain, as wrappers for every utility symbol exposed in graw would have to be written or generated somehow. --- src/gallium/targets/graw-xlib/SConscript | 1 + src/gallium/targets/graw-xlib/graw_util.c | 50 +++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) 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 32b98cdef3..21fce948f4 100644 --- a/src/gallium/targets/graw-xlib/SConscript +++ b/src/gallium/targets/graw-xlib/SConscript @@ -26,6 +26,7 @@ env.Append(CPPPATH = [ sources = [ 'graw_xlib.c', + 'graw_util.c', ] env.Tool('x11') 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..fc7c9ae6f9 --- /dev/null +++ b/src/gallium/targets/graw-xlib/graw_util.c @@ -0,0 +1,50 @@ + +#include "pipe/p_compiler.h" +#include "pipe/p_context.h" +#include "pipe/p_state.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_geometry_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_gs_state(pipe, &state); +} + +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