198ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca/**************************************************************************
298ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca *
398ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * Copyright 2010 VMware, Inc.
498ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * All Rights Reserved.
598ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca *
698ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * Permission is hereby granted, free of charge, to any person obtaining a
798ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * copy of this software and associated documentation files (the
898ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * "Software"), to deal in the Software without restriction, including
998ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * without limitation the rights to use, copy, modify, merge, publish,
1098ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * distribute, sub license, and/or sell copies of the Software, and to
1198ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * permit persons to whom the Software is furnished to do so, subject to
1298ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * the following conditions:
1398ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca *
1498ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * The above copyright notice and this permission notice (including the
1598ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * next paragraph) shall be included in all copies or substantial portions
1698ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * of the Software.
1798ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca *
1898ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1998ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2098ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
2198ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
2298ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
2398ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2498ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2598ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca *
2698ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca **************************************************************************/
2798ccee9ea6bd5841784d006fb7cdbbc34895f18bJosé Fonseca
28db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell#ifndef GALLIUM_RAW_H
29db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell#define GALLIUM_RAW_H
30db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell
31db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell/* This is an API for exercising gallium functionality in a
32db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * platform-neutral fashion.  Whatever platform integration is
33db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * necessary to implement this interface is orchestrated by the
34db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * individual target building this entity.
35db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell *
36db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * For instance, the graw-xlib target includes code to implent these
37db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * interfaces on top of the X window system.
38db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell *
39db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * Programs using this interface may additionally benefit from some of
40db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * the utilities currently in the libgallium.a library, especially
41db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * those for parsing text representations of TGSI shaders.
42db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell */
43db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell
441b83ede8cc68c01eaade6ceffab00cef5a1fb2dfVinson Lee#include "pipe/p_compiler.h"
45db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell#include "pipe/p_format.h"
46db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell
477375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith Whitwellstruct pipe_context;
48ef6967ddc201be6c400701703dd0774570d5bfeeVinson Leestruct pipe_screen;
49ef6967ddc201be6c400701703dd0774570d5bfeeVinson Leestruct pipe_surface;
50db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell
51db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell/* Returns a handle to be used with flush_frontbuffer()/present().
52db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell *
53db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * Query format support with screen::is_format_supported and usage
54db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell * XXX.
55db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell */
5615321a55e541c3209be6636ea467695a0bc6d55dKeith WhitwellPUBLIC struct pipe_screen *graw_create_window_and_screen( int x,
5715321a55e541c3209be6636ea467695a0bc6d55dKeith Whitwell                                                          int y,
5815321a55e541c3209be6636ea467695a0bc6d55dKeith Whitwell                                                          unsigned width,
5915321a55e541c3209be6636ea467695a0bc6d55dKeith Whitwell                                                          unsigned height,
6015321a55e541c3209be6636ea467695a0bc6d55dKeith Whitwell                                                          enum pipe_format format,
6115321a55e541c3209be6636ea467695a0bc6d55dKeith Whitwell                                                          void **handle);
62db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell
637375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith WhitwellPUBLIC void graw_set_display_func( void (*func)( void ) );
647375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith WhitwellPUBLIC void graw_main_loop( void );
657375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith Whitwell
669d343f4ba18e506942a9c1f70f0ccae1309d7eceKeith WhitwellPUBLIC void *graw_parse_geometry_shader( struct pipe_context *pipe,
679d343f4ba18e506942a9c1f70f0ccae1309d7eceKeith Whitwell                                         const char *text );
689d343f4ba18e506942a9c1f70f0ccae1309d7eceKeith Whitwell
697375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith WhitwellPUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe,
707375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith Whitwell                                       const char *text );
717375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith Whitwell
727375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith WhitwellPUBLIC void *graw_parse_fragment_shader( struct pipe_context *pipe,
737375d7a5c9d5c32fd6bdde0cc8cab8fe41415964Keith Whitwell                                         const char *text );
74db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell
75136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol/* Parse a single command-line option, if any. Options include:
76136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol *
77136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol * -o <filename>
78136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol *
79136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol * If an option has been successfully parsed, argi is updated
80136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol * to point just after the option and return TRUE.
81136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol */
82136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal KrolPUBLIC boolean graw_parse_args(int *argi, int argc, char *argv[]);
83136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol
84136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol/* Saves surface contents to a file.
85136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol *
86136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol * If filename is NULL, the filename provided with the `-o' option
87136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol * is used. If the option has not been specified, the surface
88136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol * will not be saved.
89136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol *
90136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol * Returns TRUE if the surface has been saved.
91136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol */
92136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal KrolPUBLIC boolean graw_save_surface_to_file(struct pipe_context *pipe,
93136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol                                         struct pipe_surface *surface,
94136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol                                         const char *filename);
95136ff67ce8a626e628dd76aeb7feba8cf9436cd7Michal Krol
96db5c2235d1accc2adcf1746aec2342bfa67237baKeith Whitwell#endif
97