Skip to content

Commit b397926

Browse files
committed
Replace FormatElement with ShaderConstant/ShaderVariableType
* FormatElement is now a static BufferFormatter class to help generate and parse buffer formatting strings
1 parent 4214aa4 commit b397926

21 files changed

+913
-650
lines changed

qrenderdoc/Code/FormatElement.cpp renamed to qrenderdoc/Code/BufferFormatter.cpp

Lines changed: 656 additions & 325 deletions
Large diffs are not rendered by default.

qrenderdoc/Code/CaptureContext.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,8 @@ void CaptureContext::LoadCapture(const rdcstr &captureFile, const ReplayOptions
736736
{
737737
m_CaptureTemporary = temporary;
738738

739+
BufferFormatter::Init(m_APIProps.pipelineType);
740+
739741
m_CaptureMods = CaptureModifications::NoModifications;
740742

741743
rdcarray<ICaptureViewer *> viewers(m_CaptureViewers);

qrenderdoc/Code/QRDUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,4 +2191,4 @@ void *AccessWaylandPlatformInterface(const QByteArray &resource, QWindow *window
21912191
{
21922192
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
21932193
return native->nativeResourceForWindow(resource, window);
2194-
}
2194+
}

qrenderdoc/Code/QRDUtils.h

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,33 +74,37 @@ inline QMetaType::Type GetVariantMetatype(const QVariant &v)
7474
return (QMetaType::Type)v.type();
7575
}
7676

77-
struct FormatElement
77+
struct BufferFormatter
7878
{
79-
Q_DECLARE_TR_FUNCTIONS(FormatElement);
79+
Q_DECLARE_TR_FUNCTIONS(BufferFormatter);
8080

81-
public:
82-
FormatElement();
83-
FormatElement(const QString &Name, uint offs, bool rowMat, uint matDim, ResourceFormat f,
84-
bool hexDisplay, bool rgbDisplay);
81+
static GraphicsAPI m_API;
8582

86-
static QList<FormatElement> ParseFormatString(const QString &formatString, uint64_t maxLen,
87-
bool tightPacking, QString &errors);
83+
static QString DeclareStruct(QList<QString> &declaredStructs, const QString &name,
84+
const rdcarray<ShaderConstant> &members, uint32_t requiredByteStride);
8885

89-
static QString GenerateTextureBufferFormat(const TextureDescription &tex);
86+
public:
87+
BufferFormatter() = default;
9088

91-
ShaderVariable GetShaderVar(const byte *&data, const byte *end) const;
89+
static void Init(GraphicsAPI api) { m_API = api; }
90+
static ShaderConstant ParseFormatString(const QString &formatString, uint64_t maxLen,
91+
bool tightPacking, QString &errors);
9292

93-
QString name;
94-
ResourceFormat format;
95-
uint32_t offset;
96-
uint32_t matrixdim;
97-
bool rowmajor;
93+
static QString GetTextureFormatString(const TextureDescription &tex);
94+
static QString GetBufferFormatString(const ShaderResource &res, const ResourceFormat &viewFormat,
95+
uint64_t &baseByteOffset);
9896

99-
bool hex, rgb;
97+
static QString DeclareStruct(const QString &name, const rdcarray<ShaderConstant> &members,
98+
uint32_t requiredByteStride);
99+
static QString DeclarePaddingBytes(uint32_t bytes);
100100
};
101101

102-
QVariantList GetVariants(ResourceFormat rowFormat, uint32_t rowCount, const byte *&data,
103-
const byte *end);
102+
QVariantList GetVariants(ResourceFormat rowFormat, uint32_t rowCount, uint32_t rowByteStride,
103+
const byte *&data, const byte *end);
104+
ResourceFormat GetInterpretedResourceFormat(const ShaderConstant &elem);
105+
void SetInterpretedResourceFormat(ShaderConstant &elem, ResourceFormatType interpretType,
106+
CompType interpretCompType);
107+
ShaderVariable InterpretShaderVar(const ShaderConstant &elem, const byte *data, const byte *end);
104108

105109
QString TypeString(const ShaderVariable &v);
106110
QString RowString(const ShaderVariable &v, uint32_t row, VarType type = VarType::Unknown);

0 commit comments

Comments
 (0)