mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-10 15:03:34 +00:00
adding backend bootstrapper
This commit is contained in:
70
Scripts/BackendBootstraper.py
git.filemode.normal_file
70
Scripts/BackendBootstraper.py
git.filemode.normal_file
@@ -0,0 +1,70 @@
|
||||
import os
|
||||
import shutil
|
||||
import argparse
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Bootstraps a new backend."
|
||||
)
|
||||
parser.add_argument("name", help="Backend's name")
|
||||
parser.add_argument("fn_name", help="Backend's function names")
|
||||
args = parser.parse_args()
|
||||
|
||||
base_name = "Template"
|
||||
src_dir = os.path.abspath("Backend" + base_name)
|
||||
dest_dir = os.path.abspath("../Sources/Backends/" + args.name)
|
||||
|
||||
if not os.path.isdir(src_dir):
|
||||
raise SystemExit(f"Source directory '{base_name}' not found in current path.")
|
||||
|
||||
if os.path.exists(dest_dir):
|
||||
raise SystemExit(f"Destination already exists: {dest_dir}")
|
||||
|
||||
fn_name = args.fn_name
|
||||
name = args.name
|
||||
name_upper = name.upper()
|
||||
|
||||
# Copy template directory
|
||||
shutil.copytree(src_dir, dest_dir)
|
||||
|
||||
# Walk through destination and replace names/contents
|
||||
for root, dirs, files in os.walk(dest_dir, topdown=False):
|
||||
# Process files
|
||||
for fname in files:
|
||||
fpath = os.path.join(root, fname)
|
||||
|
||||
# Replace contents in text files
|
||||
try:
|
||||
with open(fpath, "rb") as fb:
|
||||
head = fb.read(2048)
|
||||
is_binary = b"\x00" in head
|
||||
except Exception:
|
||||
is_binary = True
|
||||
|
||||
if not is_binary:
|
||||
try:
|
||||
with open(fpath, "r", encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
new_text = text.replace("TemplateName", fn_name).replace("TEMPLATE", name_upper).replace("Template", name)
|
||||
if new_text != text:
|
||||
with open(fpath, "w", encoding="utf-8") as f:
|
||||
f.write(new_text)
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
|
||||
# Rename file if needed
|
||||
new_fname = fname.replace("TEMPLATE", name_upper).replace("Template", name)
|
||||
if new_fname != fname:
|
||||
os.replace(fpath, os.path.join(root, new_fname))
|
||||
|
||||
# Process directories
|
||||
for dname in dirs:
|
||||
old_dpath = os.path.join(root, dname)
|
||||
new_dname = dname.replace("TEMPLATE", name_upper).replace("Template", name)
|
||||
if new_dname != dname:
|
||||
os.replace(old_dpath, os.path.join(root, new_dname))
|
||||
|
||||
print(f"✅ Project created at: {dest_dir}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
38
Scripts/BackendTemplate/Template.c
git.filemode.normal_file
38
Scripts/BackendTemplate/Template.c
git.filemode.normal_file
@@ -0,0 +1,38 @@
|
||||
// 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 "Template.h"
|
||||
#include "TemplateDevice.h"
|
||||
|
||||
PulseBackendFlags TemplateNameCheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used)
|
||||
{
|
||||
if(candidates != PULSE_BACKEND_ANY && (candidates & PULSE_BACKEND_TEMPLATE) == 0)
|
||||
return PULSE_BACKEND_INVALID;
|
||||
//if((shader_formats_used & PULSE_SHADER_FORMAT_SPIRV_BIT) == 0)
|
||||
// return PULSE_BACKEND_INVALID;
|
||||
return PULSE_BACKEND_TEMPLATE;
|
||||
}
|
||||
|
||||
bool TemplateNameLoadBackend(PulseBackend backend, PulseDebugLevel debug_level)
|
||||
{
|
||||
PULSE_UNUSED(backend);
|
||||
PULSE_UNUSED(debug_level);
|
||||
return true;
|
||||
}
|
||||
|
||||
void TemplateNameUnloadBackend(PulseBackend backend)
|
||||
{
|
||||
}
|
||||
|
||||
PulseBackendHandler TemplateNameDriver = {
|
||||
.PFN_LoadBackend = TemplateNameLoadBackend,
|
||||
.PFN_UnloadBackend = TemplateNameUnloadBackend,
|
||||
.PFN_CreateDevice = TemplateNameCreateDevice,
|
||||
.backend = PULSE_BACKEND_TEMPLATE,
|
||||
.supported_shader_formats = PULSE_SHADER_FORMAT_SPIRV_BIT,
|
||||
.driver_data = PULSE_NULLPTR
|
||||
};
|
||||
18
Scripts/BackendTemplate/Template.h
git.filemode.normal_file
18
Scripts/BackendTemplate/Template.h
git.filemode.normal_file
@@ -0,0 +1,18 @@
|
||||
// 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_TEMPLATE_BACKEND
|
||||
|
||||
#ifndef PULSE_TEMPLATE_H_
|
||||
#define PULSE_TEMPLATE_H_
|
||||
|
||||
#define TEMPLATE_RETRIEVE_DRIVER_DATA_AS(handle, cast) ((cast)handle->driver_data)
|
||||
|
||||
PulseBackendFlags TemplateNameCheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used); // Returns corresponding PULSE_BACKEND enum in case of success and PULSE_BACKEND_INVALID otherwise
|
||||
|
||||
#endif // PULSE_TEMPLATE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_TEMPLATE_BACKEND
|
||||
41
Scripts/BackendTemplate/TemplateBuffer.c
git.filemode.normal_file
41
Scripts/BackendTemplate/TemplateBuffer.c
git.filemode.normal_file
@@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Template.h"
|
||||
#include "TemplateBuffer.h"
|
||||
#include "TemplateCommandList.h"
|
||||
|
||||
PulseBuffer TemplateNameCreateBuffer(PulseDevice device, const PulseBufferCreateInfo* create_infos)
|
||||
{
|
||||
PulseBuffer buffer = (PulseBuffer)calloc(1, sizeof(PulseBufferHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(buffer, PULSE_NULL_HANDLE);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool TemplateNameMapBuffer(PulseBuffer buffer, PulseMapMode mode, void** data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void TemplateNameUnmapBuffer(PulseBuffer buffer)
|
||||
{
|
||||
}
|
||||
|
||||
bool TemplateNameCopyBufferToBuffer(PulseCommandList cmd, const PulseBufferRegion* src, const PulseBufferRegion* dst)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TemplateNameCopyBufferToImage(PulseCommandList cmd, const PulseBufferRegion* src, const PulseImageRegion* dst)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void TemplateNameDestroyBuffer(PulseDevice device, PulseBuffer buffer)
|
||||
{
|
||||
}
|
||||
28
Scripts/BackendTemplate/TemplateBuffer.h
git.filemode.normal_file
28
Scripts/BackendTemplate/TemplateBuffer.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_TEMPLATE_BACKEND
|
||||
|
||||
#ifndef PULSE_TEMPLATE_BUFFER_H_
|
||||
#define PULSE_TEMPLATE_BUFFER_H_
|
||||
|
||||
#include "Template.h"
|
||||
|
||||
typedef struct TemplateNameBuffer
|
||||
{
|
||||
int dummy;
|
||||
} TemplateNameBuffer;
|
||||
|
||||
PulseBuffer TemplateNameCreateBuffer(PulseDevice device, const PulseBufferCreateInfo* create_infos);
|
||||
bool TemplateNameMapBuffer(PulseBuffer buffer, PulseMapMode mode, void** data);
|
||||
void TemplateNameUnmapBuffer(PulseBuffer buffer);
|
||||
bool TemplateNameCopyBufferToBuffer(PulseCommandList cmd, const PulseBufferRegion* src, const PulseBufferRegion* dst);
|
||||
bool TemplateNameCopyBufferToImage(PulseCommandList cmd, const PulseBufferRegion* src, const PulseImageRegion* dst);
|
||||
void TemplateNameDestroyBuffer(PulseDevice device, PulseBuffer buffer);
|
||||
|
||||
#endif // PULSE_TEMPLATE_BUFFER_H_
|
||||
|
||||
#endif // PULSE_ENABLE_TEMPLATE_BACKEND
|
||||
29
Scripts/BackendTemplate/TemplateCommandList.c
git.filemode.normal_file
29
Scripts/BackendTemplate/TemplateCommandList.c
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>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Template.h"
|
||||
#include "TemplateFence.h"
|
||||
#include "TemplateDevice.h"
|
||||
#include "TemplateCommandList.h"
|
||||
#include "TemplateComputePass.h"
|
||||
#include "TemplateComputePipeline.h"
|
||||
#include "TemplateBuffer.h"
|
||||
|
||||
PulseCommandList TemplateNameRequestCommandList(PulseDevice device, PulseCommandListUsage usage)
|
||||
{
|
||||
PULSE_CHECK_HANDLE_RETVAL(device, PULSE_NULL_HANDLE);
|
||||
PulseCommandList cmd = (PulseCommandList)calloc(1, sizeof(PulseCommandListHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(cmd, PULSE_NULL_HANDLE);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
bool TemplateNameSubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence)
|
||||
{
|
||||
}
|
||||
|
||||
void TemplateNameReleaseCommandList(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
}
|
||||
29
Scripts/BackendTemplate/TemplateCommandList.h
git.filemode.normal_file
29
Scripts/BackendTemplate/TemplateCommandList.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_TEMPLATE_BACKEND
|
||||
|
||||
#ifndef PULSE_TEMPLATE_COMMAND_LIST_H_
|
||||
#define PULSE_TEMPLATE_COMMAND_LIST_H_
|
||||
|
||||
#include <stdatomic.h>
|
||||
#include <tinycthread.h>
|
||||
|
||||
#include "Template.h"
|
||||
#include "TemplateFence.h"
|
||||
|
||||
typedef struct TemplateNameCommandList
|
||||
{
|
||||
int dummy;
|
||||
} TemplateNameCommandList;
|
||||
|
||||
PulseCommandList TemplateNameRequestCommandList(PulseDevice device, PulseCommandListUsage usage);
|
||||
bool TemplateNameSubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence);
|
||||
void TemplateNameReleaseCommandList(PulseDevice device, PulseCommandList cmd);
|
||||
|
||||
#endif // PULSE_TEMPLATE_COMMAND_LIST_H_
|
||||
|
||||
#endif // PULSE_ENABLE_TEMPLATE_BACKEND
|
||||
49
Scripts/BackendTemplate/TemplateComputePass.c
git.filemode.normal_file
49
Scripts/BackendTemplate/TemplateComputePass.c
git.filemode.normal_file
@@ -0,0 +1,49 @@
|
||||
// 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 "Template.h"
|
||||
#include "TemplateComputePass.h"
|
||||
#include "TemplateCommandList.h"
|
||||
|
||||
PulseComputePass TemplateNameCreateComputePass(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
PULSE_UNUSED(device);
|
||||
PulseComputePass pass = (PulseComputePass)calloc(1, sizeof(PulseComputePassHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(pass, PULSE_NULL_HANDLE);
|
||||
return pass;
|
||||
}
|
||||
|
||||
void TemplateNameDestroyComputePass(PulseDevice device, PulseComputePass pass)
|
||||
{
|
||||
}
|
||||
|
||||
PulseComputePass TemplateNameBeginComputePass(PulseCommandList cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void TemplateNameEndComputePass(PulseComputePass pass)
|
||||
{
|
||||
}
|
||||
|
||||
void TemplateNameBindStorageBuffers(PulseComputePass pass, const PulseBuffer* buffers, uint32_t num_buffers)
|
||||
{
|
||||
}
|
||||
|
||||
void TemplateNameBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size)
|
||||
{
|
||||
}
|
||||
|
||||
void TemplateNameBindStorageImages(PulseComputePass pass, const PulseImage* images, uint32_t num_images)
|
||||
{
|
||||
}
|
||||
|
||||
void TemplateNameBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline)
|
||||
{
|
||||
}
|
||||
|
||||
void TemplateNameDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z)
|
||||
{
|
||||
}
|
||||
27
Scripts/BackendTemplate/TemplateComputePass.h
git.filemode.normal_file
27
Scripts/BackendTemplate/TemplateComputePass.h
git.filemode.normal_file
@@ -0,0 +1,27 @@
|
||||
// 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_TEMPLATE_BACKEND
|
||||
|
||||
#ifndef PULSE_TEMPLATE_COMPUTE_PASS_H_
|
||||
#define PULSE_TEMPLATE_COMPUTE_PASS_H_
|
||||
|
||||
#include "Template.h"
|
||||
|
||||
PulseComputePass TemplateNameCreateComputePass(PulseDevice device, PulseCommandList cmd);
|
||||
void TemplateNameDestroyComputePass(PulseDevice device, PulseComputePass pass);
|
||||
|
||||
PulseComputePass TemplateNameBeginComputePass(PulseCommandList cmd);
|
||||
void TemplateNameEndComputePass(PulseComputePass pass);
|
||||
void TemplateNameBindStorageBuffers(PulseComputePass pass, const PulseBuffer* buffers, uint32_t num_buffers);
|
||||
void TemplateNameBindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size);
|
||||
void TemplateNameBindStorageImages(PulseComputePass pass, const PulseImage* images, uint32_t num_images);
|
||||
void TemplateNameBindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline);
|
||||
void TemplateNameDispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z);
|
||||
|
||||
#endif // PULSE_TEMPLATE_COMPUTE_PASS_H_
|
||||
|
||||
#endif // PULSE_ENABLE_TEMPLATE_BACKEND
|
||||
22
Scripts/BackendTemplate/TemplateComputePipeline.c
git.filemode.normal_file
22
Scripts/BackendTemplate/TemplateComputePipeline.c
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>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Template.h"
|
||||
#include "TemplateDevice.h"
|
||||
#include "TemplateComputePipeline.h"
|
||||
|
||||
PulseComputePipeline TemplateNameCreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info)
|
||||
{
|
||||
PulseComputePipelineHandler* pipeline = (PulseComputePipelineHandler*)calloc(1, sizeof(PulseComputePipelineHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(pipeline, PULSE_NULL_HANDLE);
|
||||
if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend))
|
||||
PulseLogInfoFmt(device->backend, "(Template) created new compute pipeline %p", pipeline);
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
void TemplateNameDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipeline)
|
||||
{
|
||||
}
|
||||
24
Scripts/BackendTemplate/TemplateComputePipeline.h
git.filemode.normal_file
24
Scripts/BackendTemplate/TemplateComputePipeline.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_TEMPLATE_BACKEND
|
||||
|
||||
#ifndef PULSE_TEMPLATE_COMPUTE_PIPELINE_H_
|
||||
#define PULSE_TEMPLATE_COMPUTE_PIPELINE_H_
|
||||
|
||||
#include "Template.h"
|
||||
|
||||
typedef struct TemplateNameComputePipeline
|
||||
{
|
||||
int dummy;
|
||||
} TemplateNameComputePipeline;
|
||||
|
||||
PulseComputePipeline TemplateNameCreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info);
|
||||
void TemplateNameDestroyComputePipeline(PulseDevice device, PulseComputePipeline pipeline);
|
||||
|
||||
#endif // PULSE_TEMPLATE_COMPUTE_PIPELINE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_TEMPLATE_BACKEND
|
||||
36
Scripts/BackendTemplate/TemplateDevice.c
git.filemode.normal_file
36
Scripts/BackendTemplate/TemplateDevice.c
git.filemode.normal_file
@@ -0,0 +1,36 @@
|
||||
// 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 "Template.h"
|
||||
#include "TemplateComputePipeline.h"
|
||||
#include "TemplateCommandList.h"
|
||||
#include "TemplateDevice.h"
|
||||
#include "TemplateFence.h"
|
||||
#include "TemplateBuffer.h"
|
||||
#include "TemplateImage.h"
|
||||
#include "TemplateComputePass.h"
|
||||
|
||||
PulseDevice TemplateNameCreateDevice(PulseBackend backend, PulseDevice* forbiden_devices, uint32_t forbiden_devices_count)
|
||||
{
|
||||
PULSE_UNUSED(forbiden_devices);
|
||||
PULSE_UNUSED(forbiden_devices_count);
|
||||
|
||||
PULSE_CHECK_HANDLE_RETVAL(backend, PULSE_NULLPTR);
|
||||
|
||||
PulseDevice pulse_device = (PulseDeviceHandler*)calloc(1, sizeof(PulseDeviceHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(pulse_device, PULSE_NULL_HANDLE);
|
||||
|
||||
pulse_device->backend = backend;
|
||||
PULSE_LOAD_DRIVER_DEVICE(TemplateName);
|
||||
|
||||
if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(backend))
|
||||
PulseLogInfoFmt(backend, "(Template) created device from %s", "yes");
|
||||
return pulse_device;
|
||||
}
|
||||
|
||||
void TemplateNameDestroyDevice(PulseDevice device)
|
||||
{
|
||||
}
|
||||
24
Scripts/BackendTemplate/TemplateDevice.h
git.filemode.normal_file
24
Scripts/BackendTemplate/TemplateDevice.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_TEMPLATE_BACKEND
|
||||
|
||||
#ifndef PULSE_TEMPLATE_DEVICE_H_
|
||||
#define PULSE_TEMPLATE_DEVICE_H_
|
||||
|
||||
#include "Template.h"
|
||||
|
||||
typedef struct TemplateNameDevice
|
||||
{
|
||||
int dummy;
|
||||
} TemplateNameDevice;
|
||||
|
||||
PulseDevice TemplateNameCreateDevice(PulseBackend backend, PulseDevice* forbiden_devices, uint32_t forbiden_devices_count);
|
||||
void TemplateNameDestroyDevice(PulseDevice device);
|
||||
|
||||
#endif // PULSE_TEMPLATE_DEVICE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_TEMPLATE_BACKEND
|
||||
31
Scripts/BackendTemplate/TemplateFence.c
git.filemode.normal_file
31
Scripts/BackendTemplate/TemplateFence.c
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>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "Template.h"
|
||||
#include "TemplateFence.h"
|
||||
#include "TemplateCommandList.h"
|
||||
|
||||
PulseFence TemplateNameCreateFence(PulseDevice device)
|
||||
{
|
||||
PulseFence fence = (PulseFence)calloc(1, sizeof(PulseFence));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(fence, PULSE_NULL_HANDLE);
|
||||
return fence;
|
||||
}
|
||||
|
||||
void TemplateNameDestroyFence(PulseDevice device, PulseFence fence)
|
||||
{
|
||||
free(fence);
|
||||
}
|
||||
|
||||
bool TemplateNameIsFenceReady(PulseDevice device, PulseFence fence)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TemplateNameWaitForFences(PulseDevice device, const PulseFence* fences, uint32_t fences_count, bool wait_for_all)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
27
Scripts/BackendTemplate/TemplateFence.h
git.filemode.normal_file
27
Scripts/BackendTemplate/TemplateFence.h
git.filemode.normal_file
@@ -0,0 +1,27 @@
|
||||
// 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_TEMPLATE_BACKEND
|
||||
|
||||
#ifndef PULSE_TEMPLATE_FENCE_H_
|
||||
#define PULSE_TEMPLATE_FENCE_H_
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "Template.h"
|
||||
|
||||
typedef struct TemplateNameFence
|
||||
{
|
||||
int dummy;
|
||||
} TemplateNameFence;
|
||||
|
||||
PulseFence TemplateNameCreateFence(PulseDevice device);
|
||||
void TemplateNameDestroyFence(PulseDevice device, PulseFence fence);
|
||||
bool TemplateNameIsFenceReady(PulseDevice device, PulseFence fence);
|
||||
bool TemplateNameWaitForFences(PulseDevice device, const PulseFence* fences, uint32_t fences_count, bool wait_for_all);
|
||||
|
||||
#endif // PULSE_TEMPLATE_FENCE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_TEMPLATE_BACKEND
|
||||
28
Scripts/BackendTemplate/TemplateImage.c
git.filemode.normal_file
28
Scripts/BackendTemplate/TemplateImage.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 "Template.h"
|
||||
#include "TemplateImage.h"
|
||||
|
||||
PulseImage TemplateNameCreateImage(PulseDevice device, const PulseImageCreateInfo* create_infos)
|
||||
{
|
||||
}
|
||||
|
||||
bool TemplateNameIsImageFormatValid(PulseDevice device, PulseImageFormat format, PulseImageType type, PulseImageUsageFlags usage)
|
||||
{
|
||||
}
|
||||
|
||||
bool TemplateNameCopyImageToBuffer(PulseCommandList cmd, const PulseImageRegion* src, const PulseBufferRegion* dst)
|
||||
{
|
||||
}
|
||||
|
||||
bool TemplateNameBlitImage(PulseCommandList cmd, const PulseImageRegion* src, const PulseImageRegion* dst)
|
||||
{
|
||||
}
|
||||
|
||||
void TemplateNameDestroyImage(PulseDevice device, PulseImage image)
|
||||
{
|
||||
}
|
||||
27
Scripts/BackendTemplate/TemplateImage.h
git.filemode.normal_file
27
Scripts/BackendTemplate/TemplateImage.h
git.filemode.normal_file
@@ -0,0 +1,27 @@
|
||||
// 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_TEMPLATE_BACKEND
|
||||
|
||||
#ifndef PULSE_TEMPLATE_IMAGE_H_
|
||||
#define PULSE_TEMPLATE_IMAGE_H_
|
||||
|
||||
#include "Template.h"
|
||||
|
||||
typedef struct TemplateNameImage
|
||||
{
|
||||
int dummy;
|
||||
} TemplateNameImage;
|
||||
|
||||
PulseImage TemplateNameCreateImage(PulseDevice device, const PulseImageCreateInfo* create_infos);
|
||||
bool TemplateNameIsImageFormatValid(PulseDevice device, PulseImageFormat format, PulseImageType type, PulseImageUsageFlags usage);
|
||||
bool TemplateNameCopyImageToBuffer(PulseCommandList cmd, const PulseImageRegion* src, const PulseBufferRegion* dst);
|
||||
bool TemplateNameBlitImage(PulseCommandList cmd, const PulseImageRegion* src, const PulseImageRegion* dst);
|
||||
void TemplateNameDestroyImage(PulseDevice device, PulseImage image);
|
||||
|
||||
#endif // PULSE_TEMPLATE_IMAGE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_TEMPLATE_BACKEND
|
||||
@@ -19,6 +19,8 @@ PulseBackendFlags Direct3D11CheckSupport(PulseBackendFlags candidates, PulseShad
|
||||
|
||||
bool Direct3D11LoadBackend(PulseBackend backend, PulseDebugLevel debug_level)
|
||||
{
|
||||
PULSE_UNUSED(backend);
|
||||
PULSE_UNUSED(debug_level);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -34,4 +36,3 @@ PulseBackendHandler D3D11Driver = {
|
||||
.supported_shader_formats = PULSE_SHADER_FORMAT_DXBC_BIT,
|
||||
.driver_data = PULSE_NULLPTR
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_D3D11_BACKEND
|
||||
|
||||
#ifndef PULSE_D3D11_H_
|
||||
@@ -18,7 +20,7 @@
|
||||
|
||||
#define D3D11_RETRIEVE_DRIVER_DATA_AS(handle, cast) ((cast)handle->driver_data)
|
||||
|
||||
PulseBackendFlags Direct3D11CheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used); // Return PULSE_BACKEND_D3D11 in case of success and PULSE_BACKEND_INVALID otherwise
|
||||
PulseBackendFlags Direct3D11CheckSupport(PulseBackendFlags candidates, PulseShaderFormatsFlags shader_formats_used); // Returns corresponding PULSE_BACKEND enum in case of success and PULSE_BACKEND_INVALID otherwise
|
||||
|
||||
#endif // PULSE_D3D11_H_
|
||||
|
||||
|
||||
41
Sources/Backends/D3D11/D3D11Buffer.c
git.filemode.normal_file
41
Sources/Backends/D3D11/D3D11Buffer.c
git.filemode.normal_file
@@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2025 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "D3D11.h"
|
||||
#include "D3D11Buffer.h"
|
||||
#include "D3D11CommandList.h"
|
||||
|
||||
PulseBuffer Direct3D11CreateBuffer(PulseDevice device, const PulseBufferCreateInfo* create_infos)
|
||||
{
|
||||
PulseBuffer buffer = (PulseBuffer)calloc(1, sizeof(PulseBufferHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(buffer, PULSE_NULL_HANDLE);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool Direct3D11MapBuffer(PulseBuffer buffer, PulseMapMode mode, void** data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Direct3D11UnmapBuffer(PulseBuffer buffer)
|
||||
{
|
||||
}
|
||||
|
||||
bool Direct3D11CopyBufferToBuffer(PulseCommandList cmd, const PulseBufferRegion* src, const PulseBufferRegion* dst)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Direct3D11CopyBufferToImage(PulseCommandList cmd, const PulseBufferRegion* src, const PulseImageRegion* dst)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Direct3D11DestroyBuffer(PulseDevice device, PulseBuffer buffer)
|
||||
{
|
||||
}
|
||||
28
Sources/Backends/D3D11/D3D11Buffer.h
git.filemode.normal_file
28
Sources/Backends/D3D11/D3D11Buffer.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_D3D11_BACKEND
|
||||
|
||||
#ifndef PULSE_D3D11_BUFFER_H_
|
||||
#define PULSE_D3D11_BUFFER_H_
|
||||
|
||||
#include "D3D11.h"
|
||||
|
||||
typedef struct Direct3D11Buffer
|
||||
{
|
||||
int dummy;
|
||||
} Direct3D11Buffer;
|
||||
|
||||
PulseBuffer Direct3D11CreateBuffer(PulseDevice device, const PulseBufferCreateInfo* create_infos);
|
||||
bool Direct3D11MapBuffer(PulseBuffer buffer, PulseMapMode mode, void** data);
|
||||
void Direct3D11UnmapBuffer(PulseBuffer buffer);
|
||||
bool Direct3D11CopyBufferToBuffer(PulseCommandList cmd, const PulseBufferRegion* src, const PulseBufferRegion* dst);
|
||||
bool Direct3D11CopyBufferToImage(PulseCommandList cmd, const PulseBufferRegion* src, const PulseImageRegion* dst);
|
||||
void Direct3D11DestroyBuffer(PulseDevice device, PulseBuffer buffer);
|
||||
|
||||
#endif // PULSE_D3D11_BUFFER_H_
|
||||
|
||||
#endif // PULSE_ENABLE_D3D11_BACKEND
|
||||
29
Sources/Backends/D3D11/D3D11CommandList.c
git.filemode.normal_file
29
Sources/Backends/D3D11/D3D11CommandList.c
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>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "D3D11.h"
|
||||
#include "D3D11Fence.h"
|
||||
#include "D3D11Device.h"
|
||||
#include "D3D11CommandList.h"
|
||||
#include "D3D11ComputePass.h"
|
||||
#include "D3D11ComputePipeline.h"
|
||||
#include "D3D11Buffer.h"
|
||||
|
||||
PulseCommandList Direct3D11RequestCommandList(PulseDevice device, PulseCommandListUsage usage)
|
||||
{
|
||||
PULSE_CHECK_HANDLE_RETVAL(device, PULSE_NULL_HANDLE);
|
||||
PulseCommandList cmd = (PulseCommandList)calloc(1, sizeof(PulseCommandListHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(cmd, PULSE_NULL_HANDLE);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
bool Direct3D11SubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence)
|
||||
{
|
||||
}
|
||||
|
||||
void Direct3D11ReleaseCommandList(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
}
|
||||
29
Sources/Backends/D3D11/D3D11CommandList.h
git.filemode.normal_file
29
Sources/Backends/D3D11/D3D11CommandList.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_D3D11_BACKEND
|
||||
|
||||
#ifndef PULSE_D3D11_COMMAND_LIST_H_
|
||||
#define PULSE_D3D11_COMMAND_LIST_H_
|
||||
|
||||
#include <stdatomic.h>
|
||||
#include <tinycthread.h>
|
||||
|
||||
#include "D3D11.h"
|
||||
#include "D3D11Fence.h"
|
||||
|
||||
typedef struct Direct3D11CommandList
|
||||
{
|
||||
int dummy;
|
||||
} Direct3D11CommandList;
|
||||
|
||||
PulseCommandList Direct3D11RequestCommandList(PulseDevice device, PulseCommandListUsage usage);
|
||||
bool Direct3D11SubmitCommandList(PulseDevice device, PulseCommandList cmd, PulseFence fence);
|
||||
void Direct3D11ReleaseCommandList(PulseDevice device, PulseCommandList cmd);
|
||||
|
||||
#endif // PULSE_D3D11_COMMAND_LIST_H_
|
||||
|
||||
#endif // PULSE_ENABLE_D3D11_BACKEND
|
||||
49
Sources/Backends/D3D11/D3D11ComputePass.c
git.filemode.normal_file
49
Sources/Backends/D3D11/D3D11ComputePass.c
git.filemode.normal_file
@@ -0,0 +1,49 @@
|
||||
// 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 "D3D11.h"
|
||||
#include "D3D11ComputePass.h"
|
||||
#include "D3D11CommandList.h"
|
||||
|
||||
PulseComputePass Direct3D11CreateComputePass(PulseDevice device, PulseCommandList cmd)
|
||||
{
|
||||
PULSE_UNUSED(device);
|
||||
PulseComputePass pass = (PulseComputePass)calloc(1, sizeof(PulseComputePassHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(pass, PULSE_NULL_HANDLE);
|
||||
return pass;
|
||||
}
|
||||
|
||||
void Direct3D11DestroyComputePass(PulseDevice device, PulseComputePass pass)
|
||||
{
|
||||
}
|
||||
|
||||
PulseComputePass Direct3D11BeginComputePass(PulseCommandList cmd)
|
||||
{
|
||||
}
|
||||
|
||||
void Direct3D11EndComputePass(PulseComputePass pass)
|
||||
{
|
||||
}
|
||||
|
||||
void Direct3D11BindStorageBuffers(PulseComputePass pass, const PulseBuffer* buffers, uint32_t num_buffers)
|
||||
{
|
||||
}
|
||||
|
||||
void Direct3D11BindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size)
|
||||
{
|
||||
}
|
||||
|
||||
void Direct3D11BindStorageImages(PulseComputePass pass, const PulseImage* images, uint32_t num_images)
|
||||
{
|
||||
}
|
||||
|
||||
void Direct3D11BindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline)
|
||||
{
|
||||
}
|
||||
|
||||
void Direct3D11DispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z)
|
||||
{
|
||||
}
|
||||
27
Sources/Backends/D3D11/D3D11ComputePass.h
git.filemode.normal_file
27
Sources/Backends/D3D11/D3D11ComputePass.h
git.filemode.normal_file
@@ -0,0 +1,27 @@
|
||||
// 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_D3D11_BACKEND
|
||||
|
||||
#ifndef PULSE_D3D11_COMPUTE_PASS_H_
|
||||
#define PULSE_D3D11_COMPUTE_PASS_H_
|
||||
|
||||
#include "D3D11.h"
|
||||
|
||||
PulseComputePass Direct3D11CreateComputePass(PulseDevice device, PulseCommandList cmd);
|
||||
void Direct3D11DestroyComputePass(PulseDevice device, PulseComputePass pass);
|
||||
|
||||
PulseComputePass Direct3D11BeginComputePass(PulseCommandList cmd);
|
||||
void Direct3D11EndComputePass(PulseComputePass pass);
|
||||
void Direct3D11BindStorageBuffers(PulseComputePass pass, const PulseBuffer* buffers, uint32_t num_buffers);
|
||||
void Direct3D11BindUniformData(PulseComputePass pass, uint32_t slot, const void* data, uint32_t data_size);
|
||||
void Direct3D11BindStorageImages(PulseComputePass pass, const PulseImage* images, uint32_t num_images);
|
||||
void Direct3D11BindComputePipeline(PulseComputePass pass, PulseComputePipeline pipeline);
|
||||
void Direct3D11DispatchComputations(PulseComputePass pass, uint32_t groupcount_x, uint32_t groupcount_y, uint32_t groupcount_z);
|
||||
|
||||
#endif // PULSE_D3D11_COMPUTE_PASS_H_
|
||||
|
||||
#endif // PULSE_ENABLE_D3D11_BACKEND
|
||||
22
Sources/Backends/D3D11/D3D11ComputePipeline.c
git.filemode.normal_file
22
Sources/Backends/D3D11/D3D11ComputePipeline.c
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>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "D3D11.h"
|
||||
#include "D3D11Device.h"
|
||||
#include "D3D11ComputePipeline.h"
|
||||
|
||||
PulseComputePipeline Direct3D11CreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info)
|
||||
{
|
||||
PulseComputePipelineHandler* pipeline = (PulseComputePipelineHandler*)calloc(1, sizeof(PulseComputePipelineHandler));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(pipeline, PULSE_NULL_HANDLE);
|
||||
if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(device->backend))
|
||||
PulseLogInfoFmt(device->backend, "(D3D11) created new compute pipeline %p", pipeline);
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
void Direct3D11DestroyComputePipeline(PulseDevice device, PulseComputePipeline pipeline)
|
||||
{
|
||||
}
|
||||
24
Sources/Backends/D3D11/D3D11ComputePipeline.h
git.filemode.normal_file
24
Sources/Backends/D3D11/D3D11ComputePipeline.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_D3D11_BACKEND
|
||||
|
||||
#ifndef PULSE_D3D11_COMPUTE_PIPELINE_H_
|
||||
#define PULSE_D3D11_COMPUTE_PIPELINE_H_
|
||||
|
||||
#include "D3D11.h"
|
||||
|
||||
typedef struct Direct3D11ComputePipeline
|
||||
{
|
||||
int dummy;
|
||||
} Direct3D11ComputePipeline;
|
||||
|
||||
PulseComputePipeline Direct3D11CreateComputePipeline(PulseDevice device, const PulseComputePipelineCreateInfo* info);
|
||||
void Direct3D11DestroyComputePipeline(PulseDevice device, PulseComputePipeline pipeline);
|
||||
|
||||
#endif // PULSE_D3D11_COMPUTE_PIPELINE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_D3D11_BACKEND
|
||||
@@ -2,13 +2,18 @@
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "D3D11.h"
|
||||
#include "D3D11ComputePipeline.h"
|
||||
#include "D3D11CommandList.h"
|
||||
#include "D3D11Device.h"
|
||||
#include "D3D11Fence.h"
|
||||
#include "D3D11Buffer.h"
|
||||
#include "D3D11Image.h"
|
||||
#include "D3D11ComputePass.h"
|
||||
|
||||
bool Direct3D11IsDedicatedAdapter(IDXGIAdapter1* adapter)
|
||||
{
|
||||
@@ -146,8 +151,7 @@ PulseDevice Direct3D11CreateDevice(PulseBackend backend, PulseDevice* forbiden_d
|
||||
};
|
||||
|
||||
D3D11CreateDevice((IDXGIAdapter*)device->adapter, D3D_DRIVER_TYPE_UNKNOWN, PULSE_NULLPTR, 0, feature_levels, PULSE_SIZEOF_ARRAY(feature_levels), D3D11_SDK_VERSION, &device->device, PULSE_NULLPTR, &device->context);
|
||||
|
||||
pulse_device->PFN_DestroyDevice = Direct3D11DestroyDevice;
|
||||
PULSE_LOAD_DRIVER_DEVICE(Direct3D11);
|
||||
|
||||
if(PULSE_IS_BACKEND_HIGH_LEVEL_DEBUG(backend))
|
||||
PulseLogInfoFmt(backend, "(D3D11) created device from %ls", device->description.Description);
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
#ifdef PULSE_ENABLE_D3D11_BACKEND
|
||||
|
||||
#ifndef PULSE_D3D11_DEVICE_H_
|
||||
#define PULSE_D3D11_DEVICE_H_
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "D3D11.h"
|
||||
|
||||
typedef struct Direct3D11Device
|
||||
|
||||
31
Sources/Backends/D3D11/D3D11Fence.c
git.filemode.normal_file
31
Sources/Backends/D3D11/D3D11Fence.c
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>
|
||||
#include "../../PulseInternal.h"
|
||||
#include "D3D11.h"
|
||||
#include "D3D11Fence.h"
|
||||
#include "D3D11CommandList.h"
|
||||
|
||||
PulseFence Direct3D11CreateFence(PulseDevice device)
|
||||
{
|
||||
PulseFence fence = (PulseFence)calloc(1, sizeof(PulseFence));
|
||||
PULSE_CHECK_ALLOCATION_RETVAL(fence, PULSE_NULL_HANDLE);
|
||||
return fence;
|
||||
}
|
||||
|
||||
void Direct3D11DestroyFence(PulseDevice device, PulseFence fence)
|
||||
{
|
||||
free(fence);
|
||||
}
|
||||
|
||||
bool Direct3D11IsFenceReady(PulseDevice device, PulseFence fence)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Direct3D11WaitForFences(PulseDevice device, const PulseFence* fences, uint32_t fences_count, bool wait_for_all)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
27
Sources/Backends/D3D11/D3D11Fence.h
git.filemode.normal_file
27
Sources/Backends/D3D11/D3D11Fence.h
git.filemode.normal_file
@@ -0,0 +1,27 @@
|
||||
// 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_D3D11_BACKEND
|
||||
|
||||
#ifndef PULSE_D3D11_FENCE_H_
|
||||
#define PULSE_D3D11_FENCE_H_
|
||||
|
||||
#include <Pulse.h>
|
||||
#include "D3D11.h"
|
||||
|
||||
typedef struct Direct3D11Fence
|
||||
{
|
||||
int dummy;
|
||||
} Direct3D11Fence;
|
||||
|
||||
PulseFence Direct3D11CreateFence(PulseDevice device);
|
||||
void Direct3D11DestroyFence(PulseDevice device, PulseFence fence);
|
||||
bool Direct3D11IsFenceReady(PulseDevice device, PulseFence fence);
|
||||
bool Direct3D11WaitForFences(PulseDevice device, const PulseFence* fences, uint32_t fences_count, bool wait_for_all);
|
||||
|
||||
#endif // PULSE_D3D11_FENCE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_D3D11_BACKEND
|
||||
28
Sources/Backends/D3D11/D3D11Image.c
git.filemode.normal_file
28
Sources/Backends/D3D11/D3D11Image.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 "D3D11.h"
|
||||
#include "D3D11Image.h"
|
||||
|
||||
PulseImage Direct3D11CreateImage(PulseDevice device, const PulseImageCreateInfo* create_infos)
|
||||
{
|
||||
}
|
||||
|
||||
bool Direct3D11IsImageFormatValid(PulseDevice device, PulseImageFormat format, PulseImageType type, PulseImageUsageFlags usage)
|
||||
{
|
||||
}
|
||||
|
||||
bool Direct3D11CopyImageToBuffer(PulseCommandList cmd, const PulseImageRegion* src, const PulseBufferRegion* dst)
|
||||
{
|
||||
}
|
||||
|
||||
bool Direct3D11BlitImage(PulseCommandList cmd, const PulseImageRegion* src, const PulseImageRegion* dst)
|
||||
{
|
||||
}
|
||||
|
||||
void Direct3D11DestroyImage(PulseDevice device, PulseImage image)
|
||||
{
|
||||
}
|
||||
27
Sources/Backends/D3D11/D3D11Image.h
git.filemode.normal_file
27
Sources/Backends/D3D11/D3D11Image.h
git.filemode.normal_file
@@ -0,0 +1,27 @@
|
||||
// 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_D3D11_BACKEND
|
||||
|
||||
#ifndef PULSE_D3D11_IMAGE_H_
|
||||
#define PULSE_D3D11_IMAGE_H_
|
||||
|
||||
#include "D3D11.h"
|
||||
|
||||
typedef struct Direct3D11Image
|
||||
{
|
||||
int dummy;
|
||||
} Direct3D11Image;
|
||||
|
||||
PulseImage Direct3D11CreateImage(PulseDevice device, const PulseImageCreateInfo* create_infos);
|
||||
bool Direct3D11IsImageFormatValid(PulseDevice device, PulseImageFormat format, PulseImageType type, PulseImageUsageFlags usage);
|
||||
bool Direct3D11CopyImageToBuffer(PulseCommandList cmd, const PulseImageRegion* src, const PulseBufferRegion* dst);
|
||||
bool Direct3D11BlitImage(PulseCommandList cmd, const PulseImageRegion* src, const PulseImageRegion* dst);
|
||||
void Direct3D11DestroyImage(PulseDevice device, PulseImage image);
|
||||
|
||||
#endif // PULSE_D3D11_IMAGE_H_
|
||||
|
||||
#endif // PULSE_ENABLE_D3D11_BACKEND
|
||||
Reference in New Issue
Block a user