mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Removed support for BC7-compressed DDS images (only *very* modern systems support it right now); updated the ddsparse library
This commit is contained in:
@@ -178,7 +178,6 @@ StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM>::Entry Graphics::suppor
|
||||
{ "mipmap", Graphics::SUPPORT_MIPMAP },
|
||||
{ "dxt", Graphics::SUPPORT_DXT },
|
||||
{ "bc5", Graphics::SUPPORT_BC5 },
|
||||
{ "bc7", Graphics::SUPPORT_BC7 },
|
||||
};
|
||||
|
||||
StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM> Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries));
|
||||
|
||||
@@ -97,7 +97,6 @@ public:
|
||||
SUPPORT_MIPMAP,
|
||||
SUPPORT_DXT,
|
||||
SUPPORT_BC5,
|
||||
SUPPORT_BC7,
|
||||
SUPPORT_MAX_ENUM
|
||||
};
|
||||
|
||||
|
||||
@@ -569,10 +569,6 @@ GLenum Image::getCompressedFormat(image::CompressedData::TextureType type) const
|
||||
return GL_COMPRESSED_RG_RGTC2;
|
||||
case image::CompressedData::TYPE_BC5s:
|
||||
return GL_COMPRESSED_SIGNED_RG_RGTC2;
|
||||
case image::CompressedData::TYPE_BC7:
|
||||
return GL_COMPRESSED_RGBA_BPTC_UNORM_ARB;
|
||||
case image::CompressedData::TYPE_BC7srgb:
|
||||
return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB;
|
||||
default:
|
||||
return GL_RGBA8;
|
||||
}
|
||||
@@ -614,15 +610,9 @@ bool Image::hasCompressedTextureSupport(image::CompressedData::TextureType type)
|
||||
case image::CompressedData::TYPE_DXT3:
|
||||
case image::CompressedData::TYPE_DXT5:
|
||||
return GLEE_EXT_texture_compression_s3tc;
|
||||
|
||||
case image::CompressedData::TYPE_BC5:
|
||||
case image::CompressedData::TYPE_BC5s:
|
||||
return (GLEE_VERSION_3_0 || GLEE_ARB_texture_compression_rgtc || GLEE_EXT_texture_compression_rgtc);
|
||||
|
||||
case image::CompressedData::TYPE_BC7:
|
||||
case image::CompressedData::TYPE_BC7srgb:
|
||||
return (GLEE_VERSION_4_2 || GLEE_ARB_texture_compression_bptc);
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
||||
|
||||
@@ -1068,10 +1068,6 @@ int w_isSupported(lua_State *L)
|
||||
if (!Image::hasCompressedTextureSupport(image::CompressedData::TYPE_BC5))
|
||||
supported = false;
|
||||
break;
|
||||
case Graphics::SUPPORT_BC7:
|
||||
if (!Image::hasCompressedTextureSupport(image::CompressedData::TYPE_BC7))
|
||||
supported = false;
|
||||
break;
|
||||
default:
|
||||
supported = false;
|
||||
}
|
||||
|
||||
@@ -117,8 +117,6 @@ StringMap<CompressedData::TextureType, CompressedData::TYPE_MAX_ENUM>::Entry Com
|
||||
{"dxt5", CompressedData::TYPE_DXT5},
|
||||
{"bc5", CompressedData::TYPE_BC5},
|
||||
{"bc5s", CompressedData::TYPE_BC5s},
|
||||
{"bc7", CompressedData::TYPE_BC7},
|
||||
{"bc7srgb", CompressedData::TYPE_BC7srgb},
|
||||
};
|
||||
|
||||
StringMap<CompressedData::TextureType, CompressedData::TYPE_MAX_ENUM> CompressedData::types(CompressedData::typeEntries, sizeof(CompressedData::typeEntries));
|
||||
|
||||
@@ -36,10 +36,11 @@ namespace love
|
||||
namespace image
|
||||
{
|
||||
|
||||
// CompressedData represents image data which is designed to be uploaded to the
|
||||
// GPU and rendered in its compressed form, without being un-compressed.
|
||||
// http://renderingpipeline.com/2012/07/texture-compression/
|
||||
|
||||
/**
|
||||
* CompressedData represents image data which is designed to be uploaded to the
|
||||
* GPU and rendered in its compressed form, without being un-compressed.
|
||||
* http://renderingpipeline.com/2012/07/texture-compression/
|
||||
**/
|
||||
class CompressedData : public Data
|
||||
{
|
||||
public:
|
||||
@@ -53,8 +54,6 @@ public:
|
||||
TYPE_DXT5,
|
||||
TYPE_BC5,
|
||||
TYPE_BC5s,
|
||||
TYPE_BC7,
|
||||
TYPE_BC7srgb,
|
||||
TYPE_MAX_ENUM
|
||||
};
|
||||
|
||||
|
||||
@@ -32,12 +32,12 @@ bool ddsHandler::canParse(const filesystem::FileData *data)
|
||||
if (data->getExtension().compare("dds") != 0)
|
||||
return false;
|
||||
|
||||
return dds::Parser::isCompressedDDS(data->getData(), data->getSize());
|
||||
return dds::isCompressedDDS(data->getData(), data->getSize());
|
||||
}
|
||||
|
||||
CompressedData::TextureType ddsHandler::parse(filesystem::FileData *data, std::vector<CompressedData::SubImage> &images)
|
||||
{
|
||||
if (!dds::Parser::isDDS(data->getData(), data->getSize()))
|
||||
if (!dds::isDDS(data->getData(), data->getSize()))
|
||||
throw love::Exception("Could not decode compressed data (not a DDS file?)");
|
||||
|
||||
CompressedData::TextureType textype = CompressedData::TYPE_UNKNOWN;
|
||||
@@ -51,12 +51,12 @@ CompressedData::TextureType ddsHandler::parse(filesystem::FileData *data, std::v
|
||||
if (textype == CompressedData::TYPE_UNKNOWN)
|
||||
throw love::Exception("Could not parse compressed data: Unsupported format.");
|
||||
|
||||
if (parser.getNumMipmaps() == 0)
|
||||
if (parser.getMipmapCount() == 0)
|
||||
throw love::Exception("Could not parse compressed data: No readable texture data.");
|
||||
|
||||
for (size_t i = 0; i < parser.getNumMipmaps(); i++)
|
||||
for (size_t i = 0; i < parser.getMipmapCount(); i++)
|
||||
{
|
||||
const dds::Parser::Image *img = parser.getImageData(i);
|
||||
const dds::Image *img = parser.getImageData(i);
|
||||
|
||||
CompressedData::SubImage mip;
|
||||
|
||||
@@ -90,10 +90,6 @@ CompressedData::TextureType ddsHandler::convertFormat(dds::Format ddsformat)
|
||||
return CompressedData::TYPE_BC5;
|
||||
case dds::FORMAT_BC5s:
|
||||
return CompressedData::TYPE_BC5s;
|
||||
case dds::FORMAT_BC7:
|
||||
return CompressedData::TYPE_BC7;
|
||||
case dds::FORMAT_BC7srgb:
|
||||
return CompressedData::TYPE_BC7srgb;
|
||||
default:
|
||||
return CompressedData::TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define LOVE_IMAGE_MAGPIE_DDS_HANDLER_H
|
||||
|
||||
// LOVE
|
||||
#include "common/EnumMap.h"
|
||||
#include "filesystem/FileData.h"
|
||||
#include "image/CompressedData.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user