Change the 'viewformats' texture setting field to be a list of pixel formats.

Replace Texture:hasViewFormats with Texture:getViewFormats.
This commit is contained in:
Sasha Szpakowski
2024-02-24 23:42:28 -04:00
parent 42812ad521
commit e20f018272
7 changed files with 96 additions and 32 deletions
+9 -2
View File
@@ -76,8 +76,15 @@ Texture::Texture(love::graphics::Graphics *gfxbase, id<MTLDevice> device, const
desc.usage |= MTLTextureUsageRenderTarget;
if (computeWrite)
desc.usage |= MTLTextureUsageShaderWrite;
if (viewFormats)
desc.usage |= MTLTextureUsagePixelFormatView;
for (PixelFormat viewformat : viewFormats)
{
if (getLinearPixelFormat(viewformat) != getLinearPixelFormat(format))
{
desc.usage |= MTLTextureUsagePixelFormatView;
break;
}
}
texture = [device newTextureWithDescriptor:desc];