diff options
| author | 2019-07-27 19:40:10 -0300 | |
|---|---|---|
| committer | 2020-02-14 17:27:17 -0300 | |
| commit | 2b58652f0897053d4da04deb586490220ab5a774 (patch) | |
| tree | cb49e0b4da2297e25da1aa196bbb38d6e996d399 /src/video_core/engines | |
| parent | gl_resource_manager: Add managed query class (diff) | |
| download | yuzu-2b58652f0897053d4da04deb586490220ab5a774.tar.gz yuzu-2b58652f0897053d4da04deb586490220ab5a774.tar.xz yuzu-2b58652f0897053d4da04deb586490220ab5a774.zip | |
maxwell_3d: Slow implementation of passed samples (query 21)
Implements GL_SAMPLES_PASSED by waiting immediately for queries.
Diffstat (limited to 'src/video_core/engines')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 39 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 38 |
2 files changed, 60 insertions, 17 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 0b3e8749b..fe91ff6a0 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -400,6 +400,10 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 400 | ProcessQueryCondition(); | 400 | ProcessQueryCondition(); |
| 401 | break; | 401 | break; |
| 402 | } | 402 | } |
| 403 | case MAXWELL3D_REG_INDEX(counter_reset): { | ||
| 404 | ProcessCounterReset(); | ||
| 405 | break; | ||
| 406 | } | ||
| 403 | case MAXWELL3D_REG_INDEX(sync_info): { | 407 | case MAXWELL3D_REG_INDEX(sync_info): { |
| 404 | ProcessSyncPoint(); | 408 | ProcessSyncPoint(); |
| 405 | break; | 409 | break; |
| @@ -544,23 +548,23 @@ void Maxwell3D::ProcessQueryGet() { | |||
| 544 | "Units other than CROP are unimplemented"); | 548 | "Units other than CROP are unimplemented"); |
| 545 | 549 | ||
| 546 | switch (regs.query.query_get.operation) { | 550 | switch (regs.query.query_get.operation) { |
| 547 | case Regs::QueryOperation::Release: { | 551 | case Regs::QueryOperation::Release: |
| 548 | const u64 result = regs.query.query_sequence; | 552 | StampQueryResult(regs.query.query_sequence, regs.query.query_get.short_query == 0); |
| 549 | StampQueryResult(result, regs.query.query_get.short_query == 0); | ||
| 550 | break; | 553 | break; |
| 551 | } | 554 | case Regs::QueryOperation::Acquire: |
| 552 | case Regs::QueryOperation::Acquire: { | 555 | // TODO(Blinkhawk): Under this operation, the GPU waits for the CPU to write a value that |
| 553 | // Todo(Blinkhawk): Under this operation, the GPU waits for the CPU | 556 | // matches the current payload. |
| 554 | // to write a value that matches the current payload. | ||
| 555 | UNIMPLEMENTED_MSG("Unimplemented query operation ACQUIRE"); | 557 | UNIMPLEMENTED_MSG("Unimplemented query operation ACQUIRE"); |
| 556 | break; | 558 | break; |
| 557 | } | ||
| 558 | case Regs::QueryOperation::Counter: { | 559 | case Regs::QueryOperation::Counter: { |
| 559 | u64 result{}; | 560 | u64 result; |
| 560 | switch (regs.query.query_get.select) { | 561 | switch (regs.query.query_get.select) { |
| 561 | case Regs::QuerySelect::Zero: | 562 | case Regs::QuerySelect::Zero: |
| 562 | result = 0; | 563 | result = 0; |
| 563 | break; | 564 | break; |
| 565 | case Regs::QuerySelect::SamplesPassed: | ||
| 566 | result = rasterizer.Query(VideoCore::QueryType::SamplesPassed); | ||
| 567 | break; | ||
| 564 | default: | 568 | default: |
| 565 | result = 1; | 569 | result = 1; |
| 566 | UNIMPLEMENTED_MSG("Unimplemented query select type {}", | 570 | UNIMPLEMENTED_MSG("Unimplemented query select type {}", |
| @@ -569,15 +573,13 @@ void Maxwell3D::ProcessQueryGet() { | |||
| 569 | StampQueryResult(result, regs.query.query_get.short_query == 0); | 573 | StampQueryResult(result, regs.query.query_get.short_query == 0); |
| 570 | break; | 574 | break; |
| 571 | } | 575 | } |
| 572 | case Regs::QueryOperation::Trap: { | 576 | case Regs::QueryOperation::Trap: |
| 573 | UNIMPLEMENTED_MSG("Unimplemented query operation TRAP"); | 577 | UNIMPLEMENTED_MSG("Unimplemented query operation TRAP"); |
| 574 | break; | 578 | break; |
| 575 | } | 579 | default: |
| 576 | default: { | ||
| 577 | UNIMPLEMENTED_MSG("Unknown query operation"); | 580 | UNIMPLEMENTED_MSG("Unknown query operation"); |
| 578 | break; | 581 | break; |
| 579 | } | 582 | } |
| 580 | } | ||
| 581 | } | 583 | } |
| 582 | 584 | ||
| 583 | void Maxwell3D::ProcessQueryCondition() { | 585 | void Maxwell3D::ProcessQueryCondition() { |
| @@ -619,6 +621,17 @@ void Maxwell3D::ProcessQueryCondition() { | |||
| 619 | } | 621 | } |
| 620 | } | 622 | } |
| 621 | 623 | ||
| 624 | void Maxwell3D::ProcessCounterReset() { | ||
| 625 | switch (regs.counter_reset) { | ||
| 626 | case Regs::CounterReset::SampleCnt: | ||
| 627 | rasterizer.ResetCounter(VideoCore::QueryType::SamplesPassed); | ||
| 628 | break; | ||
| 629 | default: | ||
| 630 | UNIMPLEMENTED_MSG("counter_reset={}", static_cast<u32>(regs.counter_reset)); | ||
| 631 | break; | ||
| 632 | } | ||
| 633 | } | ||
| 634 | |||
| 622 | void Maxwell3D::ProcessSyncPoint() { | 635 | void Maxwell3D::ProcessSyncPoint() { |
| 623 | const u32 sync_point = regs.sync_info.sync_point.Value(); | 636 | const u32 sync_point = regs.sync_info.sync_point.Value(); |
| 624 | const u32 increment = regs.sync_info.increment.Value(); | 637 | const u32 increment = regs.sync_info.increment.Value(); |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 0a2af54e5..d21f678ed 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -409,6 +409,27 @@ public: | |||
| 409 | Linear = 1, | 409 | Linear = 1, |
| 410 | }; | 410 | }; |
| 411 | 411 | ||
| 412 | enum class CounterReset : u32 { | ||
| 413 | SampleCnt = 0x01, | ||
| 414 | Unk02 = 0x02, | ||
| 415 | Unk03 = 0x03, | ||
| 416 | Unk04 = 0x04, | ||
| 417 | EmittedPrimitives = 0x10, // Not tested | ||
| 418 | Unk11 = 0x11, | ||
| 419 | Unk12 = 0x12, | ||
| 420 | Unk13 = 0x13, | ||
| 421 | Unk15 = 0x15, | ||
| 422 | Unk16 = 0x16, | ||
| 423 | Unk17 = 0x17, | ||
| 424 | Unk18 = 0x18, | ||
| 425 | Unk1A = 0x1A, | ||
| 426 | Unk1B = 0x1B, | ||
| 427 | Unk1C = 0x1C, | ||
| 428 | Unk1D = 0x1D, | ||
| 429 | Unk1E = 0x1E, | ||
| 430 | GeneratedPrimitives = 0x1F, | ||
| 431 | }; | ||
| 432 | |||
| 412 | struct Cull { | 433 | struct Cull { |
| 413 | enum class FrontFace : u32 { | 434 | enum class FrontFace : u32 { |
| 414 | ClockWise = 0x0900, | 435 | ClockWise = 0x0900, |
| @@ -857,7 +878,7 @@ public: | |||
| 857 | BitField<7, 1, u32> c7; | 878 | BitField<7, 1, u32> c7; |
| 858 | } clip_distance_enabled; | 879 | } clip_distance_enabled; |
| 859 | 880 | ||
| 860 | INSERT_UNION_PADDING_WORDS(0x1); | 881 | u32 samplecnt_enable; |
| 861 | 882 | ||
| 862 | float point_size; | 883 | float point_size; |
| 863 | 884 | ||
| @@ -865,7 +886,11 @@ public: | |||
| 865 | 886 | ||
| 866 | u32 point_sprite_enable; | 887 | u32 point_sprite_enable; |
| 867 | 888 | ||
| 868 | INSERT_UNION_PADDING_WORDS(0x5); | 889 | INSERT_UNION_PADDING_WORDS(0x3); |
| 890 | |||
| 891 | CounterReset counter_reset; | ||
| 892 | |||
| 893 | INSERT_UNION_PADDING_WORDS(0x1); | ||
| 869 | 894 | ||
| 870 | u32 zeta_enable; | 895 | u32 zeta_enable; |
| 871 | 896 | ||
| @@ -1412,12 +1437,15 @@ private: | |||
| 1412 | /// Handles a write to the QUERY_GET register. | 1437 | /// Handles a write to the QUERY_GET register. |
| 1413 | void ProcessQueryGet(); | 1438 | void ProcessQueryGet(); |
| 1414 | 1439 | ||
| 1415 | // Writes the query result accordingly | 1440 | /// Writes the query result accordingly. |
| 1416 | void StampQueryResult(u64 payload, bool long_query); | 1441 | void StampQueryResult(u64 payload, bool long_query); |
| 1417 | 1442 | ||
| 1418 | // Handles Conditional Rendering | 1443 | /// Handles conditional rendering. |
| 1419 | void ProcessQueryCondition(); | 1444 | void ProcessQueryCondition(); |
| 1420 | 1445 | ||
| 1446 | /// Handles counter resets. | ||
| 1447 | void ProcessCounterReset(); | ||
| 1448 | |||
| 1421 | /// Handles writes to syncing register. | 1449 | /// Handles writes to syncing register. |
| 1422 | void ProcessSyncPoint(); | 1450 | void ProcessSyncPoint(); |
| 1423 | 1451 | ||
| @@ -1499,8 +1527,10 @@ ASSERT_REG_POSITION(screen_y_control, 0x4EB); | |||
| 1499 | ASSERT_REG_POSITION(vb_element_base, 0x50D); | 1527 | ASSERT_REG_POSITION(vb_element_base, 0x50D); |
| 1500 | ASSERT_REG_POSITION(vb_base_instance, 0x50E); | 1528 | ASSERT_REG_POSITION(vb_base_instance, 0x50E); |
| 1501 | ASSERT_REG_POSITION(clip_distance_enabled, 0x544); | 1529 | ASSERT_REG_POSITION(clip_distance_enabled, 0x544); |
| 1530 | ASSERT_REG_POSITION(samplecnt_enable, 0x545); | ||
| 1502 | ASSERT_REG_POSITION(point_size, 0x546); | 1531 | ASSERT_REG_POSITION(point_size, 0x546); |
| 1503 | ASSERT_REG_POSITION(point_sprite_enable, 0x548); | 1532 | ASSERT_REG_POSITION(point_sprite_enable, 0x548); |
| 1533 | ASSERT_REG_POSITION(counter_reset, 0x54C); | ||
| 1504 | ASSERT_REG_POSITION(zeta_enable, 0x54E); | 1534 | ASSERT_REG_POSITION(zeta_enable, 0x54E); |
| 1505 | ASSERT_REG_POSITION(multisample_control, 0x54F); | 1535 | ASSERT_REG_POSITION(multisample_control, 0x54F); |
| 1506 | ASSERT_REG_POSITION(condition, 0x554); | 1536 | ASSERT_REG_POSITION(condition, 0x554); |