mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
adding compute pass
This commit is contained in:
@@ -28,7 +28,7 @@ PulseCommandList Direct3D11RequestCommandList(PulseDevice device, PulseCommandLi
|
||||
cmd->driver_data = d3d11_cmd;
|
||||
cmd->thread_id = PulseGetThreadID();
|
||||
|
||||
cmd->pass = PULSE_NULL_HANDLE;
|
||||
cmd->pass = Direct3D11CreateComputePass(device, cmd);
|
||||
cmd->state = PULSE_COMMAND_LIST_STATE_RECORDING;
|
||||
cmd->is_available = false;
|
||||
|
||||
@@ -37,13 +37,38 @@ PulseCommandList Direct3D11RequestCommandList(PulseDevice device, PulseCommandLi
|
||||
|
||||
bool Direct3D11SubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence)
|
||||
{
|
||||
Direct3D11Device* d3d11_device = D3D11_RETRIEVE_DRIVER_DATA_AS(device, Direct3D11Device*);
|
||||
Direct3D11CommandList* d3d11_cmd = D3D11_RETRIEVE_DRIVER_DATA_AS(cmd, Direct3D11CommandList*);
|
||||
ID3D11CommandList* command_list;
|
||||
|
||||
if(fence != PULSE_NULL_HANDLE)
|
||||
{
|
||||
Direct3D11Fence* d3d11_fence = D3D11_RETRIEVE_DRIVER_DATA_AS(fence, Direct3D11Fence*);
|
||||
fence->cmd = cmd;
|
||||
ID3D11DeviceContext_End(d3d11_device->context, (ID3D11Asynchronous*)d3d11_fence->query); // Signal fence now
|
||||
}
|
||||
|
||||
HRESULT res = ID3D11DeviceContext_FinishCommandList(d3d11_cmd->context, false, &command_list);
|
||||
switch(res)
|
||||
{
|
||||
case S_OK:
|
||||
case S_FALSE: break;
|
||||
|
||||
case DXGI_ERROR_DEVICE_REMOVED: PulseSetInternalError(PULSE_ERROR_DEVICE_LOST); return false;
|
||||
case E_OUTOFMEMORY: PulseSetInternalError(PULSE_ERROR_DEVICE_ALLOCATION_FAILED); return false;
|
||||
case DXGI_ERROR_INVALID_CALL: PulseSetInternalError(PULSE_ERROR_CPU_ALLOCATION_FAILED); return false;
|
||||
default: return false;
|
||||
}
|
||||
ID3D11DeviceContext_ExecuteCommandList(d3d11_device->context, command_list, false);
|
||||
ID3D11CommandList_Release(command_list);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Direct3D11ReleaseCommandList(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
PULSE_UNUSED(device);
|
||||
Direct3D11CommandList* d3d11_cmd = D3D11_RETRIEVE_DRIVER_DATA_AS(cmd, Direct3D11CommandList*);
|
||||
ID3D11DeviceContext_Release(d3d11_cmd->context);
|
||||
Direct3D11DestroyComputePass(device, cmd->pass);
|
||||
free(d3d11_cmd);
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user