// Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "qssgrendercommands_p.h" const char *QSSGCommand::typeAsString() const { switch (m_type) { case CommandType::Unknown: return "Unknown"; case CommandType::AllocateBuffer: return "AllocateBuffer"; case CommandType::BindTarget: return "BindTarget"; case CommandType::BindBuffer: return "BindBuffer"; case CommandType::BindShader: return "BindShader"; case CommandType::ApplyInstanceValue: return "ApplyInstanceValue"; case CommandType::ApplyBufferValue: return "ApplyBufferValue"; case CommandType::Render: return "Render"; case CommandType::ApplyValue: return "ApplyValue"; default: break; } return ""; } QString QSSGCommand::debugString() const { QString result; QDebug stream(&result); switch (m_type) { case CommandType::AllocateBuffer: static_cast(this)->addDebug(stream); break; case CommandType::BindTarget: static_cast(this)->addDebug(stream); break; case CommandType::BindBuffer: static_cast(this)->addDebug(stream); break; case CommandType::BindShader: static_cast(this)->addDebug(stream); break; case CommandType::ApplyInstanceValue: static_cast(this)->addDebug(stream); break; case CommandType::ApplyBufferValue: static_cast(this)->addDebug(stream); break; case CommandType::Render: static_cast(this)->addDebug(stream); break; case CommandType::ApplyValue: static_cast(this)->addDebug(stream); break; case CommandType::Unknown: default: addDebug(stream); break; } return result; } void QSSGCommand::addDebug(QDebug &stream) const { stream << "No debug info for " << typeAsString(); }