#version 450 layout(location = 0) in vec3 in_position; layout(location = 1) in vec3 in_color; layout(location = 0) out vec3 frag_color; layout(push_constant) uniform PushConstants { mat4 mvp; // xyz is the chunk's world offset; w is the debug-tint weight, 0.0 for normal rendering and 1.0 for a debug raster pass. vec4 chunk_offset; } push_constants; // Colour applied to debug raster passes, chosen to contrast with terrain and to remain legible when overlaid on filled geometry. const vec3 DEBUG_COLOR = vec3(1.0, 0.0, 1.0); // Size, in pixels, of the points emitted under VK_POLYGON_MODE_POINT. Sizes above 1.0 require the largePoints device feature. const float DEBUG_POINT_SIZE = 5.0; void main() { // The chunk-local vertex is shifted into world space by the per-chunk offset before projection. vec3 world_position = in_position + push_constants.chunk_offset.xyz; gl_Position = push_constants.mvp * vec4(world_position, 1.0); // Point size is consulted whenever the polygon mode is POINT; leaving it unwritten renders points of undefined size. It is ignored by the FILL and LINE pipelines, so it is written unconditionally. gl_PointSize = DEBUG_POINT_SIZE; float debug_tint = push_constants.chunk_offset.w; frag_color = mix(in_color, DEBUG_COLOR, debug_tint); }