diff options
| author | 2022-11-29 18:45:16 -0500 | |
|---|---|---|
| committer | 2022-11-29 18:45:16 -0500 | |
| commit | c845d8a9e8b212308e729ffcd9ddf2e09884638e (patch) | |
| tree | 08e1eaaaf306e944885171f51e4ff6e644529e39 | |
| parent | Merge pull request #9354 from lioncash/const-param (diff) | |
| parent | maxwell_3d: Mark shifted value as unsigned (diff) | |
| download | yuzu-c845d8a9e8b212308e729ffcd9ddf2e09884638e.tar.gz yuzu-c845d8a9e8b212308e729ffcd9ddf2e09884638e.tar.xz yuzu-c845d8a9e8b212308e729ffcd9ddf2e09884638e.zip | |
Merge pull request #9352 from lioncash/vidcast
engines: Remove unnecessary casts
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/engines/engine_upload.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/engines/engine_upload.h | 2 | ||||
| -rw-r--r-- | src/video_core/engines/fermi_2d.h | 2 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.h | 14 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_memory.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 79 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_dma.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/engines/puller.cpp | 6 |
10 files changed, 60 insertions, 88 deletions
diff --git a/src/video_core/engines/engine_upload.cpp b/src/video_core/engines/engine_upload.cpp index 28aa85f32..e4f8331ab 100644 --- a/src/video_core/engines/engine_upload.cpp +++ b/src/video_core/engines/engine_upload.cpp | |||
| @@ -49,10 +49,9 @@ void State::ProcessData(std::span<const u8> read_buffer) { | |||
| 49 | if (regs.line_count == 1) { | 49 | if (regs.line_count == 1) { |
| 50 | rasterizer->AccelerateInlineToMemory(address, copy_size, read_buffer); | 50 | rasterizer->AccelerateInlineToMemory(address, copy_size, read_buffer); |
| 51 | } else { | 51 | } else { |
| 52 | for (u32 line = 0; line < regs.line_count; ++line) { | 52 | for (size_t line = 0; line < regs.line_count; ++line) { |
| 53 | const GPUVAddr dest_line = address + static_cast<size_t>(line) * regs.dest.pitch; | 53 | const GPUVAddr dest_line = address + line * regs.dest.pitch; |
| 54 | std::span<const u8> buffer(read_buffer.data() + | 54 | std::span<const u8> buffer(read_buffer.data() + line * regs.line_length_in, |
| 55 | static_cast<size_t>(line) * regs.line_length_in, | ||
| 56 | regs.line_length_in); | 55 | regs.line_length_in); |
| 57 | rasterizer->AccelerateInlineToMemory(dest_line, regs.line_length_in, buffer); | 56 | rasterizer->AccelerateInlineToMemory(dest_line, regs.line_length_in, buffer); |
| 58 | } | 57 | } |
diff --git a/src/video_core/engines/engine_upload.h b/src/video_core/engines/engine_upload.h index f08f6e36a..94fafd9dc 100644 --- a/src/video_core/engines/engine_upload.h +++ b/src/video_core/engines/engine_upload.h | |||
| @@ -39,7 +39,7 @@ struct Registers { | |||
| 39 | u32 y; | 39 | u32 y; |
| 40 | 40 | ||
| 41 | GPUVAddr Address() const { | 41 | GPUVAddr Address() const { |
| 42 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | address_low); | 42 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | u32 BlockWidth() const { | 45 | u32 BlockWidth() const { |
diff --git a/src/video_core/engines/fermi_2d.h b/src/video_core/engines/fermi_2d.h index 24b518cb5..100b21bac 100644 --- a/src/video_core/engines/fermi_2d.h +++ b/src/video_core/engines/fermi_2d.h | |||
| @@ -97,7 +97,7 @@ public: | |||
| 97 | u32 addr_lower; | 97 | u32 addr_lower; |
| 98 | 98 | ||
| 99 | [[nodiscard]] constexpr GPUVAddr Address() const noexcept { | 99 | [[nodiscard]] constexpr GPUVAddr Address() const noexcept { |
| 100 | return (static_cast<GPUVAddr>(addr_upper) << 32) | static_cast<GPUVAddr>(addr_lower); | 100 | return (GPUVAddr{addr_upper} << 32) | GPUVAddr{addr_lower}; |
| 101 | } | 101 | } |
| 102 | }; | 102 | }; |
| 103 | static_assert(sizeof(Surface) == 0x28, "Surface has incorrect size"); | 103 | static_assert(sizeof(Surface) == 0x28, "Surface has incorrect size"); |
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp index 7c50bdbe0..e5c622155 100644 --- a/src/video_core/engines/kepler_compute.cpp +++ b/src/video_core/engines/kepler_compute.cpp | |||
| @@ -50,11 +50,11 @@ void KeplerCompute::CallMultiMethod(u32 method, const u32* base_start, u32 amoun | |||
| 50 | u32 methods_pending) { | 50 | u32 methods_pending) { |
| 51 | switch (method) { | 51 | switch (method) { |
| 52 | case KEPLER_COMPUTE_REG_INDEX(data_upload): | 52 | case KEPLER_COMPUTE_REG_INDEX(data_upload): |
| 53 | upload_state.ProcessData(base_start, static_cast<size_t>(amount)); | 53 | upload_state.ProcessData(base_start, amount); |
| 54 | return; | 54 | return; |
| 55 | default: | 55 | default: |
| 56 | for (std::size_t i = 0; i < amount; i++) { | 56 | for (u32 i = 0; i < amount; i++) { |
| 57 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); | 57 | CallMethod(method, base_start[i], methods_pending - i <= 1); |
| 58 | } | 58 | } |
| 59 | break; | 59 | break; |
| 60 | } | 60 | } |
diff --git a/src/video_core/engines/kepler_compute.h b/src/video_core/engines/kepler_compute.h index aab309ecc..e154e3f06 100644 --- a/src/video_core/engines/kepler_compute.h +++ b/src/video_core/engines/kepler_compute.h | |||
| @@ -68,7 +68,7 @@ public: | |||
| 68 | struct { | 68 | struct { |
| 69 | u32 address; | 69 | u32 address; |
| 70 | GPUVAddr Address() const { | 70 | GPUVAddr Address() const { |
| 71 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address) << 8)); | 71 | return GPUVAddr{address} << 8; |
| 72 | } | 72 | } |
| 73 | } launch_desc_loc; | 73 | } launch_desc_loc; |
| 74 | 74 | ||
| @@ -83,8 +83,7 @@ public: | |||
| 83 | u32 address_low; | 83 | u32 address_low; |
| 84 | u32 limit; | 84 | u32 limit; |
| 85 | GPUVAddr Address() const { | 85 | GPUVAddr Address() const { |
| 86 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 86 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 87 | address_low); | ||
| 88 | } | 87 | } |
| 89 | } tsc; | 88 | } tsc; |
| 90 | 89 | ||
| @@ -95,8 +94,7 @@ public: | |||
| 95 | u32 address_low; | 94 | u32 address_low; |
| 96 | u32 limit; | 95 | u32 limit; |
| 97 | GPUVAddr Address() const { | 96 | GPUVAddr Address() const { |
| 98 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 97 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 99 | address_low); | ||
| 100 | } | 98 | } |
| 101 | } tic; | 99 | } tic; |
| 102 | 100 | ||
| @@ -106,8 +104,7 @@ public: | |||
| 106 | u32 address_high; | 104 | u32 address_high; |
| 107 | u32 address_low; | 105 | u32 address_low; |
| 108 | GPUVAddr Address() const { | 106 | GPUVAddr Address() const { |
| 109 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 107 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 110 | address_low); | ||
| 111 | } | 108 | } |
| 112 | } code_loc; | 109 | } code_loc; |
| 113 | 110 | ||
| @@ -162,8 +159,7 @@ public: | |||
| 162 | BitField<15, 17, u32> size; | 159 | BitField<15, 17, u32> size; |
| 163 | }; | 160 | }; |
| 164 | GPUVAddr Address() const { | 161 | GPUVAddr Address() const { |
| 165 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high.Value()) << 32) | | 162 | return (GPUVAddr{address_high.Value()} << 32) | GPUVAddr{address_low}; |
| 166 | address_low); | ||
| 167 | } | 163 | } |
| 168 | }; | 164 | }; |
| 169 | std::array<ConstBufferConfig, NumConstBuffers> const_buffer_config; | 165 | std::array<ConstBufferConfig, NumConstBuffers> const_buffer_config; |
diff --git a/src/video_core/engines/kepler_memory.cpp b/src/video_core/engines/kepler_memory.cpp index a3fbab1e5..08045d1cf 100644 --- a/src/video_core/engines/kepler_memory.cpp +++ b/src/video_core/engines/kepler_memory.cpp | |||
| @@ -42,11 +42,11 @@ void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount | |||
| 42 | u32 methods_pending) { | 42 | u32 methods_pending) { |
| 43 | switch (method) { | 43 | switch (method) { |
| 44 | case KEPLERMEMORY_REG_INDEX(data): | 44 | case KEPLERMEMORY_REG_INDEX(data): |
| 45 | upload_state.ProcessData(base_start, static_cast<size_t>(amount)); | 45 | upload_state.ProcessData(base_start, amount); |
| 46 | return; | 46 | return; |
| 47 | default: | 47 | default: |
| 48 | for (std::size_t i = 0; i < amount; i++) { | 48 | for (u32 i = 0; i < amount; i++) { |
| 49 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); | 49 | CallMethod(method, base_start[i], methods_pending - i <= 1); |
| 50 | } | 50 | } |
| 51 | break; | 51 | break; |
| 52 | } | 52 | } |
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 212427b8b..55462752c 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -370,11 +370,11 @@ void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | |||
| 370 | ProcessCBMultiData(base_start, amount); | 370 | ProcessCBMultiData(base_start, amount); |
| 371 | break; | 371 | break; |
| 372 | case MAXWELL3D_REG_INDEX(inline_data): | 372 | case MAXWELL3D_REG_INDEX(inline_data): |
| 373 | upload_state.ProcessData(base_start, static_cast<size_t>(amount)); | 373 | upload_state.ProcessData(base_start, amount); |
| 374 | return; | 374 | return; |
| 375 | default: | 375 | default: |
| 376 | for (std::size_t i = 0; i < amount; i++) { | 376 | for (u32 i = 0; i < amount; i++) { |
| 377 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); | 377 | CallMethod(method, base_start[i], methods_pending - i <= 1); |
| 378 | } | 378 | } |
| 379 | break; | 379 | break; |
| 380 | } | 380 | } |
| @@ -652,12 +652,12 @@ void Maxwell3D::ProcessDeferredDraw() { | |||
| 652 | return; | 652 | return; |
| 653 | } | 653 | } |
| 654 | 654 | ||
| 655 | u32 method_count = static_cast<u32>(deferred_draw_method.size()); | 655 | const auto method_count = deferred_draw_method.size(); |
| 656 | u32 instance_count = 1; | 656 | u32 instance_count = 1; |
| 657 | u32 vertex_buffer_count = 0; | 657 | u32 vertex_buffer_count = 0; |
| 658 | u32 index_buffer_count = 0; | 658 | u32 index_buffer_count = 0; |
| 659 | for (u32 index = 0; index < method_count; ++index) { | 659 | for (size_t index = 0; index < method_count; ++index) { |
| 660 | u32 method = deferred_draw_method[index]; | 660 | const u32 method = deferred_draw_method[index]; |
| 661 | if (method == MAXWELL3D_REG_INDEX(vertex_buffer.count)) { | 661 | if (method == MAXWELL3D_REG_INDEX(vertex_buffer.count)) { |
| 662 | instance_count = ++vertex_buffer_count; | 662 | instance_count = ++vertex_buffer_count; |
| 663 | } else if (method == MAXWELL3D_REG_INDEX(index_buffer.count)) { | 663 | } else if (method == MAXWELL3D_REG_INDEX(index_buffer.count)) { |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 84c497ebd..deba292a5 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -96,8 +96,7 @@ public: | |||
| 96 | u32 type; | 96 | u32 type; |
| 97 | 97 | ||
| 98 | GPUVAddr Address() const { | 98 | GPUVAddr Address() const { |
| 99 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 99 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 100 | address_low); | ||
| 101 | } | 100 | } |
| 102 | }; | 101 | }; |
| 103 | 102 | ||
| @@ -106,8 +105,7 @@ public: | |||
| 106 | u32 address_low; | 105 | u32 address_low; |
| 107 | 106 | ||
| 108 | GPUVAddr Address() const { | 107 | GPUVAddr Address() const { |
| 109 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 108 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 110 | address_low); | ||
| 111 | } | 109 | } |
| 112 | }; | 110 | }; |
| 113 | 111 | ||
| @@ -124,8 +122,7 @@ public: | |||
| 124 | Mode mode; | 122 | Mode mode; |
| 125 | 123 | ||
| 126 | GPUVAddr Address() const { | 124 | GPUVAddr Address() const { |
| 127 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(offset_high) << 32) | | 125 | return (GPUVAddr{offset_high} << 32) | GPUVAddr{offset_low}; |
| 128 | offset_low); | ||
| 129 | } | 126 | } |
| 130 | }; | 127 | }; |
| 131 | 128 | ||
| @@ -187,7 +184,7 @@ public: | |||
| 187 | default: | 184 | default: |
| 188 | // Thresholds begin at 0x10 (1 << 4) | 185 | // Thresholds begin at 0x10 (1 << 4) |
| 189 | // Threshold is in the range 0x1 to 0x13 | 186 | // Threshold is in the range 0x1 to 0x13 |
| 190 | return 1 << (4 + threshold.Value() - 1); | 187 | return 1U << (4 + threshold.Value() - 1); |
| 191 | } | 188 | } |
| 192 | } | 189 | } |
| 193 | }; | 190 | }; |
| @@ -468,8 +465,7 @@ public: | |||
| 468 | INSERT_PADDING_BYTES_NOINIT(0xC); | 465 | INSERT_PADDING_BYTES_NOINIT(0xC); |
| 469 | 466 | ||
| 470 | GPUVAddr Address() const { | 467 | GPUVAddr Address() const { |
| 471 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 468 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 472 | address_low); | ||
| 473 | } | 469 | } |
| 474 | }; | 470 | }; |
| 475 | static_assert(sizeof(Buffer) == 0x20); | 471 | static_assert(sizeof(Buffer) == 0x20); |
| @@ -511,12 +507,11 @@ public: | |||
| 511 | u32 default_size_per_warp; | 507 | u32 default_size_per_warp; |
| 512 | 508 | ||
| 513 | GPUVAddr Address() const { | 509 | GPUVAddr Address() const { |
| 514 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 510 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 515 | address_low); | ||
| 516 | } | 511 | } |
| 517 | 512 | ||
| 518 | u64 Size() const { | 513 | u64 Size() const { |
| 519 | return (static_cast<u64>(size_high) << 32) | size_low; | 514 | return (u64{size_high} << 32) | u64{size_low}; |
| 520 | } | 515 | } |
| 521 | }; | 516 | }; |
| 522 | 517 | ||
| @@ -538,13 +533,11 @@ public: | |||
| 538 | u32 storage_limit_address_low; | 533 | u32 storage_limit_address_low; |
| 539 | 534 | ||
| 540 | GPUVAddr StorageAddress() const { | 535 | GPUVAddr StorageAddress() const { |
| 541 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(storage_address_high) << 32) | | 536 | return (GPUVAddr{storage_address_high} << 32) | GPUVAddr{storage_address_low}; |
| 542 | storage_address_low); | ||
| 543 | } | 537 | } |
| 544 | GPUVAddr StorageLimitAddress() const { | 538 | GPUVAddr StorageLimitAddress() const { |
| 545 | return static_cast<GPUVAddr>( | 539 | return (GPUVAddr{storage_limit_address_high} << 32) | |
| 546 | (static_cast<GPUVAddr>(storage_limit_address_high) << 32) | | 540 | GPUVAddr{storage_limit_address_low}; |
| 547 | storage_limit_address_low); | ||
| 548 | } | 541 | } |
| 549 | }; | 542 | }; |
| 550 | 543 | ||
| @@ -829,11 +822,11 @@ public: | |||
| 829 | struct CompressionThresholdSamples { | 822 | struct CompressionThresholdSamples { |
| 830 | u32 samples; | 823 | u32 samples; |
| 831 | 824 | ||
| 832 | u32 Samples() { | 825 | u32 Samples() const { |
| 833 | if (samples == 0) { | 826 | if (samples == 0) { |
| 834 | return 0; | 827 | return 0; |
| 835 | } | 828 | } |
| 836 | return 1 << (samples - 1); | 829 | return 1U << (samples - 1); |
| 837 | } | 830 | } |
| 838 | }; | 831 | }; |
| 839 | 832 | ||
| @@ -1138,8 +1131,7 @@ public: | |||
| 1138 | INSERT_PADDING_BYTES_NOINIT(0x18); | 1131 | INSERT_PADDING_BYTES_NOINIT(0x18); |
| 1139 | 1132 | ||
| 1140 | GPUVAddr Address() const { | 1133 | GPUVAddr Address() const { |
| 1141 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 1134 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 1142 | address_low); | ||
| 1143 | } | 1135 | } |
| 1144 | }; | 1136 | }; |
| 1145 | static_assert(sizeof(RenderTargetConfig) == 0x40); | 1137 | static_assert(sizeof(RenderTargetConfig) == 0x40); |
| @@ -1482,8 +1474,7 @@ public: | |||
| 1482 | u32 address_low; | 1474 | u32 address_low; |
| 1483 | 1475 | ||
| 1484 | GPUVAddr Address() const { | 1476 | GPUVAddr Address() const { |
| 1485 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 1477 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 1486 | address_low); | ||
| 1487 | } | 1478 | } |
| 1488 | }; | 1479 | }; |
| 1489 | 1480 | ||
| @@ -1533,8 +1524,7 @@ public: | |||
| 1533 | u32 address_low; | 1524 | u32 address_low; |
| 1534 | 1525 | ||
| 1535 | GPUVAddr Address() const { | 1526 | GPUVAddr Address() const { |
| 1536 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 1527 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 1537 | address_low); | ||
| 1538 | } | 1528 | } |
| 1539 | }; | 1529 | }; |
| 1540 | 1530 | ||
| @@ -1561,8 +1551,7 @@ public: | |||
| 1561 | u32 array_pitch; | 1551 | u32 array_pitch; |
| 1562 | 1552 | ||
| 1563 | GPUVAddr Address() const { | 1553 | GPUVAddr Address() const { |
| 1564 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 1554 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 1565 | address_low); | ||
| 1566 | } | 1555 | } |
| 1567 | }; | 1556 | }; |
| 1568 | 1557 | ||
| @@ -1910,8 +1899,7 @@ public: | |||
| 1910 | Mode mode; | 1899 | Mode mode; |
| 1911 | 1900 | ||
| 1912 | GPUVAddr Address() const { | 1901 | GPUVAddr Address() const { |
| 1913 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 1902 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 1914 | address_low); | ||
| 1915 | } | 1903 | } |
| 1916 | }; | 1904 | }; |
| 1917 | 1905 | ||
| @@ -1921,8 +1909,7 @@ public: | |||
| 1921 | u32 limit; | 1909 | u32 limit; |
| 1922 | 1910 | ||
| 1923 | GPUVAddr Address() const { | 1911 | GPUVAddr Address() const { |
| 1924 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 1912 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 1925 | address_low); | ||
| 1926 | } | 1913 | } |
| 1927 | }; | 1914 | }; |
| 1928 | 1915 | ||
| @@ -1932,8 +1919,7 @@ public: | |||
| 1932 | u32 limit; | 1919 | u32 limit; |
| 1933 | 1920 | ||
| 1934 | GPUVAddr Address() const { | 1921 | GPUVAddr Address() const { |
| 1935 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 1922 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 1936 | address_low); | ||
| 1937 | } | 1923 | } |
| 1938 | }; | 1924 | }; |
| 1939 | 1925 | ||
| @@ -1981,8 +1967,7 @@ public: | |||
| 1981 | u32 address_low; | 1967 | u32 address_low; |
| 1982 | 1968 | ||
| 1983 | GPUVAddr Address() const { | 1969 | GPUVAddr Address() const { |
| 1984 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 1970 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 1985 | address_low); | ||
| 1986 | } | 1971 | } |
| 1987 | }; | 1972 | }; |
| 1988 | 1973 | ||
| @@ -2027,8 +2012,7 @@ public: | |||
| 2027 | u32 address_low; | 2012 | u32 address_low; |
| 2028 | 2013 | ||
| 2029 | GPUVAddr Address() const { | 2014 | GPUVAddr Address() const { |
| 2030 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 2015 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 2031 | address_low); | ||
| 2032 | } | 2016 | } |
| 2033 | }; | 2017 | }; |
| 2034 | 2018 | ||
| @@ -2224,19 +2208,16 @@ public: | |||
| 2224 | } | 2208 | } |
| 2225 | 2209 | ||
| 2226 | GPUVAddr StartAddress() const { | 2210 | GPUVAddr StartAddress() const { |
| 2227 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(start_addr_high) << 32) | | 2211 | return (GPUVAddr{start_addr_high} << 32) | GPUVAddr{start_addr_low}; |
| 2228 | start_addr_low); | ||
| 2229 | } | 2212 | } |
| 2230 | 2213 | ||
| 2231 | GPUVAddr EndAddress() const { | 2214 | GPUVAddr EndAddress() const { |
| 2232 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(limit_addr_high) << 32) | | 2215 | return (GPUVAddr{limit_addr_high} << 32) | GPUVAddr{limit_addr_low}; |
| 2233 | limit_addr_low); | ||
| 2234 | } | 2216 | } |
| 2235 | 2217 | ||
| 2236 | /// Adjust the index buffer offset so it points to the first desired index. | 2218 | /// Adjust the index buffer offset so it points to the first desired index. |
| 2237 | GPUVAddr IndexStart() const { | 2219 | GPUVAddr IndexStart() const { |
| 2238 | return StartAddress() + | 2220 | return StartAddress() + size_t{first} * size_t{FormatSizeInBytes()}; |
| 2239 | static_cast<size_t>(first) * static_cast<size_t>(FormatSizeInBytes()); | ||
| 2240 | } | 2221 | } |
| 2241 | }; | 2222 | }; |
| 2242 | 2223 | ||
| @@ -2464,8 +2445,7 @@ public: | |||
| 2464 | } query; | 2445 | } query; |
| 2465 | 2446 | ||
| 2466 | GPUVAddr Address() const { | 2447 | GPUVAddr Address() const { |
| 2467 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 2448 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 2468 | address_low); | ||
| 2469 | } | 2449 | } |
| 2470 | }; | 2450 | }; |
| 2471 | 2451 | ||
| @@ -2479,8 +2459,7 @@ public: | |||
| 2479 | u32 frequency; | 2459 | u32 frequency; |
| 2480 | 2460 | ||
| 2481 | GPUVAddr Address() const { | 2461 | GPUVAddr Address() const { |
| 2482 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 2462 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 2483 | address_low); | ||
| 2484 | } | 2463 | } |
| 2485 | 2464 | ||
| 2486 | bool IsEnabled() const { | 2465 | bool IsEnabled() const { |
| @@ -2494,8 +2473,7 @@ public: | |||
| 2494 | u32 address_low; | 2473 | u32 address_low; |
| 2495 | 2474 | ||
| 2496 | GPUVAddr Address() const { | 2475 | GPUVAddr Address() const { |
| 2497 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 2476 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 2498 | address_low); | ||
| 2499 | } | 2477 | } |
| 2500 | }; | 2478 | }; |
| 2501 | static_assert(sizeof(VertexStreamLimit) == 0x8); | 2479 | static_assert(sizeof(VertexStreamLimit) == 0x8); |
| @@ -2543,8 +2521,7 @@ public: | |||
| 2543 | std::array<u32, NumCBData> buffer; | 2521 | std::array<u32, NumCBData> buffer; |
| 2544 | 2522 | ||
| 2545 | GPUVAddr Address() const { | 2523 | GPUVAddr Address() const { |
| 2546 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | | 2524 | return (GPUVAddr{address_high} << 32) | GPUVAddr{address_low}; |
| 2547 | address_low); | ||
| 2548 | } | 2525 | } |
| 2549 | }; | 2526 | }; |
| 2550 | 2527 | ||
diff --git a/src/video_core/engines/maxwell_dma.cpp b/src/video_core/engines/maxwell_dma.cpp index 334429514..a189e60ae 100644 --- a/src/video_core/engines/maxwell_dma.cpp +++ b/src/video_core/engines/maxwell_dma.cpp | |||
| @@ -41,8 +41,8 @@ void MaxwellDMA::CallMethod(u32 method, u32 method_argument, bool is_last_call) | |||
| 41 | 41 | ||
| 42 | void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, | 42 | void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 43 | u32 methods_pending) { | 43 | u32 methods_pending) { |
| 44 | for (size_t i = 0; i < amount; ++i) { | 44 | for (u32 i = 0; i < amount; ++i) { |
| 45 | CallMethod(method, base_start[i], methods_pending - static_cast<u32>(i) <= 1); | 45 | CallMethod(method, base_start[i], methods_pending - i <= 1); |
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -94,14 +94,14 @@ void MaxwellDMA::Launch() { | |||
| 94 | reinterpret_cast<u8*>(tmp_buffer.data()), | 94 | reinterpret_cast<u8*>(tmp_buffer.data()), |
| 95 | regs.line_length_in * sizeof(u32)); | 95 | regs.line_length_in * sizeof(u32)); |
| 96 | } else { | 96 | } else { |
| 97 | auto convert_linear_2_blocklinear_addr = [](u64 address) { | 97 | const auto convert_linear_2_blocklinear_addr = [](u64 address) { |
| 98 | return (address & ~0x1f0ULL) | ((address & 0x40) >> 2) | ((address & 0x10) << 1) | | 98 | return (address & ~0x1f0ULL) | ((address & 0x40) >> 2) | ((address & 0x10) << 1) | |
| 99 | ((address & 0x180) >> 1) | ((address & 0x20) << 3); | 99 | ((address & 0x180) >> 1) | ((address & 0x20) << 3); |
| 100 | }; | 100 | }; |
| 101 | auto src_kind = memory_manager.GetPageKind(regs.offset_in); | 101 | const auto src_kind = memory_manager.GetPageKind(regs.offset_in); |
| 102 | auto dst_kind = memory_manager.GetPageKind(regs.offset_out); | 102 | const auto dst_kind = memory_manager.GetPageKind(regs.offset_out); |
| 103 | const bool is_src_pitch = IsPitchKind(static_cast<PTEKind>(src_kind)); | 103 | const bool is_src_pitch = IsPitchKind(src_kind); |
| 104 | const bool is_dst_pitch = IsPitchKind(static_cast<PTEKind>(dst_kind)); | 104 | const bool is_dst_pitch = IsPitchKind(dst_kind); |
| 105 | if (!is_src_pitch && is_dst_pitch) { | 105 | if (!is_src_pitch && is_dst_pitch) { |
| 106 | UNIMPLEMENTED_IF(regs.line_length_in % 16 != 0); | 106 | UNIMPLEMENTED_IF(regs.line_length_in % 16 != 0); |
| 107 | UNIMPLEMENTED_IF(regs.offset_in % 16 != 0); | 107 | UNIMPLEMENTED_IF(regs.offset_in % 16 != 0); |
diff --git a/src/video_core/engines/puller.cpp b/src/video_core/engines/puller.cpp index c308ba3fc..7718a09b3 100644 --- a/src/video_core/engines/puller.cpp +++ b/src/video_core/engines/puller.cpp | |||
| @@ -31,7 +31,7 @@ void Puller::ProcessBindMethod(const MethodCall& method_call) { | |||
| 31 | LOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", method_call.subchannel, | 31 | LOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", method_call.subchannel, |
| 32 | method_call.argument); | 32 | method_call.argument); |
| 33 | const auto engine_id = static_cast<EngineID>(method_call.argument); | 33 | const auto engine_id = static_cast<EngineID>(method_call.argument); |
| 34 | bound_engines[method_call.subchannel] = static_cast<EngineID>(engine_id); | 34 | bound_engines[method_call.subchannel] = engine_id; |
| 35 | switch (engine_id) { | 35 | switch (engine_id) { |
| 36 | case EngineID::FERMI_TWOD_A: | 36 | case EngineID::FERMI_TWOD_A: |
| 37 | dma_pusher.BindSubchannel(channel_state.fermi_2d.get(), method_call.subchannel); | 37 | dma_pusher.BindSubchannel(channel_state.fermi_2d.get(), method_call.subchannel); |
| @@ -285,12 +285,12 @@ void Puller::CallMultiMethod(u32 method, u32 subchannel, const u32* base_start, | |||
| 285 | if (ExecuteMethodOnEngine(method)) { | 285 | if (ExecuteMethodOnEngine(method)) { |
| 286 | CallEngineMultiMethod(method, subchannel, base_start, amount, methods_pending); | 286 | CallEngineMultiMethod(method, subchannel, base_start, amount, methods_pending); |
| 287 | } else { | 287 | } else { |
| 288 | for (std::size_t i = 0; i < amount; i++) { | 288 | for (u32 i = 0; i < amount; i++) { |
| 289 | CallPullerMethod(MethodCall{ | 289 | CallPullerMethod(MethodCall{ |
| 290 | method, | 290 | method, |
| 291 | base_start[i], | 291 | base_start[i], |
| 292 | subchannel, | 292 | subchannel, |
| 293 | methods_pending - static_cast<u32>(i), | 293 | methods_pending - i, |
| 294 | }); | 294 | }); |
| 295 | } | 295 | } |
| 296 | } | 296 | } |