texture_cache: Pack sibling queries inside a method
This commit is contained in:
		
							parent
							
								
									8eae66907e
								
							
						
					
					
						commit
						6e1db6b703
					
				@ -421,8 +421,7 @@ private:
 | 
				
			|||||||
        const auto& cr_params = current_surface->GetSurfaceParams();
 | 
					        const auto& cr_params = current_surface->GetSurfaceParams();
 | 
				
			||||||
        TSurface new_surface;
 | 
					        TSurface new_surface;
 | 
				
			||||||
        if (cr_params.pixel_format != params.pixel_format && !is_render &&
 | 
					        if (cr_params.pixel_format != params.pixel_format && !is_render &&
 | 
				
			||||||
            siblings_table[static_cast<std::size_t>(cr_params.pixel_format)] ==
 | 
					            GetSiblingFormat(cr_params.pixel_format) == params.pixel_format) {
 | 
				
			||||||
                params.pixel_format) {
 | 
					 | 
				
			||||||
            SurfaceParams new_params = params;
 | 
					            SurfaceParams new_params = params;
 | 
				
			||||||
            new_params.pixel_format = cr_params.pixel_format;
 | 
					            new_params.pixel_format = cr_params.pixel_format;
 | 
				
			||||||
            new_params.component_type = cr_params.component_type;
 | 
					            new_params.component_type = cr_params.component_type;
 | 
				
			||||||
@ -459,17 +458,16 @@ private:
 | 
				
			|||||||
                                                     const SurfaceParams& params, bool is_render) {
 | 
					                                                     const SurfaceParams& params, bool is_render) {
 | 
				
			||||||
        const bool is_mirage = !current_surface->MatchFormat(params.pixel_format);
 | 
					        const bool is_mirage = !current_surface->MatchFormat(params.pixel_format);
 | 
				
			||||||
        const bool matches_target = current_surface->MatchTarget(params.target);
 | 
					        const bool matches_target = current_surface->MatchTarget(params.target);
 | 
				
			||||||
        const auto match_check = ([&]() -> std::pair<TSurface, TView> {
 | 
					        const auto match_check = [&]() -> std::pair<TSurface, TView> {
 | 
				
			||||||
            if (matches_target) {
 | 
					            if (matches_target) {
 | 
				
			||||||
                return {current_surface, current_surface->GetMainView()};
 | 
					                return {current_surface, current_surface->GetMainView()};
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return {current_surface, current_surface->EmplaceOverview(params)};
 | 
					            return {current_surface, current_surface->EmplaceOverview(params)};
 | 
				
			||||||
        });
 | 
					        };
 | 
				
			||||||
        if (!is_mirage) {
 | 
					        if (!is_mirage) {
 | 
				
			||||||
            return match_check();
 | 
					            return match_check();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (!is_render && siblings_table[static_cast<std::size_t>(current_surface->GetFormat())] ==
 | 
					        if (!is_render && GetSiblingFormat(current_surface->GetFormat()) == params.pixel_format) {
 | 
				
			||||||
                              params.pixel_format) {
 | 
					 | 
				
			||||||
            return match_check();
 | 
					            return match_check();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return RebuildSurface(current_surface, params, is_render);
 | 
					        return RebuildSurface(current_surface, params, is_render);
 | 
				
			||||||
@ -766,6 +764,10 @@ private:
 | 
				
			|||||||
        return {};
 | 
					        return {};
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    constexpr PixelFormat GetSiblingFormat(PixelFormat format) const {
 | 
				
			||||||
 | 
					        return siblings_table[static_cast<std::size_t>(format)];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct FramebufferTargetInfo {
 | 
					    struct FramebufferTargetInfo {
 | 
				
			||||||
        TSurface target;
 | 
					        TSurface target;
 | 
				
			||||||
        TView view;
 | 
					        TView view;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user