Skip to content

Commit

Permalink
Don't make views of the same format as the source texture
Browse files Browse the repository at this point in the history
Not necessary, just use the source texture directly
  • Loading branch information
etang-cw committed Nov 7, 2023
1 parent bb914fa commit 9c18aa0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion MoltenVK/MoltenVK/GPUObjects/MVKImage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@
lock_guard<mutex> lock(_image->_lock);
mtlTex = _mtlTextureViews[mtlPixFmt];
if ( !mtlTex ) {
mtlTex = [baseTexture newTextureViewWithPixelFormat: mtlPixFmt]; // retained
if ([baseTexture pixelFormat] == mtlPixFmt)
mtlTex = [baseTexture retain];
else
mtlTex = [baseTexture newTextureViewWithPixelFormat: mtlPixFmt]; // retained
_mtlTextureViews[mtlPixFmt] = mtlTex;
}
}
Expand Down

0 comments on commit 9c18aa0

Please sign in to comment.