working on vulkan descriptor sets

This commit is contained in:
2025-01-26 00:35:06 +01:00
parent 14b9b28bf9
commit 6a40074c08
23 changed files with 518 additions and 114 deletions

View File

@@ -2,6 +2,7 @@
// This file is part of "Pulse"
// For conditions of distribution and use, see copyright notice in LICENSE
#include <string.h>
#include "PulseDefs.h"
#include "PulseInternal.h"
@@ -39,6 +40,16 @@ PULSE_API bool PulseSubmitCommandList(PulseDevice device, PulseCommandList cmd,
}
}
if(cmd->pass->is_recording)
{
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(device->backend))
PulseLogWarning(device->backend, "submitting command list with a recording compute pass, stopping record");
PulseEndComputePass(cmd->pass);
}
memset(cmd->pass->compute_pipelines_bound, 0, sizeof(PulseComputePipeline) * cmd->pass->compute_pipelines_bound_size);
cmd->pass->compute_pipelines_bound_size = 0;
return device->PFN_SubmitCommandList(device, cmd, fence);
}
@@ -64,3 +75,42 @@ PULSE_API void PulseReleaseCommandList(PulseDevice device, PulseCommandList cmd)
}
return device->PFN_ReleaseCommandList(device, cmd);
}
PULSE_API PulseComputePass PulseBeginComputePass(PulseCommandList cmd)
{
PULSE_CHECK_HANDLE_RETVAL(cmd, PULSE_NULL_HANDLE);
PULSE_CHECK_HANDLE_RETVAL(cmd->device, PULSE_NULL_HANDLE);
PULSE_CHECK_COMMAND_LIST_STATE_RETVAL(cmd, PULSE_NULL_HANDLE);
PulseComputePass pass = cmd->device->PFN_BeginComputePass(cmd);
if(pass->is_recording == true)
{
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(cmd->device->backend))
PulseLogWarning(cmd->device->backend, "a compute pass is already recording in this command buffer, please call PulseEndComputePass before beginning a new one");
return PULSE_NULL_HANDLE;
}
pass->is_recording = true;
return pass;
}
PULSE_API void PulseEndComputePass(PulseComputePass pass)
{
if(pass == PULSE_NULL_HANDLE)
{
PULSE_CHECK_HANDLE(pass->cmd);
PULSE_CHECK_HANDLE(pass->cmd->device);
if(PULSE_IS_BACKEND_LOW_LEVEL_DEBUG(pass->cmd->device->backend))
PulseLogWarning(pass->cmd->device->backend, "command list is NULL, this may be a bug in your application");
return;
}
PULSE_CHECK_COMMAND_LIST_STATE(pass->cmd);
memset(pass->readonly_images, 0, PULSE_MAX_READ_TEXTURES_BOUND * sizeof(PulseImage));
memset(pass->readwrite_images, 0, PULSE_MAX_WRITE_TEXTURES_BOUND * sizeof(PulseImage));
memset(pass->readonly_storage_buffers, 0, PULSE_MAX_READ_BUFFERS_BOUND * sizeof(PulseBuffer));
memset(pass->readwrite_storage_buffers, 0, PULSE_MAX_WRITE_BUFFERS_BOUND * sizeof(PulseBuffer));
pass->current_pipeline = PULSE_NULL_HANDLE;
pass->is_recording = false;
}