1848b8605Smrg/************************************************************************** 2848b8605Smrg * 3848b8605Smrg * Copyright 2010 VMware, Inc. 4848b8605Smrg * All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the 8848b8605Smrg * "Software"), to deal in the Software without restriction, including 9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to 11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to 12848b8605Smrg * the following conditions: 13848b8605Smrg * 14848b8605Smrg * The above copyright notice and this permission notice (including the 15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions 16848b8605Smrg * of the Software. 17848b8605Smrg * 18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25848b8605Smrg * 26848b8605Smrg **************************************************************************/ 27848b8605Smrg 28848b8605Smrg#ifndef GALLIUM_RAW_H 29848b8605Smrg#define GALLIUM_RAW_H 30848b8605Smrg 31848b8605Smrg/* This is an API for exercising gallium functionality in a 32848b8605Smrg * platform-neutral fashion. Whatever platform integration is 33848b8605Smrg * necessary to implement this interface is orchestrated by the 34848b8605Smrg * individual target building this entity. 35848b8605Smrg * 36b8e80941Smrg * For instance, the graw-xlib target includes code to implement these 37848b8605Smrg * interfaces on top of the X window system. 38848b8605Smrg * 39848b8605Smrg * Programs using this interface may additionally benefit from some of 40848b8605Smrg * the utilities currently in the libgallium.a library, especially 41848b8605Smrg * those for parsing text representations of TGSI shaders. 42848b8605Smrg */ 43848b8605Smrg 44848b8605Smrg#include "pipe/p_compiler.h" 45848b8605Smrg#include "pipe/p_format.h" 46848b8605Smrg 47848b8605Smrgstruct pipe_context; 48848b8605Smrgstruct pipe_screen; 49848b8605Smrgstruct pipe_surface; 50848b8605Smrg 51848b8605Smrg/* Returns a handle to be used with flush_frontbuffer()/present(). 52848b8605Smrg * 53848b8605Smrg * Query format support with screen::is_format_supported and usage 54848b8605Smrg * XXX. 55848b8605Smrg */ 56848b8605SmrgPUBLIC struct pipe_screen *graw_create_window_and_screen( int x, 57848b8605Smrg int y, 58848b8605Smrg unsigned width, 59848b8605Smrg unsigned height, 60848b8605Smrg enum pipe_format format, 61848b8605Smrg void **handle); 62848b8605Smrg 63848b8605SmrgPUBLIC void graw_set_display_func( void (*func)( void ) ); 64848b8605SmrgPUBLIC void graw_main_loop( void ); 65848b8605Smrg 66848b8605SmrgPUBLIC void *graw_parse_geometry_shader( struct pipe_context *pipe, 67848b8605Smrg const char *text ); 68848b8605Smrg 69848b8605SmrgPUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe, 70848b8605Smrg const char *text ); 71848b8605Smrg 72848b8605SmrgPUBLIC void *graw_parse_fragment_shader( struct pipe_context *pipe, 73848b8605Smrg const char *text ); 74848b8605Smrg 75848b8605Smrg/* Parse a single command-line option, if any. Options include: 76848b8605Smrg * 77848b8605Smrg * -o <filename> 78848b8605Smrg * 79848b8605Smrg * If an option has been successfully parsed, argi is updated 80848b8605Smrg * to point just after the option and return TRUE. 81848b8605Smrg */ 82848b8605SmrgPUBLIC boolean graw_parse_args(int *argi, int argc, char *argv[]); 83848b8605Smrg 84848b8605Smrg/* Saves surface contents to a file. 85848b8605Smrg * 86848b8605Smrg * If filename is NULL, the filename provided with the `-o' option 87848b8605Smrg * is used. If the option has not been specified, the surface 88848b8605Smrg * will not be saved. 89848b8605Smrg * 90848b8605Smrg * Returns TRUE if the surface has been saved. 91848b8605Smrg */ 92848b8605SmrgPUBLIC boolean graw_save_surface_to_file(struct pipe_context *pipe, 93848b8605Smrg struct pipe_surface *surface, 94848b8605Smrg const char *filename); 95848b8605Smrg 96848b8605Smrg#endif 97