Ejemplo n.º 1
0
        public void ClearRenderTargetColor(int index, int layer, int layerCount, uint componentMask, ColorF color)
        {
            if (FramebufferParams == null)
            {
                return;
            }

            if (componentMask != 0xf)
            {
                // We can't use CmdClearAttachments if not writing all components,
                // because on Vulkan, the pipeline state does not affect clears.
                var dstTexture = FramebufferParams.GetAttachment(index);
                if (dstTexture == null)
                {
                    return;
                }

                Span <float> clearColor = stackalloc float[4];
                clearColor[0] = color.Red;
                clearColor[1] = color.Green;
                clearColor[2] = color.Blue;
                clearColor[3] = color.Alpha;

                // TODO: Clear only the specified layer.
                Gd.HelperShader.Clear(
                    Gd,
                    dstTexture,
                    clearColor,
                    componentMask,
                    (int)FramebufferParams.Width,
                    (int)FramebufferParams.Height,
                    FramebufferParams.AttachmentFormats[index],
                    ClearScissor);
            }
            else
            {
                ClearRenderTargetColor(index, layer, layerCount, color);
            }
        }
Ejemplo n.º 2
0
 private void CreateFramebuffer(Auto <DisposableImageView> view, uint width, uint height, bool isDepthStencil, VkFormat format)
 {
     FramebufferParams = new FramebufferParams(Device, view, width, height, isDepthStencil, format);
     UpdatePipelineAttachmentFormats();
 }