载入中...
搜索中...
未找到
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
31 bool api12 = false;
32 bool drawIndirectCount = false;
33 bool multiDrawIndirect = false;
34 bool descriptorIndexing = false;
36 bool samplerArrayCapacity = false; // maxPerStageDescriptorSamplers >= array size
37 bool computeShader = false;
38
39 bool gpuDrivenAvailable() const {
40 // NOTE: the Vulkan SDK headers used by this toolchain omit the core
41 // `drawIndirect` bit from VkPhysicalDeviceFeatures, so it is assumed
42 // supported (true on every real GPU) and left untouched. The engine's
43 // glslc build lacks GL_EXT_nonuniform_qualifier, so the bindless path
44 // uses fixed-size descriptor arrays + dynamic indexing (legal because
45 // material/texture indices are uniform within each indirect draw).
46 // UPDATE_AFTER_BIND and the 1.2 feature chain are intentionally NOT
47 // required: the AMD driver in this environment hangs on large
48 // update-after-bind descriptor writes, and texture registrations are
49 // applied outside the render pass instead.
51 }
52
56 }
57};
58
62 glm::mat4 viewProj; // 0
63 glm::vec4 frustumPlanes[6]; // 64 (Gribb-Hartmann, normalized, inside>0)
64 glm::vec4 cameraPos; // 160
65 glm::vec4 screen; // 176: x=width, y=height, z=invW, w=invH
66 glm::vec4 clipNearFar; // 192: x=near, y=far, z=projScaleY, w=doHZB
67 glm::vec4 hzbInfo; // 208: x=maxMip, y=slotWordBase, z=mip0W, w=mip0H
68 glm::uvec4 counts; // 224: x=instanceCount, y=bucketCount, z=maxBuckets, w=0
69};
70static_assert(sizeof(GpuCullParams) == 240, "GpuCullParams must match GLSL std140 layout");
71
72} // 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:61
Capabilities required for the GPU-driven path. All must be true for gpuDrivenAvailable()....
Definition GpuDriven.h:30
bool gpuDrivenCullAvailable() const
Stage 2: GPU frustum/HZB cull + GPU-written indirect commands.
Definition GpuDriven.h:54