public void Execute() { if (!(m_State == CommandBufferState.Executable || m_State == CommandBufferState.Pending)) { DebugReportMessage(VkDebugReportFlagBitsEXT.VK_DEBUG_REPORT_ERROR_BIT_EXT, string.Format("Estado inválido para CommandBuffer: atual={0}, esperado={1}", m_State, CommandBufferState.Executable)); return; } if (m_State == CommandBufferState.Pending && !m_CmdBeginInfo.flags.HasFlag(VkCommandBufferUsageFlagBits.VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT)) { DebugReportMessage(VkDebugReportFlagBitsEXT.VK_DEBUG_REPORT_ERROR_BIT_EXT, string.Format("CommandBuffer pendente mas não foi informado VkCommandBufferUsageFlagBits.VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT")); return; } m_State = CommandBufferState.Pending; foreach (var item in m_Commands) { item.Execute(m_context); } if (m_CmdBeginInfo.flags.HasFlag(VkCommandBufferUsageFlagBits.VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT)) { m_State = CommandBufferState.Invalid; } else { m_State = CommandBufferState.Executable; } }
private SoftwareCommandBuffer(SoftwareDevice device, VkCommandBufferAllocateInfo allocInfo) { this.m_device = device; this.m_allocInfo = allocInfo; this.m_Commands = new List <SoftwareBufferCommand>(); this.m_State = CommandBufferState.Initial; }
private VkResult CompileBuffer() { VkResult result; var tmpContext = new SoftwareExecutionContext(m_device, this); foreach (var item in m_Commands) { result = item.Parse(tmpContext); if (result != VkResult.VK_SUCCESS) { DebugReportMessage(VkDebugReportFlagBitsEXT.VK_DEBUG_REPORT_ERROR_BIT_EXT, string.Format("Falha de compilação do CommandBuffer", m_State, CommandBufferState.Executable)); m_State = CommandBufferState.Invalid; return(result); } } m_context = new SoftwareExecutionContext(m_device, this); foreach (var item in m_Commands) { item.Prepare(m_context); } m_State = CommandBufferState.Executable; return(VkResult.VK_SUCCESS); }
public VkResult Begin(VkCommandBufferBeginInfo pBeginInfo) { if (m_State == CommandBufferState.Recording) { return(VkResult.VK_ERROR_VALIDATION_FAILED_EXT); } m_State = CommandBufferState.Recording; m_Commands.Clear(); m_CmdBeginInfo = pBeginInfo; return(VkResult.VK_SUCCESS); }