~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to src/gallium/auxiliary/tgsi/tgsi_util.h

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
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_UTIL_H
29
 
#define TGSI_UTIL_H
30
 
 
31
 
#include <stdbool.h>
32
 
#include "pipe/p_shader_tokens.h"
33
 
 
34
 
#if defined __cplusplus
35
 
extern "C" {
36
 
#endif
37
 
 
38
 
struct tgsi_src_register;
39
 
struct tgsi_full_src_register;
40
 
struct tgsi_full_instruction;
41
 
 
42
 
void *
43
 
tgsi_align_128bit(void *unaligned);
44
 
 
45
 
unsigned
46
 
tgsi_util_get_src_register_swizzle(const struct tgsi_src_register *reg,
47
 
                                   unsigned component);
48
 
 
49
 
 
50
 
unsigned
51
 
tgsi_util_get_full_src_register_swizzle(
52
 
   const struct tgsi_full_src_register *reg,
53
 
   unsigned component );
54
 
 
55
 
void
56
 
tgsi_util_set_src_register_swizzle(struct tgsi_src_register *reg,
57
 
                                   unsigned swizzle,
58
 
                                   unsigned component);
59
 
 
60
 
/* returns the channels of the src_idx src register used by the full instruction. */
61
 
unsigned
62
 
tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
63
 
                              unsigned src_idx);
64
 
 
65
 
/* Returns the channels of the src_idx src register used by an instruction with
66
 
 * these parameters.
67
 
 */
68
 
unsigned
69
 
tgsi_util_get_src_usage_mask(enum tgsi_opcode opcode,
70
 
                             unsigned src_idx,
71
 
                             uint8_t write_mask,
72
 
                             uint8_t swizzle_x,
73
 
                             uint8_t swizzle_y,
74
 
                             uint8_t swizzle_z,
75
 
                             uint8_t swizzle_w,
76
 
                             enum tgsi_texture_type tex_target,
77
 
                             enum tgsi_texture_type mem_target);
78
 
 
79
 
struct tgsi_src_register
80
 
tgsi_util_get_src_from_ind(const struct tgsi_ind_register *reg);
81
 
 
82
 
int
83
 
tgsi_util_get_texture_coord_dim(enum tgsi_texture_type tgsi_tex);
84
 
 
85
 
int
86
 
tgsi_util_get_shadow_ref_src_index(enum tgsi_texture_type tgsi_tex);
87
 
 
88
 
bool
89
 
tgsi_is_shadow_target(enum tgsi_texture_type target);
90
 
 
91
 
 
92
 
static inline bool
93
 
tgsi_is_msaa_target(enum tgsi_texture_type target)
94
 
{
95
 
   return (target == TGSI_TEXTURE_2D_MSAA ||
96
 
           target == TGSI_TEXTURE_2D_ARRAY_MSAA);
97
 
}
98
 
 
99
 
static inline bool
100
 
tgsi_is_array_sampler(enum tgsi_texture_type target)
101
 
{
102
 
   return target == TGSI_TEXTURE_1D_ARRAY ||
103
 
          target == TGSI_TEXTURE_SHADOW1D_ARRAY ||
104
 
          target == TGSI_TEXTURE_2D_ARRAY ||
105
 
          target == TGSI_TEXTURE_SHADOW2D_ARRAY ||
106
 
          target == TGSI_TEXTURE_CUBE_ARRAY ||
107
 
          target == TGSI_TEXTURE_SHADOWCUBE_ARRAY ||
108
 
          target == TGSI_TEXTURE_2D_ARRAY_MSAA;
109
 
}
110
 
 
111
 
#if defined __cplusplus
112
 
}
113
 
#endif
114
 
 
115
 
#endif /* TGSI_UTIL_H */