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