00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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