1 /*
2  * Copyright © 2014-2018 Broadcom
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 #define V3D_OUTPUT_IMAGE_FORMAT_NO 255
25 
26 #include <stdbool.h>
27 #include <stdint.h>
28 
29 struct v3d_format {
30         /** Set if the pipe format is defined in the table. */
31         bool present;
32 
33         /** One of V3D33_OUTPUT_IMAGE_FORMAT_*, or OUTPUT_IMAGE_FORMAT_NO */
34         uint8_t rt_type;
35 
36         /** One of V3D33_TEXTURE_DATA_FORMAT_*. */
37         uint8_t tex_type;
38 
39         /**
40          * Swizzle to apply to the RGBA shader output for storing to the tile
41          * buffer, to the RGBA tile buffer to produce shader input (for
42          * blending), and for turning the rgba8888 texture sampler return
43          * value into shader rgba values.
44          */
45         uint8_t swizzle[4];
46 
47         /* Whether the return value is 16F/I/UI or 32F/I/UI. */
48         uint8_t return_size;
49 
50         /* If return_size == 32, how many channels are returned by texturing.
51          * 16 always returns 2 pairs of 16 bit values.
52          */
53         uint8_t return_channels;
54 };
55