载入中...
搜索中...
未找到
GpuDriven.h
浏览该文件的文档.
1#pragma once
2
4
5namespace eve::graphics::vulkan {
6
21constexpr uint32_t kMaxBindlessSsbo = 64; // storage buffer table slots
23constexpr uint32_t kMaxGpuDrivenInstances = 65536;
24constexpr uint32_t kMaxGpuDrivenBuckets = 65536;
25constexpr uint32_t kMaxHzbMips = 16;
26constexpr uint32_t kHZBHeaderWords = 16; // uint offsets per mip, at slot start
27
30
32 bool api12 = false;
33 bool drawIndirectCount = false;
34 bool multiDrawIndirect = false;
35 bool descriptorIndexing = false;
37 bool samplerArrayCapacity = false; // maxPerStageDescriptorSamplers >= array size
38 bool computeShader = false;
39
41 bool gpuDrivenAvailable() const {
42 // NOTE: the Vulkan SDK headers used by this toolchain omit the core
43 // `drawIndirect` bit from VkPhysicalDeviceFeatures, so it is assumed
44 // supported (true on every real GPU) and left untouched. The engine's
45 // glslc build lacks GL_EXT_nonuniform_qualifier, so the bindless path
46 // uses fixed-size descriptor arrays + dynamic indexing (legal because
47 // material/texture indices are uniform within each indirect draw).
48 // UPDATE_AFTER_BIND and the 1.2 feature chain are intentionally NOT
49 // required: the AMD driver in this environment hangs on large
50 // update-after-bind descriptor writes, and texture registrations are
51 // applied outside the render pass instead.
53 }
54
59 }
60};
61
64
66 glm::mat4 viewProj; // 0
67 glm::vec4 frustumPlanes[6]; // 64 (Gribb-Hartmann, normalized, inside>0)
68 glm::vec4 cameraPos; // 160
69 glm::vec4 screen; // 176: x=width, y=height, z=invW, w=invH
70 glm::vec4 clipNearFar; // 192: x=near, y=far, z=projScaleY, w=doHZB
71 glm::vec4 hzbInfo; // 208: x=maxMip, y=slotWordBase, z=mip0W, w=mip0H
72 glm::uvec4 counts; // 224: x=instanceCount, y=bucketCount, z=maxBuckets, w=0
73};
74static_assert(sizeof(GpuCullParams) == 240, "GpuCullParams must match GLSL std140 layout");
75
76} // namespace eve::graphics::vulkan
constexpr uint32_t kMaxGpuDrivenBuckets
Definition GpuDriven.h:24
constexpr uint32_t kMaxHzbMips
Definition GpuDriven.h:25
constexpr uint32_t kMaxBindlessCubemaps
Definition GpuDriven.h:20
constexpr uint32_t kMaxBindlessSsbo
Definition GpuDriven.h:21
constexpr uint32_t kMaxGpuDrivenInstances
Definition GpuDriven.h:23
constexpr uint32_t kInvalidBindlessSlot
Definition GpuDriven.h:22
constexpr uint32_t kHZBHeaderWords
Definition GpuDriven.h:26
constexpr uint32_t kMaxBindlessTextures
Definition GpuDriven.h:19
constexpr uint32_t kMaxGpuDrivenCubemaps
constexpr uint32_t kMaxGpuDrivenTextures
constexpr uint32_t kInvalidGpuDrivenSlot
GPU-driven rendering shared constants + std430 GPU layouts.
Indirect draw command; layout identical to VkDrawIndexedIndirectCommand.
Per-instance GPU record (std430). Mirrors GLSL GpuInstance.
GPU material table record (std430). Mirrors GLSL GpuMaterialRecord.
GPU mesh table record (std430). Mirrors GLSL GpuMeshRecord.
Cull-params UBO (std140). Mirrors GLSL CullParams in shaders/gpu_driven_cull_common....
Definition GpuDriven.h:65
Capabilities required for the GPU-driven path. All must be true for gpuDrivenAvailable()....
Definition GpuDriven.h:31
bool gpuDrivenAvailable() const
Gpu driven available.
Definition GpuDriven.h:41
bool gpuDrivenCullAvailable() const
Stage 2: GPU frustum/HZB cull + GPU-written indirect commands.
Definition GpuDriven.h:56