Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引入插件com.unity.render-pipelines.lightweight导致的Gen code报错 #828

Closed
xianwx opened this issue Nov 2, 2020 · 9 comments
Closed

Comments

@xianwx
Copy link

xianwx commented Nov 2, 2020

Unity版本:2019.4.11f1
xLua版本:2.1.15
image
当项目里引用插件lightweight时,版本7.3.1,Gen Code会有:
image

@chexiongsheng
Copy link
Collaborator

错误发一半怎么定位呢?

@xianwx
Copy link
Author

xianwx commented Nov 2, 2020

image
@chexiongsheng sorry,这是完整的截图。

@chexiongsheng
Copy link
Collaborator

选中其中一条报错,把错误信息复制下

@xianwx
Copy link
Author

xianwx commented Nov 2, 2020

Assets/3rdParty/XLua/Gen/UnityEngine_Rendering_ColorUtilsWrap.cs(167,187): error CS1615: Argument 1 may not be passed with the 'ref' keyword

Assets/3rdParty/XLua/Gen/UnityEngine_Rendering_Universal_Internal_ColorGradingLutPassWrap.cs(94,50): error CS1615: Argument 1 may not be passed with the 'ref' keyword

基本都是这个

@chexiongsheng
Copy link
Collaborator

那你直接放报错的cs文件吧

@xianwx
Copy link
Author

xianwx commented Nov 2, 2020

#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;

namespace XLua.CSObjectWrap
{
using Utils = XLua.Utils;
public class UnityEngineRenderingColorUtilsWrap
{
public static void __Register(RealStatePtr L)
{
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
System.Type type = typeof(UnityEngine.Rendering.ColorUtils);
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);

		Utils.EndObjectRegister(type, L, translator, null, null,
		    null, null, null);

	    Utils.BeginClassRegister(type, L, __CreateInstance, 15, 0, 0);
		Utils.RegisterFunc(L, Utils.CLS_IDX, "StandardIlluminantY", _m_StandardIlluminantY_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "CIExyToLMS", _m_CIExyToLMS_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "ColorBalanceToLMSCoeffs", _m_ColorBalanceToLMSCoeffs_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "PrepareShadowsMidtonesHighlights", _m_PrepareShadowsMidtonesHighlights_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "PrepareLiftGammaGain", _m_PrepareLiftGammaGain_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "PrepareSplitToning", _m_PrepareSplitToning_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "Luminance", _m_Luminance_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "ComputeEV100", _m_ComputeEV100_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "ConvertEV100ToExposure", _m_ConvertEV100ToExposure_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "ConvertExposureToEV100", _m_ConvertExposureToEV100_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "ComputeEV100FromAvgLuminance", _m_ComputeEV100FromAvgLuminance_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "ComputeISO", _m_ComputeISO_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "ToHex", _m_ToHex_xlua_st_);
        Utils.RegisterFunc(L, Utils.CLS_IDX, "ToRGBA", _m_ToRGBA_xlua_st_);
        
		
        
		
		
		
		Utils.EndClassRegister(type, L, translator);
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int __CreateInstance(RealStatePtr L)
    {
        return LuaAPI.luaL_error(L, "UnityEngine.Rendering.ColorUtils does not have a constructor!");
    }
    
	
    
	
    
    
    
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_StandardIlluminantY_xlua_st_(RealStatePtr L)
    {
	    try {
        
        
        
            
            {
                float _x = (float)LuaAPI.lua_tonumber(L, 1);
                
                    float gen_ret = UnityEngine.Rendering.ColorUtils.StandardIlluminantY( _x );
                    LuaAPI.lua_pushnumber(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_CIExyToLMS_xlua_st_(RealStatePtr L)
    {
	    try {
        
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
        
        
        
            
            {
                float _x = (float)LuaAPI.lua_tonumber(L, 1);
                float _y = (float)LuaAPI.lua_tonumber(L, 2);
                
                    UnityEngine.Vector3 gen_ret = UnityEngine.Rendering.ColorUtils.CIExyToLMS( _x, _y );
                    translator.PushUnityEngineVector3(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_ColorBalanceToLMSCoeffs_xlua_st_(RealStatePtr L)
    {
	    try {
        
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
        
        
        
            
            {
                float _temperature = (float)LuaAPI.lua_tonumber(L, 1);
                float _tint = (float)LuaAPI.lua_tonumber(L, 2);
                
                    UnityEngine.Vector3 gen_ret = UnityEngine.Rendering.ColorUtils.ColorBalanceToLMSCoeffs( _temperature, _tint );
                    translator.PushUnityEngineVector3(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_PrepareShadowsMidtonesHighlights_xlua_st_(RealStatePtr L)
    {
	    try {
        
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
        
        
        
            
            {
                UnityEngine.Vector4 _inShadows;translator.Get(L, 1, out _inShadows);
                UnityEngine.Vector4 _inMidtones;translator.Get(L, 2, out _inMidtones);
                UnityEngine.Vector4 _inHighlights;translator.Get(L, 3, out _inHighlights);
                
                    System.ValueTuple<UnityEngine.Vector4, UnityEngine.Vector4, UnityEngine.Vector4> gen_ret = UnityEngine.Rendering.ColorUtils.PrepareShadowsMidtonesHighlights( ref _inShadows, ref _inMidtones, ref _inHighlights );
                    translator.Push(L, gen_ret);
                translator.PushUnityEngineVector4(L, _inShadows);
                    translator.UpdateUnityEngineVector4(L, 1, _inShadows);
                    
                translator.PushUnityEngineVector4(L, _inMidtones);
                    translator.UpdateUnityEngineVector4(L, 2, _inMidtones);
                    
                translator.PushUnityEngineVector4(L, _inHighlights);
                    translator.UpdateUnityEngineVector4(L, 3, _inHighlights);
                    
                
                
                
                return 4;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_PrepareLiftGammaGain_xlua_st_(RealStatePtr L)
    {
	    try {
        
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
        
        
        
            
            {
                UnityEngine.Vector4 _inLift;translator.Get(L, 1, out _inLift);
                UnityEngine.Vector4 _inGamma;translator.Get(L, 2, out _inGamma);
                UnityEngine.Vector4 _inGain;translator.Get(L, 3, out _inGain);
                
                    System.ValueTuple<UnityEngine.Vector4, UnityEngine.Vector4, UnityEngine.Vector4> gen_ret = UnityEngine.Rendering.ColorUtils.PrepareLiftGammaGain( ref _inLift, ref _inGamma, ref _inGain );
                    translator.Push(L, gen_ret);
                translator.PushUnityEngineVector4(L, _inLift);
                    translator.UpdateUnityEngineVector4(L, 1, _inLift);
                    
                translator.PushUnityEngineVector4(L, _inGamma);
                    translator.UpdateUnityEngineVector4(L, 2, _inGamma);
                    
                translator.PushUnityEngineVector4(L, _inGain);
                    translator.UpdateUnityEngineVector4(L, 3, _inGain);
                    
                
                
                
                return 4;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_PrepareSplitToning_xlua_st_(RealStatePtr L)
    {
	    try {
        
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
        
        
        
            
            {
                UnityEngine.Vector4 _inShadows;translator.Get(L, 1, out _inShadows);
                UnityEngine.Vector4 _inHighlights;translator.Get(L, 2, out _inHighlights);
                float _balance = (float)LuaAPI.lua_tonumber(L, 3);
                
                    System.ValueTuple<UnityEngine.Vector4, UnityEngine.Vector4> gen_ret = UnityEngine.Rendering.ColorUtils.PrepareSplitToning( ref _inShadows, ref _inHighlights, _balance );
                    translator.Push(L, gen_ret);
                translator.PushUnityEngineVector4(L, _inShadows);
                    translator.UpdateUnityEngineVector4(L, 1, _inShadows);
                    
                translator.PushUnityEngineVector4(L, _inHighlights);
                    translator.UpdateUnityEngineVector4(L, 2, _inHighlights);
                    
                
                
                
                return 3;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_Luminance_xlua_st_(RealStatePtr L)
    {
	    try {
        
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
        
        
        
            
            {
                UnityEngine.Color _color;translator.Get(L, 1, out _color);
                
                    float gen_ret = UnityEngine.Rendering.ColorUtils.Luminance( ref _color );
                    LuaAPI.lua_pushnumber(L, gen_ret);
                translator.PushUnityEngineColor(L, _color);
                    translator.UpdateUnityEngineColor(L, 1, _color);
                    
                
                
                
                return 2;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_ComputeEV100_xlua_st_(RealStatePtr L)
    {
	    try {
        
        
        
            
            {
                float _aperture = (float)LuaAPI.lua_tonumber(L, 1);
                float _shutterSpeed = (float)LuaAPI.lua_tonumber(L, 2);
                float _ISO = (float)LuaAPI.lua_tonumber(L, 3);
                
                    float gen_ret = UnityEngine.Rendering.ColorUtils.ComputeEV100( _aperture, _shutterSpeed, _ISO );
                    LuaAPI.lua_pushnumber(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_ConvertEV100ToExposure_xlua_st_(RealStatePtr L)
    {
	    try {
        
        
        
            
            {
                float _EV100 = (float)LuaAPI.lua_tonumber(L, 1);
                
                    float gen_ret = UnityEngine.Rendering.ColorUtils.ConvertEV100ToExposure( _EV100 );
                    LuaAPI.lua_pushnumber(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_ConvertExposureToEV100_xlua_st_(RealStatePtr L)
    {
	    try {
        
        
        
            
            {
                float _exposure = (float)LuaAPI.lua_tonumber(L, 1);
                
                    float gen_ret = UnityEngine.Rendering.ColorUtils.ConvertExposureToEV100( _exposure );
                    LuaAPI.lua_pushnumber(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_ComputeEV100FromAvgLuminance_xlua_st_(RealStatePtr L)
    {
	    try {
        
        
        
            
            {
                float _avgLuminance = (float)LuaAPI.lua_tonumber(L, 1);
                
                    float gen_ret = UnityEngine.Rendering.ColorUtils.ComputeEV100FromAvgLuminance( _avgLuminance );
                    LuaAPI.lua_pushnumber(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_ComputeISO_xlua_st_(RealStatePtr L)
    {
	    try {
        
        
        
            
            {
                float _aperture = (float)LuaAPI.lua_tonumber(L, 1);
                float _shutterSpeed = (float)LuaAPI.lua_tonumber(L, 2);
                float _targetEV100 = (float)LuaAPI.lua_tonumber(L, 3);
                
                    float gen_ret = UnityEngine.Rendering.ColorUtils.ComputeISO( _aperture, _shutterSpeed, _targetEV100 );
                    LuaAPI.lua_pushnumber(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_ToHex_xlua_st_(RealStatePtr L)
    {
	    try {
        
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
        
        
        
            
            {
                UnityEngine.Color _c;translator.Get(L, 1, out _c);
                
                    uint gen_ret = UnityEngine.Rendering.ColorUtils.ToHex( _c );
                    LuaAPI.xlua_pushuint(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
    static int _m_ToRGBA_xlua_st_(RealStatePtr L)
    {
	    try {
        
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
        
        
        
            
            {
                uint _hex = LuaAPI.xlua_touint(L, 1);
                
                    UnityEngine.Color gen_ret = UnityEngine.Rendering.ColorUtils.ToRGBA( _hex );
                    translator.PushUnityEngineColor(L, gen_ret);
                
                
                
                return 1;
            }
            
        } catch(System.Exception gen_e) {
            return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
        }
        
    }
    
    
    
    
    
    
	
	
	
	
}

}

这是其中一个文件。

@chexiongsheng
Copy link
Collaborator

把这个插件打包放到issue?我这里安装不了这插件

@xianwx
Copy link
Author

xianwx commented Nov 3, 2020

是package manager 里的Lightweight RP。

这是打包好的插件。
插件.zip

昨天我忘了把代码文件打成压缩包上传,这是打包好的报错代码文件。
报错的cs文件.zip

上传也太慢了 = =

@chexiongsheng
Copy link
Collaborator

修正了

onlyfeng added a commit to onlyfeng/xLua that referenced this issue Dec 7, 2020
* upstream/master:
  luajit的32位在另外的环境单独编译
  make_android_luajit_arm64.sh的x86输出目录修改
  actions自动编译,window下先启动vc-cmd再编译luajit,更正luajit android x86的路径
  更新注意事项
  处理in关键字生成代码错误的问题,fix Tencent#828
DGHeroin pushed a commit to DGHeroin/xLua that referenced this issue Jul 1, 2021
* my_master: (56 commits)
  适配rapidjson/cmsgpack/protobuf
  support valuetype for delegate in XLUA_GENERAL Mode
  fix: (ExampleCongig.typeHasEditorRef) stackoverflow error (Tencent#895)
  2020.2的兼容
  unity2017兼容
  一些告警的解决
  add LuaImporter and util/Xxtea (Tencent#876)
  发布脚本的名字修改
  添加自动发布脚本
  Update faq.md (Tencent#881)
  2020的兼容
  luajit的32位在另外的环境单独编译
  make_android_luajit_arm64.sh的x86输出目录修改
  actions自动编译,window下先启动vc-cmd再编译luajit,更正luajit android x86的路径
  更新注意事项
  处理in关键字生成代码错误的问题,fix Tencent#828
  封装部分api level和luajit编译的api level保持一致
  完善faq
  linux还是不编译32位了
  apt install 要sudo
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants