Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/intel/common/intel_sample_positions.c
4547 views
1
/*
2
* Copyright © 2020 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
#include "intel_sample_positions.h"
25
26
/**
27
* 1x MSAA has a single sample at the center: (0.5, 0.5) -> (0x8, 0x8).
28
*/
29
const struct intel_sample_position intel_sample_positions_1x[] = {
30
{ 0.5, 0.5, },
31
};
32
33
/**
34
* 2x MSAA sample positions are (0.25, 0.25) and (0.75, 0.75):
35
* 4 c
36
* 4 0
37
* c 1
38
*/
39
const struct intel_sample_position intel_sample_positions_2x[] = {
40
{ 0.75, 0.75 },
41
{ 0.25, 0.25 },
42
};
43
44
/**
45
* Sample positions:
46
* 2 6 a e
47
* 2 0
48
* 6 1
49
* a 2
50
* e 3
51
*/
52
const struct intel_sample_position intel_sample_positions_4x[] = {
53
{ 0.375, 0.125 },
54
{ 0.875, 0.375 },
55
{ 0.125, 0.625 },
56
{ 0.625, 0.875 },
57
};
58
59
/**
60
* Sample positions:
61
*
62
* From the Ivy Bridge PRM, Vol2 Part1 p304 (3DSTATE_MULTISAMPLE:
63
* Programming Notes):
64
* "When programming the sample offsets (for NUMSAMPLES_4 or _8 and
65
* MSRASTMODE_xxx_PATTERN), the order of the samples 0 to 3 (or 7
66
* for 8X) must have monotonically increasing distance from the
67
* pixel center. This is required to get the correct centroid
68
* computation in the device."
69
*
70
* Sample positions:
71
* 1 3 5 7 9 b d f
72
* 1 7
73
* 3 3
74
* 5 0
75
* 7 5
76
* 9 2
77
* b 1
78
* d 4
79
* f 6
80
*/
81
const struct intel_sample_position intel_sample_positions_8x[] = {
82
{ 0.5625, 0.3125 },
83
{ 0.4375, 0.6875 },
84
{ 0.8125, 0.5625 },
85
{ 0.3125, 0.1875 },
86
{ 0.1875, 0.8125 },
87
{ 0.0625, 0.4375 },
88
{ 0.6875, 0.9375 },
89
{ 0.9375, 0.0625 },
90
};
91
92
/**
93
* Sample positions:
94
*
95
* 0 1 2 3 4 5 6 7 8 9 a b c d e f
96
* 0 15
97
* 1 9
98
* 2 10
99
* 3 7
100
* 4 13
101
* 5 1
102
* 6 4
103
* 7 3
104
* 8 12
105
* 9 0
106
* a 2
107
* b 6
108
* c 11
109
* d 5
110
* e 8
111
* f 14
112
*/
113
const struct intel_sample_position intel_sample_positions_16x[] = {
114
{ 0.5625, 0.5625 },
115
{ 0.4375, 0.3125 },
116
{ 0.3125, 0.6250 },
117
{ 0.7500, 0.4375 },
118
{ 0.1875, 0.3750 },
119
{ 0.6250, 0.8125 },
120
{ 0.8125, 0.6875 },
121
{ 0.6875, 0.1875 },
122
{ 0.3750, 0.8750 },
123
{ 0.5000, 0.0625 },
124
{ 0.2500, 0.1250 },
125
{ 0.1250, 0.7500 },
126
{ 0.0000, 0.5000 },
127
{ 0.9375, 0.2500 },
128
{ 0.8750, 0.9375 },
129
{ 0.0625, 0.0000 },
130
};
131
132