mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +02:00
metal: clean up useless code
This commit is contained in:
@@ -69,9 +69,9 @@ void Image::create(id<MTLDevice> device)
|
|||||||
if (texture == nil)
|
if (texture == nil)
|
||||||
throw love::Exception("Out of graphics memory.");
|
throw love::Exception("Out of graphics memory.");
|
||||||
|
|
||||||
int mipcount = getMipmapCount();
|
int mipcount = mipmapsType == MIPMAPS_GENERATED ? 1 : getMipmapCount();
|
||||||
int slicecount = 1;
|
|
||||||
|
|
||||||
|
int slicecount = 1;
|
||||||
if (texType == TEXTURE_VOLUME)
|
if (texType == TEXTURE_VOLUME)
|
||||||
slicecount = getDepth();
|
slicecount = getDepth();
|
||||||
else if (texType == TEXTURE_2D_ARRAY)
|
else if (texType == TEXTURE_2D_ARRAY)
|
||||||
@@ -79,28 +79,14 @@ void Image::create(id<MTLDevice> device)
|
|||||||
else if (texType == TEXTURE_CUBE)
|
else if (texType == TEXTURE_CUBE)
|
||||||
slicecount = 6;
|
slicecount = 6;
|
||||||
|
|
||||||
if (mipmapsType == MIPMAPS_GENERATED)
|
|
||||||
mipcount = 1;
|
|
||||||
|
|
||||||
int w = pixelWidth;
|
|
||||||
int h = pixelHeight;
|
|
||||||
int d = depth;
|
|
||||||
|
|
||||||
for (int mip = 0; mip < mipcount; mip++)
|
for (int mip = 0; mip < mipcount; mip++)
|
||||||
{
|
{
|
||||||
for (int slice = 0; slice < slicecount; slice++)
|
for (int slice = 0; slice < slicecount; slice++)
|
||||||
{
|
{
|
||||||
love::image::ImageDataBase *imgd = data.get(slice, mip);
|
love::image::ImageDataBase *imgd = data.get(slice, mip);
|
||||||
|
|
||||||
if (imgd != nullptr)
|
if (imgd != nullptr)
|
||||||
uploadImageData(imgd, mip, slice, 0, 0);
|
uploadImageData(imgd, mip, slice, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
w = std::max(w / 2, 1);
|
|
||||||
h = std::max(h / 2, 1);
|
|
||||||
|
|
||||||
if (texType == TEXTURE_VOLUME)
|
|
||||||
d = std::max(d / 2, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mipmapsType == MIPMAPS_GENERATED)
|
if (mipmapsType == MIPMAPS_GENERATED)
|
||||||
|
|||||||
Reference in New Issue
Block a user