43 lines
1,011 B
C++
43 lines
1,011 B
C++
#pragma once
|
|
|
|
#include <webgpu/webgpu.h>
|
|
|
|
#include <Shared.h>
|
|
#include "../Client.h"
|
|
#include "../Platform/Window.h"
|
|
|
|
namespace Artifact {
|
|
|
|
class Graphics;
|
|
|
|
class GraphicsSubsystem {
|
|
public:
|
|
Graphics * graphics;
|
|
virtual void init() {}
|
|
virtual void reload() {}
|
|
virtual void deinit() {}
|
|
virtual void render(WGPUTextureView nextTexture, WGPUCommandEncoder encoder) {}
|
|
};
|
|
|
|
class Graphics: public ClientSubsystem, public Engine<GraphicsSubsystem> {
|
|
public:
|
|
WGPUInstance instance = nullptr;
|
|
WGPUSurface surface = nullptr;
|
|
WGPUAdapter adapter = nullptr;
|
|
WGPUDevice device = nullptr;
|
|
|
|
WGPUTexture depthTexture = nullptr;
|
|
WGPUTextureView depthTextureView = nullptr;
|
|
WGPUQueue queue = nullptr;
|
|
|
|
WindowImpl * window;
|
|
|
|
void init() override;
|
|
void deinit() override;
|
|
void render() override;
|
|
|
|
WGPUTexture createTextureFromData(const void* data, uint32_t width, uint32_t height);
|
|
WGPUTexture createTextureFromFile(const char* file);
|
|
};
|
|
|
|
}
|