aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache/image_info.h
blob: 79237aa482b844c410aa11f409e7882b1428228b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "video_core/engines/fermi_2d.h"
#include "video_core/engines/maxwell_3d.h"
#include "video_core/engines/maxwell_dma.h"
#include "video_core/surface.h"
#include "video_core/texture_cache/types.h"

namespace VideoCommon {

using Tegra::Texture::TICEntry;
using VideoCore::Surface::PixelFormat;

// Native descriptors address the selected view directly. The legacy NVN
// layer-base bookkeeping is not an additional array prefix for this ABI.
inline TICEntry TextureViewHeader(TICEntry entry, bool native) {
    if (native) {
        entry.layer_base_0_2.Assign(0);
        entry.layer_base_3_7.Assign(0);
        entry.layer_base_8_10.Assign(0);
    }
    return entry;
}

struct ImageInfo {
    ImageInfo() = default;
    explicit ImageInfo(const TICEntry& config) noexcept;
    explicit ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig& ct,
                       Tegra::Texture::MsaaMode msaa_mode) noexcept;
    explicit ImageInfo(const Tegra::Engines::Maxwell3D::Regs::Zeta& zt,
                       const Tegra::Engines::Maxwell3D::Regs::ZetaSize& zt_size,
                       Tegra::Texture::MsaaMode msaa_mode) noexcept;
    explicit ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept;
    explicit ImageInfo(const Tegra::DMA::ImageOperand& config) noexcept;

    PixelFormat format = PixelFormat::Invalid;
    ImageType type = ImageType::e1D;
    SubresourceExtent resources;
    Extent3D size{1, 1, 1};
    union {
        Extent3D block{0, 0, 0};
        u32 pitch;
    };
    u32 layer_stride = 0;
    u32 maybe_unaligned_layer_stride = 0;
    u32 num_samples = 1;
    u32 tile_width_spacing = 0;
    bool native_tiling = false;
    bool rescaleable = false;
    bool downscaleable = false;
    bool forced_flushed = false;
    bool dma_downloaded = false;
    bool is_sparse = false;
    // ASTC data whose blocks carry no alpha: re-compressed to BC1 instead of BC3 (half the size).
    bool astc_opaque = false;
};

} // namespace VideoCommon