Ejemplo n.º 1
0
        internal void ResetTextures()
        {
            for (int i = 0; i < psTextures.Length; i++)
            {
                if (psTextures[i] != null)
                {
                    graphics.Textures[i] = null;
                    psTextures[i]        = null;
                }
            }
            for (int i = 0; i < vsTextures.Length; i++)
            {
                if (psTextures[i] != null)
                {
                    graphics.VertexTextures[i] = null;
                    vsTextures[i] = null;
                }
            }
#if DEBUG
            for (int i = 0; i < psTexturesDEBUG.Length; i++)
            {
                psTexturesDEBUG[i] = null;
            }
            for (int i = 0; i < vsTexturesDEBUG.Length; i++)
            {
                vsTexturesDEBUG[i] = null;
            }
#endif
            boundShader = null;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// <para>WARNING: Use with caution. Dirties internally tracked render state caches</para>
        /// <para>See documentation for <see cref="BeginGetGraphicsDevice"/>.</para>
        /// </summary>
        /// <param name="dirtyState"></param>
        public void DirtyInternalRenderState(StateFlag dirtyState)
        {
#if DEBUG
            System.Threading.Interlocked.Increment(ref application.currentFrame.DirtyRenderStateCount);
#endif
            ValidateProtected();

            if ((dirtyState & StateFlag.Shaders) != 0)
            {
#if DEBUG
                System.Threading.Interlocked.Increment(ref application.currentFrame.DirtyRenderShadersStateCount);
#endif
                boundShader           = null;
                boundShaderType       = null;
                boundShaderStateDirty = true;
            }

            if ((dirtyState & StateFlag.VerticesAndIndices) != 0)
            {
#if DEBUG
                System.Threading.Interlocked.Increment(ref application.currentFrame.DirtyRenderVerticesAndIndicesStateCount);
#endif
                for (int i = 0; i < vertexStreams.Length; i++)
                {
                    vertexStreams[i].vb     = null;
                    vertexStreams[i].offset = -1;
                    vertexStreams[i].stride = -1;
                }
                vertexDecl  = null;
                indexBuffer = null;
            }

            if ((dirtyState & StateFlag.Textures) != 0)
            {
#if DEBUG
                System.Threading.Interlocked.Increment(ref application.currentFrame.DirtyRenderTexturesStateCount);
#endif
                boundShaderStateDirty = true;
                boundShader           = null;
                for (int i = 0; i < psSamplerDirty.Length; i++)
                {
                    psSamplerDirty[i] = true;
                }
                for (int i = 0; i < vsSamplerDirty.Length; i++)
                {
                    vsSamplerDirty[i] = true;
                }

                for (int i = 0; i < psTextures.Length; i++)
                {
                    psTextures[i] = null;
                }
                for (int i = 0; i < vsTextures.Length; i++)
                {
                    vsTextures[i] = null;
                }

#if DEBUG
                for (int i = 0; i < psTexturesDEBUG.Length; i++)
                {
                    psTexturesDEBUG[i] = null;
                }
                for (int i = 0; i < vsTexturesDEBUG.Length; i++)
                {
                    vsTexturesDEBUG[i] = null;
                }
#endif
            }

            internalStateDirty |= dirtyState;
        }