mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
adding command list Vulkan support
This commit is contained in:
71
Sources/PulseCommandList.c
git.filemode.normal_file
71
Sources/PulseCommandList.c
git.filemode.normal_file
@@ -0,0 +1,71 @@
|
||||
// Copyright (C) 2024 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include "PulseDefs.h"
|
||||
#include "PulseInternal.h"
|
||||
|
||||
PULSE_API PulseCommandList PulseRequestCommandList(PulseDevice device, PulseCommandListUsage usage)
|
||||
{
|
||||
PULSE_CHECK_HANDLE_RETVAL(device, PULSE_NULL_HANDLE);
|
||||
return device->PFN_RequestCommandList(device, usage);
|
||||
}
|
||||
|
||||
PULSE_API bool PulseSubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence)
|
||||
{
|
||||
PULSE_CHECK_HANDLE_RETVAL(device, false);
|
||||
PULSE_CHECK_HANDLE_RETVAL(cmd, false);
|
||||
|
||||
if(cmd->state != PULSE_COMMAND_LIST_STATE_READY)
|
||||
{
|
||||
switch(cmd->state)
|
||||
{
|
||||
case PULSE_COMMAND_LIST_STATE_INVALID:
|
||||
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
|
||||
PulseLogError(device->backend, "command list is in invalid state");
|
||||
return false;
|
||||
|
||||
case PULSE_COMMAND_LIST_STATE_EMPTY:
|
||||
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
|
||||
PulseLogWarning(device->backend, "command list is empty");
|
||||
return false;
|
||||
|
||||
case PULSE_COMMAND_LIST_STATE_RECORDING:
|
||||
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
|
||||
PulseLogError(device->backend, "command list is in recording state");
|
||||
return false;
|
||||
|
||||
case PULSE_COMMAND_LIST_STATE_SENT:
|
||||
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
|
||||
PulseLogWarning(device->backend, "command list has already been submitted");
|
||||
return false;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
return device->PFN_SubmitCommandList(device, cmd, fence);
|
||||
}
|
||||
|
||||
PULSE_API void PulseReleaseCommandList(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
PULSE_CHECK_HANDLE(device);
|
||||
|
||||
if(cmd == PULSE_NULL_HANDLE)
|
||||
{
|
||||
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
|
||||
PulseLogWarning(device->backend, "command list is NULL, this may be a bug in your application");
|
||||
return;
|
||||
}
|
||||
|
||||
switch(cmd->state)
|
||||
{
|
||||
case PULSE_COMMAND_LIST_STATE_RECORDING:
|
||||
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
|
||||
PulseLogWarning(device->backend, "command list is in recording state");
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
return device->PFN_ReleaseCommandList(device, cmd);
|
||||
}
|
||||
Reference in New Issue
Block a user