summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorGravatar FernandoS272018-10-09 22:28:19 -0400
committerGravatar FernandoS272018-10-09 22:28:19 -0400
commit5f4ee6f0c8c7b2532bc5be841fcee4670495d7f7 (patch)
treec0ed6314f69fa573549604cf52087f31b58c3405 /src/video_core/renderer_opengl
parentFixed block height settings for RenderTargets and Depth Buffers, and added bl... (diff)
downloadyuzu-5f4ee6f0c8c7b2532bc5be841fcee4670495d7f7.tar.gz
yuzu-5f4ee6f0c8c7b2532bc5be841fcee4670495d7f7.tar.xz
yuzu-5f4ee6f0c8c7b2532bc5be841fcee4670495d7f7.zip
Add memory Layout to Render Targets and Depth Buffers
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp30
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h8
2 files changed, 19 insertions, 19 deletions
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(