Skip to content

Commit 250c47c

Browse files
authored
iblprefilter: Remove redundant workaround (#10010)
The issue is no longer reproducible and has likely been resolved by other changes. FIXES=[437100093]
1 parent 51647ab commit 250c47c

1 file changed

Lines changed: 12 additions & 45 deletions

File tree

libs/iblprefilter/src/IBLPrefilterContext.cpp

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -295,17 +295,10 @@ Texture* IBLPrefilterContext::EquirectangularToCubemap::operator()(
295295
mi->setParameter("mirror", mConfig.mirror ? -1.0f : 1.0f);
296296

297297
for (size_t i = 0; i < 2; i++) {
298-
// This is a workaround for internal bug b/419664914 to duplicate same material for each draw.
299-
// TODO: properly address the bug and remove this workaround.
300-
#if defined(__EMSCRIPTEN__)
301-
MaterialInstance *const tempMi = MaterialInstance::duplicate(mi);
302-
#else
303-
MaterialInstance *const tempMi = mi;
304-
#endif
305-
rcm.setMaterialInstanceAt(ci, 0, tempMi);
306-
307-
tempMi->setParameter("side", i == 0 ? 1.0f : -1.0f);
308-
tempMi->commit(engine);
298+
rcm.setMaterialInstanceAt(ci, 0, mi);
299+
300+
mi->setParameter("side", i == 0 ? 1.0f : -1.0f);
301+
mi->commit(engine);
309302

310303
builder.face(RenderTarget::AttachmentPoint::COLOR0, faces[i][0])
311304
.face(RenderTarget::AttachmentPoint::COLOR1, faces[i][1])
@@ -315,10 +308,6 @@ Texture* IBLPrefilterContext::EquirectangularToCubemap::operator()(
315308
view->setRenderTarget(rt);
316309
renderer->renderStandaloneView(view);
317310
engine.destroy(rt);
318-
319-
#if defined(__EMSCRIPTEN__)
320-
cleanupMaterialInstance(tempMi, engine, rcm, ci);
321-
#endif
322311
}
323312

324313
rcm.clearMaterialInstanceAt(ci, 0);
@@ -484,17 +473,10 @@ Texture* IBLPrefilterContext::IrradianceFilter::operator()(Options options,
484473
view->setViewport({ 0, 0, dim, dim });
485474

486475
for (size_t i = 0; i < 2; i++) {
487-
// This is a workaround for internal bug b/419664914 to duplicate same material for each draw.
488-
// TODO: properly address the bug and remove this workaround.
489-
#if defined(__EMSCRIPTEN__)
490-
MaterialInstance *const tempMi = MaterialInstance::duplicate(mi);
491-
#else
492-
MaterialInstance *const tempMi = mi;
493-
#endif
494-
rcm.setMaterialInstanceAt(ci, 0, tempMi);
495-
496-
tempMi->setParameter("side", i == 0 ? 1.0f : -1.0f);
497-
tempMi->commit(engine);
476+
rcm.setMaterialInstanceAt(ci, 0, mi);
477+
478+
mi->setParameter("side", i == 0 ? 1.0f : -1.0f);
479+
mi->commit(engine);
498480

499481
builder.face(RenderTarget::AttachmentPoint::COLOR0, faces[i][0])
500482
.face(RenderTarget::AttachmentPoint::COLOR1, faces[i][1])
@@ -504,10 +486,6 @@ Texture* IBLPrefilterContext::IrradianceFilter::operator()(Options options,
504486
view->setRenderTarget(rt);
505487
renderer->renderStandaloneView(view);
506488
engine.destroy(rt);
507-
508-
#if defined(__EMSCRIPTEN__)
509-
cleanupMaterialInstance(tempMi, engine, rcm, ci);
510-
#endif
511489
}
512490

513491
rcm.clearMaterialInstanceAt(ci, 0);
@@ -731,17 +709,10 @@ Texture* IBLPrefilterContext::SpecularFilter::operator()(
731709
view->setViewport({ 0, 0, dim, dim });
732710

733711
for (size_t i = 0; i < 2; i++) {
734-
// This is a workaround for internal bug b/419664914 to duplicate same material for each draw.
735-
// TODO: properly address the bug and remove this workaround.
736-
#if defined(__EMSCRIPTEN__)
737-
MaterialInstance *const tempMi = MaterialInstance::duplicate(mi);
738-
#else
739-
MaterialInstance *const tempMi = mi;
740-
#endif
741-
rcm.setMaterialInstanceAt(ci, 0, tempMi);
742-
743-
tempMi->setParameter("side", i == 0 ? 1.0f : -1.0f);
744-
tempMi->commit(engine);
712+
rcm.setMaterialInstanceAt(ci, 0, mi);
713+
714+
mi->setParameter("side", i == 0 ? 1.0f : -1.0f);
715+
mi->commit(engine);
745716

746717
builder.face(RenderTarget::AttachmentPoint::COLOR0, faces[i][0])
747718
.face(RenderTarget::AttachmentPoint::COLOR1, faces[i][1])
@@ -751,10 +722,6 @@ Texture* IBLPrefilterContext::SpecularFilter::operator()(
751722
view->setRenderTarget(rt);
752723
renderer->renderStandaloneView(view);
753724
engine.destroy(rt);
754-
755-
#if defined(__EMSCRIPTEN__)
756-
cleanupMaterialInstance(tempMi, engine, rcm, ci);
757-
#endif
758725
}
759726

760727
dim >>= 1;

0 commit comments

Comments
 (0)