Skip to content

Commit 30fd20a

Browse files
GLTF Loader: don't set texture sampler in the texture view
The renderer uses immutable samplers for all textures
1 parent d73fe79 commit 30fd20a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

AssetLoader/src/GLTFLoader.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,15 @@ TEXTURE_FORMAT GetModelImageDataTextureFormat(const Model::ImageData& Image)
434434
if (Image.TexFormat != TEX_FORMAT_UNKNOWN)
435435
return Image.TexFormat;
436436

437-
VERIFY(Image.ComponentSize == 1, "Only 8-bit image components are currently supported");
437+
DEV_CHECK_ERR(Image.ComponentSize == 1, "Only 8-bit image components are currently supported");
438438
switch (Image.NumComponents)
439439
{
440440
case 1: return TEX_FORMAT_R8_UNORM;
441441
case 2: return TEX_FORMAT_RG8_UNORM;
442442
case 3:
443443
case 4: return TEX_FORMAT_RGBA8_UNORM;
444444
default:
445-
UNEXPECTED("Unsupported number of color components in gltf image: ", Image.NumComponents);
445+
DEV_ERROR("Unsupported number of color components in gltf image: ", Image.NumComponents);
446446
return TEX_FORMAT_UNKNOWN;
447447
}
448448
}
@@ -830,9 +830,14 @@ Uint32 Model::AddTexture(IRenderDevice* pDevice,
830830
TexDesc.MiscFlags = MISC_TEXTURE_FLAG_GENERATE_MIPS;
831831

832832
pDevice->CreateTexture(TexDesc, nullptr, &TexInfo.pTexture);
833-
TexInfo.pTexture->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE)->SetSampler(pSampler);
834-
835-
TexInfo.pTexture->SetUserData(pTexInitData);
833+
if (TexInfo.pTexture)
834+
{
835+
TexInfo.pTexture->SetUserData(pTexInitData);
836+
}
837+
else
838+
{
839+
DEV_ERROR("Failed to create texture from image data");
840+
}
836841
}
837842
}
838843
else if (Image.FileFormat == IMAGE_FILE_FORMAT_DDS || Image.FileFormat == IMAGE_FILE_FORMAT_KTX)

0 commit comments

Comments
 (0)