mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-10 15:03:34 +00:00
working on d3d11 backend
This commit is contained in:
@@ -22,7 +22,7 @@ void DebugCallBack(PulseDebugMessageSeverity severity, const char* message)
|
||||
#define BUFFER_SIZE (256 * sizeof(uint32_t))
|
||||
|
||||
const char* hlsl_source = HLSL_SOURCE(
|
||||
RWStructuredBuffer<int> ssbo : register(u0);
|
||||
RWBuffer<int> ssbo : register(u0);
|
||||
|
||||
[numthreads(16, 16, 1)]
|
||||
void CSMain(uint3 grid : SV_DispatchThreadID)
|
||||
@@ -52,6 +52,14 @@ int main(void)
|
||||
info.num_readwrite_storage_buffers = 1;
|
||||
PulseComputePipeline pipeline = PulseCreateComputePipeline(device, &info);
|
||||
|
||||
PulseFence fence = PulseCreateFence(device);
|
||||
PulseCommandList cmd = PulseRequestCommandList(device, PULSE_COMMAND_LIST_GENERAL);
|
||||
|
||||
PulseSubmitCommandList(device, cmd, fence);
|
||||
PulseWaitForFences(device, &fence, 1, true);
|
||||
|
||||
PulseReleaseCommandList(device, cmd);
|
||||
PulseDestroyFence(device, fence);
|
||||
PulseDestroyComputePipeline(device, pipeline);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "D3D11Device.h"
|
||||
|
||||
#pragma comment(lib,"d3d11.lib")
|
||||
#pragma comment(lib, "dxgi.lib")
|
||||
#pragma comment(lib,"d3dcompiler.lib")
|
||||
|
||||
PulseBackendFlags Direct3D11CheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used)
|
||||
|
||||
@@ -14,9 +14,24 @@
|
||||
|
||||
PulseCommandList Direct3D11RequestCommandList(PulseDevice device, PulseCommandListUsage usage)
|
||||
{
|
||||
PULSE_CHECK_HANDLE_RETVAL(device, PULSE_NULL_HANDLE);
|
||||
Direct3D11Device* d3d11_device = D3D11_RETRIEVE_DRIVER_DATA_AS(device, Direct3D11Device*);
|
||||
|
||||
PulseCommandList cmd = (PulseCommandList)calloc(1, sizeof(PulseCommandListHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(cmd, PULSE_NULL_HANDLE);
|
||||
Direct3D11CommandList* d3d11_cmd = (Direct3D11CommandList*)calloc(1, sizeof(Direct3D11CommandList));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(d3d11_cmd, PULSE_NULL_HANDLE);
|
||||
|
||||
CHECK_D3D11_RETVAL(device->backend, ID3D11Device_CreateDeferredContext(d3d11_device->device, 0, &d3d11_cmd->context), PULSE_ERROR_INITIALIZATION_FAILED, PULSE_NULL_HANDLE);
|
||||
|
||||
cmd->usage = usage;
|
||||
cmd->device = device;
|
||||
cmd->driver_data = d3d11_cmd;
|
||||
cmd->thread_id = PulseGetThreadID();
|
||||
|
||||
cmd->pass = PULSE_NULL_HANDLE;
|
||||
cmd->state = PULSE_COMMAND_LIST_STATE_RECORDING;
|
||||
cmd->is_available = false;
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
@@ -26,4 +41,9 @@ bool Direct3D11SubmitCommandList(PulseDevice device, PulseCommandList cmd, Pulse
|
||||
|
||||
void Direct3D11ReleaseCommandList(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
PULSE_UNUSED(device);
|
||||
Direct3D11CommandList* d3d11_cmd = D3D11_RETRIEVE_DRIVER_DATA_AS(cmd, Direct3D11CommandList*);
|
||||
ID3D11DeviceContext_Release(d3d11_cmd->context);
|
||||
free(d3d11_cmd);
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
typedef struct Direct3D11CommandList
|
||||
{
|
||||
int dummy;
|
||||
ID3D11DeviceContext* context;
|
||||
} Direct3D11CommandList;
|
||||
|
||||
PulseCommandList Direct3D11RequestCommandList(PulseDevice device, PulseCommandListUsage usage);
|
||||
|
||||
Reference in New Issue
Block a user