public void SetRenderTarget(RenderTargetBinding binding)
        {
            if (binding.colorRenderTargets.Length < 1)
            {
                throw new ArgumentException(string.Format("The number of color render targets must be at least 1, but was {0}", binding.colorRenderTargets.Length));
            }
            if (binding.colorRenderTargets.Length > SystemInfo.supportedRenderTargetCount)
            {
                throw new ArgumentException(string.Format("The number of color render targets ({0}) and exceeds the maximum supported number of render targets ({1})", binding.colorRenderTargets.Length, SystemInfo.supportedRenderTargetCount));
            }
            if (binding.colorLoadActions.Length != binding.colorRenderTargets.Length)
            {
                throw new ArgumentException(string.Format("The number of color load actions provided ({0}) does not match the number of color render targets ({1})", binding.colorLoadActions.Length, binding.colorRenderTargets.Length));
            }
            if (binding.colorStoreActions.Length != binding.colorRenderTargets.Length)
            {
                throw new ArgumentException(string.Format("The number of color store actions provided ({0}) does not match the number of color render targets ({1})", binding.colorLoadActions.Length, binding.colorRenderTargets.Length));
            }
            if (binding.depthLoadAction == RenderBufferLoadAction.Clear || Array.IndexOf(binding.colorLoadActions, RenderBufferLoadAction.Clear) > -1)
            {
                throw new ArgumentException("RenderBufferLoadAction.Clear is not supported");
            }

            if (binding.colorRenderTargets.Length == 1) // non-MRT case respects mip/face/slice of color's RenderTargetIdentifier
            {
                SetRenderTargetColorDepth_Internal(binding.colorRenderTargets[0], binding.depthRenderTarget, binding.colorLoadActions[0], binding.colorStoreActions[0], binding.depthLoadAction, binding.depthStoreAction);
            }
            else
            {
                SetRenderTargetMulti_Internal(binding.colorRenderTargets, binding.depthRenderTarget, binding.colorLoadActions, binding.colorStoreActions, binding.depthLoadAction, binding.depthStoreAction);
            }
        }
示例#2
0
 public void SetRenderTarget(RenderTargetBinding binding, int mipLevel, CubemapFace cubemapFace, int depthSlice)
 {
     ValidateAgainstExecutionFlags(CommandBufferExecutionFlags.None, CommandBufferExecutionFlags.AsyncCompute);
     if (binding.colorRenderTargets.Length < 1)
     {
         throw new ArgumentException(string.Format("The number of color render targets must be at least 1, but was {0}", binding.colorRenderTargets.Length));
     }
     if (binding.colorRenderTargets.Length > SystemInfo.supportedRenderTargetCount)
     {
         throw new ArgumentException(string.Format("The number of color render targets ({0}) and exceeds the maximum supported number of render targets ({1})", binding.colorRenderTargets.Length, SystemInfo.supportedRenderTargetCount));
     }
     if (binding.colorLoadActions.Length != binding.colorRenderTargets.Length)
     {
         throw new ArgumentException(string.Format("The number of color load actions provided ({0}) does not match the number of color render targets ({1})", binding.colorLoadActions.Length, binding.colorRenderTargets.Length));
     }
     if (binding.colorStoreActions.Length != binding.colorRenderTargets.Length)
     {
         throw new ArgumentException(string.Format("The number of color store actions provided ({0}) does not match the number of color render targets ({1})", binding.colorLoadActions.Length, binding.colorRenderTargets.Length));
     }
     if (binding.depthLoadAction == RenderBufferLoadAction.Clear || Array.IndexOf(binding.colorLoadActions, RenderBufferLoadAction.Clear) > -1)
     {
         throw new ArgumentException("RenderBufferLoadAction.Clear is not supported");
     }
     if (binding.colorRenderTargets.Length == 1) // non-MRT case respects mip/face/slice of color's RenderTargetIdentifier
     {
         SetRenderTargetColorDepthSubtarget(binding.colorRenderTargets[0], binding.depthRenderTarget, binding.colorLoadActions[0], binding.colorStoreActions[0], binding.depthLoadAction, binding.depthStoreAction, mipLevel, cubemapFace, depthSlice);
     }
     else
     {
         SetRenderTargetMultiSubtarget(binding.colorRenderTargets, binding.depthRenderTarget, binding.colorLoadActions, binding.colorStoreActions, binding.depthLoadAction, binding.depthStoreAction, mipLevel, cubemapFace, depthSlice);
     }
 }
 public RenderTargetBinding(RenderTargetIdentifier colorRenderTarget, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depthRenderTarget, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction)
 {
     this = new RenderTargetBinding(new RenderTargetIdentifier[]
     {
         colorRenderTarget
     }, new RenderBufferLoadAction[]
     {
         colorLoadAction
     }, new RenderBufferStoreAction[]
     {
         colorStoreAction
     }, depthRenderTarget, depthLoadAction, depthStoreAction);
 }
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         UnityEngine.Rendering.RenderTargetBinding o;
         if (matchType(l, "ctor__Arr_RenderTargetIdentifier__Arr_RenderBufferLoadAction__Arr_RenderBufferStoreAction__RenderTargetIdentifier__RenderBufferLoadAction__RenderBufferStoreAction", argc, 2, typeof(UnityEngine.Rendering.RenderTargetIdentifier[]), typeof(UnityEngine.Rendering.RenderBufferLoadAction[]), typeof(UnityEngine.Rendering.RenderBufferStoreAction[]), typeof(UnityEngine.Rendering.RenderTargetIdentifier), typeof(UnityEngine.Rendering.RenderBufferLoadAction), typeof(UnityEngine.Rendering.RenderBufferStoreAction)))
         {
             UnityEngine.Rendering.RenderTargetIdentifier[] a1;
             checkArray(l, 3, out a1);
             UnityEngine.Rendering.RenderBufferLoadAction[] a2;
             checkArray(l, 4, out a2);
             UnityEngine.Rendering.RenderBufferStoreAction[] a3;
             checkArray(l, 5, out a3);
             UnityEngine.Rendering.RenderTargetIdentifier a4;
             checkValueType(l, 6, out a4);
             UnityEngine.Rendering.RenderBufferLoadAction a5;
             checkEnum(l, 7, out a5);
             UnityEngine.Rendering.RenderBufferStoreAction a6;
             checkEnum(l, 8, out a6);
             o = new UnityEngine.Rendering.RenderTargetBinding(a1, a2, a3, a4, a5, a6);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, "ctor__RenderTargetIdentifier__RenderBufferLoadAction__RenderBufferStoreAction__RenderTargetIdentifier__RenderBufferLoadAction__RenderBufferStoreAction", argc, 2, typeof(UnityEngine.Rendering.RenderTargetIdentifier), typeof(UnityEngine.Rendering.RenderBufferLoadAction), typeof(UnityEngine.Rendering.RenderBufferStoreAction), typeof(UnityEngine.Rendering.RenderTargetIdentifier), typeof(UnityEngine.Rendering.RenderBufferLoadAction), typeof(UnityEngine.Rendering.RenderBufferStoreAction)))
         {
             UnityEngine.Rendering.RenderTargetIdentifier a1;
             checkValueType(l, 3, out a1);
             UnityEngine.Rendering.RenderBufferLoadAction a2;
             checkEnum(l, 4, out a2);
             UnityEngine.Rendering.RenderBufferStoreAction a3;
             checkEnum(l, 5, out a3);
             UnityEngine.Rendering.RenderTargetIdentifier a4;
             checkValueType(l, 6, out a4);
             UnityEngine.Rendering.RenderBufferLoadAction a5;
             checkEnum(l, 7, out a5);
             UnityEngine.Rendering.RenderBufferStoreAction a6;
             checkEnum(l, 8, out a6);
             o = new UnityEngine.Rendering.RenderTargetBinding(a1, a2, a3, a4, a5, a6);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.RenderTargetSetup a1;
             checkValueType(l, 3, out a1);
             o = new UnityEngine.Rendering.RenderTargetBinding(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc <= 2)
         {
             o = new UnityEngine.Rendering.RenderTargetBinding();
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#5
0
 static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         int argc = LuaDLL.lua_gettop(l);
         UnityEngine.Rendering.RenderTargetBinding o;
         if (matchType(l, argc, 2, typeof(UnityEngine.Rendering.RenderTargetIdentifier[]), typeof(UnityEngine.Rendering.RenderBufferLoadAction[]), typeof(UnityEngine.Rendering.RenderBufferStoreAction[]), typeof(UnityEngine.Rendering.RenderTargetIdentifier), typeof(UnityEngine.Rendering.RenderBufferLoadAction), typeof(UnityEngine.Rendering.RenderBufferStoreAction)))
         {
             UnityEngine.Rendering.RenderTargetIdentifier[] a1;
             checkArray(l, 2, out a1);
             UnityEngine.Rendering.RenderBufferLoadAction[] a2;
             checkArray(l, 3, out a2);
             UnityEngine.Rendering.RenderBufferStoreAction[] a3;
             checkArray(l, 4, out a3);
             UnityEngine.Rendering.RenderTargetIdentifier a4;
             checkValueType(l, 5, out a4);
             UnityEngine.Rendering.RenderBufferLoadAction a5;
             a5 = (UnityEngine.Rendering.RenderBufferLoadAction)LuaDLL.luaL_checkinteger(l, 6);
             UnityEngine.Rendering.RenderBufferStoreAction a6;
             a6 = (UnityEngine.Rendering.RenderBufferStoreAction)LuaDLL.luaL_checkinteger(l, 7);
             o  = new UnityEngine.Rendering.RenderTargetBinding(a1, a2, a3, a4, a5, a6);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(UnityEngine.Rendering.RenderTargetIdentifier), typeof(UnityEngine.Rendering.RenderBufferLoadAction), typeof(UnityEngine.Rendering.RenderBufferStoreAction), typeof(UnityEngine.Rendering.RenderTargetIdentifier), typeof(UnityEngine.Rendering.RenderBufferLoadAction), typeof(UnityEngine.Rendering.RenderBufferStoreAction)))
         {
             UnityEngine.Rendering.RenderTargetIdentifier a1;
             checkValueType(l, 2, out a1);
             UnityEngine.Rendering.RenderBufferLoadAction a2;
             a2 = (UnityEngine.Rendering.RenderBufferLoadAction)LuaDLL.luaL_checkinteger(l, 3);
             UnityEngine.Rendering.RenderBufferStoreAction a3;
             a3 = (UnityEngine.Rendering.RenderBufferStoreAction)LuaDLL.luaL_checkinteger(l, 4);
             UnityEngine.Rendering.RenderTargetIdentifier a4;
             checkValueType(l, 5, out a4);
             UnityEngine.Rendering.RenderBufferLoadAction a5;
             a5 = (UnityEngine.Rendering.RenderBufferLoadAction)LuaDLL.luaL_checkinteger(l, 6);
             UnityEngine.Rendering.RenderBufferStoreAction a6;
             a6 = (UnityEngine.Rendering.RenderBufferStoreAction)LuaDLL.luaL_checkinteger(l, 7);
             o  = new UnityEngine.Rendering.RenderTargetBinding(a1, a2, a3, a4, a5, a6);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 2)
         {
             UnityEngine.RenderTargetSetup a1;
             checkValueType(l, 2, out a1);
             o = new UnityEngine.Rendering.RenderTargetBinding(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 0)
         {
             o = new UnityEngine.Rendering.RenderTargetBinding();
             pushValue(l, true);
             pushObject(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }