Home | History | Annotate | Download | only in state_tracker
      1 /**************************************************************************
      2  *
      3  * Copyright 2010 VMware, Inc.
      4  * All Rights Reserved.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the
      8  * "Software"), to deal in the Software without restriction, including
      9  * without limitation the rights to use, copy, modify, merge, publish,
     10  * distribute, sub license, and/or sell copies of the Software, and to
     11  * permit persons to whom the Software is furnished to do so, subject to
     12  * the following conditions:
     13  *
     14  * The above copyright notice and this permission notice (including the
     15  * next paragraph) shall be included in all copies or substantial portions
     16  * of the Software.
     17  *
     18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
     21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
     22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     25  *
     26  **************************************************************************/
     27 
     28 #ifndef GALLIUM_RAW_H
     29 #define GALLIUM_RAW_H
     30 
     31 /* This is an API for exercising gallium functionality in a
     32  * platform-neutral fashion.  Whatever platform integration is
     33  * necessary to implement this interface is orchestrated by the
     34  * individual target building this entity.
     35  *
     36  * For instance, the graw-xlib target includes code to implent these
     37  * interfaces on top of the X window system.
     38  *
     39  * Programs using this interface may additionally benefit from some of
     40  * the utilities currently in the libgallium.a library, especially
     41  * those for parsing text representations of TGSI shaders.
     42  */
     43 
     44 #include "pipe/p_compiler.h"
     45 #include "pipe/p_format.h"
     46 
     47 struct pipe_context;
     48 struct pipe_screen;
     49 struct pipe_surface;
     50 
     51 /* Returns a handle to be used with flush_frontbuffer()/present().
     52  *
     53  * Query format support with screen::is_format_supported and usage
     54  * XXX.
     55  */
     56 PUBLIC struct pipe_screen *graw_create_window_and_screen( int x,
     57                                                           int y,
     58                                                           unsigned width,
     59                                                           unsigned height,
     60                                                           enum pipe_format format,
     61                                                           void **handle);
     62 
     63 PUBLIC void graw_set_display_func( void (*func)( void ) );
     64 PUBLIC void graw_main_loop( void );
     65 
     66 PUBLIC void *graw_parse_geometry_shader( struct pipe_context *pipe,
     67                                          const char *text );
     68 
     69 PUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe,
     70                                        const char *text );
     71 
     72 PUBLIC void *graw_parse_fragment_shader( struct pipe_context *pipe,
     73                                          const char *text );
     74 
     75 /* Parse a single command-line option, if any. Options include:
     76  *
     77  * -o <filename>
     78  *
     79  * If an option has been successfully parsed, argi is updated
     80  * to point just after the option and return TRUE.
     81  */
     82 PUBLIC boolean graw_parse_args(int *argi, int argc, char *argv[]);
     83 
     84 /* Saves surface contents to a file.
     85  *
     86  * If filename is NULL, the filename provided with the `-o' option
     87  * is used. If the option has not been specified, the surface
     88  * will not be saved.
     89  *
     90  * Returns TRUE if the surface has been saved.
     91  */
     92 PUBLIC boolean graw_save_surface_to_file(struct pipe_context *pipe,
     93                                          struct pipe_surface *surface,
     94                                          const char *filename);
     95 
     96 #endif
     97