Fix places where generateMipmaps is called without proper usage (#9054)

This commit is contained in:
Powei Feng
2025-08-07 15:24:40 -07:00
committed by GitHub
parent db14efc151
commit c8ab2f335e
6 changed files with 7 additions and 0 deletions

View File

@@ -204,6 +204,7 @@ Texture* MeshAssimp::createOneByOneTexture(uint32_t pixel) {
.height(uint32_t(1))
.levels(0xff)
.format(Texture::InternalFormat::RGBA8)
.usage(Texture::Usage::DEFAULT | Texture::Usage::GEN_MIPMAPPABLE)
.build(mEngine);
Texture::PixelBufferDescriptor defaultNormalBuffer(textureData,

View File

@@ -245,6 +245,7 @@ static void loadImage(App& app, Engine* engine, const Path& filename) {
.format(channels == 3 ?
Texture::InternalFormat::RGB16F : Texture::InternalFormat::RGBA16F)
.sampler(Texture::Sampler::SAMPLER_2D)
.usage(Texture::Usage::DEFAULT | Texture::Usage::GEN_MIPMAPPABLE)
.build(*engine);
Texture::PixelBufferDescriptor::Callback freeCallback = [](void* buf, size_t, void* data) {

View File

@@ -169,6 +169,7 @@ Texture* loadMap(Engine* engine, const char* name, bool sRGB = true) {
.height(uint32_t(h))
.levels(0xff)
.format(sRGB ? Texture::InternalFormat::SRGB8 : Texture::InternalFormat::RGB8)
.usage(Texture::Usage::DEFAULT | Texture::Usage::GEN_MIPMAPPABLE)
.build(*engine);
Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3),
Texture::Format::RGB, Texture::Type::UBYTE,

View File

@@ -220,6 +220,7 @@ bool loadTexture(Engine* engine, const std::string& filePath, Texture** map, boo
.height(uint32_t(h))
.levels(0xff)
.format(sRGB ? Texture::InternalFormat::SRGB8 : Texture::InternalFormat::RGB8)
.usage(Texture::Usage::DEFAULT | Texture::Usage::GEN_MIPMAPPABLE)
.build(*engine);
Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3),
Texture::Format::RGB, Texture::Type::UBYTE,

View File

@@ -193,6 +193,7 @@ void loadNormalMap(Engine* engine, Texture** normalMap, const std::string& path)
.height(uint32_t(h))
.levels(0xff)
.format(Texture::InternalFormat::RGB8)
.usage(Texture::Usage::DEFAULT | Texture::Usage::GEN_MIPMAPPABLE)
.build(*engine);
Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3),
Texture::Format::RGB, Texture::Type::UBYTE,
@@ -220,6 +221,7 @@ void loadBaseColorMap(Engine* engine) {
.height(uint32_t(h))
.levels(0xff)
.format(Texture::InternalFormat::SRGB8)
.usage(Texture::Usage::DEFAULT | Texture::Usage::GEN_MIPMAPPABLE)
.build(*engine);
Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3),
Texture::Format::RGB, Texture::Type::UBYTE,

View File

@@ -120,6 +120,7 @@ static Texture* loadNormalMap(Engine* engine, const uint8_t* normals, size_t nby
.height(uint32_t(h))
.levels(0xff)
.format(Texture::InternalFormat::RGB8)
.usage(Texture::Usage::DEFAULT | Texture::Usage::GEN_MIPMAPPABLE)
.build(*engine);
Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3),
Texture::Format::RGB, Texture::Type::UBYTE,