gltfio: fix unbound texture warnings in ubershader mode.

This commit is contained in:
Philip Rideout
2020-05-06 15:19:54 -07:00
parent b54000ccb9
commit cc29359897

View File

@@ -82,7 +82,6 @@ public:
#define MATINDEX(shading, alpha) (int(shading) + 3 * int(alpha))
UbershaderLoader::UbershaderLoader(Engine* engine) : mEngine(engine) {
#ifdef EMSCRIPTEN
unsigned char texels[4] = {};
mDummyTexture = Texture::Builder()
.width(1).height(1)
@@ -91,7 +90,6 @@ UbershaderLoader::UbershaderLoader(Engine* engine) : mEngine(engine) {
Texture::PixelBufferDescriptor pbd(texels, sizeof(texels), Texture::Format::RGBA,
Texture::Type::UBYTE);
mDummyTexture->setImage(*mEngine, 0, std::move(pbd));
#endif
}
size_t UbershaderLoader::getMaterialsCount() const noexcept {
@@ -179,11 +177,6 @@ MaterialInstance* UbershaderLoader::createMaterialInstance(MaterialKey* config,
mi->setParameter("clearCoatNormalUvMatrix", identity);
#endif
// Some WebGL implementations emit a warning at draw call time if the shader declares a sampler
// that has not been bound to a texture, even if the texture lookup is conditional. Therefore we
// need to ensure that every sampler parameter is bound to a dummy texture, even if it is never
// actually sampled from.
#ifdef EMSCRIPTEN
TextureSampler sampler;
mi->setParameter("normalMap", mDummyTexture, sampler);
mi->setParameter("baseColorMap", mDummyTexture, sampler);
@@ -193,7 +186,6 @@ MaterialInstance* UbershaderLoader::createMaterialInstance(MaterialKey* config,
mi->setParameter("clearCoatMap", mDummyTexture, sampler);
mi->setParameter("clearCoatRoughnessMap", mDummyTexture, sampler);
mi->setParameter("clearCoatNormalMap", mDummyTexture, sampler);
#endif
return mi;
}