mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-08 05:06:55 +02:00
Update image::processImage to use compress flag for GLES
This commit is contained in:
parent
9ea08f1850
commit
f1e63f489b
2 changed files with 31 additions and 30 deletions
|
@ -767,22 +767,28 @@ gpu::TexturePointer TextureUsage::process2DTextureColorFromImage(QImage&& srcIma
|
||||||
if ((image.width() > 0) && (image.height() > 0)) {
|
if ((image.width() > 0) && (image.height() > 0)) {
|
||||||
gpu::Element formatMip;
|
gpu::Element formatMip;
|
||||||
gpu::Element formatGPU;
|
gpu::Element formatGPU;
|
||||||
if (target == BackendTarget::GLES) {
|
if (compress) {
|
||||||
// GLES does not support GL_BGRA
|
if (target == BackendTarget::GLES) {
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_ETC2_SRGBA;
|
// GLES does not support GL_BGRA
|
||||||
formatMip = formatGPU;
|
formatGPU = gpu::Element::COLOR_COMPRESSED_ETC2_SRGBA;
|
||||||
} else if (compress) {
|
formatMip = formatGPU;
|
||||||
if (validAlpha) {
|
|
||||||
// NOTE: This disables BC1a compression because it was producing odd artifacts on text textures
|
|
||||||
// for the tutorial. Instead we use BC3 (which is larger) but doesn't produce the same artifacts).
|
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_SRGBA;
|
|
||||||
} else {
|
} else {
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_SRGB;
|
if (validAlpha) {
|
||||||
|
// NOTE: This disables BC1a compression because it was producing odd artifacts on text textures
|
||||||
|
// for the tutorial. Instead we use BC3 (which is larger) but doesn't produce the same artifacts).
|
||||||
|
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_SRGBA;
|
||||||
|
} else {
|
||||||
|
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_SRGB;
|
||||||
|
}
|
||||||
|
formatMip = formatGPU;
|
||||||
}
|
}
|
||||||
formatMip = formatGPU;
|
|
||||||
} else {
|
} else {
|
||||||
formatGPU = gpu::Element::COLOR_SRGBA_32;
|
if (target == BackendTarget::GLES) {
|
||||||
formatMip = gpu::Element::COLOR_SBGRA_32;
|
static_assert(false);
|
||||||
|
} else {
|
||||||
|
formatGPU = gpu::Element::COLOR_SRGBA_32;
|
||||||
|
formatMip = gpu::Element::COLOR_SBGRA_32;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isStrict) {
|
if (isStrict) {
|
||||||
|
@ -901,13 +907,13 @@ gpu::TexturePointer TextureUsage::process2DTextureNormalMapFromImage(QImage&& sr
|
||||||
gpu::Element formatMip;
|
gpu::Element formatMip;
|
||||||
gpu::Element formatGPU;
|
gpu::Element formatGPU;
|
||||||
if (compress) {
|
if (compress) {
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_XY;
|
|
||||||
} else {
|
|
||||||
if (target == BackendTarget::GLES) {
|
if (target == BackendTarget::GLES) {
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_EAC_XY;
|
formatGPU = gpu::Element::COLOR_COMPRESSED_EAC_XY;
|
||||||
} else {
|
} else {
|
||||||
formatGPU = gpu::Element::VEC2NU8_XY;
|
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_XY;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
formatGPU = gpu::Element::VEC2NU8_XY;
|
||||||
}
|
}
|
||||||
formatMip = formatGPU;
|
formatMip = formatGPU;
|
||||||
|
|
||||||
|
@ -941,13 +947,13 @@ gpu::TexturePointer TextureUsage::process2DTextureGrayscaleFromImage(QImage&& sr
|
||||||
gpu::Element formatMip;
|
gpu::Element formatMip;
|
||||||
gpu::Element formatGPU;
|
gpu::Element formatGPU;
|
||||||
if (compress) {
|
if (compress) {
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_RED;
|
|
||||||
} else {
|
|
||||||
if (target == BackendTarget::GLES) {
|
if (target == BackendTarget::GLES) {
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_EAC_RED;
|
formatGPU = gpu::Element::COLOR_COMPRESSED_EAC_RED;
|
||||||
} else {
|
} else {
|
||||||
formatGPU = gpu::Element::COLOR_R_8;
|
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_RED;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
formatGPU = gpu::Element::COLOR_R_8;
|
||||||
}
|
}
|
||||||
formatMip = formatGPU;
|
formatMip = formatGPU;
|
||||||
|
|
||||||
|
@ -1316,14 +1322,15 @@ gpu::TexturePointer TextureUsage::processCubeTextureColorFromImage(QImage&& srcI
|
||||||
gpu::Element formatMip;
|
gpu::Element formatMip;
|
||||||
gpu::Element formatGPU;
|
gpu::Element formatGPU;
|
||||||
if (compress) {
|
if (compress) {
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_HDR_RGB;
|
|
||||||
} else {
|
|
||||||
if (target == BackendTarget::GLES) {
|
if (target == BackendTarget::GLES) {
|
||||||
formatGPU = gpu::Element::COLOR_COMPRESSED_ETC2_SRGB;
|
formatGPU = gpu::Element::COLOR_COMPRESSED_ETC2_SRGB;
|
||||||
} else {
|
} else {
|
||||||
formatGPU = HDR_FORMAT;
|
formatGPU = gpu::Element::COLOR_COMPRESSED_BCX_HDR_RGB;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
formatGPU = HDR_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
formatMip = formatGPU;
|
formatMip = formatGPU;
|
||||||
|
|
||||||
// Find the layout of the cubemap in the 2D image
|
// Find the layout of the cubemap in the 2D image
|
||||||
|
|
|
@ -88,13 +88,7 @@ const QStringList getSupportedFormats();
|
||||||
|
|
||||||
gpu::TexturePointer processImage(std::shared_ptr<QIODevice> content, const std::string& url,
|
gpu::TexturePointer processImage(std::shared_ptr<QIODevice> content, const std::string& url,
|
||||||
int maxNumPixels, TextureUsage::Type textureType,
|
int maxNumPixels, TextureUsage::Type textureType,
|
||||||
bool compress = false,
|
bool compress, BackendTarget target, const std::atomic<bool>& abortProcessing = false);
|
||||||
#ifdef USE_GLES
|
|
||||||
BackendTarget target = BackendTarget::GLES,
|
|
||||||
#else
|
|
||||||
BackendTarget target = BackendTarget::GL,
|
|
||||||
#endif
|
|
||||||
const std::atomic<bool>& abortProcessing = false);
|
|
||||||
|
|
||||||
} // namespace image
|
} // namespace image
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue