Don't mipmap sRGB textures.
PiperOrigin-RevId: 858148054 Change-Id: Ic115b7431901549e1c636eb20414641c37cf3e8a
This commit is contained in:
committed by
Copybara-Service
parent
654b393060
commit
de47cf0e6f
@@ -83,14 +83,11 @@ filament::Texture* Create2dTexture(filament::Engine* engine, int width,
|
|||||||
builder.height(height);
|
builder.height(height);
|
||||||
builder.format(GetTextureInternalFormat(num_channels, is_srgb));
|
builder.format(GetTextureInternalFormat(num_channels, is_srgb));
|
||||||
builder.sampler(filament::Texture::Sampler::SAMPLER_2D);
|
builder.sampler(filament::Texture::Sampler::SAMPLER_2D);
|
||||||
// TODO: Revisit this to make it this work in WebGL
|
|
||||||
#ifndef __EMSCRIPTEN__
|
|
||||||
if (!is_srgb) {
|
if (!is_srgb) {
|
||||||
builder.usage(filament::Texture::Usage::GEN_MIPMAPPABLE |
|
builder.usage(filament::Texture::Usage::GEN_MIPMAPPABLE |
|
||||||
filament::Texture::Usage::SAMPLEABLE |
|
filament::Texture::Usage::SAMPLEABLE |
|
||||||
filament::Texture::Usage::UPLOADABLE);
|
filament::Texture::Usage::UPLOADABLE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
filament::Texture* texture = builder.build(*engine);
|
filament::Texture* texture = builder.build(*engine);
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -100,10 +97,9 @@ filament::Texture* Create2dTexture(filament::Engine* engine, int width,
|
|||||||
*engine, 0,
|
*engine, 0,
|
||||||
filament::Texture::PixelBufferDescriptor(
|
filament::Texture::PixelBufferDescriptor(
|
||||||
data, num_bytes, format, filament::Texture::Type::UBYTE));
|
data, num_bytes, format, filament::Texture::Type::UBYTE));
|
||||||
// TODO: Revisit this to make it this work in WebGL
|
if (!is_srgb) {
|
||||||
#ifndef __EMSCRIPTEN__
|
texture->generateMipmaps(*engine);
|
||||||
texture->generateMipmaps(*engine);
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
@@ -134,14 +130,11 @@ filament::Texture* CreateCubeTexture(filament::Engine* engine, int width,
|
|||||||
builder.height(face_height);
|
builder.height(face_height);
|
||||||
builder.format(GetTextureInternalFormat(num_channels, is_srgb));
|
builder.format(GetTextureInternalFormat(num_channels, is_srgb));
|
||||||
builder.sampler(filament::Texture::Sampler::SAMPLER_CUBEMAP);
|
builder.sampler(filament::Texture::Sampler::SAMPLER_CUBEMAP);
|
||||||
// TODO: Revisit this to make it this work in WebGL
|
|
||||||
#ifndef __EMSCRIPTEN__
|
|
||||||
if (!is_srgb) {
|
if (!is_srgb) {
|
||||||
builder.usage(filament::Texture::Usage::GEN_MIPMAPPABLE |
|
builder.usage(filament::Texture::Usage::GEN_MIPMAPPABLE |
|
||||||
filament::Texture::Usage::SAMPLEABLE |
|
filament::Texture::Usage::SAMPLEABLE |
|
||||||
filament::Texture::Usage::UPLOADABLE);
|
filament::Texture::Usage::UPLOADABLE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
filament::Texture* texture = builder.build(*engine);
|
filament::Texture* texture = builder.build(*engine);
|
||||||
|
|
||||||
const int face_size = width * face_height * num_channels;
|
const int face_size = width * face_height * num_channels;
|
||||||
@@ -168,10 +161,9 @@ filament::Texture* CreateCubeTexture(filament::Engine* engine, int width,
|
|||||||
buffer, num_bytes, filament::Texture::Format::RGB,
|
buffer, num_bytes, filament::Texture::Format::RGB,
|
||||||
filament::Texture::Type::UBYTE, callback);
|
filament::Texture::Type::UBYTE, callback);
|
||||||
texture->setImage(*engine, 0, std::move(desc), offsets);
|
texture->setImage(*engine, 0, std::move(desc), offsets);
|
||||||
// TODO: Revisit this to make it this work in WebGL
|
if (!is_srgb) {
|
||||||
#ifndef __EMSCRIPTEN__
|
texture->generateMipmaps(*engine);
|
||||||
texture->generateMipmaps(*engine);
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user