mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
58eb49ce5b
* This lets us use the existing logic for hovering columns, to get things like the hand cursor, while still only showing it for resource entries.
96 lines
3.1 KiB
C++
96 lines
3.1 KiB
C++
/******************************************************************************
|
|
* The MIT License (MIT)
|
|
*
|
|
* Copyright (c) 2025 Baldur Karlsson
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
******************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
#include "Extended/RDHeaderView.h"
|
|
#include "Extended/RDTreeWidget.h"
|
|
|
|
struct AnnotationResourceTag
|
|
{
|
|
AnnotationResourceTag() = default;
|
|
|
|
ResourceId resourceId;
|
|
ResourceType resourceType = ResourceType::Unknown;
|
|
|
|
// Buffer-specific fields
|
|
uint64_t bufferOffset = 0;
|
|
uint64_t bufferSize = UINT64_MAX;
|
|
rdcstr bufferFormat;
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(AnnotationResourceTag);
|
|
|
|
// can be used either as an embedded control in the resource inspector, or as a separate panel for
|
|
// monitoring API events
|
|
class AnnotationDisplay : public QFrame, public IAnnotationViewer, public ICaptureViewer
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit AnnotationDisplay(ICaptureContext &ctx, bool standalone, QWidget *parent = 0);
|
|
~AnnotationDisplay();
|
|
|
|
// IAnnotationViewer
|
|
QWidget *Widget() override { return this; }
|
|
void RevealAnnotation(const rdcstr &keyPath) override;
|
|
|
|
// ICaptureViewer
|
|
void OnCaptureLoaded() override;
|
|
void OnCaptureClosed() override;
|
|
void OnSelectedEventChanged(uint32_t eventId) override;
|
|
void OnEventChanged(uint32_t eventId) override {}
|
|
|
|
void setAnnotationObject(const SDObject *annotation);
|
|
|
|
private slots:
|
|
void customContextMenu(QModelIndex index, QMenu *menu);
|
|
void itemClicked(RDTreeWidgetItem *item, int column);
|
|
|
|
protected:
|
|
|
|
private:
|
|
ICaptureContext &m_Ctx;
|
|
const SDObject *m_Annotation = NULL;
|
|
|
|
RDTreeWidget *m_Tree;
|
|
RDHeaderView *m_Header;
|
|
RDTreeViewExpansionState m_Expansion;
|
|
|
|
// if this is a standalone viewer or not
|
|
bool m_Standalone = false;
|
|
|
|
// whether the Go column is present
|
|
bool m_HasGoColumn = false;
|
|
|
|
QMap<const SDObject *, RDTreeWidgetItem *> m_Items;
|
|
|
|
void addStructuredChildren(RDTreeWidgetItem *parent, const SDObject &parentObj);
|
|
|
|
bool hasResourceAnnotations(const SDObject &obj);
|
|
|
|
// either is a non-empty node, or has at least one non-empty child
|
|
bool shouldBeDisplayed(const SDObject &obj);
|
|
};
|