st_program.h revision 4fd7bc00f06a98e1db2ad886a13566f19895e3c0
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"
38c89502bb4e6d80182e4977ab084639850e1eba68Keith Whitwell#include "pipe/tgsi/exec/tgsi_token.h"
394fd7bc00f06a98e1db2ad886a13566f19895e3c0michal#include "x86/rtasm/x86sse.h"
404824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
414824c342c864e870251a7d343c95e51274e50d23Keith Whitwell#define ST_FP_MAX_TOKENS 1024
424824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
434824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
448e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwellstruct st_fragment_program
458e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell{
468e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   struct gl_fragment_program Base;
478e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLboolean error;             /* If program is malformed for any reason. */
488e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
498e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint    id;		/* String id, for tracking
508e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell				 * ProgramStringNotify changes.
518e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell				 */
528e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
534824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
544824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   struct tgsi_token tokens[ST_FP_MAX_TOKENS];
554824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLboolean dirty;
564824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
578e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#if 0
588e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLfloat (*cbuffer)[4];
598e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint nr_constants;
608e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
618e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   /* Translate all the parameters, etc, into a constant buffer which
628e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell    * we update on state changes.
638e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell    */
648e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   struct
658e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   {
668e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell      GLuint reg;               /* Constant idx */
678e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell      const GLfloat *values;    /* Pointer to tracked values */
688e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   } *param;
698e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint nr_params;
704824c342c864e870251a7d343c95e51274e50d23Keith Whitwell#endif
718e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
728e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell   GLuint param_state;
738e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell};
748e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
758e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
764824c342c864e870251a7d343c95e51274e50d23Keith Whitwellstruct st_vertex_program
774824c342c864e870251a7d343c95e51274e50d23Keith Whitwell{
784824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   struct gl_vertex_program Base;
794824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLboolean error;             /* If program is malformed for any reason. */
804824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
814824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLuint    id;		/* String id, for tracking
824824c342c864e870251a7d343c95e51274e50d23Keith Whitwell				 * ProgramStringNotify changes.
834824c342c864e870251a7d343c95e51274e50d23Keith Whitwell				 */
844824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
85de653b4c9bddcec46f3ddf411ec082dd178d7b38Brian   struct tgsi_token tokens[ST_FP_MAX_TOKENS];
864824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLboolean dirty;
874fd7bc00f06a98e1db2ad886a13566f19895e3c0michal
884fd7bc00f06a98e1db2ad886a13566f19895e3c0michal#if defined(USE_X86_ASM) || defined(SLANG_X86)
894fd7bc00f06a98e1db2ad886a13566f19895e3c0michal   struct x86_function  sse2_program;
904fd7bc00f06a98e1db2ad886a13566f19895e3c0michal#endif
914fd7bc00f06a98e1db2ad886a13566f19895e3c0michal
92c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian#if 0
93de653b4c9bddcec46f3ddf411ec082dd178d7b38Brian   struct pipe_constant_buffer constants;
94c0bb4ba9e665e40a325d82aa2ee48d7b8abd603bBrian#endif
954824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   GLuint param_state;
964824c342c864e870251a7d343c95e51274e50d23Keith Whitwell};
974824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
986da9234fd437f97267e7831f034c78b31156d939Brian
996da9234fd437f97267e7831f034c78b31156d939Brianextern void st_init_program_functions(struct dd_function_table *functions);
1006da9234fd437f97267e7831f034c78b31156d939Brian
1018e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
1024824c342c864e870251a7d343c95e51274e50d23Keith Whitwellstatic inline struct st_fragment_program *
1034824c342c864e870251a7d343c95e51274e50d23Keith Whitwellst_fragment_program( struct gl_fragment_program *fp )
1044824c342c864e870251a7d343c95e51274e50d23Keith Whitwell{
1054824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   return (struct st_fragment_program *)fp;
1064824c342c864e870251a7d343c95e51274e50d23Keith Whitwell}
1074824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
1084824c342c864e870251a7d343c95e51274e50d23Keith Whitwellstatic inline struct st_vertex_program *
1094824c342c864e870251a7d343c95e51274e50d23Keith Whitwellst_vertex_program( struct gl_vertex_program *vp )
1104824c342c864e870251a7d343c95e51274e50d23Keith Whitwell{
1114824c342c864e870251a7d343c95e51274e50d23Keith Whitwell   return (struct st_vertex_program *)vp;
1124824c342c864e870251a7d343c95e51274e50d23Keith Whitwell}
1134824c342c864e870251a7d343c95e51274e50d23Keith Whitwell
1148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif
115