rasterizer_cache: Handle null surface cubes properly
This commit is contained in:
@@ -42,9 +42,17 @@ RasterizerCache<T>::RasterizerCache(Memory::MemorySystem& memory_,
|
|||||||
.width = 1,
|
.width = 1,
|
||||||
.height = 1,
|
.height = 1,
|
||||||
.stride = 1,
|
.stride = 1,
|
||||||
.texture_type = VideoCore::TextureType::Texture2D,
|
.texture_type = TextureType::Texture2D,
|
||||||
.pixel_format = VideoCore::PixelFormat::RGBA8,
|
.pixel_format = PixelFormat::RGBA8,
|
||||||
.type = VideoCore::SurfaceType::Color,
|
.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{
|
void(slot_samplers.insert(runtime, SamplerParams{
|
||||||
.mag_filter = TextureConfig::TextureFilter::Linear,
|
.mag_filter = TextureConfig::TextureFilter::Linear,
|
||||||
@@ -614,6 +622,10 @@ auto RasterizerCache<T>::GetTextureSurface(const Pica::Texture::TextureInfo& inf
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
auto RasterizerCache<T>::GetTextureCube(const TextureCubeConfig& config) -> Surface& {
|
auto RasterizerCache<T>::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);
|
auto [it, new_surface] = texture_cube_cache.try_emplace(config);
|
||||||
if (new_surface) {
|
if (new_surface) {
|
||||||
const SurfaceParams cube_params = {
|
const SurfaceParams cube_params = {
|
||||||
|
@@ -22,6 +22,8 @@ using SamplerId = SlotId;
|
|||||||
|
|
||||||
/// Fake surface ID for null surfaces
|
/// Fake surface ID for null surfaces
|
||||||
constexpr SurfaceId NULL_SURFACE_ID{0};
|
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
|
/// Fake sampler ID for null samplers
|
||||||
constexpr SamplerId NULL_SAMPLER_ID{0};
|
constexpr SamplerId NULL_SAMPLER_ID{0};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user