#ifndef DC_GPU_PARAMS_H
#define DC_GPU_PARAMS_H
// GPU parameter struct layout for the density_fill shader.
// Must match the std140 uniform block in density_fill.glsl exactly.
// Shared between dc_compute.cpp and dc_worker.cpp.
#include <cstdint>
#pragma pack(push, 1)
struct GpuParams {
int32_t grid_stride; // 0
float voxel_scale; // 4
float origin_x; // 8
float origin_y; // 12
float origin_z; // 16
float primary_frequency; // 20
float primary_strength; // 24
float tunnel_frequency; // 28
float tunnel_strength; // 32
float tunnel_radius; // 36
float ridge_frequency; // 40
float ridge_strength; // 44
float warp_frequency; // 48
float warp_strength; // 52
float detail_frequency; // 56
float detail_strength; // 60
float ground_bias; // 64
float solid_floor_depth; // 68
float sky_height; // 72
float flat_center_radius; // 76
float floor_strength; // 80
float floor_height_min; // 84
float floor_height_max; // 88
float room_height; // 92
float terrain_size; // 96
int32_t primary_octaves; // 100
int32_t tunnel_octaves; // 104
int32_t ridge_octaves; // 108
int32_t warp_octaves; // 112
int32_t detail_octaves; // 116
int32_t compute_normals; // 120
int32_t seed; // 124
int32_t voronoi_cell_count; // 128
int32_t use_noise; // 132
// Spherical mode params
int32_t spherical; // 136 — 1 = planet mode, 0 = flat terrain
float planet_radius; // 140
float planet_center_x; // 144
float planet_center_y; // 148
float planet_center_z; // 152
float island_radius; // 156 — XZ radius of island; random craters place out to 40 + island_radius*0.5
int32_t flags; // 160 — bit0 = bake brick (write delta), bit1 = sample brick
};
#pragma pack(pop)
static_assert(sizeof(GpuParams) == 164, "GpuParams must be 164 bytes for std140");
// Push constants for every mesh stage (edge_classify .. quad_emit).
// Lifted out of dc_gpu_mesh_pipeline.cpp for the same reason GpuParams lives
// here: a 48-byte block transcribed by hand into a second consumer is a silent
// garbage-in generator, and the GPU stage oracle is now a second consumer.
#pragma pack(push, 1)
struct MeshPushConstants {
float cell_origin[3];
float voxel_size;
int32_t grid_dims[3];
uint32_t total_elements;
uint32_t mesh_quality_flags;
uint32_t _pad0, _pad1, _pad2;
};
#pragma pack(pop)
static_assert(sizeof(MeshPushConstants) == 48, "Push constants must be 48 bytes");
#endif // DC_GPU_PARAMS_H