public override void DrawCluster(ref RenderClusterOptions options) { PipelineFunctions.SetBaseBuffer(baseBuffer, options.cullingShader, options.frustumPlanes, options.command); PipelineFunctions.RunCullDispatching(baseBuffer, options.cullingShader, options.isOrtho, options.command); PipelineFunctions.RenderProceduralCommand(baseBuffer, options.proceduralMaterial, options.command); //TODO 绘制其他物体 //TODO options.command.DispatchCompute(options.cullingShader, 1, 1, 1, 1); }
public static void DrawCluster(ref RenderClusterOptions options, ref RenderTargets targets, ref PipelineCommandData data, Camera cam) { if (gpurpEnabled) { options.command.SetGlobalBuffer(ShaderIDs._PropertiesBuffer, commonData.propertyBuffer); options.command.SetGlobalTexture(ShaderIDs._MainTex, commonData.texArray); PipelineFunctions.SetBaseBuffer(baseBuffer, options.cullingShader, options.frustumPlanes, options.command); PipelineFunctions.RunCullDispatching(baseBuffer, options.cullingShader, options.isOrtho, options.command); PipelineFunctions.RenderProceduralCommand(baseBuffer, commonData.clusterMaterial, options.command); } RenderScene(ref data, cam); }
public static void DrawCluster(ref RenderClusterOptions options, ref RenderTargets targets, ref PipelineCommandData data, Camera cam) { data.buffer.SetRenderTarget(targets.gbufferIdentifier, targets.depthBuffer); data.buffer.ClearRenderTarget(true, true, Color.black); if (gpurpEnabled) { options.command.SetGlobalBuffer(ShaderIDs._PropertiesBuffer, commonData.propertyBuffer); options.command.SetGlobalTexture(ShaderIDs._MainTex, commonData.texArray); options.command.SetGlobalTexture(ShaderIDs._LightMap, commonData.lightmapArray); PipelineFunctions.SetBaseBuffer(baseBuffer, options.cullingShader, options.frustumPlanes, options.command); PipelineFunctions.RunCullDispatching(baseBuffer, options.cullingShader, options.command); PipelineFunctions.RenderProceduralCommand(baseBuffer, commonData.clusterMaterial, options.command); } RenderScene(ref data, cam); }
public override void DrawClusterOccSingleCheck(ref RenderClusterOptions options, ref HizOptions hizOpts) { CommandBuffer buffer = options.command; buffer.SetComputeVectorParam(options.cullingShader, ShaderIDs._CameraUpVector, hizOpts.hizData.lastFrameCameraUp); buffer.SetComputeBufferParam(options.cullingShader, 5, ShaderIDs.clusterBuffer, baseBuffer.clusterBuffer); buffer.SetComputeTextureParam(options.cullingShader, 5, ShaderIDs._HizDepthTex, hizOpts.hizData.historyDepth); buffer.SetComputeVectorArrayParam(options.cullingShader, ShaderIDs.planes, options.frustumPlanes); buffer.SetComputeBufferParam(options.cullingShader, 5, ShaderIDs.resultBuffer, baseBuffer.resultBuffer); buffer.SetComputeBufferParam(options.cullingShader, 5, ShaderIDs.instanceCountBuffer, baseBuffer.instanceCountBuffer); buffer.SetComputeBufferParam(options.cullingShader, PipelineBaseBuffer.ComputeShaderKernels.ClearClusterKernel, ShaderIDs.instanceCountBuffer, baseBuffer.instanceCountBuffer); ComputeShaderUtility.Dispatch(options.cullingShader, options.command, 5, baseBuffer.clusterCount, 256); hizOpts.hizData.lastFrameCameraUp = hizOpts.currentCameraUpVec; buffer.SetGlobalBuffer(ShaderIDs.resultBuffer, baseBuffer.resultBuffer); buffer.SetGlobalBuffer(ShaderIDs.verticesBuffer, baseBuffer.verticesBuffer); PipelineFunctions.RenderProceduralCommand(baseBuffer, options.proceduralMaterial, buffer); buffer.DispatchCompute(options.cullingShader, PipelineBaseBuffer.ComputeShaderKernels.ClearClusterKernel, 1, 1, 1); //TODO 绘制其他物体 //TODO buffer.Blit(hizOpts.currentDepthTex, hizOpts.hizData.historyDepth, hizOpts.linearLODMaterial, 0); hizOpts.hizDepth.GetMipMap(hizOpts.hizData.historyDepth, buffer); }