diff options
Diffstat (limited to 'src/video_core/pica.h')
| -rw-r--r-- | src/video_core/pica.h | 66 |
1 files changed, 11 insertions, 55 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 9077b1725..2e0c33201 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h | |||
| @@ -1089,7 +1089,16 @@ struct Regs { | |||
| 1089 | } | 1089 | } |
| 1090 | } command_buffer; | 1090 | } command_buffer; |
| 1091 | 1091 | ||
| 1092 | INSERT_PADDING_WORDS(0x20); | 1092 | INSERT_PADDING_WORDS(0x07); |
| 1093 | |||
| 1094 | enum class GPUMode : u32 { | ||
| 1095 | Drawing = 0, | ||
| 1096 | Configuring = 1 | ||
| 1097 | }; | ||
| 1098 | |||
| 1099 | GPUMode gpu_mode; | ||
| 1100 | |||
| 1101 | INSERT_PADDING_WORDS(0x18); | ||
| 1093 | 1102 | ||
| 1094 | enum class TriangleTopology : u32 { | 1103 | enum class TriangleTopology : u32 { |
| 1095 | List = 0, | 1104 | List = 0, |
| @@ -1278,6 +1287,7 @@ ASSERT_REG_POSITION(trigger_draw, 0x22e); | |||
| 1278 | ASSERT_REG_POSITION(trigger_draw_indexed, 0x22f); | 1287 | ASSERT_REG_POSITION(trigger_draw_indexed, 0x22f); |
| 1279 | ASSERT_REG_POSITION(vs_default_attributes_setup, 0x232); | 1288 | ASSERT_REG_POSITION(vs_default_attributes_setup, 0x232); |
| 1280 | ASSERT_REG_POSITION(command_buffer, 0x238); | 1289 | ASSERT_REG_POSITION(command_buffer, 0x238); |
| 1290 | ASSERT_REG_POSITION(gpu_mode, 0x245); | ||
| 1281 | ASSERT_REG_POSITION(triangle_topology, 0x25e); | 1291 | ASSERT_REG_POSITION(triangle_topology, 0x25e); |
| 1282 | ASSERT_REG_POSITION(restart_primitive, 0x25f); | 1292 | ASSERT_REG_POSITION(restart_primitive, 0x25f); |
| 1283 | ASSERT_REG_POSITION(gs, 0x280); | 1293 | ASSERT_REG_POSITION(gs, 0x280); |
| @@ -1292,64 +1302,10 @@ static_assert(sizeof(Regs::ShaderConfig) == 0x30 * sizeof(u32), "ShaderConfig st | |||
| 1292 | static_assert(sizeof(Regs) <= 0x300 * sizeof(u32), "Register set structure larger than it should be"); | 1302 | static_assert(sizeof(Regs) <= 0x300 * sizeof(u32), "Register set structure larger than it should be"); |
| 1293 | static_assert(sizeof(Regs) >= 0x300 * sizeof(u32), "Register set structure smaller than it should be"); | 1303 | static_assert(sizeof(Regs) >= 0x300 * sizeof(u32), "Register set structure smaller than it should be"); |
| 1294 | 1304 | ||
| 1295 | /// Struct used to describe current Pica state | ||
| 1296 | struct State { | ||
| 1297 | /// Pica registers | ||
| 1298 | Regs regs; | ||
| 1299 | |||
| 1300 | /// Vertex shader memory | ||
| 1301 | struct ShaderSetup { | ||
| 1302 | struct { | ||
| 1303 | // The float uniforms are accessed by the shader JIT using SSE instructions, and are | ||
| 1304 | // therefore required to be 16-byte aligned. | ||
| 1305 | Math::Vec4<float24> MEMORY_ALIGNED16(f[96]); | ||
| 1306 | |||
| 1307 | std::array<bool, 16> b; | ||
| 1308 | std::array<Math::Vec4<u8>, 4> i; | ||
| 1309 | } uniforms; | ||
| 1310 | |||
| 1311 | Math::Vec4<float24> default_attributes[16]; | ||
| 1312 | |||
| 1313 | std::array<u32, 1024> program_code; | ||
| 1314 | std::array<u32, 1024> swizzle_data; | ||
| 1315 | }; | ||
| 1316 | |||
| 1317 | ShaderSetup vs; | ||
| 1318 | ShaderSetup gs; | ||
| 1319 | |||
| 1320 | struct { | ||
| 1321 | union LutEntry { | ||
| 1322 | // Used for raw access | ||
| 1323 | u32 raw; | ||
| 1324 | |||
| 1325 | // LUT value, encoded as 12-bit fixed point, with 12 fraction bits | ||
| 1326 | BitField< 0, 12, u32> value; | ||
| 1327 | |||
| 1328 | // Used by HW for efficient interpolation, Citra does not use these | ||
| 1329 | BitField<12, 12, u32> difference; | ||
| 1330 | |||
| 1331 | float ToFloat() { | ||
| 1332 | return static_cast<float>(value) / 4095.f; | ||
| 1333 | } | ||
| 1334 | }; | ||
| 1335 | |||
| 1336 | std::array<std::array<LutEntry, 256>, 24> luts; | ||
| 1337 | } lighting; | ||
| 1338 | |||
| 1339 | /// Current Pica command list | ||
| 1340 | struct { | ||
| 1341 | const u32* head_ptr; | ||
| 1342 | const u32* current_ptr; | ||
| 1343 | u32 length; | ||
| 1344 | } cmd_list; | ||
| 1345 | }; | ||
| 1346 | |||
| 1347 | /// Initialize Pica state | 1305 | /// Initialize Pica state |
| 1348 | void Init(); | 1306 | void Init(); |
| 1349 | 1307 | ||
| 1350 | /// Shutdown Pica state | 1308 | /// Shutdown Pica state |
| 1351 | void Shutdown(); | 1309 | void Shutdown(); |
| 1352 | 1310 | ||
| 1353 | extern State g_state; ///< Current Pica state | ||
| 1354 | |||
| 1355 | } // namespace | 1311 | } // namespace |