Ejemplo n.º 1
0
        /// <summary>
        /// Function to unbind a shader view.
        /// </summary>
        /// <param name="view">View to unbind.</param>
        internal void Unbind(GorgonShaderView view)
        {
            PixelShader.Resources.Unbind(view);
            VertexShader.Resources.Unbind(view);
            if (GeometryShader != null)
            {
                GeometryShader.Resources.Unbind(view);
            }
            if (ComputeShader != null)
            {
                ComputeShader.Resources.Unbind(view);
            }
            if (HullShader != null)
            {
                HullShader.Resources.Unbind(view);
            }
            if (DomainShader != null)
            {
                DomainShader.Resources.Unbind(view);
            }

            // If we have multiple contexts, then we need to unbind from those as well.
            if ((_graphics.IsDeferred) || (_graphics.VideoDevice.SupportedFeatureLevel < DeviceFeatureLevel.SM5))
            {
                return;
            }

            foreach (var context in _graphics.GetTrackedObjectsOfType <GorgonGraphics>())
            {
                context.Shaders.Unbind(view);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Function to create the default shader view.
        /// </summary>
        protected virtual void OnCreateDefaultShaderView()
        {
            // Staging buffers cannot create shader views.
            if ((Settings.Usage == BufferUsage.Staging) ||
                (Settings.DefaultShaderViewFormat == BufferFormat.Unknown))
            {
                return;
            }

            var info = GorgonBufferFormatInfo.GetInfo(Settings.DefaultShaderViewFormat);

            DefaultShaderView = OnGetShaderView(Settings.DefaultShaderViewFormat, 0,
                                                Settings.SizeInBytes / info.SizeInBytes, false);
        }