Пример #1
0
        protected override void BindSurfaceImpl(int attachment, RenderTexture target)
        {
            Contract.Requires(attachment < Config.MaxMultipleRenderTargets);

            // Get buffer and surface to bind to
            var buffer = (D3D9HardwarePixelBuffer)(target["BUFFER"]);

            Proclaim.NotNull(buffer);

            // Find first non null target
            int y;

            for (y = 0; y < Config.MaxMultipleRenderTargets && this._renderTargets[y] == null; ++y)
            {
                ;
            }

            if (y != Config.MaxMultipleRenderTargets)
            {
                // If there is another target bound, compare sizes
                if (this._renderTargets[y].Width != buffer.Width || this._renderTargets[y].Height != buffer.Height)
                {
                    throw new AxiomException("MultiRenderTarget surfaces are not the same size.");
                }

                if (!Root.Instance.RenderSystem.Capabilities.HasCapability(Capabilities.MRTDifferentBitDepths) &&
                    (PixelUtil.GetNumElemBits(this._renderTargets[y].Format) != PixelUtil.GetNumElemBits(buffer.Format)))
                {
                    throw new AxiomException("MultiRenderTarget surfaces are not of same bit depth and hardware requires it");
                }
            }

            this._renderTargets[attachment] = buffer;
            _checkAndUpdate();
        }
Пример #2
0
        protected override void BindSurfaceImpl(int attachment, RenderTexture target)
        {
            /// Check if the render target is in the rendertarget->FBO map
            var fbObject = (GLFrameBufferObject)target["FBO"];

            Proclaim.NotNull(fbObject);

            this._fbo.BindSurface(attachment, fbObject.SurfaceDesc);

            // Initialize?

            // Set width and height
            width  = this._fbo.Width;
            height = this._fbo.Height;
        }