aurora/lib/webgpu/gpu.hpp

44 lines
1.1 KiB
C++
Raw Normal View History

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 {
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;
wgpu::Extent3D size;
wgpu::TextureFormat format;
2022-07-27 15:25:25 +00:00
wgpu::Sampler sampler;
};
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;
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