metal: do not release null mtl textures

Cette révision appartient à :
Samuliak 2024-04-08 18:30:04 +02:00
Parent 40eca20e12
révision 67dab8b8d8
Signature inconnue de Forgejo
3 fichiers modifiés avec 8 ajouts et 5 suppressions

Voir le fichier

@ -15,6 +15,7 @@
#include "video_core/renderer_metal/mtl_command_recorder.h"
#include "video_core/renderer_metal/mtl_device.h"
#include "video_core/shader_notify.h"
#include "video_core/texture_cache/texture_cache.h"
#include "video_core/texture_cache/texture_cache_base.h"
namespace Metal {

Voir le fichier

@ -266,7 +266,7 @@ std::unique_ptr<GraphicsPipeline> PipelineCache::CreateGraphicsPipeline(
// HACK: dummy info
std::array<const Shader::Info*, VideoCommon::NUM_STAGES> infos = {nullptr};
infos[0] = new Shader::Info{};
infos[1] = new Shader::Info{};
infos[4] = new Shader::Info{};
return std::make_unique<GraphicsPipeline>(device, command_recorder, key, buffer_cache,
texture_cache, &shader_notify, functions, infos);

Voir le fichier

@ -103,9 +103,9 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
ImageId image_id_, Image& image)
: VideoCommon::ImageViewBase{info, image.info, image_id_, image.gpu_addr} {
using Shader::TextureType;
// TODO: For whatever reason, some images's internal objc objects is NULL
// TODO: metal-cpp provides no method to check for this
texture = image.GetHandle()->retain();
if (image.GetHandle()) {
texture = image.GetHandle()->retain();
}
// TODO: create texture view
}
@ -128,7 +128,9 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::NullImageV
}
ImageView::~ImageView() {
texture->release();
if (texture) {
texture->release();
}
}
Sampler::Sampler(TextureCacheRuntime& runtime, const Tegra::Texture::TSCEntry& tsc) {