mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:24:24 +02:00
Limit max texture size, don't force cubemaps to sparse page size
This commit is contained in:
parent
78d55011a4
commit
a9bf2a5cd3
1 changed files with 10 additions and 7 deletions
|
@ -21,10 +21,8 @@ using namespace gpu;
|
||||||
|
|
||||||
// FIXME: Declare this to enable compression
|
// FIXME: Declare this to enable compression
|
||||||
//#define COMPRESS_TEXTURES
|
//#define COMPRESS_TEXTURES
|
||||||
|
static const uvec2 SPARSE_PAGE_SIZE(128);
|
||||||
#define SPARSE_PAGE_DIMENSION 128
|
static const uvec2 MAX_TEXTURE_SIZE(4096);
|
||||||
|
|
||||||
static const uvec2 SPARSE_PAGE_SIZE(SPARSE_PAGE_DIMENSION);
|
|
||||||
bool DEV_DECIMATE_TEXTURES = false;
|
bool DEV_DECIMATE_TEXTURES = false;
|
||||||
|
|
||||||
bool needsSparseRectification(const uvec2& size) {
|
bool needsSparseRectification(const uvec2& size) {
|
||||||
|
@ -52,8 +50,12 @@ QImage processSourceImage(const QImage& srcImage, bool cubemap) {
|
||||||
const uvec2 srcImageSize = toGlm(srcImage.size());
|
const uvec2 srcImageSize = toGlm(srcImage.size());
|
||||||
uvec2 targetSize = srcImageSize;
|
uvec2 targetSize = srcImageSize;
|
||||||
|
|
||||||
if (!cubemap && needsSparseRectification(srcImageSize)) {
|
while (glm::any(glm::greaterThan(targetSize, MAX_TEXTURE_SIZE))) {
|
||||||
targetSize = rectifyToSparseSize(srcImageSize);
|
targetSize /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cubemap && needsSparseRectification(targetSize)) {
|
||||||
|
targetSize = rectifyToSparseSize(targetSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEV_DECIMATE_TEXTURES && glm::all(glm::greaterThanEqual(targetSize / SPARSE_PAGE_SIZE, uvec2(2)))) {
|
if (DEV_DECIMATE_TEXTURES && glm::all(glm::greaterThanEqual(targetSize / SPARSE_PAGE_SIZE, uvec2(2)))) {
|
||||||
|
@ -746,7 +748,8 @@ gpu::Texture* TextureUsage::processCubeTextureColorFromImage(const QImage& srcIm
|
||||||
defineColorTexelFormats(formatGPU, formatMip, image, isLinear, doCompress);
|
defineColorTexelFormats(formatGPU, formatMip, image, isLinear, doCompress);
|
||||||
|
|
||||||
// Find the layout of the cubemap in the 2D image
|
// Find the layout of the cubemap in the 2D image
|
||||||
int foundLayout = CubeLayout::findLayout(image.width(), image.height());
|
// Use the original image size since processSourceImage may have altered the size / aspect ratio
|
||||||
|
int foundLayout = CubeLayout::findLayout(srcImage.width(), srcImage.height());
|
||||||
|
|
||||||
std::vector<QImage> faces;
|
std::vector<QImage> faces;
|
||||||
// If found, go extract the faces as separate images
|
// If found, go extract the faces as separate images
|
||||||
|
|
Loading…
Reference in a new issue