summaryrefslogtreecommitdiff
path: root/tests/util/sized-internalformats.h
blob: 104a15aedb2b2b4fbb6e3f45b5c62cd620e97a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* Copyright © 2011 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

/* F=float, UN=unsigned normalized, SN=signed normalized, I=int,
 * U=uint.
 *
 * This list has to match up with the table in sized-internalformats.c.
 */
enum bits_types {
	NONE,

	UN32,
	F32,
	I32,
	U32,

	UN24,

	UN16,
	SN16,
	F16,
	I16,
	U16,

	U10,
	U2,

	UN12,
	UN10,

	UN8,
	SN8,
	I8,
	U8,

	UN6,
	UN5,
	UN4,
	UN3,
	UN2,
	UN1,

	F11,
	F10,
	F9,


	/* Compressed internalformats get treated specially. */
	UCMP,
	SCMP,

	BITS_MAX,
};

enum channel {
	R,
	G,
	B,
	A,
	L,
	I,
	D,
	S,
	CHANNELS,
};

struct sized_internalformat {
	GLenum token;
	enum bits_types bits[CHANNELS];
};

struct required_format {
	GLenum token;
	int version;
	bool rb_required;
};

extern const struct sized_internalformat sized_internalformats[];
extern const struct required_format required_formats[];

const struct sized_internalformat *
get_sized_internalformat(GLenum token);

int
get_channel_size(const struct sized_internalformat *f, enum channel c);

GLenum
get_channel_type(const struct sized_internalformat *f, enum channel c);

void
print_bits(int size, GLenum type);

bool
valid_for_gl_version(const struct required_format *format, int target_version);

void
setup_required_size_test(int argc, char **argv,
			 struct piglit_gl_test_config *config);