mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
adding software computer base
This commit is contained in:
42
Sources/Backends/Software/Soft.c
git.filemode.normal_file
42
Sources/Backends/Software/Soft.c
git.filemode.normal_file
@@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
|
||||
#include "Soft.h"
|
||||
#include "SoftDevice.h"
|
||||
|
||||
PulseBackendFlags SoftCheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used)
|
||||
{
|
||||
if(candidates != PULSE_BACKEND_ANY && (candidates & PULSE_BACKEND_SOFTWARE) == 0)
|
||||
return PULSE_BACKEND_INVALID;
|
||||
if((shader_formats_used & PULSE_SHADER_FORMAT_SPIRV_BIT) == 0)
|
||||
return PULSE_BACKEND_INVALID;
|
||||
return PULSE_BACKEND_SOFTWARE; // Software computer is always supported
|
||||
}
|
||||
|
||||
bool SoftLoadBackend(PulseBackend backend, PulseDebugLevel debug_level)
|
||||
{
|
||||
PULSE_UNUSED(backend);
|
||||
PULSE_UNUSED(debug_level);
|
||||
SoftDriverData* driver_data = (SoftDriverData*)calloc(1, sizeof(SoftDriverData));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(driver_data, false);
|
||||
WebGPUDriver.driver_data = driver_data;
|
||||
return true;
|
||||
}
|
||||
|
||||
void SoftUnloadBackend(PulseBackend backend)
|
||||
{
|
||||
free(backend->driver_data);
|
||||
}
|
||||
|
||||
PulseBackendHandler SoftwareDriver = {
|
||||
.PFN_LoadBackend = SoftLoadBackend,
|
||||
.PFN_UnloadBackend = SoftUnloadBackend,
|
||||
.PFN_CreateDevice = SoftCreateDevice,
|
||||
.backend = PULSE_BACKEND_SOFTWARE,
|
||||
.supported_shader_formats = PULSE_SHADER_FORMAT_SPIRV_BIT,
|
||||
.driver_data = PULSE_NULLPTR
|
||||
};
|
||||
22
Sources/Backends/Software/Soft.h
git.filemode.normal_file
22
Sources/Backends/Software/Soft.h
git.filemode.normal_file
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#ifndef PULSE_SOFTWARE_H_
|
||||
#define PULSE_SOFTWARE_H_
|
||||
|
||||
#define SOFTWARE_RETRIEVE_DRIVER_DATA_AS(handle, cast) ((cast)handle->driver_data)
|
||||
|
||||
typedef struct SoftDriverData
|
||||
{
|
||||
} SoftDriverData;
|
||||
|
||||
PulseBackendFlags SoftCheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used); // Return PULSE_BACKEND_SOFTWARE in case of success and PULSE_BACKEND_INVALID otherwise
|
||||
|
||||
#endif // PULSE_SOFTWARE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
32
Sources/Backends/Software/SoftBuffer.c
git.filemode.normal_file
32
Sources/Backends/Software/SoftBuffer.c
git.filemode.normal_file
@@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Soft.h"
|
||||
#include "SoftBuffer.h"
|
||||
|
||||
PulseBuffer SoftCreateBuffer(PulseDevice device, const PulseBufferCreateInfo* create_infos)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftMapBuffer(PulseBuffer buffer, PulseMapMode mode, void** data)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftUnmapBuffer(PulseBuffer buffer)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftCopyBufferToBuffer(PulseCommandList cmd, const PulseBufferRegion* src, const PulseBufferRegion* dst)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftCopyBufferToImage(PulseCommandList cmd, const PulseBufferRegion* src, const PulseImageRegion* dst)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftDestroyBuffer(PulseDevice device, PulseBuffer buffer)
|
||||
{
|
||||
}
|
||||
28
Sources/Backends/Software/SoftBuffer.h
git.filemode.normal_file
28
Sources/Backends/Software/SoftBuffer.h
git.filemode.normal_file
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#ifndef PULSE_SOFTWARE_BUFFER_H_
|
||||
#define PULSE_SOFTWARE_BUFFER_H_
|
||||
|
||||
#include "Soft.h"
|
||||
|
||||
typedef struct SoftBuffer
|
||||
{
|
||||
void* map;
|
||||
} SoftBuffer;
|
||||
|
||||
PulseBuffer SoftCreateBuffer(PulseDevice device, const PulseBufferCreateInfo* create_infos);
|
||||
bool SoftMapBuffer(PulseBuffer buffer, PulseMapMode mode, void** data);
|
||||
void SoftUnmapBuffer(PulseBuffer buffer);
|
||||
bool SoftCopyBufferToBuffer(PulseCommandList cmd, const PulseBufferRegion* src, const PulseBufferRegion* dst);
|
||||
bool SoftCopyBufferToImage(PulseCommandList cmd, const PulseBufferRegion* src, const PulseImageRegion* dst);
|
||||
void SoftDestroyBuffer(PulseDevice device, PulseBuffer buffer);
|
||||
|
||||
#endif // PULSE_SOFTWARE_BUFFER_H_
|
||||
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
20
Sources/Backends/Software/SoftCommandList.c
git.filemode.normal_file
20
Sources/Backends/Software/SoftCommandList.c
git.filemode.normal_file
@@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Soft.h"
|
||||
#include "SoftCommandlist.h"
|
||||
|
||||
PulseCommandList SoftRequestCommandList(PulseDevice device, PulseCommandListUsage usage)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftSubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftReleaseCommandList(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
}
|
||||
24
Sources/Backends/Software/SoftCommandlist.h
git.filemode.normal_file
24
Sources/Backends/Software/SoftCommandlist.h
git.filemode.normal_file
@@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#ifndef PULSE_SOFTWARE_COMMAND_LIST_H_
|
||||
#define PULSE_SOFTWARE_COMMAND_LIST_H_
|
||||
|
||||
#include "Soft.h"
|
||||
|
||||
typedef struct SoftCommandList
|
||||
{
|
||||
} SoftCommandList;
|
||||
|
||||
PulseCommandList SoftRequestCommandList(PulseDevice device, PulseCommandListUsage usage);
|
||||
bool SoftSubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence);
|
||||
void SoftReleaseCommandList(PulseDevice device, PulseCommandList cmd);
|
||||
|
||||
#endif // PULSE_SOFTWARE_COMMAND_LIST_H_
|
||||
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
44
Sources/Backends/Software/SoftComputePass.c
git.filemode.normal_file
44
Sources/Backends/Software/SoftComputePass.c
git.filemode.normal_file
@@ -0,0 +1,44 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Soft.h"
|
||||
#include "SoftComputePass.h"
|
||||
|
||||
PulseComputePass SoftCreateComputePass(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftDestroyComputePass(PulseDevice device, PulseComputePass pass)
|
||||
{
|
||||
}
|
||||
|
||||
PulseComputePass SoftBeginComputePass(PulseCommandList cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftEndComputePass(PulseComputePass pass)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftBindStorageBuffers(PulseComputePass pass, const PulseBuffer* buffers, uint32_t num_buffers)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftBindStorageImages(PulseComputePass pass, const PulseImage* images, uint32_t num_images)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z)
|
||||
{
|
||||
}
|
||||
31
Sources/Backends/Software/SoftComputePass.h
git.filemode.normal_file
31
Sources/Backends/Software/SoftComputePass.h
git.filemode.normal_file
@@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#ifndef PULSE_SOFTWARE_COMPUTE_PASS_H_
|
||||
#define PULSE_SOFTWARE_COMPUTE_PASS_H_
|
||||
|
||||
#include "Soft.h"
|
||||
|
||||
typedef struct SoftComputePass
|
||||
{
|
||||
} SoftComputePass;
|
||||
|
||||
PulseComputePass SoftCreateComputePass(PulseDevice device, PulseCommandList cmd);
|
||||
void SoftDestroyComputePass(PulseDevice device, PulseComputePass pass);
|
||||
|
||||
PulseComputePass SoftBeginComputePass(PulseCommandList cmd);
|
||||
void SoftEndComputePass(PulseComputePass pass);
|
||||
void SoftBindStorageBuffers(PulseComputePass pass, const PulseBuffer* buffers, uint32_t num_buffers);
|
||||
void SoftBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size);
|
||||
void SoftBindStorageImages(PulseComputePass pass, const PulseImage* images, uint32_t num_images);
|
||||
void SoftBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline);
|
||||
void SoftDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z);
|
||||
|
||||
#endif // PULSE_SOFTWARE_COMPUTE_PASS_H_
|
||||
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
16
Sources/Backends/Software/SoftComputePipeline.c
git.filemode.normal_file
16
Sources/Backends/Software/SoftComputePipeline.c
git.filemode.normal_file
@@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Soft.h"
|
||||
#include "SoftComputePipeline.h"
|
||||
|
||||
PulseComputePipeline SoftCreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipeline)
|
||||
{
|
||||
}
|
||||
23
Sources/Backends/Software/SoftComputePipeline.h
git.filemode.normal_file
23
Sources/Backends/Software/SoftComputePipeline.h
git.filemode.normal_file
@@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#ifndef PULSE_SOFTWARE_COMPUTE_PIPELINE_H_
|
||||
#define PULSE_SOFTWARE_COMPUTE_PIPELINE_H_
|
||||
|
||||
#include "Soft.h"
|
||||
|
||||
typedef struct SoftComputePipeline
|
||||
{
|
||||
} SoftComputePipeline;
|
||||
|
||||
PulseComputePipeline SoftCreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info);
|
||||
void SoftDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipeline);
|
||||
|
||||
#endif // PULSE_SOFTWARE_COMPUTE_PIPELINE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
16
Sources/Backends/Software/SoftDevice.c
git.filemode.normal_file
16
Sources/Backends/Software/SoftDevice.c
git.filemode.normal_file
@@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Soft.h"
|
||||
#include "SoftDevice.h"
|
||||
|
||||
PulseDevice SoftCreateDevice(PulseBackend backend, PulseDevice* forbiden_devices, uint32_t forbiden_devices_count)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftDestroyDevice(PulseDevice device)
|
||||
{
|
||||
}
|
||||
23
Sources/Backends/Software/SoftDevice.h
git.filemode.normal_file
23
Sources/Backends/Software/SoftDevice.h
git.filemode.normal_file
@@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#ifndef PULSE_SOFTWARE_DEVICE_H_
|
||||
#define PULSE_SOFTWARE_DEVICE_H_
|
||||
|
||||
#include "Soft.h"
|
||||
|
||||
typedef struct SoftDevice
|
||||
{
|
||||
} SoftDevice;
|
||||
|
||||
PulseDevice SoftCreateDevice(PulseBackend backend, PulseDevice* forbiden_devices, uint32_t forbiden_devices_count);
|
||||
void SoftDestroyDevice(PulseDevice device);
|
||||
|
||||
#endif // PULSE_SOFTWARE_DEVICE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
24
Sources/Backends/Software/SoftFence.c
git.filemode.normal_file
24
Sources/Backends/Software/SoftFence.c
git.filemode.normal_file
@@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Soft.h"
|
||||
#include "SoftFence.h"
|
||||
|
||||
PulseFence SoftCreateFence(PulseDevice device)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftDestroyFence(PulseDevice device, PulseFence fence)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftIsFenceReady(PulseDevice device, PulseFence fence)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftWaitForFences(PulseDevice device, const PulseFence* fences, uint32_t fences_count, bool wait_for_all)
|
||||
{
|
||||
}
|
||||
29
Sources/Backends/Software/SoftFence.h
git.filemode.normal_file
29
Sources/Backends/Software/SoftFence.h
git.filemode.normal_file
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#ifndef PULSE_SOFTWARE_FENCE_H_
|
||||
#define PULSE_SOFTWARE_FENCE_H_
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "Soft.h"
|
||||
|
||||
typedef struct SoftFence
|
||||
{
|
||||
atomic_bool signal;
|
||||
} SoftFence;
|
||||
|
||||
PulseFence SoftCreateFence(PulseDevice device);
|
||||
void SoftDestroyFence(PulseDevice device, PulseFence fence);
|
||||
bool SoftIsFenceReady(PulseDevice device, PulseFence fence);
|
||||
bool SoftWaitForFences(PulseDevice device, const PulseFence* fences, uint32_t fences_count, bool wait_for_all);
|
||||
|
||||
#endif // PULSE_SOFTWARE_FENCE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
28
Sources/Backends/Software/SoftImage.c
git.filemode.normal_file
28
Sources/Backends/Software/SoftImage.c
git.filemode.normal_file
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Soft.h"
|
||||
#include "SoftImage.h"
|
||||
|
||||
PulseImage SoftCreateImage(PulseDevice device, const PulseImageCreateInfo* create_infos)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftIsImageFormatValid(PulseDevice device, PulseImageFormat format, PulseImageType type, PulseImageUsageFlags usage)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftCopyImageToBuffer(PulseCommandList cmd, const PulseImageRegion* src, const PulseBufferRegion* dst)
|
||||
{
|
||||
}
|
||||
|
||||
bool SoftBlitImage(PulseCommandList cmd, const PulseImageRegion* src, const PulseImageRegion* dst)
|
||||
{
|
||||
}
|
||||
|
||||
void SoftDestroyImage(PulseDevice device, PulseImage image)
|
||||
{
|
||||
}
|
||||
26
Sources/Backends/Software/SoftImage.h
git.filemode.normal_file
26
Sources/Backends/Software/SoftImage.h
git.filemode.normal_file
@@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#ifndef PULSE_SOFTWARE_IMAGE_H_
|
||||
#define PULSE_SOFTWARE_IMAGE_H_
|
||||
|
||||
#include "Soft.h"
|
||||
|
||||
typedef struct SoftImage
|
||||
{
|
||||
} SoftImage;
|
||||
|
||||
PulseImage SoftCreateImage(PulseDevice device, const PulseImageCreateInfo* create_infos);
|
||||
bool SoftIsImageFormatValid(PulseDevice device, PulseImageFormat format, PulseImageType type, PulseImageUsageFlags usage);
|
||||
bool SoftCopyImageToBuffer(PulseCommandList cmd, const PulseImageRegion* src, const PulseBufferRegion* dst);
|
||||
bool SoftBlitImage(PulseCommandList cmd, const PulseImageRegion* src, const PulseImageRegion* dst);
|
||||
void SoftDestroyImage(PulseDevice device, PulseImage image);
|
||||
|
||||
#endif // PULSE_SOFTWARE_IMAGE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
Reference in New Issue
Block a user