1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2020 Intel Corporation 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21bf215546Sopenharmony_ci * IN THE SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci#include "intel_sample_positions.h" 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci/** 27bf215546Sopenharmony_ci * 1x MSAA has a single sample at the center: (0.5, 0.5) -> (0x8, 0x8). 28bf215546Sopenharmony_ci */ 29bf215546Sopenharmony_ciconst struct intel_sample_position intel_sample_positions_1x[] = { 30bf215546Sopenharmony_ci { 0.5, 0.5, }, 31bf215546Sopenharmony_ci}; 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ci/** 34bf215546Sopenharmony_ci * 2x MSAA sample positions are (0.25, 0.25) and (0.75, 0.75): 35bf215546Sopenharmony_ci * 4 c 36bf215546Sopenharmony_ci * 4 0 37bf215546Sopenharmony_ci * c 1 38bf215546Sopenharmony_ci */ 39bf215546Sopenharmony_ciconst struct intel_sample_position intel_sample_positions_2x[] = { 40bf215546Sopenharmony_ci { 0.75, 0.75 }, 41bf215546Sopenharmony_ci { 0.25, 0.25 }, 42bf215546Sopenharmony_ci}; 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_ci/** 45bf215546Sopenharmony_ci * Sample positions: 46bf215546Sopenharmony_ci * 2 6 a e 47bf215546Sopenharmony_ci * 2 0 48bf215546Sopenharmony_ci * 6 1 49bf215546Sopenharmony_ci * a 2 50bf215546Sopenharmony_ci * e 3 51bf215546Sopenharmony_ci */ 52bf215546Sopenharmony_ciconst struct intel_sample_position intel_sample_positions_4x[] = { 53bf215546Sopenharmony_ci { 0.375, 0.125 }, 54bf215546Sopenharmony_ci { 0.875, 0.375 }, 55bf215546Sopenharmony_ci { 0.125, 0.625 }, 56bf215546Sopenharmony_ci { 0.625, 0.875 }, 57bf215546Sopenharmony_ci}; 58bf215546Sopenharmony_ci 59bf215546Sopenharmony_ci/** 60bf215546Sopenharmony_ci * Sample positions: 61bf215546Sopenharmony_ci * 62bf215546Sopenharmony_ci * From the Ivy Bridge PRM, Vol2 Part1 p304 (3DSTATE_MULTISAMPLE: 63bf215546Sopenharmony_ci * Programming Notes): 64bf215546Sopenharmony_ci * "When programming the sample offsets (for NUMSAMPLES_4 or _8 and 65bf215546Sopenharmony_ci * MSRASTMODE_xxx_PATTERN), the order of the samples 0 to 3 (or 7 66bf215546Sopenharmony_ci * for 8X) must have monotonically increasing distance from the 67bf215546Sopenharmony_ci * pixel center. This is required to get the correct centroid 68bf215546Sopenharmony_ci * computation in the device." 69bf215546Sopenharmony_ci * 70bf215546Sopenharmony_ci * Sample positions: 71bf215546Sopenharmony_ci * 1 3 5 7 9 b d f 72bf215546Sopenharmony_ci * 1 7 73bf215546Sopenharmony_ci * 3 3 74bf215546Sopenharmony_ci * 5 0 75bf215546Sopenharmony_ci * 7 5 76bf215546Sopenharmony_ci * 9 2 77bf215546Sopenharmony_ci * b 1 78bf215546Sopenharmony_ci * d 4 79bf215546Sopenharmony_ci * f 6 80bf215546Sopenharmony_ci */ 81bf215546Sopenharmony_ciconst struct intel_sample_position intel_sample_positions_8x[] = { 82bf215546Sopenharmony_ci { 0.5625, 0.3125 }, 83bf215546Sopenharmony_ci { 0.4375, 0.6875 }, 84bf215546Sopenharmony_ci { 0.8125, 0.5625 }, 85bf215546Sopenharmony_ci { 0.3125, 0.1875 }, 86bf215546Sopenharmony_ci { 0.1875, 0.8125 }, 87bf215546Sopenharmony_ci { 0.0625, 0.4375 }, 88bf215546Sopenharmony_ci { 0.6875, 0.9375 }, 89bf215546Sopenharmony_ci { 0.9375, 0.0625 }, 90bf215546Sopenharmony_ci}; 91bf215546Sopenharmony_ci 92bf215546Sopenharmony_ci/** 93bf215546Sopenharmony_ci * Sample positions: 94bf215546Sopenharmony_ci * 95bf215546Sopenharmony_ci * 0 1 2 3 4 5 6 7 8 9 a b c d e f 96bf215546Sopenharmony_ci * 0 15 97bf215546Sopenharmony_ci * 1 9 98bf215546Sopenharmony_ci * 2 10 99bf215546Sopenharmony_ci * 3 7 100bf215546Sopenharmony_ci * 4 13 101bf215546Sopenharmony_ci * 5 1 102bf215546Sopenharmony_ci * 6 4 103bf215546Sopenharmony_ci * 7 3 104bf215546Sopenharmony_ci * 8 12 105bf215546Sopenharmony_ci * 9 0 106bf215546Sopenharmony_ci * a 2 107bf215546Sopenharmony_ci * b 6 108bf215546Sopenharmony_ci * c 11 109bf215546Sopenharmony_ci * d 5 110bf215546Sopenharmony_ci * e 8 111bf215546Sopenharmony_ci * f 14 112bf215546Sopenharmony_ci */ 113bf215546Sopenharmony_ciconst struct intel_sample_position intel_sample_positions_16x[] = { 114bf215546Sopenharmony_ci { 0.5625, 0.5625 }, 115bf215546Sopenharmony_ci { 0.4375, 0.3125 }, 116bf215546Sopenharmony_ci { 0.3125, 0.6250 }, 117bf215546Sopenharmony_ci { 0.7500, 0.4375 }, 118bf215546Sopenharmony_ci { 0.1875, 0.3750 }, 119bf215546Sopenharmony_ci { 0.6250, 0.8125 }, 120bf215546Sopenharmony_ci { 0.8125, 0.6875 }, 121bf215546Sopenharmony_ci { 0.6875, 0.1875 }, 122bf215546Sopenharmony_ci { 0.3750, 0.8750 }, 123bf215546Sopenharmony_ci { 0.5000, 0.0625 }, 124bf215546Sopenharmony_ci { 0.2500, 0.1250 }, 125bf215546Sopenharmony_ci { 0.1250, 0.7500 }, 126bf215546Sopenharmony_ci { 0.0000, 0.5000 }, 127bf215546Sopenharmony_ci { 0.9375, 0.2500 }, 128bf215546Sopenharmony_ci { 0.8750, 0.9375 }, 129bf215546Sopenharmony_ci { 0.0625, 0.0000 }, 130bf215546Sopenharmony_ci}; 131