diff options
| author | 2018-11-16 13:01:54 -0400 | |
|---|---|---|
| committer | 2018-11-26 09:05:12 -0400 | |
| commit | ddfbe0b58d856ae4a62683943cb35c2ae8f13b95 (patch) | |
| tree | 51210c339a0aabe9e86eb3b830262ffa53eb2b57 /src/video_core/renderer_opengl | |
| parent | Merge pull request #1763 from ReinUsesLisp/bfi (diff) | |
| download | yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.gz yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.xz yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.zip | |
Implemented Tile Width Spacing
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 13 |
2 files changed, 18 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index d458f77e4..dde2f468d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -97,6 +97,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only, | |||
| 97 | params.block_width = params.is_tiled ? config.tic.BlockWidth() : 0, | 97 | params.block_width = params.is_tiled ? config.tic.BlockWidth() : 0, |
| 98 | params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, | 98 | params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0, |
| 99 | params.block_depth = params.is_tiled ? config.tic.BlockDepth() : 0, | 99 | params.block_depth = params.is_tiled ? config.tic.BlockDepth() : 0, |
| 100 | params.tile_width_spacing = params.is_tiled ? (1 << config.tic.tile_width_spacing.Value()) : 1; | ||
| 100 | params.srgb_conversion = config.tic.IsSrgbConversionEnabled(); | 101 | params.srgb_conversion = config.tic.IsSrgbConversionEnabled(); |
| 101 | params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(), | 102 | params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(), |
| 102 | params.srgb_conversion); | 103 | params.srgb_conversion); |
| @@ -162,6 +163,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only, | |||
| 162 | params.block_width = 1 << config.memory_layout.block_width; | 163 | params.block_width = 1 << config.memory_layout.block_width; |
| 163 | params.block_height = 1 << config.memory_layout.block_height; | 164 | params.block_height = 1 << config.memory_layout.block_height; |
| 164 | params.block_depth = 1 << config.memory_layout.block_depth; | 165 | params.block_depth = 1 << config.memory_layout.block_depth; |
| 166 | params.tile_width_spacing = 1; | ||
| 165 | params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); | 167 | params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); |
| 166 | params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB || | 168 | params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB || |
| 167 | config.format == Tegra::RenderTargetFormat::RGBA8_SRGB; | 169 | config.format == Tegra::RenderTargetFormat::RGBA8_SRGB; |
| @@ -197,6 +199,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only, | |||
| 197 | params.block_width = 1 << std::min(block_width, 5U); | 199 | params.block_width = 1 << std::min(block_width, 5U); |
| 198 | params.block_height = 1 << std::min(block_height, 5U); | 200 | params.block_height = 1 << std::min(block_height, 5U); |
| 199 | params.block_depth = 1 << std::min(block_depth, 5U); | 201 | params.block_depth = 1 << std::min(block_depth, 5U); |
| 202 | params.tile_width_spacing = 1; | ||
| 200 | params.pixel_format = PixelFormatFromDepthFormat(format); | 203 | params.pixel_format = PixelFormatFromDepthFormat(format); |
| 201 | params.component_type = ComponentTypeFromDepthFormat(format); | 204 | params.component_type = ComponentTypeFromDepthFormat(format); |
| 202 | params.type = GetFormatType(params.pixel_format); | 205 | params.type = GetFormatType(params.pixel_format); |
| @@ -223,6 +226,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only, | |||
| 223 | params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 32U) : 0, | 226 | params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 32U) : 0, |
| 224 | params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 32U) : 0, | 227 | params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 32U) : 0, |
| 225 | params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 32U) : 0, | 228 | params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 32U) : 0, |
| 229 | params.tile_width_spacing = 1; | ||
| 226 | params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); | 230 | params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); |
| 227 | params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB || | 231 | params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB || |
| 228 | config.format == Tegra::RenderTargetFormat::RGBA8_SRGB; | 232 | config.format == Tegra::RenderTargetFormat::RGBA8_SRGB; |
| @@ -387,8 +391,8 @@ void SwizzleFunc(const MortonSwizzleMode& mode, const SurfaceParams& params, | |||
| 387 | for (u32 i = 0; i < params.depth; i++) { | 391 | for (u32 i = 0; i < params.depth; i++) { |
| 388 | MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level), | 392 | MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level), |
| 389 | params.MipBlockHeight(mip_level), params.MipHeight(mip_level), | 393 | params.MipBlockHeight(mip_level), params.MipHeight(mip_level), |
| 390 | params.MipBlockDepth(mip_level), 1, gl_buffer.data() + offset_gl, gl_size, | 394 | params.MipBlockDepth(mip_level), params.tile_width_spacing, 1, |
| 391 | params.addr + offset); | 395 | gl_buffer.data() + offset_gl, gl_size, params.addr + offset); |
| 392 | offset += layer_size; | 396 | offset += layer_size; |
| 393 | offset_gl += gl_size; | 397 | offset_gl += gl_size; |
| 394 | } | 398 | } |
| @@ -396,8 +400,8 @@ void SwizzleFunc(const MortonSwizzleMode& mode, const SurfaceParams& params, | |||
| 396 | const u64 offset = params.GetMipmapLevelOffset(mip_level); | 400 | const u64 offset = params.GetMipmapLevelOffset(mip_level); |
| 397 | MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level), | 401 | MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level), |
| 398 | params.MipBlockHeight(mip_level), params.MipHeight(mip_level), | 402 | params.MipBlockHeight(mip_level), params.MipHeight(mip_level), |
| 399 | params.MipBlockDepth(mip_level), depth, gl_buffer.data(), gl_buffer.size(), | 403 | params.MipBlockDepth(mip_level), depth, params.tile_width_spacing, |
| 400 | params.addr + offset); | 404 | gl_buffer.data(), gl_buffer.size(), params.addr + offset); |
| 401 | } | 405 | } |
| 402 | } | 406 | } |
| 403 | 407 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 9ac79c5a4..c710aa245 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -196,9 +196,15 @@ struct SurfaceParams { | |||
| 196 | 196 | ||
| 197 | /// Checks if surfaces are compatible for caching | 197 | /// Checks if surfaces are compatible for caching |
| 198 | bool IsCompatibleSurface(const SurfaceParams& other) const { | 198 | bool IsCompatibleSurface(const SurfaceParams& other) const { |
| 199 | return std::tie(pixel_format, type, width, height, target, depth) == | 199 | if (std::tie(pixel_format, type, width, height, target, depth, is_tiled) == |
| 200 | std::tie(other.pixel_format, other.type, other.width, other.height, other.target, | 200 | std::tie(other.pixel_format, other.type, other.width, other.height, other.target, |
| 201 | other.depth); | 201 | other.depth, other.is_tiled)) { |
| 202 | if (!is_tiled) | ||
| 203 | return true; | ||
| 204 | return std::tie(block_height, block_depth, tile_width_spacing) == | ||
| 205 | std::tie(other.block_height, other.block_depth, other.tile_width_spacing); | ||
| 206 | } | ||
| 207 | return false; | ||
| 202 | } | 208 | } |
| 203 | 209 | ||
| 204 | /// Initializes parameters for caching, should be called after everything has been initialized | 210 | /// Initializes parameters for caching, should be called after everything has been initialized |
| @@ -208,6 +214,7 @@ struct SurfaceParams { | |||
| 208 | u32 block_width; | 214 | u32 block_width; |
| 209 | u32 block_height; | 215 | u32 block_height; |
| 210 | u32 block_depth; | 216 | u32 block_depth; |
| 217 | u32 tile_width_spacing; | ||
| 211 | PixelFormat pixel_format; | 218 | PixelFormat pixel_format; |
| 212 | ComponentType component_type; | 219 | ComponentType component_type; |
| 213 | SurfaceType type; | 220 | SurfaceType type; |