コード例 #1
0
        internal void Join()
        {
            Debug.Assert(!m_joined);
            m_joined = true;
            int passHash = ((int)FrustumType) << 10 | FrustumIndex;

            MyRender11.GatherPassStats(passHash, DebugName, Stats);
        }
コード例 #2
0
        private static void Render(ISrvBindable depthRead, MyBucketBatches bucketBatches, bool oit)
        {
            if (!MyRender11.DebugOverrides.BillboardsDynamic && !MyRender11.DebugOverrides.BillboardsStatic)
            {
                return;
            }

            if (m_batches.Count == 0)
            {
                return;
            }

            MyRender11.GetRenderProfiler().StartProfilingBlock("Draw");

            RC.PixelShader.SetSrv(1, depthRead);
            BindResourcesCommon();

            PixelShaderFlags basePsFlags = (MyRender11.Settings.DisplayTransparencyHeatMap ? PixelShaderFlags.DEBUG_UNIFORM_ACCUM : 0) |
                                           ((MyRender11.DebugOverrides.OIT && oit) ? PixelShaderFlags.OIT : 0) |
                                           (depthRead != null ? PixelShaderFlags.SOFT_PARTICLE : 0);

            for (int i = bucketBatches.StartIndex; i < bucketBatches.StartIndex + bucketBatches.Count; i++)
            {
                var ps = m_psBundle[(int)(basePsFlags |
                                          (m_batches[i].Lit ? PixelShaderFlags.LIT_PARTICLE : 0) |
                                          (m_batches[i].AlphaCutout ? PixelShaderFlags.ALPHA_CUTOUT : 0))];
                RC.VertexShader.Set(m_batches[i].Lit ? m_vsLit : m_vs);
                RC.PixelShader.Set(ps);

                ISrvBindable texture = m_batches[i].Texture;
                RC.PixelShader.SetSrv(0, texture);
                if (!MyStereoRender.Enable)
                {
                    RC.DrawIndexed(m_batches[i].Num * 6, m_batches[i].Offset * 6, 0);
                }
                else
                {
                    MyStereoRender.DrawIndexedBillboards(RC, m_batches[i].Num * 6, m_batches[i].Offset * 6, 0);
                }

                IBorrowedRtvTexture borrowedTexture = texture as IBorrowedRtvTexture;
                if (borrowedTexture != null)
                {
                    borrowedTexture.Release();
                }

                MyStatsUpdater.Passes.DrawBillboards++;
            }

            m_stats.Billboards += m_billboardCountSafe;

            RC.SetRasterizerState(null);
            MyRender11.GatherPassStats(1298737, "Billboards", m_stats);
            MyRender11.GetRenderProfiler().EndProfilingBlock();
        }
コード例 #3
0
        internal unsafe static void Render(ISrvBindable depthRead)
        {
            if (!MyRender11.DebugOverrides.BillboardsDynamic && !MyRender11.DebugOverrides.BillboardsStatic)
            {
                return;
            }

            if (m_batches.Count == 0)
            {
                return;
            }

            MyRender11.GetRenderProfiler().StartProfilingBlock("Draw");
            TransferDataCustomProjections();
            TransferDataBillboards(0, BillboardCountSafe, ref m_arrayDataBillboards);

            RC.PixelShader.SetSrv(1, depthRead);
            BindResourcesCommon();

            for (int i = 0; i < m_batches.Count; i++)
            {
                // first part of batches contain sorted billboards and they read depth
                // second part of batches contain unsorted billboards and they ignore depth
                // switch here:
                if (m_batches[i].Offset == m_sortedCount)
                {
                    //RC.BindDepthRT(null, DepthStencilAccess.ReadOnly, dst);
                }

                if (MyRender11.Settings.DisplayTransparencyHeatMap)
                {
                    RC.VertexShader.Set(m_vs);
                    RC.PixelShader.Set(MyRender11.DebugOverrides.OIT ? m_psDebugUniformAccumOIT : m_psDebugUniformAccum);
                }
                else if (m_batches[i].Lit)
                {
                    RC.VertexShader.Set(m_vsLit);

                    if (m_batches[i].AlphaCutout)
                    {
                        RC.PixelShader.Set(MyRender11.DebugOverrides.OIT ? m_psAlphaCutoutAndLitOIT : m_psAlphaCutoutAndLit);
                    }
                    else
                    {
                        RC.PixelShader.Set(MyRender11.DebugOverrides.OIT ? m_psLitOIT : m_psLit);
                    }
                }
                else if (m_batches[i].AlphaCutout)
                {
                    RC.VertexShader.Set(m_vs);
                    RC.PixelShader.Set(MyRender11.DebugOverrides.OIT ? m_psAlphaCutoutOIT : m_psAlphaCutout);
                }
                else
                {
                    RC.VertexShader.Set(m_vs);
                    RC.PixelShader.Set(MyRender11.DebugOverrides.OIT ? m_psOIT : m_ps);
                }

                ISrvBindable texture = m_batches[i].Texture;
                RC.PixelShader.SetSrv(0, texture);
                if (!MyStereoRender.Enable)
                {
                    RC.DrawIndexed(m_batches[i].Num * 6, m_batches[i].Offset * 6, 0);
                }
                else
                {
                    MyStereoRender.DrawIndexedBillboards(RC, m_batches[i].Num * 6, m_batches[i].Offset * 6, 0);
                }

                IBorrowedRtvTexture borrowedTexture = texture as IBorrowedRtvTexture;
                if (borrowedTexture != null)
                {
                    borrowedTexture.Release();
                }

                MyStatsUpdater.Passes.DrawBillboards++;
            }

            m_stats.Billboards += BillboardCountSafe;

            RC.SetRasterizerState(null);
            MyRender11.GatherPassStats(1298737, "Billboards", m_stats);
            MyRender11.GetRenderProfiler().EndProfilingBlock();
        }