Esempio n. 1
0
 /// <summary>	
 /// Get the target output {{buffers}} for the {{StreamOutput}} stage of the pipeline.	
 /// </summary>	
 /// <remarks>	
 /// Any returned interfaces will have their reference count incremented by one. Applications should call {{IUnknown::Release}} on the returned interfaces when they are no longer needed to avoid memory leaks. 	
 /// </remarks>	
 /// <param name="numBuffers">Number of buffers to get. A maximum of four output buffers can be retrieved. </param>
 /// <returns>an array of output buffers (see <see cref="SharpDX.Direct3D10.StreamOutputBufferBinding"/>) to bind to the device.</returns>
 /// <unmanaged>void SOGetTargets([In] int NumBuffers,[Out, Buffer, Optional] ID3D10Buffer** ppSOTargets,[Out, Buffer, Optional] int* pOffsets)</unmanaged>
 public StreamOutputBufferBinding[] GetTargets(int numBuffers)
 {
     var bufferBindings = new StreamOutputBufferBinding[numBuffers];
     var buffers = new Buffer[bufferBindings.Length];
     var offsets = new int[bufferBindings.Length];
     GetTargets(bufferBindings.Length, buffers, offsets);
     for (int i = 0; i < bufferBindings.Length; i++)
     {
         bufferBindings[i].Buffer = buffers[i];
         bufferBindings[i].Offset = offsets[i];
     }
     return bufferBindings;
 }
Esempio n. 2
0
        /// <summary>
        /// Get the target output {{buffers}} for the {{StreamOutput}} stage of the pipeline.
        /// </summary>
        /// <remarks>
        /// Any returned interfaces will have their reference count incremented by one. Applications should call {{IUnknown::Release}} on the returned interfaces when they are no longer needed to avoid memory leaks.
        /// </remarks>
        /// <param name="numBuffers">Number of buffers to get. A maximum of four output buffers can be retrieved. </param>
        /// <returns>an array of output buffers (see <see cref="SharpDX.Direct3D10.StreamOutputBufferBinding"/>) to bind to the device.</returns>
        /// <unmanaged>void SOGetTargets([In] int NumBuffers,[Out, Buffer, Optional] ID3D10Buffer** ppSOTargets,[Out, Buffer, Optional] int* pOffsets)</unmanaged>
        public StreamOutputBufferBinding[] GetTargets(int numBuffers)
        {
            var bufferBindings = new StreamOutputBufferBinding[numBuffers];
            var buffers        = new Buffer[bufferBindings.Length];
            var offsets        = new int[bufferBindings.Length];

            GetTargets(bufferBindings.Length, buffers, offsets);
            for (int i = 0; i < bufferBindings.Length; i++)
            {
                bufferBindings[i].Buffer = buffers[i];
                bufferBindings[i].Offset = offsets[i];
            }
            return(bufferBindings);
        }
Esempio n. 3
0
        public void Render(DX11RenderContext context)
        {
            if (this.currentBufferCount == 0)
            {
                return;
            }

            Device        device = context.Device;
            DeviceContext ctx    = context.CurrentDeviceContext;

            //Just in case
            if (!this.updateddevices.Contains(context))
            {
                this.Update(context);
            }

            if (!this.FInLayer.IsConnected)
            {
                return;
            }

            if (this.rendereddevices.Contains(context))
            {
                return;
            }

            if (this.FInEnabled[0])
            {
                if (this.BeginQuery != null)
                {
                    this.BeginQuery(context);
                }


                context.CurrentDeviceContext.OutputMerger.SetTargets(new RenderTargetView[0]);

                StreamOutputBufferBinding[] binding = new StreamOutputBufferBinding[this.currentBufferCount];
                for (int i = 0; i < this.currentBufferCount; i++)
                {
                    binding[i].Buffer = this.outputBuffer[i].D3DBuffer;
                    binding[i].Offset = 0;
                }
                ctx.StreamOutput.SetTargets(binding);

                settings.ViewportIndex  = 0;
                settings.ViewportCount  = 1;
                settings.View           = Matrix.Identity;
                settings.Projection     = Matrix.Identity;
                settings.ViewProjection = Matrix.Identity;
                settings.RenderWidth    = 1;
                settings.RenderHeight   = 1;
                settings.RenderDepth    = 1;
                settings.BackBuffer     = null;

                this.FInLayer.RenderAll(context, settings);

                ctx.StreamOutput.SetTargets(null);

                if (this.EndQuery != null)
                {
                    this.EndQuery(context);
                }
            }
        }