Exemplo n.º 1
0
        /// <summary>
        /// Function to release the specified commands list.
        /// </summary>
        /// <param name="commands">Commands to release.</param>
        internal void ReleaseCommands(GorgonRenderCommands commands)
        {
            if ((_commands == null) ||
                (commands == null) ||
                (!_commands.Contains(commands)))
            {
                return;
            }

            _commands.Remove(commands);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Function to execute rendering commands from a deferred context.
        /// </summary>
        /// <param name="commands">Commands to execute.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="commands"/> parameter is NULL (Nothing in VB.Net).</exception>
        /// <exception cref="System.NotSupportedException">Thrown when the current context is a deferred context.
        /// <para>-or-</para>
        /// <para>Thrown if the current video device does not have a feature level of SM5 or better.</para>
        /// </exception>
        /// <remarks>
        /// Use this method to execute previously recorded rendering commands on the immediate context.  This method must be called from the immediate context.
        /// </remarks>
        public void ExecuteDeferred(GorgonRenderCommands commands)
        {
            GorgonDebug.AssertNull(commands, "commands");

#if DEBUG
            if (IsDeferred)
            {
                throw new NotSupportedException(Resources.GORGFX_CANNOT_USE_DEFERRED_CONTEXT);
            }
#endif

            Context.ExecuteCommandList(commands.D3DCommands, true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Function to finalize the deferred rendering context.
        /// </summary>
        /// <returns>An object containing the rendering commands to issue.</returns>
        /// <exception cref="System.NotSupportedException">Thrown when the current context is an immediate context.
        /// <para>-or-</para>
        /// <para>Thrown if the current video device does not have a feature level of SM5 or better.</para>
        /// </exception>
        /// <remarks>
        /// Use this method to finish recording of the rendering commands sent to a deferred context.  This method must be called from a deferred context.
        /// </remarks>
        public GorgonRenderCommands FinalizeDeferred()
        {
#if DEBUG
            if (!IsDeferred)
            {
                throw new NotSupportedException(Resources.GORGFX_CANNOT_USE_IMMEDIATE_CONTEXT);
            }
#endif

            var result = new GorgonRenderCommands(this);

            if (_commands == null)
            {
                _commands = new List <GorgonRenderCommands>();
            }

            _commands.Add(result);

            return(result);
        }