st_program.h revision c0bb4ba9e665e40a325d82aa2ee48d7b8abd603b
18e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell/**************************************************************************
28e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
38e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
48e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * All Rights Reserved.
58e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
68e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
78e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * copy of this software and associated documentation files (the
88e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * "Software"), to deal in the Software without restriction, including
98e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to
128e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * the following conditions:
138e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * The above copyright notice and this permission notice (including the
158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * next paragraph) shall be included in all copies or substantial portions
168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * of the Software.
178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
208e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
218e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
248e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell **************************************************************************/
278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
288e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell /*
298e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell  * Authors:
308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell  *   Keith Whitwell <keith@tungstengraphics.com>
318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell  */
328e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
338e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
348e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#ifndef ST_PROGRAM_H
358e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define ST_PROGRAM_H
368e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
374824c342c864e870251a7d343c95e51274e50d23Keith Whitwell#include "mtypes.h"
384824c342c864e870251a7d343c95e51274e50d23Keith Whitwell#include "pipe/tgsi/core/tgsi_token.h"
394824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
404824c342c864e870251a7d343c95e51274e50d23Keith Whitwell#define ST_FP_MAX_TOKENS 1024
414824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
424824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
438e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwellstruct st_fragment_program
448e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell{
458e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   struct gl_fragment_program Base;
468e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLboolean error;             /* If program is malformed for any reason. */
478e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
488e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint    id;		/* String id, for tracking
498e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell				 * ProgramStringNotify changes.
508e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell				 */
518e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
524824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
534824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   struct tgsi_token tokens[ST_FP_MAX_TOKENS];
544824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLboolean dirty;
554824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#if 0
578e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLfloat (*cbuffer)[4];
588e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint nr_constants;
598e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
608e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   /* Translate all the parameters, etc, into a constant buffer which
618e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell    * we update on state changes.
628e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell    */
638e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   struct
648e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   {
658e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell      GLuint reg;               /* Constant idx */
668e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell      const GLfloat *values;    /* Pointer to tracked values */
678e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   } *param;
688e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint nr_params;
694824c342c864e870251a7d343c95e51274e50d23Keith Whitwell#endif
708e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
718e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint param_state;
728e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
738e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
748e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
754824c342c864e870251a7d343c95e51274e50d23Keith Whitwellstruct st_vertex_program
764824c342c864e870251a7d343c95e51274e50d23Keith Whitwell{
774824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   struct gl_vertex_program Base;
784824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLboolean error;             /* If program is malformed for any reason. */
794824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
804824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLuint    id;		/* String id, for tracking
814824c342c864e870251a7d343c95e51274e50d23Keith Whitwell				 * ProgramStringNotify changes.
824824c342c864e870251a7d343c95e51274e50d23Keith Whitwell				 */
834824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
84de653b4c9bddcec46f3ddf411ec082dd178d7b38Brian   struct tgsi_token tokens[ST_FP_MAX_TOKENS];
854824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLboolean dirty;
86c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian#if 0
87de653b4c9bddcec46f3ddf411ec082dd178d7b38Brian   struct pipe_constant_buffer constants;
88c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian#endif
894824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLuint param_state;
904824c342c864e870251a7d343c95e51274e50d23Keith Whitwell};
914824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
926da9234fd437f97267e7831f034c78b31156d939Brian
936da9234fd437f97267e7831f034c78b31156d939Brianextern void st_init_program_functions(struct dd_function_table *functions);
946da9234fd437f97267e7831f034c78b31156d939Brian
958e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
964824c342c864e870251a7d343c95e51274e50d23Keith Whitwellstatic inline struct st_fragment_program *
974824c342c864e870251a7d343c95e51274e50d23Keith Whitwellst_fragment_program( struct gl_fragment_program *fp )
984824c342c864e870251a7d343c95e51274e50d23Keith Whitwell{
994824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   return (struct st_fragment_program *)fp;
1004824c342c864e870251a7d343c95e51274e50d23Keith Whitwell}
1014824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
1024824c342c864e870251a7d343c95e51274e50d23Keith Whitwellstatic inline struct st_vertex_program *
1034824c342c864e870251a7d343c95e51274e50d23Keith Whitwellst_vertex_program( struct gl_vertex_program *vp )
1044824c342c864e870251a7d343c95e51274e50d23Keith Whitwell{
1054824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   return (struct st_vertex_program *)vp;
1064824c342c864e870251a7d343c95e51274e50d23Keith Whitwell}
1074824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
1088e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif
109