Files
EVEngine/src/modules/virtualgeometry/VirtualGeometryBackend.h
T
西风逍遥游 4377e062dd feat: zeroerr parameter validation + Doxygen API documentation
Squashed onto current main. Adds src/engine/common/Assert.h (EV_PARAM_CHECK / EV_ASSERT backed by zeroerr), an EVENGINE_ENABLE_ASSERTS option (non-Debug builds strip ZEROERR_NO_ASSERT unless enabled), parameter checks at key entry points, Doxygen comments across headers, Doxyfile + make docs / CMake docs targets, and Windows setup + code conventions in AGENTS.md.
2026-08-19 09:01:12 +08:00

43 lines
1.3 KiB
C++

#pragma once
#include "virtualgeometry/VirtualGeometryAsset.h"
#include <cstdint>
#include <vector>
namespace eve::virtualgeometry {
struct VgUniforms {
float viewProj[16];
float model[16];
float cameraPos[4];
float params[4]; // x=viewW, y=viewH, z=projScale, w=errorPx
float frustum[24]; // 6 planes
float misc[4]; // x=clusterCount
};
/**
* @brief Opaque backend state for one virtual-geometry renderer. Owned by
* VirtualGeometryRenderer; allocated/freed by the active backend.
*/
struct VgBackend {
void *state = nullptr; // vulkan::VgState*
};
// ---- backend interface (implemented in vulkan/) ----
void vgCreate(VgBackend &be);
void vgDestroy(VgBackend &be);
// Upload a built asset (positions/triangles/clusters) to the GPU.
void vgUpload(VgBackend &be, const VirtualGeometryAsset &asset);
void vgUploadUniforms(VgBackend &be, const VgUniforms &u);
void vgReset(VgBackend &be, int visibleCapacity);
// Dispatch cull + raster for the given workgroup counts. Returns visible count.
int vgUpdate(VgBackend &be, int clusterCount, int visibleCapacity, int viewW, int viewH);
// Read the visibility buffer back to CPU (packed depth<<16|clusterId).
bool vgReadPixels(VgBackend &be, std::vector<uint32_t> &out);
} // namespace eve::virtualgeometry