summaryrefslogtreecommitdiffstats
path: root/src/video_core/buffer_cache/map_interval.h
blob: ad4db013591d2369313d693ca642b09146e1cf09 (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
// Copyright 2019 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include "common/common_types.h"
#include "video_core/gpu.h"

namespace VideoCommon {

struct MapInterval {
    constexpr explicit MapInterval() noexcept = default;

    constexpr explicit MapInterval(VAddr start, VAddr end, GPUVAddr gpu_addr) noexcept
        : start{start}, end{end}, gpu_addr{gpu_addr} {}

    constexpr bool IsInside(VAddr other_start, VAddr other_end) const noexcept {
        return (start <= other_start && other_end <= end);
    }

    constexpr bool operator==(const MapInterval& rhs) const noexcept {
        return start == rhs.start && end == rhs.end;
    }

    constexpr bool operator!=(const MapInterval& rhs) const noexcept {
        return !operator==(rhs);
    }

    constexpr void MarkAsModified(bool is_modified_, u64 ticks_) noexcept {
        is_modified = is_modified_;
        ticks = ticks_;
    }

    VAddr start = 0;
    VAddr end = 0;
    GPUVAddr gpu_addr = 0;
    VAddr cpu_addr = 0;
    u64 ticks = 0;
    bool is_written = false;
    bool is_modified = false;
    bool is_registered = false;
    bool is_memory_marked = false;
    bool is_sync_pending = false;
};

} // namespace VideoCommon