Exemplo n.º 1
0
 internal void CheckErrors()
 {
     if (!m_isDeferred)
     {
         MyRender11.ProcessDebugOutput();
     }
 }
Exemplo n.º 2
0
        static void GatherFrame(MyFrameProfiling frame)
        {
            QueryDataTimestampDisjoint disjoint = MyImmediateRC.RC.GetData <QueryDataTimestampDisjoint>(frame.m_disjoint.m_query, AsynchronousFlags.DoNotFlush);

#if UNSHARPER
            if (!disjoint.Disjoint.value)
#else
            if (!disjoint.Disjoint)
#endif
            {
                var    freq    = disjoint.Frequency;
                double invFreq = 1.0 / (double)freq;

                m_timestampStack.Clear();

                int stackDepth = 0;

                while (frame.m_issued.Count > 0)
                {
                    var q = frame.m_issued.Dequeue();

                    ulong timestamp;
                    MyImmediateRC.RC.GetData <ulong>(q.m_query, AsynchronousFlags.DoNotFlush, out timestamp);

                    if (q.m_info == MyIssuedQueryEnum.BlockStart)
                    {
                        stackDepth++;
                        MyRender11.GetRenderProfiler().GPU_StartProfilingBlock(q.m_tag);
                        MySimpleProfiler.BeginGPUBlock(q.m_tag);
                        m_timestampStack.Push(timestamp);
                    }
                    else if (q.m_info == MyIssuedQueryEnum.BlockEnd)
                    {
                        stackDepth--;
                        var start = m_timestampStack.Pop();
                        var time  = (timestamp - start) * invFreq;

                        // tick is 100 nanoseconds = 10^-7 second
                        MyRender11.GetRenderProfiler().GPU_EndProfilingBlock(0, MyTimeSpan.FromSeconds(time));
                        MySimpleProfiler.EndGPUBlock(MyTimeSpan.FromSeconds(time));
                    }

                    Debug.Assert(stackDepth >= 0);

                    MyQueryFactory.RelaseTimestampQuery(q.m_query);
                }

                Debug.Assert(stackDepth == 0);
            }

            frame.Clear();
        }
Exemplo n.º 3
0
        public void PostprocessWork()
        {
            CommandList commandList = m_RC.FinishCommandList(false);

            Profiler.MyGpuProfiler.IC_BeginBlock(m_debugName + m_frustumIndex);
            MyRender11.RC.ExecuteCommandList(commandList, false);
            Profiler.MyGpuProfiler.IC_EndBlock();

            commandList.Dispose();
            MyManagers.DeferredRCs.FreeRC(m_RC);

            int passHash = ((int)m_frustumType) << 10 | m_frustumIndex;

            MyRender11.GatherPassStats(passHash, m_debugName, m_stats);
        }
Exemplo n.º 4
0
        internal static unsafe void Init()
        {
            //MyRender11.RegisterSettingsChangedListener(new OnSettingsChangedDelegate(RecreateShadersForSettings));

            m_directionalEnvironmentLightPixel  = MyShaders.CreatePs("Lighting/LightDir.hlsl");
            m_directionalEnvironmentLightSample = MyShaders.CreatePs("Lighting/LightDir.hlsl", MyRender11.ShaderSampleFrequencyDefine());

            m_pointlightsTiledPixel  = MyShaders.CreatePs("Lighting/LightPoint.hlsl");
            m_pointlightsTiledSample = MyShaders.CreatePs("Lighting/LightPoint.hlsl", MyRender11.ShaderSampleFrequencyDefine());

            m_preparePointLights = MyShaders.CreateCs("Lighting/PrepareLights.hlsl", new[] { new ShaderMacro("NUMTHREADS", TILE_SIZE) });

            m_spotlightProxyVs  = MyShaders.CreateVs("Lighting/LightSpot.hlsl");
            m_spotlightPsPixel  = MyShaders.CreatePs("Lighting/LightSpot.hlsl");
            m_spotlightPsSample = MyShaders.CreatePs("Lighting/LightSpot.hlsl", MyRender11.ShaderSampleFrequencyDefine());
            m_spotlightProxyIl  = MyShaders.CreateIL(m_spotlightProxyVs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION_PACKED));

            m_pointlightCullHwBuffer = MyManagers.Buffers.CreateSrv(
                "MyLightRendering", MyRender11Constants.MAX_POINT_LIGHTS, sizeof(MyPointlightConstants),
                usage: ResourceUsage.Dynamic);
        }