diff options
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 16 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 30 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 8 |
3 files changed, 33 insertions, 21 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 896498b89..68831a1ac 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -347,6 +347,16 @@ public: | |||
| 347 | DecrWrap = 8, | 347 | DecrWrap = 8, |
| 348 | }; | 348 | }; |
| 349 | 349 | ||
| 350 | enum class MemoryLayout : u32 { | ||
| 351 | Linear = 0, | ||
| 352 | BlockLinear = 1, | ||
| 353 | }; | ||
| 354 | |||
| 355 | enum class InvMemoryLayout : u32 { | ||
| 356 | BlockLinear = 0, | ||
| 357 | Linear = 1, | ||
| 358 | }; | ||
| 359 | |||
| 350 | struct Cull { | 360 | struct Cull { |
| 351 | enum class FrontFace : u32 { | 361 | enum class FrontFace : u32 { |
| 352 | ClockWise = 0x0900, | 362 | ClockWise = 0x0900, |
| @@ -436,7 +446,8 @@ public: | |||
| 436 | BitField<0, 3, u32> block_width; | 446 | BitField<0, 3, u32> block_width; |
| 437 | BitField<4, 3, u32> block_height; | 447 | BitField<4, 3, u32> block_height; |
| 438 | BitField<8, 3, u32> block_depth; | 448 | BitField<8, 3, u32> block_depth; |
| 439 | } block_dimensions; | 449 | BitField<12, 1, InvMemoryLayout> type; |
| 450 | } memory_layout; | ||
| 440 | u32 array_mode; | 451 | u32 array_mode; |
| 441 | u32 layer_stride; | 452 | u32 layer_stride; |
| 442 | u32 base_layer; | 453 | u32 base_layer; |
| @@ -556,7 +567,8 @@ public: | |||
| 556 | BitField<0, 4, u32> block_width; | 567 | BitField<0, 4, u32> block_width; |
| 557 | BitField<4, 4, u32> block_height; | 568 | BitField<4, 4, u32> block_height; |
| 558 | BitField<8, 4, u32> block_depth; | 569 | BitField<8, 4, u32> block_depth; |
| 559 | } block_dimensions; | 570 | BitField<20, 1, InvMemoryLayout> type; |
| 571 | } memory_layout; | ||
| 560 | u32 layer_stride; | 572 | u32 layer_stride; |
| 561 | 573 | ||
| 562 | GPUVAddr Address() const { | 574 | GPUVAddr Address() const { |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 433b34b27..65a220c41 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -99,10 +99,11 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) { | |||
| 99 | const auto& config{Core::System::GetInstance().GPU().Maxwell3D().regs.rt[index]}; | 99 | const auto& config{Core::System::GetInstance().GPU().Maxwell3D().regs.rt[index]}; |
| 100 | SurfaceParams params{}; | 100 | SurfaceParams params{}; |
| 101 | params.addr = TryGetCpuAddr(config.Address()); | 101 | params.addr = TryGetCpuAddr(config.Address()); |
| 102 | params.is_tiled = true; | 102 | params.is_tiled = |
| 103 | params.block_width = 1 << config.block_dimensions.block_width; | 103 | config.memory_layout.type == Tegra::Engines::Maxwell3D::Regs::InvMemoryLayout::BlockLinear; |
| 104 | params.block_height = 1 << config.block_dimensions.block_height; | 104 | params.block_width = 1 << config.memory_layout.block_width; |
| 105 | params.block_depth = 1 << config.block_dimensions.block_depth; | 105 | params.block_height = 1 << config.memory_layout.block_height; |
| 106 | params.block_depth = 1 << config.memory_layout.block_depth; | ||
| 106 | params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); | 107 | params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); |
| 107 | params.component_type = ComponentTypeFromRenderTarget(config.format); | 108 | params.component_type = ComponentTypeFromRenderTarget(config.format); |
| 108 | params.type = GetFormatType(params.pixel_format); | 109 | params.type = GetFormatType(params.pixel_format); |
| @@ -124,14 +125,13 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) { | |||
| 124 | return params; | 125 | return params; |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 127 | /*static*/ SurfaceParams SurfaceParams::CreateForDepthBuffer(u32 zeta_width, u32 zeta_height, | 128 | /*static*/ SurfaceParams SurfaceParams::CreateForDepthBuffer( |
| 128 | Tegra::GPUVAddr zeta_address, | 129 | u32 zeta_width, u32 zeta_height, Tegra::GPUVAddr zeta_address, Tegra::DepthFormat format, |
| 129 | Tegra::DepthFormat format, | 130 | u32 block_width, u32 block_height, u32 block_depth, |
| 130 | u32 block_width, u32 block_height, | 131 | Tegra::Engines::Maxwell3D::Regs::InvMemoryLayout type) { |
| 131 | u32 block_depth) { | ||
| 132 | SurfaceParams params{}; | 132 | SurfaceParams params{}; |
| 133 | params.addr = TryGetCpuAddr(zeta_address); | 133 | params.addr = TryGetCpuAddr(zeta_address); |
| 134 | params.is_tiled = true; | 134 | params.is_tiled = type == Tegra::Engines::Maxwell3D::Regs::InvMemoryLayout::BlockLinear; |
| 135 | params.block_width = 1 << std::min(block_width, 5U); | 135 | params.block_width = 1 << std::min(block_width, 5U); |
| 136 | params.block_height = 1 << std::min(block_height, 5U); | 136 | params.block_height = 1 << std::min(block_height, 5U); |
| 137 | params.block_depth = 1 << std::min(block_depth, 5U); | 137 | params.block_depth = 1 << std::min(block_depth, 5U); |
| @@ -156,9 +156,9 @@ static VAddr TryGetCpuAddr(Tegra::GPUVAddr gpu_addr) { | |||
| 156 | SurfaceParams params{}; | 156 | SurfaceParams params{}; |
| 157 | params.addr = TryGetCpuAddr(config.Address()); | 157 | params.addr = TryGetCpuAddr(config.Address()); |
| 158 | params.is_tiled = !config.linear; | 158 | params.is_tiled = !config.linear; |
| 159 | params.block_width = params.is_tiled ? std::min(config.BlockWidth(),32U) : 0, | 159 | params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 32U) : 0, |
| 160 | params.block_height = params.is_tiled ? std::min(config.BlockHeight(),32U) : 0, | 160 | params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 32U) : 0, |
| 161 | params.block_depth = params.is_tiled ? std::min(config.BlockDepth(),32U) : 0, | 161 | params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 32U) : 0, |
| 162 | params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); | 162 | params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); |
| 163 | params.component_type = ComponentTypeFromRenderTarget(config.format); | 163 | params.component_type = ComponentTypeFromRenderTarget(config.format); |
| 164 | params.type = GetFormatType(params.pixel_format); | 164 | params.type = GetFormatType(params.pixel_format); |
| @@ -1005,8 +1005,8 @@ Surface RasterizerCacheOpenGL::GetDepthBufferSurface(bool preserve_contents) { | |||
| 1005 | 1005 | ||
| 1006 | SurfaceParams depth_params{SurfaceParams::CreateForDepthBuffer( | 1006 | SurfaceParams depth_params{SurfaceParams::CreateForDepthBuffer( |
| 1007 | regs.zeta_width, regs.zeta_height, regs.zeta.Address(), regs.zeta.format, | 1007 | regs.zeta_width, regs.zeta_height, regs.zeta.Address(), regs.zeta.format, |
| 1008 | regs.zeta.block_dimensions.block_width, regs.zeta.block_dimensions.block_height, | 1008 | regs.zeta.memory_layout.block_width, regs.zeta.memory_layout.block_height, |
| 1009 | regs.zeta.block_dimensions.block_depth)}; | 1009 | regs.zeta.memory_layout.block_depth, regs.zeta.memory_layout.type)}; |
| 1010 | 1010 | ||
| 1011 | return GetSurface(depth_params, preserve_contents); | 1011 | return GetSurface(depth_params, preserve_contents); |
| 1012 | } | 1012 | } |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 542886a6f..66d98ad4e 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -716,10 +716,10 @@ struct SurfaceParams { | |||
| 716 | static SurfaceParams CreateForFramebuffer(std::size_t index); | 716 | static SurfaceParams CreateForFramebuffer(std::size_t index); |
| 717 | 717 | ||
| 718 | /// Creates SurfaceParams for a depth buffer configuration | 718 | /// Creates SurfaceParams for a depth buffer configuration |
| 719 | static SurfaceParams CreateForDepthBuffer(u32 zeta_width, u32 zeta_height, | 719 | static SurfaceParams CreateForDepthBuffer( |
| 720 | Tegra::GPUVAddr zeta_address, | 720 | u32 zeta_width, u32 zeta_height, Tegra::GPUVAddr zeta_address, Tegra::DepthFormat format, |
| 721 | Tegra::DepthFormat format, u32 block_width, | 721 | u32 block_width, u32 block_height, u32 block_depth, |
| 722 | u32 block_height, u32 block_depth); | 722 | Tegra::Engines::Maxwell3D::Regs::InvMemoryLayout type); |
| 723 | 723 | ||
| 724 | /// Creates SurfaceParams for a Fermi2D surface copy | 724 | /// Creates SurfaceParams for a Fermi2D surface copy |
| 725 | static SurfaceParams CreateForFermiCopySurface( | 725 | static SurfaceParams CreateForFermiCopySurface( |