blob: ffc3ebbc5e54e30658efc40f980ff3058342390f [file] [log] [blame]
Chia-I Wuac6ba132014-08-07 14:21:43 +08001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
Chia-I Wu44e42362014-09-02 08:32:09 +080023 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
Chia-I Wuac6ba132014-08-07 14:21:43 +080026 */
27
28#ifndef FORMAT_H
29#define FORMAT_H
30
31#include "intel.h"
32
Chia-I Wufb240262014-08-16 13:26:06 +080033struct intel_gpu;
34
35static inline bool intel_format_is_depth(const struct intel_gpu *gpu,
36 XGL_FORMAT format)
Chia-I Wu1bf06df2014-08-16 12:33:13 +080037{
38 return (format.numericFormat == XGL_NUM_FMT_DS &&
39 (format.channelFormat == XGL_CH_FMT_R16 ||
40 format.channelFormat == XGL_CH_FMT_R32));
41}
42
Chia-I Wufb240262014-08-16 13:26:06 +080043static inline bool intel_format_is_stencil(const struct intel_gpu *gpu,
44 XGL_FORMAT format)
Chia-I Wu1bf06df2014-08-16 12:33:13 +080045{
46 return (format.numericFormat == XGL_NUM_FMT_DS &&
47 format.channelFormat == XGL_CH_FMT_R8);
48}
49
Chia-I Wufb240262014-08-16 13:26:06 +080050int intel_format_translate_color(const struct intel_gpu *gpu,
51 XGL_FORMAT format);
Chia-I Wu1bf06df2014-08-16 12:33:13 +080052
Chia-I Wuac6ba132014-08-07 14:21:43 +080053#endif /* FORMAT_H */