forked from suyu/suyu
metal: do not release null mtl textures
This commit is contained in:
parent
40eca20e12
commit
67dab8b8d8
3 changed files with 8 additions and 5 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue