载入中...
搜索中...
未找到
Capabilities.h
浏览该文件的文档.
1#pragma once
2
4
5#include <cstdint>
6
7namespace eve::graphics::webgpu {
8
19public:
21 Capabilities() = default;
22
27 static WGPUTextureFormat querySurfaceFormat(wgpu::Adapter &adapter, wgpu::Surface &surface,
28 WGPUTextureFormat defaultFormat);
29
34 void capture(wgpu::Adapter &adapter, wgpu::Device &device);
35
37 bool supportsSampleCount(uint32_t count) const;
38
40 bool supportsFormat(WGPUTextureFormat format) const;
41
43 uint32_t maxTextureDimension2D() const { return maxTextureDim2D_; }
44
46 uint32_t maxBindGroups() const { return maxBindGroups_; }
47
49 uint32_t maxDynamicUniformBuffers() const { return maxDynamicUniformBuffers_; }
50
52 uint32_t maxSampledTexturesPerShaderStage() const { return maxSampledTexturesPerShaderStage_; }
53
55 bool supportsFiveTargetGBuffer() const { return maxColorAttachmentBytesPerSample_ >= 40; }
56
58 uint32_t maxSamplersPerShaderStage() const { return maxSamplersPerShaderStage_; }
59
61 float maxSamplerAnisotropy() const { return maxAnisotropy_; }
62
63private:
64 // Conservative defaults: a value that is never worse than a guaranteed limit
65 // so an uncaptured Capabilities still lets valid calls through.
66 uint32_t maxTextureDim2D_ = 16384;
67 uint32_t maxBindGroups_ = 4;
68 uint32_t maxDynamicUniformBuffers_ = 8;
69 uint32_t maxSampledTexturesPerShaderStage_ = 16;
70 uint32_t maxColorAttachmentBytesPerSample_ = 32;
71 uint32_t maxSamplersPerShaderStage_ = 16;
72 float maxAnisotropy_ = 16.f;
73 uint32_t maxSampleCount_ = 4;
74 bool captured_ = false;
75};
76
77} // namespace eve::graphics::webgpu
vkb::Device & device
int count
std::string_view adapter
Read-only snapshot of WebGPU adapter/device limits and surface capabilities, queried once after devic...
uint32_t maxSamplersPerShaderStage() const
Maximum samplers visible to one shader stage.
void capture(wgpu::Adapter &adapter, wgpu::Device &device)
Populate the snapshot from an adapter and device. Call once, right after device creation; keep the re...
bool supportsSampleCount(uint32_t count) const
True when the device supports the given render-target sample count.
uint32_t maxSampledTexturesPerShaderStage() const
Maximum sampled textures visible to one shader stage.
uint32_t maxBindGroups() const
Maximum bind group count per pipeline layout.
float maxSamplerAnisotropy() const
Maximum sampler anisotropy the device supports (>=1).
Capabilities()=default
Default-constructed: all queries report their (conservative) default.
static WGPUTextureFormat querySurfaceFormat(wgpu::Adapter &adapter, wgpu::Surface &surface, WGPUTextureFormat defaultFormat)
Query the surface's preferred format from the adapter. Falls back to defaultFormat when the surface r...
uint32_t maxTextureDimension2D() const
Maximum 2D texture dimension the device guarantees.
bool supportsFiveTargetGBuffer() const
True when the granted device limit supports five RGBA8 GBuffer targets.
bool supportsFormat(WGPUTextureFormat format) const
True when the device advertises the given texture format.
uint32_t maxDynamicUniformBuffers() const
Maximum dynamic uniform buffers per pipeline layout.