Linux fixes
This commit is contained in:
+1
-4
@@ -13,9 +13,6 @@
|
|||||||
[submodule "external/SPIRV-Cross"]
|
[submodule "external/SPIRV-Cross"]
|
||||||
path = external/SPIRV-Cross
|
path = external/SPIRV-Cross
|
||||||
url = https://github.com/KhronosGroup/SPIRV-Cross.git
|
url = https://github.com/KhronosGroup/SPIRV-Cross.git
|
||||||
[submodule "external/ktx"]
|
|
||||||
path = external/ktx
|
|
||||||
url = https://github.com/KhronosGroup/KTX-Software
|
|
||||||
[submodule "external/stb"]
|
[submodule "external/stb"]
|
||||||
path = external/stb
|
path = external/stb
|
||||||
url = https://github.com/nothings/stb
|
url = https://github.com/nothings/stb
|
||||||
@@ -24,4 +21,4 @@
|
|||||||
url = https://github.com/shader-slang/slang.git
|
url = https://github.com/shader-slang/slang.git
|
||||||
[submodule "external/boost"]
|
[submodule "external/boost"]
|
||||||
path = external/boost
|
path = external/boost
|
||||||
url = https://github.com/boostorg/boost
|
url = https://github.com/boostorg/boost
|
||||||
Vendored
+2
@@ -13,6 +13,7 @@
|
|||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceRoot}/bin/Debug",
|
"cwd": "${workspaceRoot}/bin/Debug",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
|
"visualizerFile": "${workspaceRoot}/Seele.natvis",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
"externalConsole": false,
|
"externalConsole": false,
|
||||||
"setupCommands": [
|
"setupCommands": [
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"cwd": "${workspaceRoot}/bin/Debug",
|
"cwd": "${workspaceRoot}/bin/Debug",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
|
"visualizerFile": "${workspaceRoot}/Seele.natvis"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Test",
|
"name": "Test",
|
||||||
|
|||||||
Vendored
-1
Submodule external/ktx deleted from a2ccc90eff
@@ -23,7 +23,7 @@ struct GraphicsInitializer
|
|||||||
: applicationName("SeeleEngine")
|
: applicationName("SeeleEngine")
|
||||||
, engineName("SeeleEngine")
|
, engineName("SeeleEngine")
|
||||||
, windowLayoutFile(nullptr)
|
, windowLayoutFile(nullptr)
|
||||||
, layers{"VK_LAYER_KHRONOS_validation", "VK_LAYER_LUNARG_monitor"}
|
, layers{}
|
||||||
, instanceExtensions{}
|
, instanceExtensions{}
|
||||||
, deviceExtensions{"VK_KHR_swapchain"}
|
, deviceExtensions{"VK_KHR_swapchain"}
|
||||||
, windowHandle(nullptr)
|
, windowHandle(nullptr)
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ MeshBatchElement::MeshBatchElement()
|
|||||||
, indirectArgsBuffer(nullptr)
|
, indirectArgsBuffer(nullptr)
|
||||||
{}
|
{}
|
||||||
MeshBatch::MeshBatch()
|
MeshBatch::MeshBatch()
|
||||||
: useReverseCulling(false)
|
: elements()
|
||||||
|
, useReverseCulling(false)
|
||||||
, isBackfaceCullingDisabled(false)
|
, isBackfaceCullingDisabled(false)
|
||||||
, isCastingShadow(true)
|
, isCastingShadow(true)
|
||||||
, useWireframe(false)
|
, useWireframe(false)
|
||||||
, topology(Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST)
|
, topology(Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST)
|
||||||
, vertexInput(nullptr)
|
, vertexInput(nullptr)
|
||||||
, material(nullptr)
|
, material(nullptr)
|
||||||
, elements()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
virtual void launchStart();
|
virtual void launchStart();
|
||||||
virtual void start() {}
|
virtual void start() {}
|
||||||
Array<Job> launchTick(float deltaTime) const;
|
Array<Job> launchTick(float deltaTime) const;
|
||||||
virtual Job tick(float deltaTime) const { co_return; }
|
virtual Job tick(float) const { co_return; }
|
||||||
Array<Job> launchUpdate();
|
Array<Job> launchUpdate();
|
||||||
virtual Job update() { co_return; }
|
virtual Job update() { co_return; }
|
||||||
void notifySceneAttach(PScene scene);
|
void notifySceneAttach(PScene scene);
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ CameraComponent::CameraComponent()
|
|||||||
, fieldOfView(0)
|
, fieldOfView(0)
|
||||||
, bNeedsViewBuild(true)
|
, bNeedsViewBuild(true)
|
||||||
, bNeedsProjectionBuild(true)
|
, bNeedsProjectionBuild(true)
|
||||||
, projectionMatrix(Matrix4())
|
|
||||||
, viewMatrix(Matrix4())
|
, viewMatrix(Matrix4())
|
||||||
|
, projectionMatrix(Matrix4())
|
||||||
{
|
{
|
||||||
yaw = 0;
|
yaw = 0;
|
||||||
pitch = 0;
|
pitch = 0;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
void launchStart();
|
void launchStart();
|
||||||
virtual void start() {};
|
virtual void start() {};
|
||||||
Array<Job> launchTick(float deltaTime) const;
|
Array<Job> launchTick(float deltaTime) const;
|
||||||
virtual Job tick(float deltaTime) const { co_return; }
|
virtual Job tick(float) const { co_return; }
|
||||||
Array<Job> launchUpdate();
|
Array<Job> launchUpdate();
|
||||||
virtual Job update() { co_return; }
|
virtual Job update() { co_return; }
|
||||||
PComponent getParent();
|
PComponent getParent();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ void MyComponent::start()
|
|||||||
otherComp.update();
|
otherComp.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Job MyComponent::tick(float deltatime) const
|
Job MyComponent::tick(float) const
|
||||||
{
|
{
|
||||||
//std::cout << "MyComponent::tick" << std::endl;
|
//std::cout << "MyComponent::tick" << std::endl;
|
||||||
++writable;
|
++writable;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele;
|
||||||
|
|
||||||
Job MyOtherComponent::tick(float deltaTime) const
|
Job MyOtherComponent::tick(float) const
|
||||||
{
|
{
|
||||||
//std::cout << *data << std::endl;
|
//std::cout << *data << std::endl;
|
||||||
co_return;
|
co_return;
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ public:
|
|||||||
Writable()
|
Writable()
|
||||||
{}
|
{}
|
||||||
Writable(T initialData)
|
Writable(T initialData)
|
||||||
: data(initialData)
|
: toBeWritten(initialData)
|
||||||
, toBeWritten(initialData)
|
, data(initialData)
|
||||||
{}
|
{}
|
||||||
Writable(const Writable& other) = delete;
|
Writable(const Writable& other) = delete;
|
||||||
Writable(Writable&& other) = default;
|
Writable(Writable&& other) = default;
|
||||||
|
|||||||
@@ -13,18 +13,20 @@ Event::Event(nullptr_t)
|
|||||||
Event::Event(const std::string &name, const std::source_location &location)
|
Event::Event(const std::string &name, const std::source_location &location)
|
||||||
: name(name)
|
: name(name)
|
||||||
, location(location)
|
, location(location)
|
||||||
|
, eventLock(std::make_unique<std::mutex>())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::Event(const std::source_location &location)
|
Event::Event(const std::source_location &location)
|
||||||
: name(location.function_name())
|
: name(location.function_name())
|
||||||
, location(location)
|
, location(location)
|
||||||
|
, eventLock(std::make_unique<std::mutex>())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Event::raise()
|
void Event::raise()
|
||||||
{
|
{
|
||||||
std::scoped_lock lock(eventLock);
|
std::scoped_lock lock(*eventLock);
|
||||||
data = true;
|
data = true;
|
||||||
if(waitingJobs.size() > 0)
|
if(waitingJobs.size() > 0)
|
||||||
{
|
{
|
||||||
@@ -37,17 +39,17 @@ void Event::raise()
|
|||||||
}
|
}
|
||||||
void Event::reset()
|
void Event::reset()
|
||||||
{
|
{
|
||||||
std::scoped_lock lock(eventLock);
|
std::scoped_lock lock(*eventLock);
|
||||||
data = false;
|
data = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Event::await_ready()
|
bool Event::await_ready()
|
||||||
{
|
{
|
||||||
eventLock.lock();
|
eventLock->lock();
|
||||||
bool result = data;
|
bool result = data;
|
||||||
if(result)
|
if(result)
|
||||||
{
|
{
|
||||||
eventLock.unlock();
|
eventLock->unlock();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -56,14 +58,14 @@ void Event::await_suspend(std::coroutine_handle<JobPromiseBase<false>> h)
|
|||||||
{
|
{
|
||||||
//h.promise().enqueue(this);
|
//h.promise().enqueue(this);
|
||||||
waitingJobs.add(JobBase<false>(&h.promise()));
|
waitingJobs.add(JobBase<false>(&h.promise()));
|
||||||
eventLock.unlock();
|
eventLock->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Event::await_suspend(std::coroutine_handle<JobPromiseBase<true>> h)
|
void Event::await_suspend(std::coroutine_handle<JobPromiseBase<true>> h)
|
||||||
{
|
{
|
||||||
//h.promise().enqueue(this);
|
//h.promise().enqueue(this);
|
||||||
waitingMainJobs.add(JobBase<true>(&h.promise()));
|
waitingMainJobs.add(JobBase<true>(&h.promise()));
|
||||||
eventLock.unlock();
|
eventLock->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadPool::ThreadPool(uint32 threadCount)
|
ThreadPool::ThreadPool(uint32 threadCount)
|
||||||
|
|||||||
+63
-56
@@ -34,7 +34,7 @@ public:
|
|||||||
}
|
}
|
||||||
operator bool()
|
operator bool()
|
||||||
{
|
{
|
||||||
std::scoped_lock lock(eventLock);
|
std::scoped_lock lock(*eventLock);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,9 +58,9 @@ public:
|
|||||||
void await_suspend(std::coroutine_handle<JobPromiseBase<true>> h);
|
void await_suspend(std::coroutine_handle<JobPromiseBase<true>> h);
|
||||||
constexpr void await_resume() {}
|
constexpr void await_resume() {}
|
||||||
private:
|
private:
|
||||||
std::mutex eventLock;
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::source_location location;
|
std::source_location location;
|
||||||
|
std::unique_ptr<std::mutex> eventLock;
|
||||||
bool data = false;
|
bool data = false;
|
||||||
Array<JobBase<false>> waitingJobs;
|
Array<JobBase<false>> waitingJobs;
|
||||||
Array<JobBase<true>> waitingMainJobs;
|
Array<JobBase<true>> waitingMainJobs;
|
||||||
@@ -120,16 +120,6 @@ struct JobPromiseBase
|
|||||||
state = State::EXECUTING;
|
state = State::EXECUTING;
|
||||||
handle.resume();
|
handle.resume();
|
||||||
}
|
}
|
||||||
void markDone()
|
|
||||||
{
|
|
||||||
state = State::DONE;
|
|
||||||
finishedEvent.raise();
|
|
||||||
if(continuation)
|
|
||||||
{
|
|
||||||
getGlobalThreadPool().scheduleJob(JobBase<MainJob>(continuation));
|
|
||||||
continuation->removeRef();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void setContinuation(JobPromiseBase* cont)
|
void setContinuation(JobPromiseBase* cont)
|
||||||
{
|
{
|
||||||
assert(cont->ready());
|
assert(cont->ready());
|
||||||
@@ -158,26 +148,8 @@ struct JobPromiseBase
|
|||||||
{
|
{
|
||||||
return state == State::READY;
|
return state == State::READY;
|
||||||
}
|
}
|
||||||
void enqueue(Event* event)
|
void enqueue(Event* event);
|
||||||
{
|
bool schedule();
|
||||||
if(!handle || handle.done() || waiting() || scheduled())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
state = State::WAITING;
|
|
||||||
waitingFor = event;
|
|
||||||
getGlobalThreadPool().enqueueWaiting(event, std::move(JobBase<MainJob>(this)));
|
|
||||||
}
|
|
||||||
bool schedule()
|
|
||||||
{
|
|
||||||
if(!handle || done() || !ready())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
state = State::SCHEDULED;
|
|
||||||
getGlobalThreadPool().scheduleJob(std::move(JobBase<MainJob>(this)));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
void addRef()
|
void addRef()
|
||||||
{
|
{
|
||||||
numRefs++;
|
numRefs++;
|
||||||
@@ -290,15 +262,8 @@ public:
|
|||||||
}
|
}
|
||||||
static JobBase all() = delete;
|
static JobBase all() = delete;
|
||||||
template<std::ranges::range Iterable>
|
template<std::ranges::range Iterable>
|
||||||
requires std::same_as<std::ranges::range_value_t<Iterable>, JobBase>
|
requires std::same_as<std::ranges::range_value_t<Iterable>, JobBase<MainJob>>
|
||||||
static JobBase all(Iterable collection)
|
static JobBase<MainJob> all(Iterable collection);
|
||||||
{
|
|
||||||
getGlobalThreadPool().scheduleBatch(collection);
|
|
||||||
for(auto it : collection)
|
|
||||||
{
|
|
||||||
co_await it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template<std::ranges::range Iterable>
|
template<std::ranges::range Iterable>
|
||||||
static JobBase all(Iterable collection)
|
static JobBase all(Iterable collection)
|
||||||
{
|
{
|
||||||
@@ -314,19 +279,7 @@ public:
|
|||||||
}
|
}
|
||||||
template<typename JobFunc, std::ranges::input_range Iterable>
|
template<typename JobFunc, std::ranges::input_range Iterable>
|
||||||
requires std::invocable<JobFunc, std::ranges::range_reference_t<Iterable>>
|
requires std::invocable<JobFunc, std::ranges::range_reference_t<Iterable>>
|
||||||
static JobBase launchJobs(JobFunc&& func, Iterable params)
|
static JobBase launchJobs(JobFunc&& func, Iterable params);
|
||||||
{
|
|
||||||
Array<JobBase> jobs;
|
|
||||||
for(auto&& param : params)
|
|
||||||
{
|
|
||||||
jobs.add(func(param));
|
|
||||||
}
|
|
||||||
getGlobalThreadPool().scheduleBatch(jobs);
|
|
||||||
for(auto job : jobs)
|
|
||||||
{
|
|
||||||
co_await job;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
JobPromiseBase<MainJob>* promise;
|
JobPromiseBase<MainJob>* promise;
|
||||||
friend class ThreadPool;
|
friend class ThreadPool;
|
||||||
@@ -407,8 +360,62 @@ inline auto JobPromiseBase<MainJob>::initial_suspend() noexcept
|
|||||||
template<bool MainJob>
|
template<bool MainJob>
|
||||||
inline auto JobPromiseBase<MainJob>::final_suspend() noexcept
|
inline auto JobPromiseBase<MainJob>::final_suspend() noexcept
|
||||||
{
|
{
|
||||||
markDone();
|
state = State::DONE;
|
||||||
|
finishedEvent.raise();
|
||||||
|
if(continuation)
|
||||||
|
{
|
||||||
|
getGlobalThreadPool().scheduleJob(JobBase<MainJob>(continuation));
|
||||||
|
continuation->removeRef();
|
||||||
|
}
|
||||||
return std::suspend_always{};
|
return std::suspend_always{};
|
||||||
}
|
}
|
||||||
|
//template<bool MainJob>
|
||||||
|
//inline void JobPromiseBase<MainJob>::enqueue(Event* event)
|
||||||
|
//{
|
||||||
|
// if(!handle || handle.done() || waiting() || scheduled())
|
||||||
|
// {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// state = State::WAITING;
|
||||||
|
// waitingFor = event;
|
||||||
|
// getGlobalThreadPool().enqueueWaiting(event, std::move(JobBase<MainJob>(this)));
|
||||||
|
//}
|
||||||
|
template<bool MainJob>
|
||||||
|
inline bool JobPromiseBase<MainJob>::schedule()
|
||||||
|
{
|
||||||
|
if(!handle || done() || !ready())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
state = State::SCHEDULED;
|
||||||
|
getGlobalThreadPool().scheduleJob(std::move(JobBase<MainJob>(this)));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
template<bool MainJob>
|
||||||
|
template<std::ranges::range Iterable>
|
||||||
|
requires std::same_as<std::ranges::range_value_t<Iterable>, JobBase<MainJob>>
|
||||||
|
inline JobBase<MainJob> JobBase<MainJob>::all(Iterable collection)
|
||||||
|
{
|
||||||
|
getGlobalThreadPool().scheduleBatch(collection);
|
||||||
|
for(auto it : collection)
|
||||||
|
{
|
||||||
|
co_await it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template<bool MainJob>
|
||||||
|
template<typename JobFunc, std::ranges::input_range Iterable>
|
||||||
|
requires std::invocable<JobFunc, std::ranges::range_reference_t<Iterable>>
|
||||||
|
inline JobBase<MainJob> JobBase<MainJob>::launchJobs(JobFunc&& func, Iterable params)
|
||||||
|
{
|
||||||
|
Array<JobBase<MainJob>> jobs;
|
||||||
|
for(auto&& param : params)
|
||||||
|
{
|
||||||
|
jobs.add(func(param));
|
||||||
|
}
|
||||||
|
getGlobalThreadPool().scheduleBatch(jobs);
|
||||||
|
for(auto job : jobs)
|
||||||
|
{
|
||||||
|
co_await job;
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace Seele
|
} // namespace Seele
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ Seele::SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const Viewpo
|
|||||||
AssetRegistry::importFile("/home/dynamitos/TestSeeleProject/Assets/Ayaka/Avatar_Girl_Tex_FaceLightmap.png");
|
AssetRegistry::importFile("/home/dynamitos/TestSeeleProject/Assets/Ayaka/Avatar_Girl_Tex_FaceLightmap.png");
|
||||||
AssetRegistry::importFile("/home/dynamitos/TestSeeleProject/Assets/Ayaka/Ayaka.fbx");
|
AssetRegistry::importFile("/home/dynamitos/TestSeeleProject/Assets/Ayaka/Ayaka.fbx");
|
||||||
PPrimitiveComponent ayaka = new PrimitiveComponent(AssetRegistry::findMesh("Ayaka"));
|
PPrimitiveComponent ayaka = new PrimitiveComponent(AssetRegistry::findMesh("Ayaka"));
|
||||||
ayaka->addWorldTranslation(Vector(0, 0, 0));
|
ayaka->setRelativeLocation(Vector(0, 0, 0));
|
||||||
ayaka->setWorldScale(Vector(10, 10, 10));
|
ayaka->setRelativeScale(Vector(10, 10, 10));
|
||||||
scene->addPrimitiveComponent(ayaka);
|
scene->addPrimitiveComponent(ayaka);
|
||||||
|
|
||||||
//AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Ely\\Ely.fbx");
|
//AssetRegistry::importFile("D:\\Private\\Programming\\Unreal Engine\\Assets\\Ely\\Ely.fbx");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <vld.h>
|
//#include <vld.h>
|
||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user