summaryrefslogtreecommitdiff
path: root/src/gpu/gpu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/gpu.cc')
-rw-r--r--src/gpu/gpu.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc
index 45f0f34..63a30ff 100644
--- a/src/gpu/gpu.cc
+++ b/src/gpu/gpu.cc
@@ -21,10 +21,11 @@
static WGPUInstance g_instance = nullptr;
static WGPUAdapter g_adapter = nullptr;
-static WGPUDevice g_device = nullptr;
-static WGPUQueue g_queue = nullptr;
+WGPUDevice g_device = nullptr; // Non-static for external access (debug builds)
+WGPUQueue g_queue = nullptr; // Non-static for external access (debug builds)
static WGPUSurface g_surface = nullptr;
static WGPUSurfaceConfiguration g_config = {};
+WGPUTextureFormat g_format = WGPUTextureFormat_BGRA8Unorm; // Exposed for custom effects
static MainSequence g_main_sequence;
@@ -354,6 +355,7 @@ void gpu_init(PlatformState* platform_state) {
g_config.device = g_device;
g_config.format = swap_chain_format;
+ g_format = swap_chain_format; // Update global format for external access
g_config.usage = WGPUTextureUsage_RenderAttachment;
g_config.width = platform_state->width;
g_config.height = platform_state->height;
@@ -386,6 +388,13 @@ void gpu_resize(int width, int height) {
void gpu_simulate_until(float time) {
g_main_sequence.simulate_until(time, 1.0f / 60.0f);
}
+
+void gpu_add_custom_effect(Effect* effect, float start_time, float end_time, int priority) {
+ auto seq = std::make_shared<Sequence>();
+ seq->add_effect(std::shared_ptr<Effect>(effect), start_time, end_time, priority);
+ seq->init(&g_main_sequence);
+ g_main_sequence.add_sequence(seq, 0.0f, priority);
+}
#endif /* !defined(STRIP_ALL) */
void gpu_shutdown() {