diff options
| author | 2018-03-22 19:47:28 -0400 | |
|---|---|---|
| committer | 2018-03-22 19:47:28 -0400 | |
| commit | 3a6604e8fa07ed68362f884a7d15797e5e67b791 (patch) | |
| tree | bd908a08a4f390eea8a2e3ffa524c497830f9292 /src | |
| parent | renderer: Create rasterizer and cleanup. (diff) | |
| download | yuzu-3a6604e8fa07ed68362f884a7d15797e5e67b791.tar.gz yuzu-3a6604e8fa07ed68362f884a7d15797e5e67b791.tar.xz yuzu-3a6604e8fa07ed68362f884a7d15797e5e67b791.zip | |
maxwell_3d: Add some format decodings and string helper functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 110 |
1 files changed, 107 insertions, 3 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index aab282b77..69ed56338 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <unordered_map> | 8 | #include <unordered_map> |
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | #include "common/assert.h" | ||
| 10 | #include "common/bit_field.h" | 11 | #include "common/bit_field.h" |
| 11 | #include "common/common_funcs.h" | 12 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| @@ -62,6 +63,107 @@ public: | |||
| 62 | Fragment = 4, | 63 | Fragment = 4, |
| 63 | }; | 64 | }; |
| 64 | 65 | ||
| 66 | enum class VertexSize : u32 { | ||
| 67 | Size_32_32_32_32 = 0x01, | ||
| 68 | Size_32_32_32 = 0x02, | ||
| 69 | Size_16_16_16_16 = 0x03, | ||
| 70 | Size_32_32 = 0x04, | ||
| 71 | Size_16_16_16 = 0x05, | ||
| 72 | Size_8_8_8_8 = 0x0a, | ||
| 73 | Size_16_16 = 0x0f, | ||
| 74 | Size_32 = 0x12, | ||
| 75 | Size_8_8_8 = 0x13, | ||
| 76 | Size_8_8 = 0x18, | ||
| 77 | Size_16 = 0x1b, | ||
| 78 | Size_8 = 0x1d, | ||
| 79 | Size_10_10_10_2 = 0x30, | ||
| 80 | Size_11_11_10 = 0x31, | ||
| 81 | }; | ||
| 82 | |||
| 83 | static std::string VertexSizeToString(VertexSize vertex_size) { | ||
| 84 | switch (vertex_size) { | ||
| 85 | case VertexSize::Size_32_32_32_32: | ||
| 86 | return "32_32_32_32"; | ||
| 87 | case VertexSize::Size_32_32_32: | ||
| 88 | return "32_32_32"; | ||
| 89 | case VertexSize::Size_16_16_16_16: | ||
| 90 | return "16_16_16_16"; | ||
| 91 | case VertexSize::Size_32_32: | ||
| 92 | return "32_32"; | ||
| 93 | case VertexSize::Size_16_16_16: | ||
| 94 | return "16_16_16"; | ||
| 95 | case VertexSize::Size_8_8_8_8: | ||
| 96 | return "8_8_8_8"; | ||
| 97 | case VertexSize::Size_16_16: | ||
| 98 | return "16_16"; | ||
| 99 | case VertexSize::Size_32: | ||
| 100 | return "32"; | ||
| 101 | case VertexSize::Size_8_8_8: | ||
| 102 | return "8_8_8"; | ||
| 103 | case VertexSize::Size_8_8: | ||
| 104 | return "8_8"; | ||
| 105 | case VertexSize::Size_16: | ||
| 106 | return "16"; | ||
| 107 | case VertexSize::Size_8: | ||
| 108 | return "8"; | ||
| 109 | case VertexSize::Size_10_10_10_2: | ||
| 110 | return "10_10_10_2"; | ||
| 111 | case VertexSize::Size_11_11_10: | ||
| 112 | return "11_11_10"; | ||
| 113 | } | ||
| 114 | UNIMPLEMENTED(); | ||
| 115 | return {}; | ||
| 116 | } | ||
| 117 | |||
| 118 | enum class VertexType : u32 { | ||
| 119 | SignedNorm = 1, | ||
| 120 | UnsignedNorm = 2, | ||
| 121 | SignedInt = 3, | ||
| 122 | UnsignedInt = 4, | ||
| 123 | UnsignedScaled = 5, | ||
| 124 | SignedScaled = 6, | ||
| 125 | Float = 7, | ||
| 126 | }; | ||
| 127 | |||
| 128 | static std::string VertexTypeToString(VertexType vertex_type) { | ||
| 129 | switch (vertex_type) { | ||
| 130 | case VertexType::SignedNorm: | ||
| 131 | return "SignedNorm"; | ||
| 132 | case VertexType::UnsignedNorm: | ||
| 133 | return "UnsignedNorm"; | ||
| 134 | case VertexType::SignedInt: | ||
| 135 | return "SignedInt"; | ||
| 136 | case VertexType::UnsignedInt: | ||
| 137 | return "UnsignedInt"; | ||
| 138 | case VertexType::UnsignedScaled: | ||
| 139 | return "UnsignedScaled"; | ||
| 140 | case VertexType::SignedScaled: | ||
| 141 | return "SignedScaled"; | ||
| 142 | case VertexType::Float: | ||
| 143 | return "Float"; | ||
| 144 | } | ||
| 145 | UNIMPLEMENTED(); | ||
| 146 | return {}; | ||
| 147 | } | ||
| 148 | |||
| 149 | enum class PrimitiveTopology : u32 { | ||
| 150 | Points = 0x0, | ||
| 151 | Lines = 0x1, | ||
| 152 | LineLoop = 0x2, | ||
| 153 | LineStrip = 0x3, | ||
| 154 | Triangles = 0x4, | ||
| 155 | TriangleStrip = 0x5, | ||
| 156 | TriangleFan = 0x6, | ||
| 157 | Quads = 0x7, | ||
| 158 | QuadStrip = 0x8, | ||
| 159 | Polygon = 0x9, | ||
| 160 | LinesAdjacency = 0xa, | ||
| 161 | LineStripAdjacency = 0xb, | ||
| 162 | TrianglesAdjacency = 0xc, | ||
| 163 | TriangleStripAdjacency = 0xd, | ||
| 164 | Patches = 0xe, | ||
| 165 | }; | ||
| 166 | |||
| 65 | union { | 167 | union { |
| 66 | struct { | 168 | struct { |
| 67 | INSERT_PADDING_WORDS(0x200); | 169 | INSERT_PADDING_WORDS(0x200); |
| @@ -112,8 +214,8 @@ public: | |||
| 112 | BitField<0, 5, u32> buffer; | 214 | BitField<0, 5, u32> buffer; |
| 113 | BitField<6, 1, u32> constant; | 215 | BitField<6, 1, u32> constant; |
| 114 | BitField<7, 14, u32> offset; | 216 | BitField<7, 14, u32> offset; |
| 115 | BitField<21, 6, u32> size; | 217 | BitField<21, 6, VertexSize> size; |
| 116 | BitField<27, 3, u32> type; | 218 | BitField<27, 3, VertexType> type; |
| 117 | BitField<31, 1, u32> bgra; | 219 | BitField<31, 1, u32> bgra; |
| 118 | } vertex_attrib_format[NumVertexAttributes]; | 220 | } vertex_attrib_format[NumVertexAttributes]; |
| 119 | 221 | ||
| @@ -163,13 +265,15 @@ public: | |||
| 163 | } | 265 | } |
| 164 | } code_address; | 266 | } code_address; |
| 165 | INSERT_PADDING_WORDS(1); | 267 | INSERT_PADDING_WORDS(1); |
| 268 | |||
| 166 | struct { | 269 | struct { |
| 167 | u32 vertex_end_gl; | 270 | u32 vertex_end_gl; |
| 168 | union { | 271 | union { |
| 169 | u32 vertex_begin_gl; | 272 | u32 vertex_begin_gl; |
| 170 | BitField<0, 16, u32> topology; | 273 | BitField<0, 16, PrimitiveTopology> topology; |
| 171 | }; | 274 | }; |
| 172 | } draw; | 275 | } draw; |
| 276 | |||
| 173 | INSERT_PADDING_WORDS(0x139); | 277 | INSERT_PADDING_WORDS(0x139); |
| 174 | struct { | 278 | struct { |
| 175 | u32 query_address_high; | 279 | u32 query_address_high; |