spu_exec.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 #if !defined SPU_EXEC_H
00029 #define SPU_EXEC_H
00030 
00031 #include "pipe/p_compiler.h"
00032 #include "tgsi/tgsi_exec.h"
00033 
00034 #if defined __cplusplus
00035 extern "C" {
00036 #endif
00037 
00041 union spu_exec_channel
00042 {
00043    float    f[QUAD_SIZE];
00044    int      i[QUAD_SIZE];
00045    unsigned u[QUAD_SIZE];
00046    qword    q;
00047 };
00048 
00052 struct spu_exec_vector
00053 {
00054    union spu_exec_channel xyzw[NUM_CHANNELS];
00055 };
00056 
00061 struct spu_interp_coef
00062 {
00063    float a0[NUM_CHANNELS];      /* in an xyzw layout */
00064    float dadx[NUM_CHANNELS];
00065    float dady[NUM_CHANNELS];
00066 };
00067 
00068 
00069 struct softpipe_tile_cache;  
00075 struct spu_sampler
00076 {
00077    const struct pipe_sampler_state *state;
00078    struct pipe_texture *texture;
00080    void (*get_samples)(struct spu_sampler *sampler,
00081                        const float s[QUAD_SIZE],
00082                        const float t[QUAD_SIZE],
00083                        const float p[QUAD_SIZE],
00084                        float lodbias,
00085                        float rgba[NUM_CHANNELS][QUAD_SIZE]);
00086    void *pipe; /*XXX temporary*/
00087    struct softpipe_tile_cache *cache;
00088 };
00089 
00090 
00094 struct spu_exec_machine
00095 {
00096    /*
00097     * 32 program temporaries
00098     * 4  internal temporaries
00099     * 1  address
00100     */
00101    struct spu_exec_vector       Temps[TGSI_EXEC_NUM_TEMPS 
00102                                       + TGSI_EXEC_NUM_TEMP_EXTRAS + 1]
00103        ALIGN16_ATTRIB;
00104 
00105    struct spu_exec_vector       *Addrs;
00106 
00107    struct spu_sampler           *Samplers;
00108 
00109    float                         Imms[TGSI_EXEC_NUM_IMMEDIATES][4];
00110    unsigned                      ImmLimit;
00111    float                         (*Consts)[4];
00112    struct spu_exec_vector       *Inputs;
00113    struct spu_exec_vector       *Outputs;
00114    unsigned                      Processor;
00115 
00116    /* GEOMETRY processor only. */
00117    unsigned                      *Primitives;
00118 
00119    /* FRAGMENT processor only. */
00120    const struct spu_interp_coef *InterpCoefs;
00121    struct spu_exec_vector       QuadPos;
00122 
00123    /* Conditional execution masks */
00124    uint CondMask;  
00125    uint LoopMask;  
00126    uint ContMask;  
00127    uint FuncMask;  
00128    uint ExecMask;  
00131    uint CondStack[TGSI_EXEC_MAX_COND_NESTING];
00132    int CondStackTop;
00133 
00135    uint LoopStack[TGSI_EXEC_MAX_LOOP_NESTING];
00136    int LoopStackTop;
00137 
00139    uint ContStack[TGSI_EXEC_MAX_LOOP_NESTING];
00140    int ContStackTop;
00141 
00143    uint FuncStack[TGSI_EXEC_MAX_CALL_NESTING];
00144    int FuncStackTop;
00145 
00147    uint CallStack[TGSI_EXEC_MAX_CALL_NESTING];
00148    int CallStackTop;
00149 
00150    struct tgsi_full_instruction *Instructions;
00151    uint NumInstructions;
00152 
00153    struct tgsi_full_declaration *Declarations;
00154    uint NumDeclarations;
00155 };
00156 
00157 
00158 extern void
00159 spu_exec_machine_init(struct spu_exec_machine *mach,
00160                       uint numSamplers,
00161                       struct spu_sampler *samplers,
00162                       unsigned processor);
00163 
00164 extern uint
00165 spu_exec_machine_run( struct spu_exec_machine *mach );
00166 
00167 
00168 #if defined __cplusplus
00169 } /* extern "C" */
00170 #endif
00171 
00172 #endif /* SPU_EXEC_H */

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