Path: blob/21.2-virgl/src/intel/common/intel_sample_positions.c
4547 views
/*1* Copyright © 2020 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#include "intel_sample_positions.h"2425/**26* 1x MSAA has a single sample at the center: (0.5, 0.5) -> (0x8, 0x8).27*/28const struct intel_sample_position intel_sample_positions_1x[] = {29{ 0.5, 0.5, },30};3132/**33* 2x MSAA sample positions are (0.25, 0.25) and (0.75, 0.75):34* 4 c35* 4 036* c 137*/38const struct intel_sample_position intel_sample_positions_2x[] = {39{ 0.75, 0.75 },40{ 0.25, 0.25 },41};4243/**44* Sample positions:45* 2 6 a e46* 2 047* 6 148* a 249* e 350*/51const struct intel_sample_position intel_sample_positions_4x[] = {52{ 0.375, 0.125 },53{ 0.875, 0.375 },54{ 0.125, 0.625 },55{ 0.625, 0.875 },56};5758/**59* Sample positions:60*61* From the Ivy Bridge PRM, Vol2 Part1 p304 (3DSTATE_MULTISAMPLE:62* Programming Notes):63* "When programming the sample offsets (for NUMSAMPLES_4 or _8 and64* MSRASTMODE_xxx_PATTERN), the order of the samples 0 to 3 (or 765* for 8X) must have monotonically increasing distance from the66* pixel center. This is required to get the correct centroid67* computation in the device."68*69* Sample positions:70* 1 3 5 7 9 b d f71* 1 772* 3 373* 5 074* 7 575* 9 276* b 177* d 478* f 679*/80const struct intel_sample_position intel_sample_positions_8x[] = {81{ 0.5625, 0.3125 },82{ 0.4375, 0.6875 },83{ 0.8125, 0.5625 },84{ 0.3125, 0.1875 },85{ 0.1875, 0.8125 },86{ 0.0625, 0.4375 },87{ 0.6875, 0.9375 },88{ 0.9375, 0.0625 },89};9091/**92* Sample positions:93*94* 0 1 2 3 4 5 6 7 8 9 a b c d e f95* 0 1596* 1 997* 2 1098* 3 799* 4 13100* 5 1101* 6 4102* 7 3103* 8 12104* 9 0105* a 2106* b 6107* c 11108* d 5109* e 8110* f 14111*/112const struct intel_sample_position intel_sample_positions_16x[] = {113{ 0.5625, 0.5625 },114{ 0.4375, 0.3125 },115{ 0.3125, 0.6250 },116{ 0.7500, 0.4375 },117{ 0.1875, 0.3750 },118{ 0.6250, 0.8125 },119{ 0.8125, 0.6875 },120{ 0.6875, 0.1875 },121{ 0.3750, 0.8750 },122{ 0.5000, 0.0625 },123{ 0.2500, 0.1250 },124{ 0.1250, 0.7500 },125{ 0.0000, 0.5000 },126{ 0.9375, 0.2500 },127{ 0.8750, 0.9375 },128{ 0.0625, 0.0000 },129};130131132