1 | // Copyright (C) 2020 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qssgrendercommands_p.h" |
5 | |
6 | const char *QSSGCommand::typeAsString() const |
7 | { |
8 | switch (m_type) { |
9 | case CommandType::Unknown: |
10 | return "Unknown"; |
11 | case CommandType::AllocateBuffer: |
12 | return "AllocateBuffer"; |
13 | case CommandType::BindTarget: |
14 | return "BindTarget"; |
15 | case CommandType::BindBuffer: |
16 | return "BindBuffer"; |
17 | case CommandType::BindShader: |
18 | return "BindShader"; |
19 | case CommandType::ApplyInstanceValue: |
20 | return "ApplyInstanceValue"; |
21 | case CommandType::ApplyBufferValue: |
22 | return "ApplyBufferValue"; |
23 | case CommandType::Render: |
24 | return "Render"; |
25 | case CommandType::ApplyValue: |
26 | return "ApplyValue"; |
27 | default: |
28 | break; |
29 | } |
30 | return ""; |
31 | } |
32 | |
33 | QString QSSGCommand::debugString() const |
34 | { |
35 | QString result; |
36 | QDebug stream(&result); |
37 | |
38 | switch (m_type) { |
39 | case CommandType::AllocateBuffer: |
40 | static_cast<const QSSGAllocateBuffer*>(this)->addDebug(stream); |
41 | break; |
42 | case CommandType::BindTarget: |
43 | static_cast<const QSSGBindTarget*>(this)->addDebug(stream); |
44 | break; |
45 | case CommandType::BindBuffer: |
46 | static_cast<const QSSGBindBuffer*>(this)->addDebug(stream); |
47 | break; |
48 | case CommandType::BindShader: |
49 | static_cast<const QSSGBindShader*>(this)->addDebug(stream); |
50 | break; |
51 | case CommandType::ApplyInstanceValue: |
52 | static_cast<const QSSGApplyInstanceValue*>(this)->addDebug(stream); |
53 | break; |
54 | case CommandType::ApplyBufferValue: |
55 | static_cast<const QSSGApplyBufferValue*>(this)->addDebug(stream); |
56 | break; |
57 | case CommandType::Render: |
58 | static_cast<const QSSGRender*>(this)->addDebug(stream); |
59 | break; |
60 | case CommandType::ApplyValue: |
61 | static_cast<const QSSGApplyValue*>(this)->addDebug(stream); |
62 | break; |
63 | case CommandType::Unknown: |
64 | default: |
65 | addDebug(stream); |
66 | break; |
67 | } |
68 | |
69 | return result; |
70 | } |
71 | |
72 | void QSSGCommand::addDebug(QDebug &stream) const |
73 | { |
74 | stream << "No debug info for "<< typeAsString(); |
75 | } |
76 |