diff options
| author | 2020-04-12 09:11:44 -0400 | |
|---|---|---|
| committer | 2020-04-12 09:11:44 -0400 | |
| commit | 4aec01b850cd11d4313fe168c8be09c0796f9c77 (patch) | |
| tree | b6c6b7ac0d40bb8dbe338ba9f5865321c0493783 | |
| parent | Merge pull request #3635 from FernandoS27/buffer-free (diff) | |
| parent | video_core: Add MSAA registers in 3D engine and TIC (diff) | |
| download | yuzu-4aec01b850cd11d4313fe168c8be09c0796f9c77.tar.gz yuzu-4aec01b850cd11d4313fe168c8be09c0796f9c77.tar.xz yuzu-4aec01b850cd11d4313fe168c8be09c0796f9c77.zip | |
Merge pull request #3644 from ReinUsesLisp/msaa
video_core: Add MSAA registers in 3D engine and TIC
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 67 | ||||
| -rw-r--r-- | src/video_core/textures/texture.h | 15 |
2 files changed, 76 insertions, 6 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index d24c9f657..4637ddabd 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -312,6 +312,35 @@ public: | |||
| 312 | } | 312 | } |
| 313 | }; | 313 | }; |
| 314 | 314 | ||
| 315 | struct MsaaSampleLocation { | ||
| 316 | union { | ||
| 317 | BitField<0, 4, u32> x0; | ||
| 318 | BitField<4, 4, u32> y0; | ||
| 319 | BitField<8, 4, u32> x1; | ||
| 320 | BitField<12, 4, u32> y1; | ||
| 321 | BitField<16, 4, u32> x2; | ||
| 322 | BitField<20, 4, u32> y2; | ||
| 323 | BitField<24, 4, u32> x3; | ||
| 324 | BitField<28, 4, u32> y3; | ||
| 325 | }; | ||
| 326 | |||
| 327 | constexpr std::pair<u32, u32> Location(int index) const { | ||
| 328 | switch (index) { | ||
| 329 | case 0: | ||
| 330 | return {x0, y0}; | ||
| 331 | case 1: | ||
| 332 | return {x1, y1}; | ||
| 333 | case 2: | ||
| 334 | return {x2, y2}; | ||
| 335 | case 3: | ||
| 336 | return {x3, y3}; | ||
| 337 | default: | ||
| 338 | UNREACHABLE(); | ||
| 339 | return {0, 0}; | ||
| 340 | } | ||
| 341 | } | ||
| 342 | }; | ||
| 343 | |||
| 315 | enum class DepthMode : u32 { | 344 | enum class DepthMode : u32 { |
| 316 | MinusOneToOne = 0, | 345 | MinusOneToOne = 0, |
| 317 | ZeroToOne = 1, | 346 | ZeroToOne = 1, |
| @@ -793,7 +822,13 @@ public: | |||
| 793 | 822 | ||
| 794 | u32 rt_separate_frag_data; | 823 | u32 rt_separate_frag_data; |
| 795 | 824 | ||
| 796 | INSERT_UNION_PADDING_WORDS(0xC); | 825 | INSERT_UNION_PADDING_WORDS(0x1); |
| 826 | |||
| 827 | u32 multisample_raster_enable; | ||
| 828 | u32 multisample_raster_samples; | ||
| 829 | std::array<u32, 4> multisample_sample_mask; | ||
| 830 | |||
| 831 | INSERT_UNION_PADDING_WORDS(0x5); | ||
| 797 | 832 | ||
| 798 | struct { | 833 | struct { |
| 799 | u32 address_high; | 834 | u32 address_high; |
| @@ -830,7 +865,16 @@ public: | |||
| 830 | 865 | ||
| 831 | std::array<VertexAttribute, NumVertexAttributes> vertex_attrib_format; | 866 | std::array<VertexAttribute, NumVertexAttributes> vertex_attrib_format; |
| 832 | 867 | ||
| 833 | INSERT_UNION_PADDING_WORDS(0xF); | 868 | std::array<MsaaSampleLocation, 4> multisample_sample_locations; |
| 869 | |||
| 870 | INSERT_UNION_PADDING_WORDS(0x2); | ||
| 871 | |||
| 872 | union { | ||
| 873 | BitField<0, 1, u32> enable; | ||
| 874 | BitField<4, 3, u32> target; | ||
| 875 | } multisample_coverage_to_color; | ||
| 876 | |||
| 877 | INSERT_UNION_PADDING_WORDS(0x8); | ||
| 834 | 878 | ||
| 835 | struct { | 879 | struct { |
| 836 | union { | 880 | union { |
| @@ -943,7 +987,7 @@ public: | |||
| 943 | 987 | ||
| 944 | CounterReset counter_reset; | 988 | CounterReset counter_reset; |
| 945 | 989 | ||
| 946 | INSERT_UNION_PADDING_WORDS(0x1); | 990 | u32 multisample_enable; |
| 947 | 991 | ||
| 948 | u32 zeta_enable; | 992 | u32 zeta_enable; |
| 949 | 993 | ||
| @@ -1007,7 +1051,11 @@ public: | |||
| 1007 | 1051 | ||
| 1008 | float polygon_offset_units; | 1052 | float polygon_offset_units; |
| 1009 | 1053 | ||
| 1010 | INSERT_UNION_PADDING_WORDS(0x11); | 1054 | INSERT_UNION_PADDING_WORDS(0x4); |
| 1055 | |||
| 1056 | Tegra::Texture::MsaaMode multisample_mode; | ||
| 1057 | |||
| 1058 | INSERT_UNION_PADDING_WORDS(0xC); | ||
| 1011 | 1059 | ||
| 1012 | union { | 1060 | union { |
| 1013 | BitField<2, 1, u32> coord_origin; | 1061 | BitField<2, 1, u32> coord_origin; |
| @@ -1507,12 +1555,17 @@ ASSERT_REG_POSITION(stencil_back_func_ref, 0x3D5); | |||
| 1507 | ASSERT_REG_POSITION(stencil_back_mask, 0x3D6); | 1555 | ASSERT_REG_POSITION(stencil_back_mask, 0x3D6); |
| 1508 | ASSERT_REG_POSITION(stencil_back_func_mask, 0x3D7); | 1556 | ASSERT_REG_POSITION(stencil_back_func_mask, 0x3D7); |
| 1509 | ASSERT_REG_POSITION(color_mask_common, 0x3E4); | 1557 | ASSERT_REG_POSITION(color_mask_common, 0x3E4); |
| 1510 | ASSERT_REG_POSITION(rt_separate_frag_data, 0x3EB); | ||
| 1511 | ASSERT_REG_POSITION(depth_bounds, 0x3E7); | 1558 | ASSERT_REG_POSITION(depth_bounds, 0x3E7); |
| 1559 | ASSERT_REG_POSITION(rt_separate_frag_data, 0x3EB); | ||
| 1560 | ASSERT_REG_POSITION(multisample_raster_enable, 0x3ED); | ||
| 1561 | ASSERT_REG_POSITION(multisample_raster_samples, 0x3EE); | ||
| 1562 | ASSERT_REG_POSITION(multisample_sample_mask, 0x3EF); | ||
| 1512 | ASSERT_REG_POSITION(zeta, 0x3F8); | 1563 | ASSERT_REG_POSITION(zeta, 0x3F8); |
| 1513 | ASSERT_REG_POSITION(clear_flags, 0x43E); | 1564 | ASSERT_REG_POSITION(clear_flags, 0x43E); |
| 1514 | ASSERT_REG_POSITION(fill_rectangle, 0x44F); | 1565 | ASSERT_REG_POSITION(fill_rectangle, 0x44F); |
| 1515 | ASSERT_REG_POSITION(vertex_attrib_format, 0x458); | 1566 | ASSERT_REG_POSITION(vertex_attrib_format, 0x458); |
| 1567 | ASSERT_REG_POSITION(multisample_sample_locations, 0x478); | ||
| 1568 | ASSERT_REG_POSITION(multisample_coverage_to_color, 0x47E); | ||
| 1516 | ASSERT_REG_POSITION(rt_control, 0x487); | 1569 | ASSERT_REG_POSITION(rt_control, 0x487); |
| 1517 | ASSERT_REG_POSITION(zeta_width, 0x48a); | 1570 | ASSERT_REG_POSITION(zeta_width, 0x48a); |
| 1518 | ASSERT_REG_POSITION(zeta_height, 0x48b); | 1571 | ASSERT_REG_POSITION(zeta_height, 0x48b); |
| @@ -1545,11 +1598,12 @@ ASSERT_REG_POSITION(samplecnt_enable, 0x545); | |||
| 1545 | ASSERT_REG_POSITION(point_size, 0x546); | 1598 | ASSERT_REG_POSITION(point_size, 0x546); |
| 1546 | ASSERT_REG_POSITION(point_sprite_enable, 0x548); | 1599 | ASSERT_REG_POSITION(point_sprite_enable, 0x548); |
| 1547 | ASSERT_REG_POSITION(counter_reset, 0x54C); | 1600 | ASSERT_REG_POSITION(counter_reset, 0x54C); |
| 1601 | ASSERT_REG_POSITION(multisample_enable, 0x54D); | ||
| 1548 | ASSERT_REG_POSITION(zeta_enable, 0x54E); | 1602 | ASSERT_REG_POSITION(zeta_enable, 0x54E); |
| 1549 | ASSERT_REG_POSITION(multisample_control, 0x54F); | 1603 | ASSERT_REG_POSITION(multisample_control, 0x54F); |
| 1550 | ASSERT_REG_POSITION(condition, 0x554); | 1604 | ASSERT_REG_POSITION(condition, 0x554); |
| 1551 | ASSERT_REG_POSITION(tsc, 0x557); | 1605 | ASSERT_REG_POSITION(tsc, 0x557); |
| 1552 | ASSERT_REG_POSITION(polygon_offset_factor, 0x55b); | 1606 | ASSERT_REG_POSITION(polygon_offset_factor, 0x55B); |
| 1553 | ASSERT_REG_POSITION(tic, 0x55D); | 1607 | ASSERT_REG_POSITION(tic, 0x55D); |
| 1554 | ASSERT_REG_POSITION(stencil_two_side_enable, 0x565); | 1608 | ASSERT_REG_POSITION(stencil_two_side_enable, 0x565); |
| 1555 | ASSERT_REG_POSITION(stencil_back_op_fail, 0x566); | 1609 | ASSERT_REG_POSITION(stencil_back_op_fail, 0x566); |
| @@ -1558,6 +1612,7 @@ ASSERT_REG_POSITION(stencil_back_op_zpass, 0x568); | |||
| 1558 | ASSERT_REG_POSITION(stencil_back_func_func, 0x569); | 1612 | ASSERT_REG_POSITION(stencil_back_func_func, 0x569); |
| 1559 | ASSERT_REG_POSITION(framebuffer_srgb, 0x56E); | 1613 | ASSERT_REG_POSITION(framebuffer_srgb, 0x56E); |
| 1560 | ASSERT_REG_POSITION(polygon_offset_units, 0x56F); | 1614 | ASSERT_REG_POSITION(polygon_offset_units, 0x56F); |
| 1615 | ASSERT_REG_POSITION(multisample_mode, 0x574); | ||
| 1561 | ASSERT_REG_POSITION(point_coord_replace, 0x581); | 1616 | ASSERT_REG_POSITION(point_coord_replace, 0x581); |
| 1562 | ASSERT_REG_POSITION(code_address, 0x582); | 1617 | ASSERT_REG_POSITION(code_address, 0x582); |
| 1563 | ASSERT_REG_POSITION(draw, 0x585); | 1618 | ASSERT_REG_POSITION(draw, 0x585); |
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h index 59b8a5e66..eba05aced 100644 --- a/src/video_core/textures/texture.h +++ b/src/video_core/textures/texture.h | |||
| @@ -131,6 +131,20 @@ enum class SwizzleSource : u32 { | |||
| 131 | OneFloat = 7, | 131 | OneFloat = 7, |
| 132 | }; | 132 | }; |
| 133 | 133 | ||
| 134 | enum class MsaaMode : u32 { | ||
| 135 | Msaa1x1 = 0, | ||
| 136 | Msaa2x1 = 1, | ||
| 137 | Msaa2x2 = 2, | ||
| 138 | Msaa4x2 = 3, | ||
| 139 | Msaa4x2_D3D = 4, | ||
| 140 | Msaa2x1_D3D = 5, | ||
| 141 | Msaa4x4 = 6, | ||
| 142 | Msaa2x2_VC4 = 8, | ||
| 143 | Msaa2x2_VC12 = 9, | ||
| 144 | Msaa4x2_VC8 = 10, | ||
| 145 | Msaa4x2_VC24 = 11, | ||
| 146 | }; | ||
| 147 | |||
| 134 | union TextureHandle { | 148 | union TextureHandle { |
| 135 | TextureHandle(u32 raw) : raw{raw} {} | 149 | TextureHandle(u32 raw) : raw{raw} {} |
| 136 | 150 | ||
| @@ -197,6 +211,7 @@ struct TICEntry { | |||
| 197 | union { | 211 | union { |
| 198 | BitField<0, 4, u32> res_min_mip_level; | 212 | BitField<0, 4, u32> res_min_mip_level; |
| 199 | BitField<4, 4, u32> res_max_mip_level; | 213 | BitField<4, 4, u32> res_max_mip_level; |
| 214 | BitField<8, 4, MsaaMode> msaa_mode; | ||
| 200 | BitField<12, 12, u32> min_lod_clamp; | 215 | BitField<12, 12, u32> min_lod_clamp; |
| 201 | }; | 216 | }; |
| 202 | 217 | ||