Skip to content

Commit

Permalink
fix compress texture
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleyljl committed Oct 9, 2023
1 parent f7535d9 commit d0befed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions cocos/asset/assets/simple-texture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,9 @@ export class SimpleTexture extends TextureBase {
if (this._width === 0 || this._height === 0) { return; }
let flags = TextureFlagBit.NONE;
if (this._mipFilter !== Filter.NONE && canGenerateMipmap(device, this._width, this._height)) {
if (!this.isCompressed) {
this._mipmapLevel = getMipLevel(this._width, this._height);
}
if (!this.isUsingOfflineMipmaps() && !this.isCompressed) {
flags = TextureFlagBit.GEN_MIPMAP;
this._mipmapLevel = getMipLevel(this._width, this._height);
}
}
const textureCreateInfo = this._getGfxTextureCreateInfo({
Expand Down
4 changes: 1 addition & 3 deletions native/cocos/core/assets/SimpleTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,9 @@ void SimpleTexture::createTexture(gfx::Device *device) {
auto flags = gfx::TextureFlagBit::NONE;
auto usage = gfx::TextureUsageBit::SAMPLED | gfx::TextureUsageBit::TRANSFER_DST;
if (_mipFilter != Filter::NONE && canGenerateMipmap(_width, _height)) {
if (!isCompressed()) {
_mipmapLevel = getMipLevel(_width, _height);
}
if (!isUsingOfflineMipmaps() && !isCompressed()) {
flags = gfx::TextureFlagBit::GEN_MIPMAP;
_mipmapLevel = getMipLevel(_width, _height);
}
}

Expand Down

0 comments on commit d0befed

Please sign in to comment.