/// <summary>
 /// Dispose ShaderInfo at index 'shaderIndex' in the Shaders list, and replace it
 /// with the new 'ShaderInfo' given in arguments. If new `ShaderInfo` is null, the shader list element at the given index will be removed.
 /// </summary>
 /// <param name="shaderIndex">ShaderInfo index in the Shaders list of this configuration object</param>
 /// <param name="info">the new Shader to use or null to remove the list item.</param>
 public void ReplaceShader(int shaderIndex, ShaderInfo info)
 {
     Shaders[shaderIndex].Dispose();
     if (info == null)
     {
         Shaders.RemoveAt(shaderIndex);
     }
     else
     {
         Shaders[shaderIndex] = info;
     }
 }
示例#2
0
        public override void Activate()
        {
            if (state != ActivableState.Activated)
            {
                layout.Activate();
                Cache?.Activate();

                using (ShaderInfo shader = new ShaderInfo(Dev, VkShaderStageFlags.Compute, SpirVPath)) {
                    VkComputePipelineCreateInfo info = VkComputePipelineCreateInfo.New();
                    info.layout             = layout.Handle;
                    info.stage              = shader.Info;
                    info.basePipelineHandle = 0;
                    info.basePipelineIndex  = 0;

                    Utils.CheckResult(Vk.vkCreateComputePipelines(Dev.VkDev, Cache == null ? VkPipelineCache.Null : Cache.handle, 1, ref info, IntPtr.Zero, out handle));
                }
            }
            base.Activate();
        }
 /// <summary>
 /// Dispose ShaderInfo at index 'shaderIndex' in the Shaders list, and replace it with a new one.
 /// </summary>
 public void ReplaceShader(int shaderIndex, Device dev, VkShaderStageFlags stageFlags, string spirvShaderPath, SpecializationInfo specializationInfo = null, string entryPoint = "main")
 {
     Shaders[shaderIndex].Dispose();
     Shaders[shaderIndex] = new ShaderInfo(dev, stageFlags, spirvShaderPath, specializationInfo, entryPoint);
 }
 /// <summary>
 /// Dispose ShaderInfo at index 'shaderIndex' in the Shaders list, and replace it with a new one.
 /// </summary>
 public void ReplaceShader(int shaderIndex, VkShaderStageFlags stageFlags, VkShaderModule module, SpecializationInfo specializationInfo = null, string entryPoint = "main")
 {
     Shaders[shaderIndex].Dispose();
     Shaders[shaderIndex] = new ShaderInfo(stageFlags, module, specializationInfo, entryPoint);
 }