浏览代码

Use RenderTextureDesc to create VR RTs

We can now fetch RenderTextureDesc for VR eye textures from VRDevice.  This greatly simplifies the creation process for VR RTs.

We should also do this for the camera 'back buffer'.
/vr_sandbox
Robert Srinivasiah 8 年前
当前提交
3a8831ec
共有 1 个文件被更改,包括 5 次插入24 次删除
  1. 29
      Assets/LowEndMobilePipeline/LowEndMobilePipeline.cs

29
Assets/LowEndMobilePipeline/LowEndMobilePipeline.cs


if (VRSettings.isDeviceActive)
{
int w = VRSettings.eyeTextureWidth;
int h = VRSettings.eyeTextureHeight;
var aa = QualitySettings.antiAliasing;
if (aa < 1)
aa = 1;
// TODO: this won't work in...the Player
var stereoPath = PlayerSettings.stereoRenderingPath;
if (StereoRenderingPath.Instancing == stereoPath) // can't actually check for GetGraphicsCaps().hasRenderTargetArrayIndexFromAnyShader...yet
{
bindTempRTCmd.GetTemporaryRTArray(intermediateRT, w, h, 2, 0, FilterMode.Point, RenderTextureFormat.Default, RenderTextureReadWrite.Default, aa, true);
bindTempRTCmd.GetTemporaryRTArray(intermediateDepthRT, w, h, 2, 24, FilterMode.Point, RenderTextureFormat.Depth);
}
else
{
bindTempRTCmd.GetTemporaryRT(intermediateRT, w, h, 0, FilterMode.Point, RenderTextureFormat.Default, RenderTextureReadWrite.Default, aa, true);
bindTempRTCmd.GetTemporaryRT(intermediateDepthRT, w, h, 24, FilterMode.Point, RenderTextureFormat.Depth);
}
bindTempRTCmd.SetRenderTarget(intermediateRTID, intermediateDepthRTID);
RenderTextureDesc vrDesc = VRDevice.GetVREyeTextureDesc();
vrDesc.depthBufferBits = 24;
bindTempRTCmd.GetTemporaryRT(intermediateRT, vrDesc, FilterMode.Point);
bindTempRTCmd.SetRenderTarget(intermediateRTID);
context.ExecuteCommandBuffer(bindTempRTCmd);
bindTempRTCmd.Dispose();
}

// this does the combined color/depth RT
bindTempRTCmd.GetTemporaryRT(intermediateRT, w, h, 24, FilterMode.Point, RenderTextureFormat.Default, RenderTextureReadWrite.Default, aa, true);
bindTempRTCmd.SetRenderTarget(intermediateRTID);
//bindTempRTCmd.GetTemporaryRT(intermediateDepthRT, w, h, 24, FilterMode.Point, RenderTextureFormat.Depth);
//bindTempRTCmd.SetRenderTarget(intermediateRTID, intermediateDepthRTID);
context.ExecuteCommandBuffer(bindTempRTCmd);
bindTempRTCmd.Dispose();
}

正在加载...
取消
保存