mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-10 15:03:34 +00:00
adding software computer base
This commit is contained in:
29
Examples/Software/main.c
git.filemode.normal_file
29
Examples/Software/main.c
git.filemode.normal_file
@@ -0,0 +1,29 @@
|
||||
#include <Pulse.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void DebugCallBack(PulseDebugMessageSeverity severity, const char* message)
|
||||
{
|
||||
if(severity == PULSE_DEBUG_MESSAGE_SEVERITY_ERROR)
|
||||
{
|
||||
fprintf(stderr, "Pulse Error: %s\n", message);
|
||||
exit(1);
|
||||
}
|
||||
else if(severity == PULSE_DEBUG_MESSAGE_SEVERITY_WARNING)
|
||||
fprintf(stderr, "Pulse Warning: %s\n", message);
|
||||
else
|
||||
printf("Pulse: %s\n", message);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
PulseBackend backend = PulseLoadBackend(PULSE_BACKEND_SOFTWARE, PULSE_SHADER_FORMAT_SPIRV_BIT, PULSE_HIGH_DEBUG);
|
||||
PulseSetDebugCallback(backend, DebugCallBack);
|
||||
PulseDevice device = PulseCreateDevice(backend, NULL, 0);
|
||||
|
||||
PulseDestroyDevice(device);
|
||||
PulseUnloadBackend(backend);
|
||||
puts("Successfully executed Pulse example using Software backend !");
|
||||
return 0;
|
||||
}
|
||||
7
Examples/Software/xmake.lua
git.filemode.normal_file
7
Examples/Software/xmake.lua
git.filemode.normal_file
@@ -0,0 +1,7 @@
|
||||
target("SoftwareExample")
|
||||
add_deps("pulse_gpu")
|
||||
if is_plat("linux") then
|
||||
set_extension(".x86_64")
|
||||
end
|
||||
add_files("*.c")
|
||||
target_end()
|
||||
@@ -8,4 +8,7 @@ if has_config("examples") then
|
||||
if has_config("webgpu") then
|
||||
includes("WebGPU/xmake.lua")
|
||||
end
|
||||
if has_config("software") then
|
||||
includes("Software/xmake.lua")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,12 +34,12 @@ PULSE_DEFINE_NULLABLE_HANDLE(PulseComputePass);
|
||||
// Flags
|
||||
typedef enum PulseBackendBits
|
||||
{
|
||||
PULSE_BACKEND_INVALID = PULSE_BIT(1),
|
||||
PULSE_BACKEND_ANY = PULSE_BIT(2),
|
||||
PULSE_BACKEND_VULKAN = PULSE_BIT(3),
|
||||
PULSE_BACKEND_METAL = PULSE_BIT(4),
|
||||
PULSE_BACKEND_WEBGPU = PULSE_BIT(5),
|
||||
// More to come
|
||||
PULSE_BACKEND_INVALID = PULSE_BIT(1),
|
||||
PULSE_BACKEND_ANY = PULSE_BIT(2),
|
||||
PULSE_BACKEND_VULKAN = PULSE_BIT(3),
|
||||
PULSE_BACKEND_METAL = PULSE_BIT(4),
|
||||
PULSE_BACKEND_WEBGPU = PULSE_BIT(5),
|
||||
PULSE_BACKEND_SOFTWARE = PULSE_BIT(6),
|
||||
} PulseBackendBits;
|
||||
typedef PulseFlags PulseBackendFlags;
|
||||
|
||||
@@ -68,10 +68,10 @@ typedef PulseFlags PulseImageUsageFlags;
|
||||
|
||||
typedef enum PulseShaderFormatsBits
|
||||
{
|
||||
PULSE_SHADER_FORMAT_SPIRV_BIT = PULSE_BIT(1), // Can be used by Vulkan
|
||||
PULSE_SHADER_FORMAT_MSL_BIT = PULSE_BIT(2), // Can be used by Metal
|
||||
PULSE_SHADER_FORMAT_METALLIB_BIT = PULSE_BIT(3), // Can be used by Metal
|
||||
PULSE_SHADER_FORMAT_WGSL_BIT = PULSE_BIT(4), // Can be used by WebGPU
|
||||
PULSE_SHADER_FORMAT_SPIRV_BIT = PULSE_BIT(1), // Can be used by Vulkan and Software backends
|
||||
PULSE_SHADER_FORMAT_MSL_BIT = PULSE_BIT(2), // Can be used by Metal backend
|
||||
PULSE_SHADER_FORMAT_METALLIB_BIT = PULSE_BIT(3), // Can be used by Metal backend
|
||||
PULSE_SHADER_FORMAT_WGSL_BIT = PULSE_BIT(4), // Can be used by WebGPU backend
|
||||
// More to come
|
||||
} PulseShaderFormatsBits;
|
||||
typedef PulseFlags PulseShaderFormatsFlags;
|
||||
|
||||
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
|
||||
@@ -17,6 +17,9 @@
|
||||
#ifdef PULSE_ENABLE_WEBGPU_BACKEND
|
||||
#include "Backends/WebGPU/WebGPU.h"
|
||||
#endif
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
#include "Backends/Software/Soft.h"
|
||||
#endif
|
||||
|
||||
// Ordered by default preference
|
||||
static const PulseCheckBackendSupportPFN backends_supports[] = {
|
||||
@@ -29,6 +32,9 @@ static const PulseCheckBackendSupportPFN backends_supports[] = {
|
||||
#ifdef PULSE_ENABLE_WEBGPU_BACKEND
|
||||
WebGPUCheckSupport,
|
||||
#endif
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
SoftCheckSupport,
|
||||
#endif
|
||||
PULSE_NULLPTR
|
||||
};
|
||||
|
||||
@@ -99,6 +105,9 @@ static PulseBackend PulseGetBackendFromFlag(PulseBackendBits flag)
|
||||
#ifdef PULSE_ENABLE_WEBGPU_BACKEND
|
||||
case PULSE_BACKEND_WEBGPU: return &WebGPUDriver;
|
||||
#endif
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
case PULSE_BACKEND_SOFTWARE: return &SoftwareDriver;
|
||||
#endif
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -178,5 +178,8 @@ void PulseLogBackend(PulseBackend backend, PulseDebugMessageSeverity type, const
|
||||
#ifdef PULSE_ENABLE_WEBGPU_BACKEND
|
||||
extern PulseBackendHandler WebGPUDriver;
|
||||
#endif // PULSE_ENABLE_WEBGPU_BACKEND
|
||||
#ifdef PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
extern PulseBackendHandler SoftwareDriver;
|
||||
#endif // PULSE_ENABLE_SOFTWARE_BACKEND
|
||||
|
||||
#endif // PULSE_INTERNAL_H_
|
||||
|
||||
30
Xmake/packages/s/spirv-vm/xmake.lua
git.filemode.normal_file
30
Xmake/packages/s/spirv-vm/xmake.lua
git.filemode.normal_file
@@ -0,0 +1,30 @@
|
||||
package("spirv-vm")
|
||||
set_homepage("https://github.com/dfranx/SPIRV-VM/")
|
||||
set_description("A Virtual machine for executing SPIR-V.")
|
||||
set_license("MIT")
|
||||
|
||||
add_urls("https://github.com/dfranx/SPIRV-VM.git")
|
||||
|
||||
on_install(function (package)
|
||||
os.cp("inc/spvm", package:installdir("include"))
|
||||
io.writefile("xmake.lua", [[
|
||||
add_rules("mode.debug", "mode.release")
|
||||
target("spirv-vm")
|
||||
set_kind("$(kind)")
|
||||
add_files("src/**.c")
|
||||
add_includedirs("inc/")
|
||||
--add_headerfiles("inc/**.h")
|
||||
]])
|
||||
import("package.tools.xmake").install(package)
|
||||
end)
|
||||
|
||||
on_test(function (package)
|
||||
assert(package:check_csnippets({test = [[
|
||||
#include <spvm/context.h>
|
||||
void test()
|
||||
{
|
||||
spvm_context_t ctx = spvm_context_initialize();
|
||||
spvm_context_deinitialize(ctx);
|
||||
}
|
||||
]]}))
|
||||
end)
|
||||
@@ -1,21 +1,21 @@
|
||||
package("tiny-c-thread")
|
||||
set_homepage("https://github.com/tinycthread/tinycthread")
|
||||
set_description("A small, portable implementation of the C11 threads API.")
|
||||
set_license("MIT")
|
||||
set_description("A small, portable implementation of the C11 threads API.")
|
||||
set_license("MIT")
|
||||
|
||||
add_urls("https://github.com/tinycthread/tinycthread.git")
|
||||
add_urls("https://github.com/tinycthread/tinycthread.git")
|
||||
|
||||
on_install(function (package)
|
||||
io.writefile("xmake.lua", [[
|
||||
add_rules("mode.debug", "mode.release")
|
||||
target("tiny-c-thread")
|
||||
set_kind("static")
|
||||
add_files("source/*.c")
|
||||
add_headerfiles("source/*.h")
|
||||
]])
|
||||
import("package.tools.xmake").install(package)
|
||||
end)
|
||||
io.writefile("xmake.lua", [[
|
||||
add_rules("mode.debug", "mode.release")
|
||||
target("tiny-c-thread")
|
||||
set_kind("static")
|
||||
add_files("source/*.c")
|
||||
add_headerfiles("source/*.h")
|
||||
]])
|
||||
import("package.tools.xmake").install(package)
|
||||
end)
|
||||
|
||||
on_test(function (package)
|
||||
assert(package:has_ctypes("thrd_t", {configs = {languages = "c11"}, includes = "tinycthread.h"}))
|
||||
end)
|
||||
on_test(function (package)
|
||||
assert(package:has_ctypes("thrd_t", {configs = {languages = "c11"}, includes = "tinycthread.h"}))
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user