2022-07-27 15:25:25 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <aurora/aurora.h>
|
|
|
|
|
|
|
|
#include "wgpu.hpp"
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
struct SDL_Window;
|
|
|
|
|
|
|
|
namespace aurora::webgpu {
|
|
|
|
struct GraphicsConfig {
|
2022-08-02 20:37:56 +00:00
|
|
|
wgpu::SwapChainDescriptor swapChainDescriptor;
|
|
|
|
wgpu::TextureFormat depthFormat;
|
2022-07-27 15:25:25 +00:00
|
|
|
uint32_t msaaSamples;
|
|
|
|
uint16_t textureAnisotropy;
|
|
|
|
};
|
|
|
|
struct TextureWithSampler {
|
|
|
|
wgpu::Texture texture;
|
|
|
|
wgpu::TextureView view;
|
2022-08-02 20:37:56 +00:00
|
|
|
wgpu::Extent3D size;
|
|
|
|
wgpu::TextureFormat format;
|
2022-07-27 15:25:25 +00:00
|
|
|
wgpu::Sampler sampler;
|
|
|
|
};
|
|
|
|
|
2022-08-02 20:37:56 +00:00
|
|
|
extern wgpu::Device g_device;
|
|
|
|
extern wgpu::Queue g_queue;
|
|
|
|
extern wgpu::SwapChain g_swapChain;
|
|
|
|
extern wgpu::BackendType g_backendType;
|
2022-07-27 15:25:25 +00:00
|
|
|
extern GraphicsConfig g_graphicsConfig;
|
|
|
|
extern TextureWithSampler g_frameBuffer;
|
|
|
|
extern TextureWithSampler g_frameBufferResolved;
|
|
|
|
extern TextureWithSampler g_depthBuffer;
|
2022-08-02 20:37:56 +00:00
|
|
|
extern wgpu::RenderPipeline g_CopyPipeline;
|
|
|
|
extern wgpu::BindGroup g_CopyBindGroup;
|
|
|
|
extern wgpu::Instance g_instance;
|
2022-07-27 15:25:25 +00:00
|
|
|
|
|
|
|
bool initialize(AuroraBackend backend);
|
|
|
|
void shutdown();
|
|
|
|
void resize_swapchain(uint32_t width, uint32_t height, bool force = false);
|
|
|
|
TextureWithSampler create_render_texture(bool multisampled);
|
|
|
|
} // namespace aurora::webgpu
|