Fix regression with getDefaultInstance().

This caused color writes to be disabled in our "hello triangle" samples.

Fixes #2164.
This commit is contained in:
Philip Rideout
2020-02-25 11:16:19 -08:00
parent 3cfc6981a4
commit 3f7ef9738d

View File

@@ -76,9 +76,15 @@ FMaterialInstance::FMaterialInstance(FEngine& engine, FMaterial const* material)
void FMaterialInstance::initDefaultInstance(FEngine& engine, FMaterial const* material) {
mMaterial = material;
const RasterState& rasterState = mMaterial->getRasterState();
// We inherit the resolved culling mode rather than the builder-set culling mode.
// This preserves the property whereby double-sidedness automatically disables culling.
mCulling = mMaterial->getRasterState().culling;
mCulling = rasterState.culling;
mColorWrite = rasterState.colorWrite;
mDepthWrite = rasterState.depthWrite;
mDepthFunc = rasterState.depthFunc;
mMaterialSortingKey = RenderPass::makeMaterialSortingKey(
material->getId(), material->generateMaterialInstanceId());