diff options
| author | 2019-05-21 08:36:00 -0400 | |
|---|---|---|
| committer | 2019-06-20 21:38:33 -0300 | |
| commit | e60ed2bb3e7e4ce63cc263019cce72a080c536ed (patch) | |
| tree | a19de7e065f23a3f324607c25c5ac90f71b19ff4 /src | |
| parent | texture_cache: Add checks for texture buffers. (diff) | |
| download | yuzu-e60ed2bb3e7e4ce63cc263019cce72a080c536ed.tar.gz yuzu-e60ed2bb3e7e4ce63cc263019cce72a080c536ed.tar.xz yuzu-e60ed2bb3e7e4ce63cc263019cce72a080c536ed.zip | |
texture_cache: return null surface on invalid address
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 593ceeaf6..24c87127d 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -483,6 +483,18 @@ private: | |||
| 483 | const auto host_ptr{memory_manager->GetPointer(gpu_addr)}; | 483 | const auto host_ptr{memory_manager->GetPointer(gpu_addr)}; |
| 484 | const auto cache_addr{ToCacheAddr(host_ptr)}; | 484 | const auto cache_addr{ToCacheAddr(host_ptr)}; |
| 485 | 485 | ||
| 486 | // Step 0: guarantee a valid surface | ||
| 487 | if (!cache_addr) { | ||
| 488 | // Return a null surface if it's invalid | ||
| 489 | SurfaceParams new_params = params; | ||
| 490 | new_params.width = 1; | ||
| 491 | new_params.height = 1; | ||
| 492 | new_params.depth = 1; | ||
| 493 | new_params.block_height = 0; | ||
| 494 | new_params.block_depth = 0; | ||
| 495 | return InitializeSurface(gpu_addr, new_params, false); | ||
| 496 | } | ||
| 497 | |||
| 486 | // Step 1 | 498 | // Step 1 |
| 487 | // Check Level 1 Cache for a fast structural match. If candidate surface | 499 | // Check Level 1 Cache for a fast structural match. If candidate surface |
| 488 | // matches at certain level we are pretty much done. | 500 | // matches at certain level we are pretty much done. |