|
|
|
|
|
|
{ |
|
|
|
bool isEnabledMSAA = false; |
|
|
|
Debug.Assert(!isEnabledMSAA || m_PassSettings.enableClustered); |
|
|
|
bool disableFptl = (m_PassSettings.disableFptlWhenClustered && m_PassSettings.enableClustered) || isEnabledMSAA; |
|
|
|
bool disableFptl = (!m_PassSettings.enableFptlForOpaqueWhenClustered && m_PassSettings.enableClustered) || isEnabledMSAA; |
|
|
|
return !disableFptl; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
// TODO: get rid of this by making global parameters visible to compute shaders
|
|
|
|
BindGlobalParams(cmd, shadeOpaqueShader, kernel, camera, renderContext); |
|
|
|
|
|
|
|
cmd.SetComputeBufferParam(shadeOpaqueShader, kernel, "g_vLightListGlobal", bUseClusteredForDeferred ? s_PerVoxelLightLists : s_LightList); |
|
|
|
|
|
|
|
cmd.SetComputeTextureParam(shadeOpaqueShader, kernel, "_MainDepthTexture", depthStencilTexture); |
|
|
|
cmd.SetComputeTextureParam(shadeOpaqueShader, kernel, "_GBufferTexture0", Shader.PropertyToID("_GBufferTexture0")); |
|
|
|
cmd.SetComputeTextureParam(shadeOpaqueShader, kernel, "_GBufferTexture1", Shader.PropertyToID("_GBufferTexture1")); |
|
|
|
|
|
|
cmd.SetComputeTextureParam(shadeOpaqueShader, kernel, "g_tShadowBuffer", Shader.PropertyToID("g_tShadowBuffer")); |
|
|
|
|
|
|
|
|
|
|
|
cmd.SetComputeTextureParam(shadeOpaqueShader, kernel, "_LtcData", Shader.GetGlobalTexture(Shader.PropertyToID("_LtcData"))); |
|
|
|
Utilities.SetMatrixCS(cmd, shadeOpaqueShader, "_InvViewProjMatrix", Shader.GetGlobalMatrix("_InvViewProjMatrix")); |
|
|
|
Utilities.SetMatrixCS(cmd, shadeOpaqueShader, "_ViewProjMatrix", Shader.GetGlobalMatrix("_ViewProjMatrix")); |
|
|
|
Matrix4x4 viewToWorld = camera.cameraToWorldMatrix; |
|
|
|
Matrix4x4 worldToView = camera.worldToCameraMatrix; |
|
|
|
Matrix4x4 viewProjection = hdCamera.viewProjectionMatrix; |
|
|
|
Matrix4x4 invViewProjection = hdCamera.invViewProjectionMatrix; |
|
|
|
|
|
|
|
Utilities.SetMatrixCS(cmd, shadeOpaqueShader, "unity_MatrixV", worldToView); |
|
|
|
Utilities.SetMatrixCS(cmd, shadeOpaqueShader, "unity_MatrixInvV", viewToWorld); |
|
|
|
Utilities.SetMatrixCS(cmd, shadeOpaqueShader, "unity_MatrixVP", viewProjection); |
|
|
|
|
|
|
|
Utilities.SetMatrixCS(cmd, shadeOpaqueShader, "_InvViewProjMatrix", invViewProjection); |
|
|
|
Utilities.SetMatrixCS(cmd, shadeOpaqueShader, "_ViewProjMatrix", viewProjection); |
|
|
|
Utilities.SetMatrixCS(cmd, shadeOpaqueShader, "g_mInvScrProjection", Shader.GetGlobalMatrix("g_mInvScrProjection")); |
|
|
|
cmd.SetComputeVectorParam(shadeOpaqueShader, "_ScreenSize", Shader.GetGlobalVector("_ScreenSize")); |
|
|
|
cmd.SetComputeIntParam(shadeOpaqueShader, "_UseTileLightList", Shader.GetGlobalInt("_UseTileLightList")); |
|
|
|