summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/debugger/graphics_framebuffer.h
blob: dff91d131b1cf6dcad10f04d034951f03bdd2fdb (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include <QDockWidget>

#include "graphics_breakpoint_observer.h"

class QComboBox;
class QLabel;
class QSpinBox;

class CSpinBox;

class GraphicsFramebufferWidget : public BreakPointObserverDock {
    Q_OBJECT

    using Event = Pica::DebugContext::Event;

    enum class Source {
        PicaTarget = 0,
        DepthBuffer = 1,
        Custom = 2,

        // TODO: Add GPU framebuffer sources!
    };

    enum class Format {
        RGBA8    = 0,
        RGB8     = 1,
        RGB5A1   = 2,
        RGB565   = 3,
        RGBA4    = 4,
        D16      = 5,
        D24      = 6,
        D24S8    = 7
    };

    static u32 BytesPerPixel(Format format);

public:
    GraphicsFramebufferWidget(std::shared_ptr<Pica::DebugContext> debug_context, QWidget* parent = nullptr);

public slots:
    void OnFramebufferSourceChanged(int new_value);
    void OnFramebufferAddressChanged(qint64 new_value);
    void OnFramebufferWidthChanged(int new_value);
    void OnFramebufferHeightChanged(int new_value);
    void OnFramebufferFormatChanged(int new_value);
    void OnUpdate();

private slots:
    void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
    void OnResumed() override;

signals:
    void Update();

private:

    QComboBox* framebuffer_source_list;
    CSpinBox* framebuffer_address_control;
    QSpinBox* framebuffer_width_control;
    QSpinBox* framebuffer_height_control;
    QComboBox* framebuffer_format_control;

    QLabel* framebuffer_picture_label;

    Source framebuffer_source;
    unsigned framebuffer_address;
    unsigned framebuffer_width;
    unsigned framebuffer_height;
    Format framebuffer_format;
};