Beispiel #1
0
        internal virtual void Cleanup()
        {
            m_RC = null;
            if (Locals != null)
            {
                Locals.Clear();
            }
            Stats.Clear();
            m_joined = false;

            m_currentProfilingBlock_renderableType     = -1;
            m_currentProfilingBlock_renderableMaterial = string.Empty;

            m_isImmediate  = false;
            ViewProjection = default(Matrix);
            Viewport       = default(MyViewport);
            DebugName      = string.Empty;
            ProcessingMask = 0;
        }
        internal virtual void Begin()
        {
            if (Locals == null)
            {
                Locals = new MyPassLocals();
            }
            Locals.Clear();

            //if (!m_isImmediate)
            //{
            //    //Debug.Assert(m_RC == null);
            //    //m_RC = MyRenderContextPool.AcquireRC();
            //}

            var mapping = MyMapping.MapDiscard(RC.Context, MyCommon.ProjectionConstants);

            mapping.stream.Write(Matrix.Transpose(ViewProjection));
            mapping.Unmap();

            // common settings
            Context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
            Context.Rasterizer.SetViewport(Viewport.OffsetX, Viewport.OffsetY, Viewport.Width, Viewport.Height);

            Context.PixelShader.SetSamplers(0, MyRender11.StandardSamplers);

            RC.SetCB(MyCommon.FRAME_SLOT, MyCommon.FrameConstants);
            RC.SetCB(MyCommon.PROJECTION_SLOT, MyCommon.ProjectionConstants);
            RC.SetCB(MyCommon.ALPHAMASK_VIEWS_SLOT, MyCommon.AlphamaskViewsConstants);

            Context.PixelShader.SetShaderResource(MyCommon.DITHER_8X8_SLOT, MyTextures.Views[MyTextures.Dithering8x8TexId.Index]);

            if (MyBigMeshTable.Table.m_IB != null)
            {
                RC.VSBindSRV(MyCommon.BIG_TABLE_INDICES,
                             MyBigMeshTable.Table.m_IB.Srv,
                             MyBigMeshTable.Table.m_VB_positions.Srv,
                             MyBigMeshTable.Table.m_VB_rest.Srv);
            }
        }