We were having a look at this code on the side of
GrDirectContext::MakeMetal and we notice this (this is one of the deprecated ones):
sk_sp<GrDirectContext> GrDirectContext::MakeMetal(void* device, void* queue,
const GrContextOptions& options) {
sk_sp<GrDirectContext> direct(new GrDirectContext(GrBackendApi::kMetal, options));
GrMtlBackendContext backendContext = {};
backendContext.fDevice.reset(device);
backendContext.fQueue.reset(queue);
return GrDirectContext::MakeMetal(backendContext, options);
}
Should that sk_sp<GrDirectContext> direct(new GrDirectContext(GrBackendApi::kMetal, options)); line be there?
The call to MakeMetal at the bottom calls another function that also has this line, so it may be a merge issue?
But, I also see that the fDevice and fQueue are using reset. In other code around the repo, I have see retain used instead.
When should we be using reset vs retain?