194f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol/**************************************************************************
294f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol *
394f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
494f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * All Rights Reserved.
594f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol *
694f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * Permission is hereby granted, free of charge, to any person obtaining a
794f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * copy of this software and associated documentation files (the
894f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * "Software"), to deal in the Software without restriction, including
994f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * without limitation the rights to use, copy, modify, merge, publish,
1094f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * distribute, sub license, and/or sell copies of the Software, and to
1194f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * permit persons to whom the Software is furnished to do so, subject to
1294f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * the following conditions:
1394f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol *
1494f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * The above copyright notice and this permission notice (including the
1594f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * next paragraph) shall be included in all copies or substantial portions
1694f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * of the Software.
1794f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol *
1894f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1994f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2094f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
2194f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
2294f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
2394f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2494f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2594f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol *
2694f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol **************************************************************************/
2794f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol
2894f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol#ifndef TGSI_INFO_H
2994f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol#define TGSI_INFO_H
3094f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol
3157421cb464c63ed65f5e0438ad4c13c527f41118Vinson Lee#include "pipe/p_compiler.h"
3294f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol#include "pipe/p_shader_tokens.h"
3313e2e51f7058dff01281050db1b64639ad3b399eDave Airlie#include "util/u_format.h"
3494f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol
3594f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol#if defined __cplusplus
3694f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krolextern "C" {
3794f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol#endif
3894f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol
39df169457909e1985c65e8a19c245133d2f5f013dTom Stellard/* This enum describes how an opcode calculates its result. */
40df169457909e1985c65e8a19c245133d2f5f013dTom Stellardenum tgsi_output_mode {
41df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   /** The opcode produces no result. */
42df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   TGSI_OUTPUT_NONE            = 0,
43df169457909e1985c65e8a19c245133d2f5f013dTom Stellard
44df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   /** When this opcode writes to a channel of the destination register,
45df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *  it takes as arguments values from the same channel of the source
46df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *  register(s).
47df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *
48df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *  Example: TGSI_OPCODE_ADD
49df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    */
50df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   TGSI_OUTPUT_COMPONENTWISE   = 1,
51df169457909e1985c65e8a19c245133d2f5f013dTom Stellard
52df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   /** This opcode writes the same value to all enabled channels of the
53df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    * destination register.
54df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *
55df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *  Example: TGSI_OPCODE_RSQ
56df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    */
57df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   TGSI_OUTPUT_REPLICATE       = 2,
58df169457909e1985c65e8a19c245133d2f5f013dTom Stellard
59df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   /** The operation performed by this opcode is dependent on which channel
60df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *  of the destination register is being written.
61df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *
62df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    *  Example: TGSI_OPCODE_LOG
63df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    */
64df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   TGSI_OUTPUT_CHAN_DEPENDENT  = 3,
65df169457909e1985c65e8a19c245133d2f5f013dTom Stellard
66df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   /**
67df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    * Example: TGSI_OPCODE_TEX
68df169457909e1985c65e8a19c245133d2f5f013dTom Stellard    */
69df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   TGSI_OUTPUT_OTHER           = 4
70df169457909e1985c65e8a19c245133d2f5f013dTom Stellard};
71df169457909e1985c65e8a19c245133d2f5f013dTom Stellard
7294f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krolstruct tgsi_opcode_info
7394f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol{
74848ab8be8c34b00b2afe6120882f8c29f047ced5Keith Whitwell   unsigned num_dst:3;
75848ab8be8c34b00b2afe6120882f8c29f047ced5Keith Whitwell   unsigned num_src:3;
76848ab8be8c34b00b2afe6120882f8c29f047ced5Keith Whitwell   unsigned is_tex:1;
77848ab8be8c34b00b2afe6120882f8c29f047ced5Keith Whitwell   unsigned is_branch:1;
78848ab8be8c34b00b2afe6120882f8c29f047ced5Keith Whitwell   int pre_dedent:2;
79848ab8be8c34b00b2afe6120882f8c29f047ced5Keith Whitwell   int post_indent:2;
80df169457909e1985c65e8a19c245133d2f5f013dTom Stellard   enum tgsi_output_mode output_mode:3;
8194f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol   const char *mnemonic;
82ede9f3b52ecb27ada81fee06a943bb595c60eaeeKeith Whitwell   uint opcode;
8394f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol};
8494f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol
8594f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krolconst struct tgsi_opcode_info *
8694f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Kroltgsi_get_opcode_info( uint opcode );
8794f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol
88c3c90c2dd95ba4f714c6d5fdf5793e1db1a191caBrian Paulconst char *
89c3c90c2dd95ba4f714c6d5fdf5793e1db1a191caBrian Paultgsi_get_opcode_name( uint opcode );
90c3c90c2dd95ba4f714c6d5fdf5793e1db1a191caBrian Paul
9192d88ccd9a3f68584453ba548df4fb5496a7dbf9Brian Paulconst char *
9292d88ccd9a3f68584453ba548df4fb5496a7dbf9Brian Paultgsi_get_processor_name( uint processor );
9392d88ccd9a3f68584453ba548df4fb5496a7dbf9Brian Paul
9413e2e51f7058dff01281050db1b64639ad3b399eDave Airlieenum tgsi_opcode_type {
9513e2e51f7058dff01281050db1b64639ad3b399eDave Airlie   TGSI_TYPE_UNTYPED, /* for MOV */
9613e2e51f7058dff01281050db1b64639ad3b399eDave Airlie   TGSI_TYPE_VOID,
9713e2e51f7058dff01281050db1b64639ad3b399eDave Airlie   TGSI_TYPE_UNSIGNED,
9813e2e51f7058dff01281050db1b64639ad3b399eDave Airlie   TGSI_TYPE_SIGNED,
9913e2e51f7058dff01281050db1b64639ad3b399eDave Airlie   TGSI_TYPE_FLOAT,
100c3e3df9b184e8c843c1abab29faa3af9e0c826bfBrian Paul   TGSI_TYPE_DOUBLE
10113e2e51f7058dff01281050db1b64639ad3b399eDave Airlie};
10213e2e51f7058dff01281050db1b64639ad3b399eDave Airlie
10313e2e51f7058dff01281050db1b64639ad3b399eDave Airlieenum tgsi_opcode_type
10413e2e51f7058dff01281050db1b64639ad3b399eDave Airlietgsi_opcode_infer_src_type( uint opcode );
10513e2e51f7058dff01281050db1b64639ad3b399eDave Airlie
10613e2e51f7058dff01281050db1b64639ad3b399eDave Airlieenum tgsi_opcode_type
10713e2e51f7058dff01281050db1b64639ad3b399eDave Airlietgsi_opcode_infer_dst_type( uint opcode );
108c3c90c2dd95ba4f714c6d5fdf5793e1db1a191caBrian Paul
10994f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol#if defined __cplusplus
11094f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol}
11194f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol#endif
11294f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol
11394f9faab31f7fbf5f14d23d993f9830fa51ce076Michal Krol#endif /* TGSI_INFO_H */
114