Skip to content

Commit

Permalink
karm-gpu: Sketching out more of the GPU stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Jan 6, 2025
1 parent 3960d59 commit 46dfc50
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/libs/karm-gfx/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
],
"subdirs": [
"mixbox",
"cpu"
"cpu",
"gpu"
]
}
38 changes: 38 additions & 0 deletions src/libs/karm-gpu/base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma once

#include <karm-base/rc.h>
#include <karm-base/res.h>

namespace Karm::Gpu {

struct Device {
static Res<Strong<Device>> open();

virtual ~Device() = default;
};

struct Shader {
virtual ~Shader() = default;
};

struct CommandBuffer {
virtual ~CommandBuffer() = default;
};

struct RenderPass {
virtual ~RenderPass() = default;
};

struct Pipeline {
virtual ~Pipeline() = default;
};

struct Buffer {
virtual ~Buffer() = default;
};

struct Texture {
virtual ~Texture() = default;
};

} // namespace Karm::Gpu
3 changes: 2 additions & 1 deletion src/libs/karm-gpu/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"description": "GPU acceleration",
"requires": [
"karm-io",
"karm-math"
"karm-math",
"karm-shader"
]
}
4 changes: 3 additions & 1 deletion src/libs/karm-jit/arm/emit.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

namespace Karm::Jit::Arm {} // namespace Karm::Jit::Arm
namespace Karm::Jit::Arm {

} // namespace Karm::Jit::Arm
32 changes: 32 additions & 0 deletions src/libs/karm-jit/ir.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include <karm-base/base.h>
#include <karm-base/vec.h>

namespace Karm::Jit {

enum struct Op : u8 {
};

struct Ref {
enum struct _Type : u8 {

};

using enum _Type;

_Type type;
};

struct Inst {
Op op;
Ref out;
Ref lhs;
Ref rhs;
};

struct Block {
Vec<Inst> insts;
};

} // namespace Karm::Jit
5 changes: 5 additions & 0 deletions src/libs/karm-jit/spirv/emit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

namespace Karm::Jit::Spirv {

} // namespace Karm::Jit::Spirv
13 changes: 1 addition & 12 deletions src/libs/karm-rpc/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,8 @@
#include <karm-base/map.h>
#include <karm-io/pack.h>
#include <karm-logger/logger.h>
#include <karm-sys/context.h>
#include <karm-sys/socket.h>

struct ChannelHook : public Sys::Service {
Sys::IpcConnection con;

ChannelHook(Sys::IpcConnection con)
: con(std::move(con)) {}
};

inline ChannelHook &useChannel(Sys::Context &ctx = Sys::globalContext()) {
return ctx.use<ChannelHook>();
}
#include "hooks.h"

namespace Karm::Rpc {

Expand Down
15 changes: 15 additions & 0 deletions src/libs/karm-rpc/hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include <karm-sys/context.h>
#include <karm-sys/socket.h>

struct ChannelHook : public Sys::Service {
Sys::IpcConnection con;

ChannelHook(Sys::IpcConnection con)
: con(std::move(con)) {}
};

inline ChannelHook &useChannel(Sys::Context &ctx = Sys::globalContext()) {
return ctx.use<ChannelHook>();
}
7 changes: 7 additions & 0 deletions src/libs/karm-shader/ast.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

namespace Karm::Shader {

struct Expr {};

} // namespace Karm::Shader
7 changes: 7 additions & 0 deletions src/libs/karm-shader/comp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <karm-jit/ir.h>

#include "ast.h"

namespace Karm::Shader {

} // namespace Karm::Shader
9 changes: 9 additions & 0 deletions src/libs/karm-shader/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://schemas.cute.engineering/stable/cutekit.manifest.component.v1",
"id": "karm-shader",
"type": "lib",
"description": "Shader language & compiler",
"requires": [
"karm-jit"
]
}

0 comments on commit 46dfc50

Please sign in to comment.