st_program.h

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2003 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   * Authors:
00030   *   Keith Whitwell <keith@tungstengraphics.com>
00031   */
00032     
00033 
00034 #ifndef ST_PROGRAM_H
00035 #define ST_PROGRAM_H
00036 
00037 #include "main/mtypes.h"
00038 #include "shader/program.h"
00039 #include "pipe/p_shader_tokens.h"
00040 
00041 
00042 struct cso_fragment_shader;
00043 struct cso_vertex_shader;
00044 struct translated_vertex_program;
00045 
00046 
00050 struct st_fragment_program
00051 {
00052    struct gl_fragment_program Base;
00053    GLuint serialNo;
00054 
00055    GLuint input_to_slot[FRAG_ATTRIB_MAX];  
00056    GLuint num_input_slots;
00057 
00059    GLuint input_map[PIPE_MAX_SHADER_INPUTS];
00060 
00061    ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
00062    ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
00063 
00064    struct pipe_shader_state state;
00065    void *driver_shader;
00066 
00067    GLuint param_state;
00068 
00072    struct translated_vertex_program *vertex_programs;
00073 
00075    struct st_fragment_program *bitmap_program;
00076    uint bitmap_sampler;
00077 };
00078 
00079 
00083 struct st_vertex_program
00084 {
00085    struct gl_vertex_program Base;  
00086    GLuint serialNo;
00087 
00089    GLuint input_to_index[VERT_ATTRIB_MAX];
00091    GLuint index_to_input[PIPE_MAX_SHADER_INPUTS];
00092 
00093    GLuint num_inputs;
00094 
00095    struct pipe_shader_state state;
00096    void *driver_shader;
00097 
00099    struct draw_vertex_shader *draw_shader;
00100 
00101    GLuint param_state;
00102 };
00103 
00104 
00105 static INLINE struct st_fragment_program *
00106 st_fragment_program( struct gl_fragment_program *fp )
00107 {
00108    return (struct st_fragment_program *)fp;
00109 }
00110 
00111 
00112 static INLINE struct st_vertex_program *
00113 st_vertex_program( struct gl_vertex_program *vp )
00114 {
00115    return (struct st_vertex_program *)vp;
00116 }
00117 
00118 
00119 static INLINE void
00120 st_reference_vertprog(struct st_context *st,
00121                       struct st_vertex_program **ptr,
00122                       struct st_vertex_program *prog)
00123 {
00124    _mesa_reference_program(st->ctx,
00125                            (struct gl_program **) ptr,
00126                            (struct gl_program *) prog);
00127 }
00128 
00129 static INLINE void
00130 st_reference_fragprog(struct st_context *st,
00131                       struct st_fragment_program **ptr,
00132                       struct st_fragment_program *prog)
00133 {
00134    _mesa_reference_program(st->ctx,
00135                            (struct gl_program **) ptr,
00136                            (struct gl_program *) prog);
00137 }
00138 
00139 
00140 extern void
00141 st_translate_fragment_program(struct st_context *st,
00142                               struct st_fragment_program *fp,
00143                               const GLuint inputMapping[]);
00144 
00145 
00146 extern void
00147 st_translate_vertex_program(struct st_context *st,
00148                             struct st_vertex_program *vp,
00149                             const GLuint vert_output_to_slot[],
00150                             const ubyte *fs_input_semantic_name,
00151                             const ubyte *fs_input_semantic_index);
00152 
00153 
00154 extern void
00155 st_print_shaders(GLcontext *ctx);
00156 
00157 
00158 #endif

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