コード例 #1
0
        int                        m_UseSrpBatcher; // only needed to match native struct
#pragma warning restore 414

        public DrawingSettings(ShaderTagId shaderPassName, SortingSettings sortingSettings)
        {
            m_SortingSettings = sortingSettings;
            m_PerObjectData   = PerObjectData.None;
            m_Flags           = DrawRendererFlags.EnableInstancing;

            m_OverrideMaterialInstanceId = 0;
            m_OverrideMaterialPassIndex  = 0;
            m_fallbackMaterialInstanceId = 0;
            m_MainLightIndex             = -1;

            fixed(int *p = shaderPassNames)
            {
                p[0] = shaderPassName.id;
                for (int i = 1; i < maxShaderPasses; i++)
                {
                    p[i] = -1;
                }
            }

            m_PerObjectData = PerObjectData.None;
            m_Flags         = DrawRendererFlags.EnableInstancing;

            m_UseSrpBatcher = 0;
        }
コード例 #2
0
ファイル: ShaderUtil.cs プロジェクト: leek9d/UnityCsReference
            public UnityEngine.Rendering.ShaderTagId FindTagValue(UnityEngine.Rendering.ShaderTagId tagName)
            {
                int id = ShaderUtil.FindPassTagValue(SourceShader, m_Subshader.m_SubshaderIndex, m_PassIndex, tagName.id);

                return(new UnityEngine.Rendering.ShaderTagId {
                    id = id
                });
            }
コード例 #3
0
        public void SetShaderPassName(int index, ShaderTagId shaderPassName)
        {
            if (index >= maxShaderPasses || index < 0)
                throw new ArgumentOutOfRangeException(nameof(index), $"Index should range from 0 to DrawSettings.maxShaderPasses ({maxShaderPasses}), was {index}");

            fixed(int *p = shaderPassNames)
            {
                p[index] = shaderPassName.id;
            }
        }
コード例 #4
0
 public RendererListParams(CullingResults cullingResults, DrawingSettings drawSettings, FilteringSettings filteringSettings)
 {
     this.cullingResults    = cullingResults;
     this.drawSettings      = drawSettings;
     this.filteringSettings = filteringSettings;
     tagName       = ShaderTagId.none;
     isPassTagName = false;
     tagValues     = null;
     stateBlocks   = null;
 }
コード例 #5
0
        public unsafe void DrawRenderers(CullingResults cullingResults, ref DrawingSettings drawingSettings, ref FilteringSettings filteringSettings, ref RenderStateBlock stateBlock)
        {
            Validate();
            cullingResults.Validate();
            var renderType = new ShaderTagId();

            fixed(RenderStateBlock *stateBlockPtr = &stateBlock)
            {
                DrawRenderers_Internal(cullingResults.ptr, ref drawingSettings, ref filteringSettings, (IntPtr)(&renderType), (IntPtr)stateBlockPtr, 1);
            }
        }
コード例 #6
0
        public Rendering.ShaderTagId FindPassTagValue(int passIndex, Rendering.ShaderTagId tagName)
        {
            if (passIndex < 0 || passIndex >= passCount)
            {
                throw new ArgumentOutOfRangeException("passIndex");
            }
            var id = Internal_FindPassTagValue(passIndex, tagName.id);

            return(new Rendering.ShaderTagId {
                id = id
            });
        }
コード例 #7
0
        public unsafe void DrawRenderers(CullingResults cullingResults, ref DrawingSettings drawingSettings, ref FilteringSettings filteringSettings, ref RenderStateBlock stateBlock)
        {
            this.Validate();
            cullingResults.Validate();
            ShaderTagId shaderTagId = default(ShaderTagId);

            fixed(RenderStateBlock *ptr = &stateBlock)
            {
                RenderStateBlock *value = ptr;

                this.DrawRenderers_Internal(cullingResults.ptr, ref drawingSettings, ref filteringSettings, ShaderTagId.none, false, (IntPtr)((void *)(&shaderTagId)), (IntPtr)((void *)value), 1);
            }
        }
コード例 #8
0
    static int FindPassTagValue(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            UnityEngine.Shader obj = (UnityEngine.Shader)ToLua.CheckObject(L, 1, typeof(UnityEngine.Shader));
            int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
            UnityEngine.Rendering.ShaderTagId arg1 = StackTraits <UnityEngine.Rendering.ShaderTagId> .Check(L, 3);

            UnityEngine.Rendering.ShaderTagId o = obj.FindPassTagValue(arg0, arg1);
            ToLua.PushValue(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #9
0
        // RendererList public API
        public unsafe RendererUtils.RendererList CreateRendererList(RendererUtils.RendererListDesc desc)
        {
            Validate();
            RendererUtils.RendererListParams param = RendererUtils.RendererListParams.Create(desc);

            if (param.stateBlock == null)
            {
                return(CreateRendererList_Internal(param.cullingResult.ptr, ref param.drawSettings, ref param.filteringSettings, ShaderTagId.none, false, IntPtr.Zero, IntPtr.Zero, 0));
            }
            else
            {
                var renderType                  = new ShaderTagId();
                var renderStateBlock            = param.stateBlock.Value;
                RenderStateBlock *stateBlockPtr = &renderStateBlock;
                {
                    return(CreateRendererList_Internal(param.cullingResult.ptr, ref param.drawSettings, ref param.filteringSettings, ShaderTagId.none, false, (IntPtr)(&renderType), (IntPtr)stateBlockPtr, 1));
                }
            }
        }
コード例 #10
0
 extern private unsafe RendererList CreateRendererList_Internal(IntPtr cullResults, ref DrawingSettings drawingSettings, ref FilteringSettings filteringSettings, ShaderTagId tagName, bool isPassTagName, IntPtr tagValues, IntPtr stateBlocks, int stateCount);
コード例 #11
0
 public unsafe void DrawRenderers(CullingResults cullingResults, ref DrawingSettings drawingSettings, ref FilteringSettings filteringSettings, ShaderTagId tagName, bool isPassTagName, NativeArray <ShaderTagId> tagValues, NativeArray <RenderStateBlock> stateBlocks)
 {
     Validate();
     cullingResults.Validate();
     if (tagValues.Length != stateBlocks.Length)
     {
         throw new ArgumentException($"Arrays {nameof(tagValues)} and {nameof(stateBlocks)} should have same length, but {nameof(tagValues)} had length {tagValues.Length} while {nameof(stateBlocks)} had length {stateBlocks.Length}.");
     }
     DrawRenderers_Internal(cullingResults.ptr, ref drawingSettings, ref filteringSettings, tagName, isPassTagName, (IntPtr)tagValues.GetUnsafeReadOnlyPtr(), (IntPtr)stateBlocks.GetUnsafeReadOnlyPtr(), tagValues.Length);
 }
コード例 #12
0
 private void DrawRenderers_Internal(IntPtr cullResults, ref DrawingSettings drawingSettings, ref FilteringSettings filteringSettings, ShaderTagId tagName, bool isPassTagName, IntPtr tagValues, IntPtr stateBlocks, int stateCount)
 {
     ScriptableRenderContext.DrawRenderers_Internal_Injected(ref this, cullResults, ref drawingSettings, ref filteringSettings, ref tagName, isPassTagName, tagValues, stateBlocks, stateCount);
 }
コード例 #13
0
 private static extern void DrawRenderers_Internal_Injected(ref ScriptableRenderContext _unity_self, IntPtr cullResults, ref DrawingSettings drawingSettings, ref FilteringSettings filteringSettings, ref ShaderTagId tagName, bool isPassTagName, IntPtr tagValues, IntPtr stateBlocks, int stateCount);
コード例 #14
0
        public void DrawRenderers(CullingResults cullingResults, ref DrawingSettings drawingSettings, ref FilteringSettings filteringSettings, ShaderTagId tagName, bool isPassTagName, NativeArray <ShaderTagId> tagValues, NativeArray <RenderStateBlock> stateBlocks)
        {
            this.Validate();
            cullingResults.Validate();
            bool flag = tagValues.Length != stateBlocks.Length;

            if (flag)
            {
                throw new ArgumentException(string.Format("Arrays {0} and {1} should have same length, but {2} had length {3} while {4} had length {5}.", new object[]
                {
                    "tagValues",
                    "stateBlocks",
                    "tagValues",
                    tagValues.Length,
                    "stateBlocks",
                    stateBlocks.Length
                }));
            }
            this.DrawRenderers_Internal(cullingResults.ptr, ref drawingSettings, ref filteringSettings, tagName, isPassTagName, (IntPtr)tagValues.GetUnsafeReadOnlyPtr <ShaderTagId>(), (IntPtr)stateBlocks.GetUnsafeReadOnlyPtr <RenderStateBlock>(), tagValues.Length);
        }