"Fossies" - the Fresh Open Source Software Archive

Member "mesa-20.1.8/src/gallium/auxiliary/tgsi/tgsi_parse.h" (16 Sep 2020, 4611 Bytes) of package /linux/misc/mesa-20.1.8.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "tgsi_parse.h" see the Fossies "Dox" file reference documentation.

    1 /**************************************************************************
    2  * 
    3  * Copyright 2007 VMware, Inc.
    4  * All Rights Reserved.
    5  * 
    6  * Permission is hereby granted, free of charge, to any person obtaining a
    7  * copy of this software and associated documentation files (the
    8  * "Software"), to deal in the Software without restriction, including
    9  * without limitation the rights to use, copy, modify, merge, publish,
   10  * distribute, sub license, and/or sell copies of the Software, and to
   11  * permit persons to whom the Software is furnished to do so, subject to
   12  * the following conditions:
   13  * 
   14  * The above copyright notice and this permission notice (including the
   15  * next paragraph) shall be included in all copies or substantial portions
   16  * of the Software.
   17  * 
   18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
   21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
   22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   25  * 
   26  **************************************************************************/
   27 
   28 #ifndef TGSI_PARSE_H
   29 #define TGSI_PARSE_H
   30 
   31 #include "pipe/p_compiler.h"
   32 #include "pipe/p_shader_tokens.h"
   33 
   34 #if defined __cplusplus
   35 extern "C" {
   36 #endif
   37 
   38 struct tgsi_full_header
   39 {
   40    struct tgsi_header      Header;
   41    struct tgsi_processor   Processor;
   42 };
   43 
   44 struct tgsi_full_dst_register
   45 {
   46    struct tgsi_dst_register               Register;
   47    struct tgsi_ind_register               Indirect;
   48    struct tgsi_dimension                  Dimension;
   49    struct tgsi_ind_register               DimIndirect;
   50 };
   51 
   52 struct tgsi_full_src_register
   53 {
   54    struct tgsi_src_register         Register;
   55    struct tgsi_ind_register         Indirect;
   56    struct tgsi_dimension            Dimension;
   57    struct tgsi_ind_register         DimIndirect;
   58 };
   59 
   60 struct tgsi_full_declaration
   61 {
   62    struct tgsi_declaration Declaration;
   63    struct tgsi_declaration_range Range;
   64    struct tgsi_declaration_dimension Dim;
   65    struct tgsi_declaration_interp Interp;
   66    struct tgsi_declaration_semantic Semantic;
   67    struct tgsi_declaration_image Image;
   68    struct tgsi_declaration_sampler_view SamplerView;
   69    struct tgsi_declaration_array Array;
   70 };
   71 
   72 struct tgsi_full_immediate
   73 {
   74    struct tgsi_immediate   Immediate;
   75    union tgsi_immediate_data u[4];
   76 };
   77 
   78 struct tgsi_full_property
   79 {
   80    struct tgsi_property   Property;
   81    struct tgsi_property_data u[8];
   82 };
   83 
   84 #define TGSI_FULL_MAX_DST_REGISTERS 2
   85 #define TGSI_FULL_MAX_SRC_REGISTERS 5 /* SAMPLE_D has 5 */
   86 #define TGSI_FULL_MAX_TEX_OFFSETS 4
   87 
   88 struct tgsi_full_instruction
   89 {
   90    struct tgsi_instruction             Instruction;
   91    struct tgsi_instruction_label       Label;
   92    struct tgsi_instruction_texture     Texture;
   93    struct tgsi_instruction_memory      Memory;
   94    struct tgsi_full_dst_register       Dst[TGSI_FULL_MAX_DST_REGISTERS];
   95    struct tgsi_full_src_register       Src[TGSI_FULL_MAX_SRC_REGISTERS];
   96    struct tgsi_texture_offset          TexOffsets[TGSI_FULL_MAX_TEX_OFFSETS];
   97 };
   98 
   99 union tgsi_full_token
  100 {
  101    struct tgsi_token             Token;
  102    struct tgsi_full_declaration  FullDeclaration;
  103    struct tgsi_full_immediate    FullImmediate;
  104    struct tgsi_full_instruction  FullInstruction;
  105    struct tgsi_full_property     FullProperty;
  106 };
  107 
  108 struct tgsi_parse_context
  109 {
  110    const struct tgsi_token    *Tokens;
  111    unsigned                   Position;
  112    struct tgsi_full_header    FullHeader;
  113    union tgsi_full_token      FullToken;
  114 };
  115 
  116 #define TGSI_PARSE_OK      0
  117 #define TGSI_PARSE_ERROR   1
  118 
  119 unsigned
  120 tgsi_parse_init(
  121    struct tgsi_parse_context *ctx,
  122    const struct tgsi_token *tokens );
  123 
  124 void
  125 tgsi_parse_free(
  126    struct tgsi_parse_context *ctx );
  127 
  128 boolean
  129 tgsi_parse_end_of_tokens(
  130    struct tgsi_parse_context *ctx );
  131 
  132 void
  133 tgsi_parse_token(
  134    struct tgsi_parse_context *ctx );
  135 
  136 static inline unsigned
  137 tgsi_num_tokens(const struct tgsi_token *tokens)
  138 {
  139    struct tgsi_header header;
  140    memcpy(&header, tokens, sizeof(header));
  141    return header.HeaderSize + header.BodySize;
  142 }
  143 
  144 void
  145 tgsi_dump_tokens(const struct tgsi_token *tokens);
  146 
  147 struct tgsi_token *
  148 tgsi_dup_tokens(const struct tgsi_token *tokens);
  149 
  150 struct tgsi_token *
  151 tgsi_alloc_tokens(unsigned num_tokens);
  152 
  153 void
  154 tgsi_free_tokens(const struct tgsi_token *tokens);
  155 
  156 unsigned
  157 tgsi_get_processor_type(const struct tgsi_token *tokens);
  158 
  159 #if defined __cplusplus
  160 }
  161 #endif
  162 
  163 #endif /* TGSI_PARSE_H */
  164