载入中...
搜索中...
未找到
IndirectBuilder.h
浏览该文件的文档.
1#pragma once
2
4
5#include <cstdint>
6#include <vector>
7#include <algorithm>
8
9namespace eve::graphics {
10
23public:
24 void reset();
25
27 void add(uint32_t seq, uint32_t meshId, uint32_t materialId, uint32_t pipelineId);
28
33 uint32_t build(const std::vector<GpuMeshRecord> &meshTable);
34
36 const std::vector<uint32_t> &sortedInstanceOrder() const { return order_; }
37
38 const std::vector<GpuIndirectCommand> &commands() const { return commands_; }
39 uint32_t drawCount() const { return uint32_t(commands_.size()); }
40
41private:
42 struct Entry {
43 uint64_t key = 0;
44 uint32_t seq = 0;
45 uint32_t meshId = kInvalidGpuDrivenSlot;
46 uint32_t materialId = kInvalidGpuDrivenSlot;
47 uint32_t pipelineId = 0;
48 };
49
50 static uint64_t makeKey(uint32_t seq, uint32_t meshId, uint32_t materialId,
51 uint32_t pipelineId) {
52 return (uint64_t(pipelineId & 0xFF) << 56) |
53 (uint64_t(materialId & 0xFFFF) << 40) |
54 (uint64_t(meshId & 0xFFFF) << 24) | (seq & 0xFFFFFF);
55 }
56
57 std::vector<Entry> entries_;
58 std::vector<uint32_t> order_;
59 std::vector<GpuIndirectCommand> commands_;
60};
61
62} // namespace eve::graphics
CPU-side builder for GPU-driven indirect draws (stage 1).
uint32_t build(const std::vector< GpuMeshRecord > &meshTable)
Sort + merge. meshTable supplies indexCount/firstIndex/vertexBase.
void add(uint32_t seq, uint32_t meshId, uint32_t materialId, uint32_t pipelineId)
seq = monotonic instance sequence (stable order tiebreak).
const std::vector< GpuIndirectCommand > & commands() const
const std::vector< uint32_t > & sortedInstanceOrder() const
Instance indices in the sorted order the caller must upload.
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition AnimTrail.h:6
constexpr uint32_t kInvalidGpuDrivenSlot
GPU-driven rendering shared constants + std430 GPU layouts.