示例#1
0
        /// <summary>
        /// Function called when a dirty item is found and added.
        /// </summary>
        /// <param name="dirtyIndex">The index that is considered dirty.</param>
        /// <param name="value">The dirty value.</param>
        protected override void OnAssignDirtyItem(int dirtyIndex, GorgonStreamOutBinding value)
        {
            D3D11.StreamOutputBufferBinding binding = default;

            if (value.Buffer != null)
            {
                binding = new D3D11.StreamOutputBufferBinding(value.Buffer?.Native, value.Offset);
            }

            Native[dirtyIndex] = binding;
        }
示例#2
0
        /// <summary>
        /// Sets the stream targets.
        /// </summary>
        /// <param name="buffers">The buffers.</param>
        public void SetStreamTargets(params Buffer[] buffers)
        {
            SharpDX.Direct3D11.StreamOutputBufferBinding[] streamOutputBufferBindings;

            if (buffers != null)
            {
                streamOutputBufferBindings = new SharpDX.Direct3D11.StreamOutputBufferBinding[buffers.Length];
                for (int i = 0; i < buffers.Length; ++i)
                {
                    streamOutputBufferBindings[i].Buffer = buffers[i].NativeBuffer;
                }
            }
            else
            {
                streamOutputBufferBindings = null;
            }

            NativeDeviceContext.StreamOutput.SetTargets(streamOutputBufferBindings);
        }
        /// <summary>	
        /// Set the target output {{buffers}} for the {{StreamOutput}} stage, which enables/disables the pipeline to stream-out data.	
        /// </summary>	
        /// <remarks>	
        /// Call ID3D10Device::SOSetTargets (before any draw calls) to stream data out; call SOSetTargets with NULL to stop streaming data out. For an example, see Exercise 01 from the GDC 2007 workshop, which sets the stream output rendertargets before calling draw methods in the RenderInstanceToStream function. An offset of -1 will cause the stream output buffer to be appended, continuing after the last location written to the buffer in a previous stream output pass. Calling this method using a buffer that is currently bound for writing will effectively bind NULL instead because a buffer cannot be bound as both an input and an output at the same time. The {{DeviceDebug Layer}} will generate a warning whenever a resource is prevented from being bound simultaneously as an input and an output, but this will not prevent invalid data from being used by the runtime. The method will not hold a reference to the interfaces passed in. For that reason, applications should be careful not to release an interface currently in use by the device. 	
        /// </remarks>	
        /// <param name="bufferBindings">an array of output buffers (see <see cref="SharpDX.Direct3D11.StreamOutputBufferBinding"/>) to bind to the device. The buffers must have been created with the <see cref="SharpDX.Direct3D11.BindFlags.StreamOutput"/> flag. </param>
        /// <unmanaged>void SOSetTargets([In] int NumBuffers,[In, Buffer, Optional] const ID3D10Buffer** ppSOTargets,[In, Buffer, Optional] const int* pOffsets)</unmanaged>
        /// <msdn-id>ff476484</msdn-id>	
        /// <unmanaged>void ID3D11DeviceContext::SOSetTargets([In] unsigned int NumBuffers,[In, Buffer, Optional] const ID3D11Buffer** ppSOTargets,[In, Buffer, Optional] const unsigned int* pOffsets)</unmanaged>	
        /// <unmanaged-short>ID3D11DeviceContext::SOSetTargets</unmanaged-short>	
        public void SetTargets(StreamOutputBufferBinding[] bufferBindings)
        {
            if (bufferBindings == null)
            {
                SetTargets(0, null, null);
            }
            else
            {
                var buffers = new Buffer[bufferBindings.Length];
                var offsets = new int[bufferBindings.Length];
                for (int i = 0; i < bufferBindings.Length; i++)
                {
                    buffers[i] = bufferBindings[i].Buffer;
                    offsets[i] = bufferBindings[i].Offset;
                }

                SetTargets(bufferBindings.Length, buffers, offsets);
            }
        }
示例#4
0
        /// <summary>
        /// Sets the stream targets.
        /// </summary>
        /// <param name="buffers">The buffers.</param>
        public void SetStreamTargets(params Buffer[] buffers)
        {
            SharpDX.Direct3D11.StreamOutputBufferBinding[] streamOutputBufferBindings;

            if (buffers != null)
            {
                streamOutputBufferBindings = new SharpDX.Direct3D11.StreamOutputBufferBinding[buffers.Length];
                for (int i = 0; i < buffers.Length; ++i)
                    streamOutputBufferBindings[i].Buffer = buffers[i].NativeBuffer;
            }
            else
            {
                streamOutputBufferBindings = null;
            }

            NativeDeviceContext.StreamOutput.SetTargets(streamOutputBufferBindings);
        }
 /// <summary>
 /// Function called when a dirty item is found and added.
 /// </summary>
 /// <param name="dirtyIndex">The index that is considered dirty.</param>
 /// <param name="value">The dirty value.</param>
 protected override void OnDirtyItemAdded(int dirtyIndex, GorgonStreamOutBinding value) => Native[dirtyIndex] = new D3D11.StreamOutputBufferBinding(value.Buffer?.Native, value.Offset);