fix shadow map no binding warning (#7754)

This commit is contained in:
troublemaker52025
2020-11-11 12:03:37 +08:00
committed by GitHub
parent 3c669c4d9f
commit 82f87f3776
2 changed files with 7 additions and 4 deletions
@@ -211,9 +211,6 @@ export class ForwardPipeline extends RenderPipeline {
const shadowInfo = this.shadows;
if (mainLight && shadowInfo.type === ShadowType.ShadowMap) {
if (this.shadowFrameBufferMap.has(mainLight)) {
this._descriptorSet.bindTexture(UNIFORM_SHADOWMAP_BINDING, this.shadowFrameBufferMap.get(mainLight)!.colorTextures[0]!);
}
// light view
let shadowCameraView: Mat4;
@@ -280,6 +277,8 @@ export class ForwardPipeline extends RenderPipeline {
));
this._descriptorSet.bindBuffer(UBOShadow.BINDING, shadowUBO);
this._descriptorSet.update();
// update global defines when all states initialized.
this.macros.CC_USE_HDR = this._isHDR;
this.macros.CC_SUPPORT_FLOAT_TEXTURE = this.device.hasFeature(Feature.TEXTURE_FLOAT);
+5 -1
View File
@@ -41,7 +41,7 @@ import { ForwardPipeline } from '../forward/forward-pipeline';
import { RenderView } from '../render-view';
import { ShadowType } from '../../renderer/scene/shadows';
import { genSamplerHash, samplerLib } from '../../renderer/core/sampler-lib';
import { Light } from '../../renderer/scene/light';
import { Light, LightType } from '../../renderer/scene/light';
import { lightCollecting, shadowCollecting } from '../forward/scene-culling';
import { Vec2 } from '../../math';
@@ -167,6 +167,10 @@ export class ShadowFlow extends RenderFlow {
const shadowMapSamplerHash = genSamplerHash(_samplerInfo);
const shadowMapSampler = samplerLib.getSampler(device, shadowMapSamplerHash);
pipeline.descriptorSet.bindSampler(UNIFORM_SHADOWMAP_BINDING, shadowMapSampler);
if (light.type === LightType.DIRECTIONAL) {
pipeline.descriptorSet.bindTexture(UNIFORM_SHADOWMAP_BINDING, shadowFrameBuffer.colorTextures[0]!);
}
}
private resizeShadowMap (light: Light, size: Vec2) {