summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2018-11-16 18:01:54 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2018-11-26 14:05:12 +0100
commitddfbe0b58d856ae4a62683943cb35c2ae8f13b95 (patch)
tree51210c339a0aabe9e86eb3b830262ffa53eb2b57 /src/video_core/renderer_opengl
parentMerge pull request #1763 from ReinUsesLisp/bfi (diff)
downloadyuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar
yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.gz
yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.bz2
yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.lz
yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.xz
yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.zst
yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h13
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,
params.block_width = params.is_tiled ? config.tic.BlockWidth() : 0,
params.block_height = params.is_tiled ? config.tic.BlockHeight() : 0,
params.block_depth = params.is_tiled ? config.tic.BlockDepth() : 0,
+ params.tile_width_spacing = params.is_tiled ? (1 << config.tic.tile_width_spacing.Value()) : 1;
params.srgb_conversion = config.tic.IsSrgbConversionEnabled();
params.pixel_format = PixelFormatFromTextureFormat(config.tic.format, config.tic.r_type.Value(),
params.srgb_conversion);
@@ -162,6 +163,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
params.block_width = 1 << config.memory_layout.block_width;
params.block_height = 1 << config.memory_layout.block_height;
params.block_depth = 1 << config.memory_layout.block_depth;
+ params.tile_width_spacing = 1;
params.pixel_format = PixelFormatFromRenderTargetFormat(config.format);
params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB ||
config.format == Tegra::RenderTargetFormat::RGBA8_SRGB;
@@ -197,6 +199,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
params.block_width = 1 << std::min(block_width, 5U);
params.block_height = 1 << std::min(block_height, 5U);
params.block_depth = 1 << std::min(block_depth, 5U);
+ params.tile_width_spacing = 1;
params.pixel_format = PixelFormatFromDepthFormat(format);
params.component_type = ComponentTypeFromDepthFormat(format);
params.type = GetFormatType(params.pixel_format);
@@ -223,6 +226,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
params.block_width = params.is_tiled ? std::min(config.BlockWidth(), 32U) : 0,
params.block_height = params.is_tiled ? std::min(config.BlockHeight(), 32U) : 0,
params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 32U) : 0,
+ params.tile_width_spacing = 1;
params.pixel_format = PixelFormatFromRenderTargetFormat(config.format);
params.srgb_conversion = config.format == Tegra::RenderTargetFormat::BGRA8_SRGB ||
config.format == Tegra::RenderTargetFormat::RGBA8_SRGB;
@@ -387,8 +391,8 @@ void SwizzleFunc(const MortonSwizzleMode& mode, const SurfaceParams& params,
for (u32 i = 0; i < params.depth; i++) {
MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level),
params.MipBlockHeight(mip_level), params.MipHeight(mip_level),
- params.MipBlockDepth(mip_level), 1, gl_buffer.data() + offset_gl, gl_size,
- params.addr + offset);
+ params.MipBlockDepth(mip_level), params.tile_width_spacing, 1,
+ gl_buffer.data() + offset_gl, gl_size, params.addr + offset);
offset += layer_size;
offset_gl += gl_size;
}
@@ -396,8 +400,8 @@ void SwizzleFunc(const MortonSwizzleMode& mode, const SurfaceParams& params,
const u64 offset = params.GetMipmapLevelOffset(mip_level);
MortonSwizzle(mode, params.pixel_format, params.MipWidth(mip_level),
params.MipBlockHeight(mip_level), params.MipHeight(mip_level),
- params.MipBlockDepth(mip_level), depth, gl_buffer.data(), gl_buffer.size(),
- params.addr + offset);
+ params.MipBlockDepth(mip_level), depth, params.tile_width_spacing,
+ gl_buffer.data(), gl_buffer.size(), params.addr + offset);
}
}
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 {
/// Checks if surfaces are compatible for caching
bool IsCompatibleSurface(const SurfaceParams& other) const {
- return std::tie(pixel_format, type, width, height, target, depth) ==
- std::tie(other.pixel_format, other.type, other.width, other.height, other.target,
- other.depth);
+ if (std::tie(pixel_format, type, width, height, target, depth, is_tiled) ==
+ std::tie(other.pixel_format, other.type, other.width, other.height, other.target,
+ other.depth, other.is_tiled)) {
+ if (!is_tiled)
+ return true;
+ return std::tie(block_height, block_depth, tile_width_spacing) ==
+ std::tie(other.block_height, other.block_depth, other.tile_width_spacing);
+ }
+ return false;
}
/// Initializes parameters for caching, should be called after everything has been initialized
@@ -208,6 +214,7 @@ struct SurfaceParams {
u32 block_width;
u32 block_height;
u32 block_depth;
+ u32 tile_width_spacing;
PixelFormat pixel_format;
ComponentType component_type;
SurfaceType type;