summaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-06-29 20:47:46 -0300
committerGravatar ReinUsesLisp2019-06-29 20:47:46 -0300
commit6e1db6b7038329a9716763c8bdf14cc5b578fec1 (patch)
tree595cb82e8f6f70d2bd740a8288e95a2a3703cb18 /src/video_core/texture_cache
parenttexture_cache: Use std::vector reservation for sampled_textures (diff)
downloadyuzu-6e1db6b7038329a9716763c8bdf14cc5b578fec1.tar.gz
yuzu-6e1db6b7038329a9716763c8bdf14cc5b578fec1.tar.xz
yuzu-6e1db6b7038329a9716763c8bdf14cc5b578fec1.zip
texture_cache: Pack sibling queries inside a method
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r--src/video_core/texture_cache/texture_cache.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 8edae3d97..c9e72531a 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -421,8 +421,7 @@ private:
421 const auto& cr_params = current_surface->GetSurfaceParams(); 421 const auto& cr_params = current_surface->GetSurfaceParams();
422 TSurface new_surface; 422 TSurface new_surface;
423 if (cr_params.pixel_format != params.pixel_format && !is_render && 423 if (cr_params.pixel_format != params.pixel_format && !is_render &&
424 siblings_table[static_cast<std::size_t>(cr_params.pixel_format)] == 424 GetSiblingFormat(cr_params.pixel_format) == params.pixel_format) {
425 params.pixel_format) {
426 SurfaceParams new_params = params; 425 SurfaceParams new_params = params;
427 new_params.pixel_format = cr_params.pixel_format; 426 new_params.pixel_format = cr_params.pixel_format;
428 new_params.component_type = cr_params.component_type; 427 new_params.component_type = cr_params.component_type;
@@ -459,17 +458,16 @@ private:
459 const SurfaceParams& params, bool is_render) { 458 const SurfaceParams& params, bool is_render) {
460 const bool is_mirage = !current_surface->MatchFormat(params.pixel_format); 459 const bool is_mirage = !current_surface->MatchFormat(params.pixel_format);
461 const bool matches_target = current_surface->MatchTarget(params.target); 460 const bool matches_target = current_surface->MatchTarget(params.target);
462 const auto match_check = ([&]() -> std::pair<TSurface, TView> { 461 const auto match_check = [&]() -> std::pair<TSurface, TView> {
463 if (matches_target) { 462 if (matches_target) {
464 return {current_surface, current_surface->GetMainView()}; 463 return {current_surface, current_surface->GetMainView()};
465 } 464 }
466 return {current_surface, current_surface->EmplaceOverview(params)}; 465 return {current_surface, current_surface->EmplaceOverview(params)};
467 }); 466 };
468 if (!is_mirage) { 467 if (!is_mirage) {
469 return match_check(); 468 return match_check();
470 } 469 }
471 if (!is_render && siblings_table[static_cast<std::size_t>(current_surface->GetFormat())] == 470 if (!is_render && GetSiblingFormat(current_surface->GetFormat()) == params.pixel_format) {
472 params.pixel_format) {
473 return match_check(); 471 return match_check();
474 } 472 }
475 return RebuildSurface(current_surface, params, is_render); 473 return RebuildSurface(current_surface, params, is_render);
@@ -766,6 +764,10 @@ private:
766 return {}; 764 return {};
767 } 765 }
768 766
767 constexpr PixelFormat GetSiblingFormat(PixelFormat format) const {
768 return siblings_table[static_cast<std::size_t>(format)];
769 }
770
769 struct FramebufferTargetInfo { 771 struct FramebufferTargetInfo {
770 TSurface target; 772 TSurface target;
771 TView view; 773 TView view;