cell_context.h

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
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 above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  * 
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  * 
00026  **************************************************************************/
00027 
00028 
00029 #ifndef CELL_CONTEXT_H
00030 #define CELL_CONTEXT_H
00031 
00032 
00033 #include "pipe/p_context.h"
00034 #include "pipe/p_defines.h"
00035 #include "draw/draw_vertex.h"
00036 #include "draw/draw_vbuf.h"
00037 #include "cell_winsys.h"
00038 #include "cell/common.h"
00039 #include "rtasm/rtasm_ppc_spe.h"
00040 #include "tgsi/tgsi_scan.h"
00041 
00042 
00043 struct cell_vbuf_render;
00044 
00045 
00049 struct cell_vertex_shader_state
00050 {
00051    struct pipe_shader_state shader;
00052    struct tgsi_shader_info info;
00053    void *draw_data;
00054 };
00055 
00056 
00060 struct cell_fragment_shader_state
00061 {
00062    struct pipe_shader_state shader;
00063    struct tgsi_shader_info info;
00064    struct spe_function code;
00065    void *data;
00066 };
00067 
00068 
00072 struct cell_blend_state
00073 {
00074    struct pipe_blend_state base;
00075 
00079    struct spe_function code;
00080 };
00081 
00082 
00087 struct cell_depth_stencil_alpha_state
00088 {
00089    struct pipe_depth_stencil_alpha_state base;
00090 
00094    struct spe_function code;
00095 };
00096 
00097 
00101 struct cell_context
00102 {
00103    struct pipe_context pipe;
00104 
00105    struct cell_winsys *winsys;
00106 
00107    const struct cell_blend_state *blend;
00108    const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
00109    uint num_samplers;
00110    const struct cell_depth_stencil_alpha_state   *depth_stencil;
00111    const struct pipe_rasterizer_state *rasterizer;
00112    const struct cell_vertex_shader_state *vs;
00113    const struct cell_fragment_shader_state *fs;
00114 
00115    struct spe_function logic_op;
00116 
00117    struct pipe_blend_color blend_color;
00118    struct pipe_clip_state clip;
00119    struct pipe_constant_buffer constants[2];
00120    struct pipe_framebuffer_state framebuffer;
00121    struct pipe_poly_stipple poly_stipple;
00122    struct pipe_scissor_state scissor;
00123    struct cell_texture *texture[PIPE_MAX_SAMPLERS];
00124    uint num_textures;
00125    struct pipe_viewport_state viewport;
00126    struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
00127    uint num_vertex_buffers;
00128    struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
00129    uint num_vertex_elements;
00130 
00131    ubyte *cbuf_map[PIPE_MAX_COLOR_BUFS];
00132    ubyte *zsbuf_map;
00133 
00134    struct pipe_surface *tex_surf;
00135    uint *tex_map;
00136 
00137    uint dirty;
00138 
00140    struct draw_context *draw;
00141    struct draw_stage *render_stage;
00142 
00144    struct cell_vbuf_render *vbuf_render;
00145    struct draw_stage *vbuf;
00146 
00147    struct vertex_info vertex_info;
00148 
00150    void *mapped_constants[PIPE_SHADER_TYPES];
00151 
00152 
00153    uint num_spus;
00154 
00156    uint buffer_size[CELL_NUM_BUFFERS];
00157    ubyte buffer[CELL_NUM_BUFFERS][CELL_BUFFER_SIZE] ALIGN16_ATTRIB;
00158 
00159    int cur_batch;  
00162    uint buffer_status[CELL_MAX_SPUS][CELL_NUM_BUFFERS][4] ALIGN16_ATTRIB;
00163 
00164 
00165    struct spe_function attrib_fetch;
00166    unsigned attrib_fetch_offsets[PIPE_MAX_ATTRIBS];
00167 
00168    unsigned debug_flags;
00169 };
00170 
00171 
00172 
00173 
00174 static INLINE struct cell_context *
00175 cell_context(struct pipe_context *pipe)
00176 {
00177    return (struct cell_context *) pipe;
00178 }
00179 
00180 
00181 extern struct pipe_context *
00182 cell_create_context(struct pipe_screen *screen, struct cell_winsys *cws);
00183 
00184 extern void
00185 cell_vertex_shader_queue_flush(struct draw_context *draw);
00186 
00187 
00188 /* XXX find a better home for this */
00189 extern void cell_update_vertex_fetch(struct draw_context *draw);
00190 
00191 
00192 #endif /* CELL_CONTEXT_H */

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