17ec681f3Smrg/**************************************************************************
27ec681f3Smrg *
37ec681f3Smrg * Copyright 2010 VMware, Inc.
47ec681f3Smrg * All Rights Reserved.
57ec681f3Smrg *
67ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
77ec681f3Smrg * copy of this software and associated documentation files (the
87ec681f3Smrg * "Software"), to deal in the Software without restriction, including
97ec681f3Smrg * without limitation the rights to use, copy, modify, merge, publish,
107ec681f3Smrg * distribute, sub license, and/or sell copies of the Software, and to
117ec681f3Smrg * permit persons to whom the Software is furnished to do so, subject to
127ec681f3Smrg * the following conditions:
137ec681f3Smrg *
147ec681f3Smrg * The above copyright notice and this permission notice (including the
157ec681f3Smrg * next paragraph) shall be included in all copies or substantial portions
167ec681f3Smrg * of the Software.
177ec681f3Smrg *
187ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
197ec681f3Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
207ec681f3Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
217ec681f3Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
227ec681f3Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
237ec681f3Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
247ec681f3Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
257ec681f3Smrg *
267ec681f3Smrg **************************************************************************/
277ec681f3Smrg
287ec681f3Smrg#ifndef GALLIUM_RAW_H
297ec681f3Smrg#define GALLIUM_RAW_H
307ec681f3Smrg
317ec681f3Smrg/* This is an API for exercising gallium functionality in a
327ec681f3Smrg * platform-neutral fashion.  Whatever platform integration is
337ec681f3Smrg * necessary to implement this interface is orchestrated by the
347ec681f3Smrg * individual target building this entity.
357ec681f3Smrg *
367ec681f3Smrg * For instance, the graw-xlib target includes code to implement these
377ec681f3Smrg * interfaces on top of the X window system.
387ec681f3Smrg *
397ec681f3Smrg * Programs using this interface may additionally benefit from some of
407ec681f3Smrg * the utilities currently in the libgallium.a library, especially
417ec681f3Smrg * those for parsing text representations of TGSI shaders.
427ec681f3Smrg */
437ec681f3Smrg
447ec681f3Smrg#include "pipe/p_compiler.h"
457ec681f3Smrg#include "pipe/p_format.h"
467ec681f3Smrg
477ec681f3Smrgstruct pipe_context;
487ec681f3Smrgstruct pipe_screen;
497ec681f3Smrgstruct pipe_surface;
507ec681f3Smrg
517ec681f3Smrg/* Returns a handle to be used with flush_frontbuffer()/present().
527ec681f3Smrg *
537ec681f3Smrg * Query format support with screen::is_format_supported and usage
547ec681f3Smrg * XXX.
557ec681f3Smrg */
567ec681f3SmrgPUBLIC struct pipe_screen *graw_create_window_and_screen( int x,
577ec681f3Smrg                                                          int y,
587ec681f3Smrg                                                          unsigned width,
597ec681f3Smrg                                                          unsigned height,
607ec681f3Smrg                                                          enum pipe_format format,
617ec681f3Smrg                                                          void **handle);
627ec681f3Smrg
637ec681f3SmrgPUBLIC void graw_set_display_func( void (*func)( void ) );
647ec681f3SmrgPUBLIC void graw_main_loop( void );
657ec681f3Smrg
667ec681f3SmrgPUBLIC void *graw_parse_geometry_shader( struct pipe_context *pipe,
677ec681f3Smrg                                         const char *text );
687ec681f3Smrg
697ec681f3SmrgPUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe,
707ec681f3Smrg                                       const char *text );
717ec681f3Smrg
727ec681f3SmrgPUBLIC void *graw_parse_fragment_shader( struct pipe_context *pipe,
737ec681f3Smrg                                         const char *text );
747ec681f3Smrg
757ec681f3Smrg/* Parse a single command-line option, if any. Options include:
767ec681f3Smrg *
777ec681f3Smrg * -o <filename>
787ec681f3Smrg *
797ec681f3Smrg * If an option has been successfully parsed, argi is updated
807ec681f3Smrg * to point just after the option and return TRUE.
817ec681f3Smrg */
827ec681f3SmrgPUBLIC bool graw_parse_args(int *argi, int argc, char *argv[]);
837ec681f3Smrg
847ec681f3Smrg/* Saves surface contents to a file.
857ec681f3Smrg *
867ec681f3Smrg * If filename is NULL, the filename provided with the `-o' option
877ec681f3Smrg * is used. If the option has not been specified, the surface
887ec681f3Smrg * will not be saved.
897ec681f3Smrg *
907ec681f3Smrg * Returns TRUE if the surface has been saved.
917ec681f3Smrg */
927ec681f3SmrgPUBLIC bool graw_save_surface_to_file(struct pipe_context *pipe,
937ec681f3Smrg                                      struct pipe_surface *surface,
947ec681f3Smrg                                      const char *filename);
957ec681f3Smrg
967ec681f3Smrg#endif
97