intel/fs: Use SHADER_OPCODE_SEND for varying UBO pulls on gen7+
[mesa.git] / src / intel / compiler / brw_reg_type.h
1 /*
2 * Copyright © 2017 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #ifndef BRW_REG_TYPE_H
25 #define BRW_REG_TYPE_H
26
27 #include <stdbool.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #ifdef HAVE_FUNC_ATTRIBUTE_PURE
34 #define ATTRIBUTE_PURE __attribute__((__pure__))
35 #else
36 #define ATTRIBUTE_PURE
37 #endif
38
39 enum brw_reg_file;
40 struct gen_device_info;
41
42 /*
43 * The ordering has been chosen so that no enum value is the same as a
44 * compatible hardware encoding.
45 */
46 enum PACKED brw_reg_type {
47 /** Floating-point types: @{ */
48 BRW_REGISTER_TYPE_NF,
49 BRW_REGISTER_TYPE_DF,
50 BRW_REGISTER_TYPE_F,
51 BRW_REGISTER_TYPE_HF,
52 BRW_REGISTER_TYPE_VF,
53 /** @} */
54
55 /** Integer types: @{ */
56 BRW_REGISTER_TYPE_Q,
57 BRW_REGISTER_TYPE_UQ,
58 BRW_REGISTER_TYPE_D,
59 BRW_REGISTER_TYPE_UD,
60 BRW_REGISTER_TYPE_W,
61 BRW_REGISTER_TYPE_UW,
62 BRW_REGISTER_TYPE_B,
63 BRW_REGISTER_TYPE_UB,
64 BRW_REGISTER_TYPE_V,
65 BRW_REGISTER_TYPE_UV,
66 /** @} */
67
68 BRW_REGISTER_TYPE_LAST = BRW_REGISTER_TYPE_UV
69 };
70
71 static inline bool
72 brw_reg_type_is_floating_point(enum brw_reg_type type)
73 {
74 switch (type) {
75 case BRW_REGISTER_TYPE_NF:
76 case BRW_REGISTER_TYPE_DF:
77 case BRW_REGISTER_TYPE_F:
78 case BRW_REGISTER_TYPE_HF:
79 return true;
80 default:
81 return false;
82 }
83 }
84
85 unsigned
86 brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
87 enum brw_reg_file file, enum brw_reg_type type);
88
89 enum brw_reg_type ATTRIBUTE_PURE
90 brw_hw_type_to_reg_type(const struct gen_device_info *devinfo,
91 enum brw_reg_file file, unsigned hw_type);
92
93 unsigned
94 brw_reg_type_to_a16_hw_3src_type(const struct gen_device_info *devinfo,
95 enum brw_reg_type type);
96
97 unsigned
98 brw_reg_type_to_a1_hw_3src_type(const struct gen_device_info *devinfo,
99 enum brw_reg_type type);
100
101 enum brw_reg_type
102 brw_a16_hw_3src_type_to_reg_type(const struct gen_device_info *devinfo,
103 unsigned hw_type);
104
105 enum brw_reg_type
106 brw_a1_hw_3src_type_to_reg_type(const struct gen_device_info *devinfo,
107 unsigned hw_type, unsigned exec_type);
108
109 unsigned
110 brw_reg_type_to_size(enum brw_reg_type type);
111
112 const char *
113 brw_reg_type_to_letters(enum brw_reg_type type);
114
115 #ifdef __cplusplus
116 }
117 #endif
118
119 #endif