@@ -291,7 +291,7 @@ struct RenderAccumulationParameters
291
291
public HDCamera hdCamera ;
292
292
}
293
293
294
- RenderAccumulationParameters PrepareRenderAccumulationParameters ( HDCamera hdCamera , bool needExposure )
294
+ RenderAccumulationParameters PrepareRenderAccumulationParameters ( HDCamera hdCamera , bool needExposure , bool inputFromRadianceTexture )
295
295
{
296
296
var parameters = new RenderAccumulationParameters ( ) ;
297
297
@@ -301,6 +301,11 @@ RenderAccumulationParameters PrepareRenderAccumulationParameters(HDCamera hdCame
301
301
parameters . needExposure = needExposure ;
302
302
parameters . hdCamera = hdCamera ;
303
303
304
+ parameters . accumulationCS . shaderKeywords = null ;
305
+ if ( inputFromRadianceTexture )
306
+ {
307
+ parameters . accumulationCS . EnableKeyword ( "INPUT_FROM_RADIANCE_TEXTURE" ) ;
308
+ }
304
309
return parameters ;
305
310
}
306
311
@@ -310,7 +315,8 @@ void RenderAccumulation(HDCamera hdCamera, RTHandle inputTexture, RTHandle outpu
310
315
RTHandle history = hdCamera . GetCurrentFrameRT ( ( int ) HDCameraFrameHistoryType . PathTracing )
311
316
?? hdCamera . AllocHistoryFrameRT ( ( int ) HDCameraFrameHistoryType . PathTracing , PathTracingHistoryBufferAllocatorFunction , 1 ) ;
312
317
313
- var parameters = PrepareRenderAccumulationParameters ( hdCamera , needExposure ) ;
318
+ bool inputFromRadianceTexture = ! inputTexture . Equals ( outputTexture ) ;
319
+ var parameters = PrepareRenderAccumulationParameters ( hdCamera , needExposure , inputFromRadianceTexture ) ;
314
320
RenderAccumulation ( parameters , inputTexture , outputTexture , history , cmd ) ;
315
321
}
316
322
@@ -332,7 +338,10 @@ static void RenderAccumulation(in RenderAccumulationParameters parameters, RTHan
332
338
cmd . SetComputeIntParam ( accumulationShader , HDShaderIDs . _AccumulationNumSamples , ( int ) parameters . subFrameManager . subFrameCount ) ;
333
339
cmd . SetComputeTextureParam ( accumulationShader , parameters . accumulationKernel , HDShaderIDs . _AccumulatedFrameTexture , historyTexture ) ;
334
340
cmd . SetComputeTextureParam ( accumulationShader , parameters . accumulationKernel , HDShaderIDs . _CameraColorTextureRW , outputTexture ) ;
335
- cmd . SetComputeTextureParam ( accumulationShader , parameters . accumulationKernel , HDShaderIDs . _RadianceTexture , inputTexture ) ;
341
+ if ( ! inputTexture . Equals ( outputTexture ) )
342
+ {
343
+ cmd . SetComputeTextureParam ( accumulationShader , parameters . accumulationKernel , HDShaderIDs . _RadianceTexture , inputTexture ) ;
344
+ }
336
345
cmd . SetComputeVectorParam ( accumulationShader , HDShaderIDs . _AccumulationWeights , frameWeights ) ;
337
346
cmd . SetComputeIntParam ( accumulationShader , HDShaderIDs . _AccumulationNeedsExposure , parameters . needExposure ? 1 : 0 ) ;
338
347
cmd . DispatchCompute ( accumulationShader , parameters . accumulationKernel , ( parameters . hdCamera . actualWidth + 7 ) / 8 , ( parameters . hdCamera . actualHeight + 7 ) / 8 , parameters . hdCamera . viewCount ) ;
0 commit comments