static StackObject *GetData_8(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 5);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @count = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 @computeBufferStartIndex = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Int32 @managedBufferStartIndex = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            System.Array @data = (System.Array) typeof(System.Array).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 5);
            UnityEngine.ComputeBuffer instance_of_this_method = (UnityEngine.ComputeBuffer) typeof(UnityEngine.ComputeBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.GetData(@data, @managedBufferStartIndex, @computeBufferStartIndex, @count);

            return(__ret);
        }
        static StackObject *Ctor_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.ComputeBufferMode @usage = (UnityEngine.ComputeBufferMode) typeof(UnityEngine.ComputeBufferMode).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.ComputeBufferType @type = (UnityEngine.ComputeBufferType) typeof(UnityEngine.ComputeBufferType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Int32 @stride = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            System.Int32 @count = ptr_of_this_method->Value;


            var result_of_this_method = new UnityEngine.ComputeBuffer(@count, @stride, @type, @usage);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Example #3
0
        static int _m_SetConstantBuffer(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.ComputeShader gen_to_be_invoked = (UnityEngine.ComputeShader)translator.FastGetCSObj(L, 1);



                {
                    int _nameID = LuaAPI.xlua_tointeger(L, 2);
                    UnityEngine.ComputeBuffer _buffer = (UnityEngine.ComputeBuffer)translator.GetObject(L, 3, typeof(UnityEngine.ComputeBuffer));
                    int _offset = LuaAPI.xlua_tointeger(L, 4);
                    int _size   = LuaAPI.xlua_tointeger(L, 5);

                    gen_to_be_invoked.SetConstantBuffer(_nameID, _buffer, _offset, _size);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
                {
                    int _count  = LuaAPI.xlua_tointeger(L, 2);
                    int _stride = LuaAPI.xlua_tointeger(L, 3);

                    var gen_ret = new UnityEngine.ComputeBuffer(_count, _stride);
                    translator.Push(L, gen_ret);

                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable <UnityEngine.ComputeBufferType>(L, 4))
                {
                    int _count  = LuaAPI.xlua_tointeger(L, 2);
                    int _stride = LuaAPI.xlua_tointeger(L, 3);
                    UnityEngine.ComputeBufferType _type; translator.Get(L, 4, out _type);

                    var gen_ret = new UnityEngine.ComputeBuffer(_count, _stride, _type);
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ComputeBuffer constructor!"));
        }
Example #5
0
 public unsafe static void SetData <T>
     (this ComputeBuffer buffer, System.ReadOnlySpan <T> data)
     where T : unmanaged
 {
     fixed(T *pData = &data.GetPinnableReference())
     buffer.SetData((IntPtr)pData, data.Length, sizeof(T));
 }
Example #6
0
 public void Dispose()
 {
     if (Buffer != null)
     {
         GpuBackend.ReleaseBuffer(Buffer);
         Buffer = null;
     }
 }
Example #7
0
 void Dispose(bool disposing)
 {
     if (disposing && Buffer != null)
     {
         GpuBackend.ReleaseBuffer(Buffer);
         Buffer = null;
     }
 }
        static int _s_set_name(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                UnityEngine.ComputeBuffer gen_to_be_invoked = (UnityEngine.ComputeBuffer)translator.FastGetCSObj(L, 1);
                gen_to_be_invoked.name = LuaAPI.lua_tostring(L, 2);
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(0);
        }
        static int _g_get_stride(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                UnityEngine.ComputeBuffer gen_to_be_invoked = (UnityEngine.ComputeBuffer)translator.FastGetCSObj(L, 1);
                LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.stride);
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(1);
        }
Example #10
0
        public Tensor(int[] shape, float[] data = null)
        {
            Shape = shape;

            var total = shape.Aggregate(1, (acc, x) => acc * x);

            Buffer = GpuBackend.AllocateBuffer(total);

            if (data != null)
            {
                UnityEngine.Debug.Assert(data.Length == total);
                Buffer.SetData(data);
            }
        }
        static StackObject *Release_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.ComputeBuffer instance_of_this_method = (UnityEngine.ComputeBuffer) typeof(UnityEngine.ComputeBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Release();

            return(__ret);
        }
Example #12
0
        public Tensor(Shape shape, float[] data = null)
        {
            Shape = shape;

            var total = shape.ElementCount;

            Buffer = GpuBackend.AllocateBuffer(total);

            if (data != null)
            {
                UnityEngine.Debug.Assert(data.Length == total);
                Buffer.SetData(data);
            }
        }
Example #13
0
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 stride = ptr_of_this_method->Value;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 count = ptr_of_this_method->Value;

            var result_of_this_method = new UnityEngine.ComputeBuffer(count, stride);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
        static StackObject *get_stride_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.ComputeBuffer instance_of_this_method = (UnityEngine.ComputeBuffer) typeof(UnityEngine.ComputeBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.stride;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
Example #15
0
        protected override void OnCreateManager()
        {
            base.OnCreateManager();

            instanceMesh = new UnityEngine.Mesh();

            instanceMesh.SetVertices(
                new System.Collections.Generic.List <UnityEngine.Vector3>()
            {
                new UnityEngine.Vector3(-0.25f, 0f, 0f),
                new UnityEngine.Vector3(-0.25f, 0.5f, 0f),
                new UnityEngine.Vector3(0.25f, 0f, 0f),
                new UnityEngine.Vector3(0.25f, 0.5f, 0f),
            }
                );

            instanceMesh.SetUVs(
                0,
                new System.Collections.Generic.List <UnityEngine.Vector2>()
            {
                new UnityEngine.Vector3(0f, 0f),
                new UnityEngine.Vector3(0f, 1f),
                new UnityEngine.Vector3(1f, 0f),
                new UnityEngine.Vector3(1f, 1f),
            }
                );

            instanceMesh.SetTriangles(
                new System.Collections.Generic.List <int>()
            {
                0, 1, 2, 3, 2, 1
            },
                0
                );

            instanceMesh.UploadMeshData(true);

            instanceCount = 0;

            InsObjSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(InsObj));

            argsBuffer = new UnityEngine.ComputeBuffer(1, args.Length * sizeof(uint), UnityEngine.ComputeBufferType.IndirectArguments);

            InsObjs = null;

            InsObjsID = UnityEngine.Shader.PropertyToID("InsObjs");
        }
Example #16
0
 /// <summary>
 /// Create a Tensor of shape `s`, associated ComputeBuffer `srcBuffer` filled with tensor values, and an optional name `n`
 /// `srcBuffer` should be larger than `s.length`.
 /// </summary>
 public Tensor(TensorShape s, UnityEngine.ComputeBuffer srcBuffer, string n = "")
 {
     name  = n;
     shape = s;
     if (srcBuffer.count < s.length)
     {
         throw new ArgumentException($"Compute buffer `{name}` capacity is {srcBuffer.count} less than {s.length} required for shape {s}");
     }
     if (srcBuffer.stride != 4)
     {
         throw new ArgumentException($"Currently only compute buffers with stride of 4 are supported. Compute buffer `{name}` stride is {srcBuffer.stride} instead");
     }
     m_TensorOnDevice  = new ComputeTensorData(srcBuffer, shape, offset: 0, name);
     m_TensorAllocator = null;
     m_Cache           = null;
     m_CacheIsDirty    = false;
 }
        static StackObject *SetCounterValue_10(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.UInt32 @counterValue = (uint)ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.ComputeBuffer instance_of_this_method = (UnityEngine.ComputeBuffer) typeof(UnityEngine.ComputeBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.SetCounterValue(@counterValue);

            return(__ret);
        }
Example #18
0
        public void Reset(Shape shape)
        {
            Shape = shape;

            var total = shape.ElementCount;

            if (Buffer != null && total != Buffer.count)
            {
                GpuBackend.ReleaseBuffer(Buffer);
                Buffer = null;
            }

            if (Buffer == null && total > 0)
            {
                Buffer = GpuBackend.AllocateBuffer(total);
            }
        }
Example #19
0
        protected override void OnDestroyManager()
        {
            if (insObjBuffer != null)
            {
                insObjBuffer.Release();
                insObjBuffer = null;
            }

            if (argsBuffer != null)
            {
                argsBuffer.Release();
                argsBuffer = null;
            }

            InsObjs = null;

            base.OnDestroyManager();
        }
Example #20
0
        static StackObject *CopyCount_7(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 dstOffset = ptr_of_this_method->Value;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.ComputeBuffer dst = (UnityEngine.ComputeBuffer) typeof(UnityEngine.ComputeBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.ComputeBuffer src = (UnityEngine.ComputeBuffer) typeof(UnityEngine.ComputeBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            UnityEngine.ComputeBuffer.CopyCount(src, dst, dstOffset);

            return(__ret);
        }
        static int _m_Dispose(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.ComputeBuffer __cl_gen_to_be_invoked = (UnityEngine.ComputeBuffer)translator.FastGetCSObj(L, 1);


            try {
                {
                    __cl_gen_to_be_invoked.Dispose(  );



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Example #22
0
        static StackObject *DispatchIndirect_22(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.ComputeBuffer argsBuffer = (UnityEngine.ComputeBuffer) typeof(UnityEngine.ComputeBuffer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 kernelIndex = ptr_of_this_method->Value;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.ComputeShader instance_of_this_method;
            instance_of_this_method = (UnityEngine.ComputeShader) typeof(UnityEngine.ComputeShader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.DispatchIndirect(kernelIndex, argsBuffer);

            return(__ret);
        }
        static int _m_SetBuffer(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.ComputeShader __cl_gen_to_be_invoked = (UnityEngine.ComputeShader)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable <UnityEngine.ComputeBuffer>(L, 4))
                {
                    int kernelIndex = LuaAPI.xlua_tointeger(L, 2);
                    int nameID      = LuaAPI.xlua_tointeger(L, 3);
                    UnityEngine.ComputeBuffer buffer = (UnityEngine.ComputeBuffer)translator.GetObject(L, 4, typeof(UnityEngine.ComputeBuffer));

                    __cl_gen_to_be_invoked.SetBuffer(kernelIndex, nameID, buffer);



                    return(0);
                }
                if (__gen_param_count == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && translator.Assignable <UnityEngine.ComputeBuffer>(L, 4))
                {
                    int    kernelIndex = LuaAPI.xlua_tointeger(L, 2);
                    string name        = LuaAPI.lua_tostring(L, 3);
                    UnityEngine.ComputeBuffer buffer = (UnityEngine.ComputeBuffer)translator.GetObject(L, 4, typeof(UnityEngine.ComputeBuffer));

                    __cl_gen_to_be_invoked.SetBuffer(kernelIndex, name, buffer);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ComputeShader.SetBuffer!"));
        }
Example #24
0
        //
        // Directly load an unmanaged data array to a compute buffer via an
        // Intptr. This is not a public interface so will be broken one day.
        // DO NOT TRY AT HOME.
        //
        public static void SetData
            (this ComputeBuffer buffer, IntPtr pointer, int count, int stride)
        {
            if (_method == null)
            {
                _method = typeof(ComputeBuffer).GetMethod(
                    "InternalSetNativeData",
                    BindingFlags.InvokeMethod |
                    BindingFlags.NonPublic |
                    BindingFlags.Instance
                    );
            }

            _args5[0] = pointer;
            _args5[1] = 0;      // source offset
            _args5[2] = 0;      // buffer offset
            _args5[3] = count;
            _args5[4] = stride;

            _method.Invoke(buffer, _args5);
        }
        static int _m_GetNativeBufferPtr(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.ComputeBuffer __cl_gen_to_be_invoked = (UnityEngine.ComputeBuffer)translator.FastGetCSObj(L, 1);


            try {
                {
                    System.IntPtr __cl_gen_ret = __cl_gen_to_be_invoked.GetNativeBufferPtr(  );
                    LuaAPI.lua_pushlightuserdata(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Example #26
0
        static int _m_SetGlobalBuffer_xlua_st_(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



            try {
                {
                    string propertyName = LuaAPI.lua_tostring(L, 1);
                    UnityEngine.ComputeBuffer buffer = (UnityEngine.ComputeBuffer)translator.GetObject(L, 2, typeof(UnityEngine.ComputeBuffer));

                    UnityEngine.Shader.SetGlobalBuffer(propertyName, buffer);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
        static int _m_GetData(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.ComputeBuffer gen_to_be_invoked = (UnityEngine.ComputeBuffer)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <System.Array>(L, 2))
                {
                    System.Array _data = (System.Array)translator.GetObject(L, 2, typeof(System.Array));

                    gen_to_be_invoked.GetData(_data);



                    return(0);
                }
                if (gen_param_count == 5 && translator.Assignable <System.Array>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    System.Array _data = (System.Array)translator.GetObject(L, 2, typeof(System.Array));
                    int          _managedBufferStartIndex = LuaAPI.xlua_tointeger(L, 3);
                    int          _computeBufferStartIndex = LuaAPI.xlua_tointeger(L, 4);
                    int          _count = LuaAPI.xlua_tointeger(L, 5);

                    gen_to_be_invoked.GetData(_data, _managedBufferStartIndex, _computeBufferStartIndex, _count);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ComputeBuffer.GetData!"));
        }
        static int _m_DispatchIndirect(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.ComputeShader __cl_gen_to_be_invoked = (UnityEngine.ComputeShader)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <UnityEngine.ComputeBuffer>(L, 3))
                {
                    int kernelIndex = LuaAPI.xlua_tointeger(L, 2);
                    UnityEngine.ComputeBuffer argsBuffer = (UnityEngine.ComputeBuffer)translator.GetObject(L, 3, typeof(UnityEngine.ComputeBuffer));

                    __cl_gen_to_be_invoked.DispatchIndirect(kernelIndex, argsBuffer);



                    return(0);
                }
                if (__gen_param_count == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <UnityEngine.ComputeBuffer>(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))
                {
                    int kernelIndex = LuaAPI.xlua_tointeger(L, 2);
                    UnityEngine.ComputeBuffer argsBuffer = (UnityEngine.ComputeBuffer)translator.GetObject(L, 3, typeof(UnityEngine.ComputeBuffer));
                    uint argsOffset = LuaAPI.xlua_touint(L, 4);

                    __cl_gen_to_be_invoked.DispatchIndirect(kernelIndex, argsBuffer, argsOffset);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ComputeShader.DispatchIndirect!"));
        }
        static int _m_IsValid(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                UnityEngine.ComputeBuffer gen_to_be_invoked = (UnityEngine.ComputeBuffer)translator.FastGetCSObj(L, 1);



                {
                    var gen_ret = gen_to_be_invoked.IsValid(  );
                    LuaAPI.lua_pushboolean(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        static int _m_CopyCount_xlua_st_(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);



                {
                    UnityEngine.ComputeBuffer _src = (UnityEngine.ComputeBuffer)translator.GetObject(L, 1, typeof(UnityEngine.ComputeBuffer));
                    UnityEngine.ComputeBuffer _dst = (UnityEngine.ComputeBuffer)translator.GetObject(L, 2, typeof(UnityEngine.ComputeBuffer));
                    int _dstOffsetBytes            = LuaAPI.xlua_tointeger(L, 3);

                    UnityEngine.ComputeBuffer.CopyCount(_src, _dst, _dstOffsetBytes);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }