14a49301eSmrg/**************************************************************************
24a49301eSmrg *
3af69d88dSmrg * Copyright 2008 VMware, Inc.
44a49301eSmrg * All Rights Reserved.
54a49301eSmrg *
64a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
74a49301eSmrg * copy of this software and associated documentation files (the
84a49301eSmrg * "Software"), to deal in the Software without restriction, including
94a49301eSmrg * without limitation the rights to use, copy, modify, merge, publish,
104a49301eSmrg * distribute, sub license, and/or sell copies of the Software, and to
114a49301eSmrg * permit persons to whom the Software is furnished to do so, subject to
124a49301eSmrg * the following conditions:
134a49301eSmrg *
144a49301eSmrg * The above copyright notice and this permission notice (including the
154a49301eSmrg * next paragraph) shall be included in all copies or substantial portions
164a49301eSmrg * of the Software.
174a49301eSmrg *
184a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
194a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
204a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21af69d88dSmrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
224a49301eSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
234a49301eSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
244a49301eSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
254a49301eSmrg *
264a49301eSmrg **************************************************************************/
274a49301eSmrg
284a49301eSmrg#ifndef TGSI_INFO_H
294a49301eSmrg#define TGSI_INFO_H
304a49301eSmrg
313464ebd5Sriastradh#include "pipe/p_compiler.h"
324a49301eSmrg#include "pipe/p_shader_tokens.h"
337ec681f3Smrg#include "util/format/u_format.h"
344a49301eSmrg
354a49301eSmrg#if defined __cplusplus
364a49301eSmrgextern "C" {
374a49301eSmrg#endif
384a49301eSmrg
39af69d88dSmrg/* This enum describes how an opcode calculates its result. */
40af69d88dSmrgenum tgsi_output_mode {
41af69d88dSmrg   /** The opcode produces no result. */
42af69d88dSmrg   TGSI_OUTPUT_NONE            = 0,
43af69d88dSmrg
44af69d88dSmrg   /** When this opcode writes to a channel of the destination register,
45af69d88dSmrg    *  it takes as arguments values from the same channel of the source
46af69d88dSmrg    *  register(s).
47af69d88dSmrg    *
48af69d88dSmrg    *  Example: TGSI_OPCODE_ADD
49af69d88dSmrg    */
50af69d88dSmrg   TGSI_OUTPUT_COMPONENTWISE   = 1,
51af69d88dSmrg
52af69d88dSmrg   /** This opcode writes the same value to all enabled channels of the
53af69d88dSmrg    * destination register.
54af69d88dSmrg    *
55af69d88dSmrg    *  Example: TGSI_OPCODE_RSQ
56af69d88dSmrg    */
57af69d88dSmrg   TGSI_OUTPUT_REPLICATE       = 2,
58af69d88dSmrg
59af69d88dSmrg   /** The operation performed by this opcode is dependent on which channel
60af69d88dSmrg    *  of the destination register is being written.
61af69d88dSmrg    *
62af69d88dSmrg    *  Example: TGSI_OPCODE_LOG
63af69d88dSmrg    */
64af69d88dSmrg   TGSI_OUTPUT_CHAN_DEPENDENT  = 3,
65af69d88dSmrg
66af69d88dSmrg   /**
67af69d88dSmrg    * Example: TGSI_OPCODE_TEX
68af69d88dSmrg    */
69af69d88dSmrg   TGSI_OUTPUT_OTHER           = 4
70af69d88dSmrg};
71af69d88dSmrg
724a49301eSmrgstruct tgsi_opcode_info
734a49301eSmrg{
744a49301eSmrg   unsigned num_dst:3;
754a49301eSmrg   unsigned num_src:3;
764a49301eSmrg   unsigned is_tex:1;
7701e04c3fSmrg   unsigned is_store:1;
784a49301eSmrg   unsigned is_branch:1;
7901e04c3fSmrg   unsigned pre_dedent:1;
8001e04c3fSmrg   unsigned post_indent:1;
8101e04c3fSmrg   enum tgsi_output_mode output_mode:4;
8201e04c3fSmrg   enum tgsi_opcode opcode:10;
834a49301eSmrg};
844a49301eSmrg
854a49301eSmrgconst struct tgsi_opcode_info *
8601e04c3fSmrgtgsi_get_opcode_info(enum tgsi_opcode opcode);
874a49301eSmrg
884a49301eSmrgconst char *
8901e04c3fSmrgtgsi_get_opcode_name(enum tgsi_opcode opcode);
904a49301eSmrg
913464ebd5Sriastradhconst char *
9201e04c3fSmrgtgsi_get_processor_name(enum pipe_shader_type processor);
933464ebd5Sriastradh
94af69d88dSmrgenum tgsi_opcode_type {
95af69d88dSmrg   TGSI_TYPE_UNTYPED, /* for MOV */
96af69d88dSmrg   TGSI_TYPE_VOID,
97af69d88dSmrg   TGSI_TYPE_UNSIGNED,
98af69d88dSmrg   TGSI_TYPE_SIGNED,
99af69d88dSmrg   TGSI_TYPE_FLOAT,
10001e04c3fSmrg   TGSI_TYPE_DOUBLE,
10101e04c3fSmrg   TGSI_TYPE_UNSIGNED64,
10201e04c3fSmrg   TGSI_TYPE_SIGNED64,
103af69d88dSmrg};
104af69d88dSmrg
10501e04c3fSmrgstatic inline bool tgsi_type_is_64bit(enum tgsi_opcode_type type)
10601e04c3fSmrg{
10701e04c3fSmrg   if (type == TGSI_TYPE_DOUBLE || type == TGSI_TYPE_UNSIGNED64 ||
10801e04c3fSmrg       type == TGSI_TYPE_SIGNED64)
10901e04c3fSmrg      return true;
11001e04c3fSmrg   return false;
11101e04c3fSmrg}
11201e04c3fSmrg
113af69d88dSmrgenum tgsi_opcode_type
11401e04c3fSmrgtgsi_opcode_infer_src_type(enum tgsi_opcode opcode, uint src_idx);
115af69d88dSmrg
116af69d88dSmrgenum tgsi_opcode_type
11701e04c3fSmrgtgsi_opcode_infer_dst_type(enum tgsi_opcode opcode, uint dst_idx);
1184a49301eSmrg
1194a49301eSmrg#if defined __cplusplus
1204a49301eSmrg}
1214a49301eSmrg#endif
1224a49301eSmrg
1234a49301eSmrg#endif /* TGSI_INFO_H */
124