载入中...
搜索中...
未找到
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 uint32_t maxSamplersPerShaderStage() const { return maxSamplersPerShaderStage_; }
56
58 float maxSamplerAnisotropy() const { return maxAnisotropy_; }
59
60private:
61 // Conservative defaults: a value that is never worse than a guaranteed limit
62 // so an uncaptured Capabilities still lets valid calls through.
63 uint32_t maxTextureDim2D_ = 16384;
64 uint32_t maxBindGroups_ = 4;
65 uint32_t maxDynamicUniformBuffers_ = 8;
66 uint32_t maxSampledTexturesPerShaderStage_ = 16;
67 uint32_t maxSamplersPerShaderStage_ = 16;
68 float maxAnisotropy_ = 16.f;
69 uint32_t maxSampleCount_ = 4;
70 bool captured_ = false;
71};
72
73} // namespace eve::graphics::webgpu
vkb::Device & device
std::uint32_t 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 supportsFormat(WGPUTextureFormat format) const
True when the device advertises the given texture format.
uint32_t maxDynamicUniformBuffers() const
Maximum dynamic uniform buffers per pipeline layout.