2 * Copyright © 2016 Intel Corporation
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:
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
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
23 #ifndef GEN_SAMPLE_POSITIONS_H
24 #define GEN_SAMPLE_POSITIONS_H
27 * This file defines the standard multisample positions used by both GL and
28 * Vulkan. These correspond to the Vulkan "standard sample locations".
32 * 1x MSAA has a single sample at the center: (0.5, 0.5) -> (0x8, 0x8).
34 #define GEN_SAMPLE_POS_1X(prefix) \
35 prefix##0XOffset = 0.5; \
36 prefix##0YOffset = 0.5;
39 * 2x MSAA sample positions are (0.25, 0.25) and (0.75, 0.75):
44 #define GEN_SAMPLE_POS_2X(prefix) \
45 prefix##0XOffset = 0.25; \
46 prefix##0YOffset = 0.25; \
47 prefix##1XOffset = 0.75; \
48 prefix##1YOffset = 0.75;
58 #define GEN_SAMPLE_POS_4X(prefix) \
59 prefix##0XOffset = 0.375; \
60 prefix##0YOffset = 0.125; \
61 prefix##1XOffset = 0.875; \
62 prefix##1YOffset = 0.375; \
63 prefix##2XOffset = 0.125; \
64 prefix##2YOffset = 0.625; \
65 prefix##3XOffset = 0.625; \
66 prefix##3YOffset = 0.875;
71 * From the Ivy Bridge PRM, Vol2 Part1 p304 (3DSTATE_MULTISAMPLE:
73 * "When programming the sample offsets (for NUMSAMPLES_4 or _8 and
74 * MSRASTMODE_xxx_PATTERN), the order of the samples 0 to 3 (or 7
75 * for 8X) must have monotonically increasing distance from the
76 * pixel center. This is required to get the correct centroid
77 * computation in the device."
90 #define GEN_SAMPLE_POS_8X(prefix) \
91 prefix##0XOffset = 0.5625; \
92 prefix##0YOffset = 0.3125; \
93 prefix##1XOffset = 0.4375; \
94 prefix##1YOffset = 0.6875; \
95 prefix##2XOffset = 0.8125; \
96 prefix##2YOffset = 0.5625; \
97 prefix##3XOffset = 0.3125; \
98 prefix##3YOffset = 0.1875; \
99 prefix##4XOffset = 0.1875; \
100 prefix##4YOffset = 0.8125; \
101 prefix##5XOffset = 0.0625; \
102 prefix##5YOffset = 0.4375; \
103 prefix##6XOffset = 0.6875; \
104 prefix##6YOffset = 0.9375; \
105 prefix##7XOffset = 0.9375; \
106 prefix##7YOffset = 0.0625;
111 * 0 1 2 3 4 5 6 7 8 9 a b c d e f
129 #define GEN_SAMPLE_POS_16X(prefix) \
130 prefix##0XOffset = 0.5625; \
131 prefix##0YOffset = 0.5625; \
132 prefix##1XOffset = 0.4375; \
133 prefix##1YOffset = 0.3125; \
134 prefix##2XOffset = 0.3125; \
135 prefix##2YOffset = 0.6250; \
136 prefix##3XOffset = 0.7500; \
137 prefix##3YOffset = 0.4375; \
138 prefix##4XOffset = 0.1875; \
139 prefix##4YOffset = 0.3750; \
140 prefix##5XOffset = 0.6250; \
141 prefix##5YOffset = 0.8125; \
142 prefix##6XOffset = 0.8125; \
143 prefix##6YOffset = 0.6875; \
144 prefix##7XOffset = 0.6875; \
145 prefix##7YOffset = 0.1875; \
146 prefix##8XOffset = 0.3750; \
147 prefix##8YOffset = 0.8750; \
148 prefix##9XOffset = 0.5000; \
149 prefix##9YOffset = 0.0625; \
150 prefix##10XOffset = 0.2500; \
151 prefix##10YOffset = 0.1250; \
152 prefix##11XOffset = 0.1250; \
153 prefix##11YOffset = 0.7500; \
154 prefix##12XOffset = 0.0000; \
155 prefix##12YOffset = 0.5000; \
156 prefix##13XOffset = 0.9375; \
157 prefix##13YOffset = 0.2500; \
158 prefix##14XOffset = 0.8750; \
159 prefix##14YOffset = 0.9375; \
160 prefix##15XOffset = 0.0625; \
161 prefix##15YOffset = 0.0000;
163 #endif /* GEN_SAMPLE_POSITIONS_H */