tgsi_parse.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 #ifndef TGSI_PARSE_H
00029 #define TGSI_PARSE_H
00030 
00031 #include "pipe/p_shader_tokens.h"
00032 
00033 #if defined __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 struct tgsi_full_version
00038 {
00039    struct tgsi_version  Version;
00040 };
00041 
00042 struct tgsi_full_header
00043 {
00044    struct tgsi_header      Header;
00045    struct tgsi_processor   Processor;
00046 };
00047 
00048 struct tgsi_full_dst_register
00049 {
00050    struct tgsi_dst_register               DstRegister;
00051    struct tgsi_dst_register_ext_concode   DstRegisterExtConcode;
00052    struct tgsi_dst_register_ext_modulate  DstRegisterExtModulate;
00053 };
00054 
00055 struct tgsi_full_src_register
00056 {
00057    struct tgsi_src_register         SrcRegister;
00058    struct tgsi_src_register_ext_swz SrcRegisterExtSwz;
00059    struct tgsi_src_register_ext_mod SrcRegisterExtMod;
00060    struct tgsi_src_register         SrcRegisterInd;
00061    struct tgsi_dimension            SrcRegisterDim;
00062    struct tgsi_src_register         SrcRegisterDimInd;
00063 };
00064 
00065 struct tgsi_full_declaration
00066 {
00067    struct tgsi_declaration Declaration;
00068    struct tgsi_declaration_range DeclarationRange;
00069    struct tgsi_declaration_semantic Semantic;
00070 };
00071 
00072 struct tgsi_full_immediate
00073 {
00074    struct tgsi_immediate   Immediate;
00075    union
00076    {
00077       const void                          *Pointer;
00078       const struct tgsi_immediate_float32 *ImmediateFloat32;
00079    } u;
00080 };
00081 
00082 #define TGSI_FULL_MAX_DST_REGISTERS 2
00083 #define TGSI_FULL_MAX_SRC_REGISTERS 4 /* TXD has 4 */
00084 
00085 struct tgsi_full_instruction
00086 {
00087    struct tgsi_instruction             Instruction;
00088    struct tgsi_instruction_ext_nv      InstructionExtNv;
00089    struct tgsi_instruction_ext_label   InstructionExtLabel;
00090    struct tgsi_instruction_ext_texture InstructionExtTexture;
00091    struct tgsi_full_dst_register       FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS];
00092    struct tgsi_full_src_register       FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS];
00093 };
00094 
00095 union tgsi_full_token
00096 {
00097    struct tgsi_token             Token;
00098    struct tgsi_full_declaration  FullDeclaration;
00099    struct tgsi_full_immediate    FullImmediate;
00100    struct tgsi_full_instruction  FullInstruction;
00101 };
00102 
00103 void
00104 tgsi_full_token_init(
00105    union tgsi_full_token *full_token );
00106 
00107 void
00108 tgsi_full_token_free(
00109    union tgsi_full_token *full_token );
00110 
00111 struct tgsi_parse_context
00112 {
00113    const struct tgsi_token    *Tokens;
00114    unsigned                   Position;
00115    struct tgsi_full_version   FullVersion;
00116    struct tgsi_full_header    FullHeader;
00117    union tgsi_full_token      FullToken;
00118 };
00119 
00120 #define TGSI_PARSE_OK      0
00121 #define TGSI_PARSE_ERROR   1
00122 
00123 unsigned
00124 tgsi_parse_init(
00125    struct tgsi_parse_context *ctx,
00126    const struct tgsi_token *tokens );
00127 
00128 void
00129 tgsi_parse_free(
00130    struct tgsi_parse_context *ctx );
00131 
00132 boolean
00133 tgsi_parse_end_of_tokens(
00134    struct tgsi_parse_context *ctx );
00135 
00136 void
00137 tgsi_parse_token(
00138    struct tgsi_parse_context *ctx );
00139 
00140 unsigned
00141 tgsi_num_tokens(const struct tgsi_token *tokens);
00142 
00143 struct tgsi_token *
00144 tgsi_dup_tokens(const struct tgsi_token *tokens);
00145 
00146 #if defined __cplusplus
00147 }
00148 #endif
00149 
00150 #endif /* TGSI_PARSE_H */
00151 

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