Skip to content

Commit

Permalink
Fix imported texture path (#8175)
Browse files Browse the repository at this point in the history
We need to also account for external image textures that are
imported in texture creation.
  • Loading branch information
poweifeng authored Oct 3, 2024
1 parent 3ed9e8f commit 739d400
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions filament/src/details/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,15 @@ FTexture::FTexture(FEngine& engine, const Builder& builder) {
mSwizzle = builder->mSwizzle;
mTextureIsSwizzled = builder->mTextureIsSwizzled;

if (mTarget == SamplerType::SAMPLER_EXTERNAL) {
bool const isImported = builder->mImportedId != 0;
if (mTarget == SamplerType::SAMPLER_EXTERNAL && !isImported) {
// mHandle and mHandleForSampling will be created in setExternalImage()
// If this Texture is used for sampling before setExternalImage() is called,
// we'll lazily create a 1x1 placeholder texture.
return;
}

if (UTILS_LIKELY(builder->mImportedId == 0)) {
if (UTILS_LIKELY(!isImported)) {
mHandle = driver.createTexture(
mTarget, mLevelCount, mFormat, mSampleCount, mWidth, mHeight, mDepth, mUsage);
} else {
Expand Down

0 comments on commit 739d400

Please sign in to comment.