diff --git a/src/video_core/rasterizer_cache/rasterizer_cache.h b/src/video_core/rasterizer_cache/rasterizer_cache.h index d4feffe0e..e77bd83ea 100644 --- a/src/video_core/rasterizer_cache/rasterizer_cache.h +++ b/src/video_core/rasterizer_cache/rasterizer_cache.h @@ -42,9 +42,17 @@ RasterizerCache::RasterizerCache(Memory::MemorySystem& memory_, .width = 1, .height = 1, .stride = 1, - .texture_type = VideoCore::TextureType::Texture2D, - .pixel_format = VideoCore::PixelFormat::RGBA8, - .type = VideoCore::SurfaceType::Color, + .texture_type = TextureType::Texture2D, + .pixel_format = PixelFormat::RGBA8, + .type = SurfaceType::Color, + })); + void(slot_surfaces.insert(runtime, SurfaceParams{ + .width = 1, + .height = 1, + .stride = 1, + .texture_type = TextureType::CubeMap, + .pixel_format = PixelFormat::RGBA8, + .type = SurfaceType::Color, })); void(slot_samplers.insert(runtime, SamplerParams{ .mag_filter = TextureConfig::TextureFilter::Linear, @@ -614,6 +622,10 @@ auto RasterizerCache::GetTextureSurface(const Pica::Texture::TextureInfo& inf template auto RasterizerCache::GetTextureCube(const TextureCubeConfig& config) -> Surface& { + if (config.px == 0) [[unlikely]] { + return slot_surfaces[NULL_SURFACE_CUBE_ID]; + } + auto [it, new_surface] = texture_cube_cache.try_emplace(config); if (new_surface) { const SurfaceParams cube_params = { diff --git a/src/video_core/rasterizer_cache/utils.h b/src/video_core/rasterizer_cache/utils.h index 2c08002f2..464989231 100644 --- a/src/video_core/rasterizer_cache/utils.h +++ b/src/video_core/rasterizer_cache/utils.h @@ -22,6 +22,8 @@ using SamplerId = SlotId; /// Fake surface ID for null surfaces constexpr SurfaceId NULL_SURFACE_ID{0}; +/// Fake surface Id for null surface cubes +constexpr SurfaceId NULL_SURFACE_CUBE_ID{1}; /// Fake sampler ID for null samplers constexpr SamplerId NULL_SAMPLER_ID{0};