mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-11 00:26:35 +02:00
back out previous changes, do compressionOptions.setPitchAlignment(4) instead
This commit is contained in:
parent
ac2bc39a27
commit
4aa683363c
3 changed files with 9 additions and 9 deletions
|
@ -383,6 +383,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
|
|||
} else if (mipFormat == gpu::Element::COLOR_RGBA_32) {
|
||||
compressionOptions.setFormat(nvtt::Format_RGBA);
|
||||
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
|
||||
compressionOptions.setPitchAlignment(4);
|
||||
compressionOptions.setPixelFormat(32,
|
||||
0x000000FF,
|
||||
0x0000FF00,
|
||||
|
@ -393,6 +394,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
|
|||
} else if (mipFormat == gpu::Element::COLOR_BGRA_32) {
|
||||
compressionOptions.setFormat(nvtt::Format_RGBA);
|
||||
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
|
||||
compressionOptions.setPitchAlignment(4);
|
||||
compressionOptions.setPixelFormat(32,
|
||||
0x00FF0000,
|
||||
0x0000FF00,
|
||||
|
@ -403,6 +405,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
|
|||
} else if (mipFormat == gpu::Element::COLOR_SRGBA_32) {
|
||||
compressionOptions.setFormat(nvtt::Format_RGBA);
|
||||
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
|
||||
compressionOptions.setPitchAlignment(4);
|
||||
compressionOptions.setPixelFormat(32,
|
||||
0x000000FF,
|
||||
0x0000FF00,
|
||||
|
@ -411,6 +414,7 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
|
|||
} else if (mipFormat == gpu::Element::COLOR_SBGRA_32) {
|
||||
compressionOptions.setFormat(nvtt::Format_RGBA);
|
||||
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
|
||||
compressionOptions.setPitchAlignment(4);
|
||||
compressionOptions.setPixelFormat(32,
|
||||
0x00FF0000,
|
||||
0x0000FF00,
|
||||
|
@ -419,11 +423,13 @@ void generateMips(gpu::Texture* texture, QImage& image, int face = -1) {
|
|||
} else if (mipFormat == gpu::Element::COLOR_R_8) {
|
||||
compressionOptions.setFormat(nvtt::Format_RGB);
|
||||
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
|
||||
compressionOptions.setPitchAlignment(4);
|
||||
compressionOptions.setPixelFormat(8, 0, 0, 0);
|
||||
} else if (mipFormat == gpu::Element::VEC2NU8_XY) {
|
||||
inputOptions.setNormalMap(true);
|
||||
compressionOptions.setFormat(nvtt::Format_RGBA);
|
||||
compressionOptions.setPixelType(nvtt::PixelType_UnsignedNorm);
|
||||
compressionOptions.setPitchAlignment(4);
|
||||
compressionOptions.setPixelFormat(8, 8, 0, 0);
|
||||
} else {
|
||||
qCWarning(imagelogging) << "Unknown mip format";
|
||||
|
|
|
@ -38,12 +38,8 @@ StoragePointer Storage::toFileStorage(const QString& filename) const {
|
|||
return FileStorage::create(filename, size(), data());
|
||||
}
|
||||
|
||||
MemoryStorage::MemoryStorage(size_t size, const uint8_t* data) : _size(size) {
|
||||
// we end up calling glCompressedTextureSubImage2D with this, and the rows of the image are expected
|
||||
// to be word aligned. This is fine in all cases except for 1x1 images and 2x2 images. For 1x1,
|
||||
// there is only one row, so the problem is avoided. For 2x2, we add 2 extra bytes so there's
|
||||
// room for the second row.
|
||||
_data.resize(size == 4 ? 6 : size);
|
||||
MemoryStorage::MemoryStorage(size_t size, const uint8_t* data) {
|
||||
_data.resize(size);
|
||||
if (data) {
|
||||
memcpy(_data.data(), data, size);
|
||||
}
|
||||
|
|
|
@ -44,9 +44,7 @@ namespace storage {
|
|||
const uint8_t* data() const override { return _data.data(); }
|
||||
uint8_t* data() { return _data.data(); }
|
||||
uint8_t* mutableData() override { return _data.data(); }
|
||||
|
||||
const size_t _size;
|
||||
size_t size() const override { return _size; }
|
||||
size_t size() const override { return _data.size(); }
|
||||
operator bool() const override { return true; }
|
||||
private:
|
||||
std::vector<uint8_t> _data;
|
||||
|
|
Loading…
Reference in a new issue