intel_winsys_softpipe.c

Go to the documentation of this file.
00001 /**************************************************************************
00002  *
00003  * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
00004  * All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
00017  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
00018  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
00019  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
00020  * USE OR OTHER DEALINGS IN THE SOFTWARE.
00021  *
00022  * The above copyright notice and this permission notice (including the
00023  * next paragraph) shall be included in all copies or substantial portions
00024  * of the Software.
00025  *
00026  *
00027  **************************************************************************/
00028 /*
00029  * Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
00030  */
00031 
00032 #include "intel_context.h"
00033 #include "intel_winsys_softpipe.h"
00034 #include "pipe/p_defines.h"
00035 #include "pipe/p_format.h"
00036 #include "util/u_memory.h"
00037 #include "softpipe/sp_winsys.h"
00038 
00039 
00040 struct intel_softpipe_winsys {
00041    struct softpipe_winsys sws;
00042    struct intel_context *intel;
00043 };
00044 
00048 static boolean
00049 intel_is_format_supported(struct softpipe_winsys *sws,
00050                           enum pipe_format format)
00051 {
00052    switch(format) {
00053    case PIPE_FORMAT_A8R8G8B8_UNORM:
00054    case PIPE_FORMAT_R5G6B5_UNORM:
00055    case PIPE_FORMAT_S8Z24_UNORM:
00056       return TRUE;
00057    default:
00058       return FALSE;
00059    }
00060 }
00061 
00062 
00066 struct pipe_context *
00067 intel_create_softpipe( struct intel_context *intel,
00068                        struct pipe_winsys *winsys )
00069 {
00070    struct intel_softpipe_winsys *isws = CALLOC_STRUCT( intel_softpipe_winsys );
00071    struct pipe_screen *screen = softpipe_create_screen(winsys);
00072 
00073    /* Fill in this struct with callbacks that softpipe will need to
00074     * communicate with the window system, buffer manager, etc.
00075     */
00076    isws->sws.is_format_supported = intel_is_format_supported;
00077    isws->intel = intel;
00078 
00079    /* Create the softpipe context:
00080     */
00081    return softpipe_create( screen, winsys, &isws->sws );
00082 }

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4