mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 15:33:34 +00:00
adding sources
This commit is contained in:
@@ -12,6 +12,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "PulseProfile.h"
|
||||
|
||||
@@ -31,6 +32,14 @@ PULSE_DEFINE_NULLABLE_HANDLE(PulseFence);
|
||||
PULSE_DEFINE_NULLABLE_HANDLE(PulseImage);
|
||||
|
||||
// Flags
|
||||
typedef enum PulseBackendBits
|
||||
{
|
||||
PULSE_BACKEND_INVALID = PULSE_BIT(1),
|
||||
PULSE_BACKEND_VULKAN = PULSE_BIT(2),
|
||||
// More to come
|
||||
} PulseBackendBits;
|
||||
typedef PulseFlags PulseBackendFlags;
|
||||
|
||||
typedef enum PulseBufferUsageBits
|
||||
{
|
||||
PULSE_BUFFER_USAGE_TRANSFER_UPLOAD = PULSE_BIT(1),
|
||||
@@ -146,7 +155,6 @@ typedef enum PulseImageFormat
|
||||
} PulseImageFormat;
|
||||
|
||||
// Structs
|
||||
|
||||
typedef struct PulseBufferCreateInfo
|
||||
{
|
||||
PulseBufferUsageFlags usage;
|
||||
@@ -221,6 +229,12 @@ typedef struct PulseImageRegion
|
||||
uint32_t depth;
|
||||
} PulseImageRegion;
|
||||
|
||||
// Functions
|
||||
PULSE_API PulseDevice PulseCreateDevice(PulseBackendFlags backend_candidates, PulseShaderFormatsFlags shader_formats_used);
|
||||
PULSE_API void PulseDestroyDevice(PulseDevice device);
|
||||
PULSE_API PulseBackendBits PulseGetBackendInUseByDevice(PulseDevice device);
|
||||
PULSE_API bool PulseSupportsBackend(PulseBackendFlags backend_candidates, PulseShaderFormatsFlags shader_formats_used);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,71 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
#define PULSE_COMPILER_BORDLAND
|
||||
#elif defined(__clang__)
|
||||
#define PULSE_COMPILER_CLANG
|
||||
#ifdef __MINGW32__
|
||||
#define PULSE_COMPILER_MINGW
|
||||
#ifdef __MINGW64_VERSION_MAJOR
|
||||
#define PULSE_COMPILER_MINGW_W64
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__GNUC__) || defined(__MINGW32__)
|
||||
#define PULSE_COMPILER_GCC
|
||||
#ifdef __MINGW32__
|
||||
#define PULSE_COMPILER_MINGW
|
||||
#ifdef __MINGW64_VERSION_MAJOR
|
||||
#define PULSE_COMPILER_MINGW_W64
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__INTEL_COMPILER) || defined(__ICL)
|
||||
#define PULSE_COMPILER_INTEL
|
||||
#elif defined(_MSC_VER)
|
||||
#define PULSE_COMPILER_MSVC
|
||||
#else
|
||||
#define PULSE_COMPILER_UNKNOWN
|
||||
#warning "This compiler is not fully supported"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#define PULSE_PLAT_WINDOWS
|
||||
#elif defined(__linux__)
|
||||
#define PULSE_PLAT_LINUX
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
#define PULSE_PLAT_MACOS
|
||||
#elif defined(unix) || defined(__unix__) || defined(__unix)
|
||||
#define PULSE_PLAT_UNIX
|
||||
#else
|
||||
#error "Unknown environment (not Windows, not Linux, not MacOS, not Unix)"
|
||||
#endif
|
||||
|
||||
#ifndef PULSE_STATIC
|
||||
#ifdef PULSE_PLAT_WINDOWS
|
||||
#ifdef PULSE_COMPILER_MSVC
|
||||
#ifdef PULSE_BUILD
|
||||
#define PULSE_API __declspec(dllexport)
|
||||
#else
|
||||
#define PULSE_API __declspec(dllimport)
|
||||
#endif
|
||||
#elif defined(PULSE_COMPILER_GCC)
|
||||
#ifdef PULSE_BUILD
|
||||
#define PULSE_API __attribute__((dllexport))
|
||||
#else
|
||||
#define PULSE_API __attribute__((dllimport))
|
||||
#endif
|
||||
#else
|
||||
#define PULSE_API
|
||||
#endif
|
||||
#elif defined(PULSE_COMPILER_GCC)
|
||||
#define PULSE_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define PULSE_API
|
||||
#endif
|
||||
#else
|
||||
#define PULSE_API
|
||||
#endif
|
||||
|
||||
#define PULSE_DEFINE_NULLABLE_HANDLE(object) typedef struct object##Handler* object
|
||||
|
||||
#if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L))
|
||||
|
||||
6
Sources/Backends/Vulkan/VulkanDevice.c
git.filemode.normal_file
6
Sources/Backends/Vulkan/VulkanDevice.c
git.filemode.normal_file
@@ -0,0 +1,6 @@
|
||||
// Copyright (C) 2024 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
21
Sources/PulseDevice.c
git.filemode.normal_file
21
Sources/PulseDevice.c
git.filemode.normal_file
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2024 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
PULSE_API PulseDevice PulseCreateDevice(PulseBackendFlags backend_candidates, PulseShaderFormatsFlags shader_formats_used)
|
||||
{
|
||||
}
|
||||
|
||||
PULSE_API void PulseDestroyDevice(PulseDevice device)
|
||||
{
|
||||
}
|
||||
|
||||
PULSE_API PulseBackendBits PulseGetBackendInUseByDevice(PulseDevice device)
|
||||
{
|
||||
}
|
||||
|
||||
PULSE_API bool PulseSupportsBackend(PulseBackendFlags backend_candidates, PulseShaderFormatsFlags shader_formats_used)
|
||||
{
|
||||
}
|
||||
10
Sources/PulseDevice.h
git.filemode.normal_file
10
Sources/PulseDevice.h
git.filemode.normal_file
@@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2024 kanel
|
||||
// This file is part of "Pulse"
|
||||
// For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
#include <Pulse.h>
|
||||
|
||||
typedef struct PulseDeviceHandler
|
||||
{
|
||||
|
||||
} PulseDeviceHandler;
|
||||
43
xmake.lua
43
xmake.lua
@@ -0,0 +1,43 @@
|
||||
-- Copyright (C) 2024 kanel
|
||||
-- This file is part of "Pulse"
|
||||
-- For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
local sanitizers = {
|
||||
asan = "address",
|
||||
lsan = "leak",
|
||||
tsan = "thread",
|
||||
}
|
||||
|
||||
for opt, policy in table.orderpairs(sanitizers) do
|
||||
option(opt, { description = "Enable " .. opt, default = false })
|
||||
if has_config(opt) then
|
||||
set_policy("build.sanitizer." .. policy, true)
|
||||
end
|
||||
end
|
||||
|
||||
add_rules("mode.debug", "mode.release")
|
||||
|
||||
add_includedirs("Includes")
|
||||
set_languages("c99", "cxx20")
|
||||
|
||||
set_objectdir("build/Objs/$(os)_$(arch)")
|
||||
set_targetdir("build/Bin/$(os)_$(arch)")
|
||||
set_rundir("build/Bin/$(os)_$(arch)")
|
||||
set_dependir("build/.deps")
|
||||
|
||||
set_optimize("fastest")
|
||||
|
||||
target("pulse_gpu")
|
||||
set_kind("$(kind)")
|
||||
add_defines("PULSE_BUILD")
|
||||
add_headerfiles("Includes/*.hpp)")
|
||||
add_headerfiles("Sources/**.h", { prefixdir = "private", install = false })
|
||||
add_headerfiles("Sources/**.inl", { prefixdir = "private", install = false })
|
||||
add_files("Sources/**.c")
|
||||
add_files("Sources/**.cpp")
|
||||
on_load(function(target)
|
||||
if target:kind() == "static" then
|
||||
target:add("defines", "PULSE_STATIC", { public = true })
|
||||
end
|
||||
end)
|
||||
target_end()
|
||||
|
||||
Reference in New Issue
Block a user