OverviewFilesCommitsIssuesDocsReleasesPeers

dc-terrain commits / 029cca8

Revert "atlas: emit HBLK_ATLAS_W + HBLK_USE_ATLAS so binding 14 can actually be read"
This reverts commit f8103c41b768f4edf297a7523472b5deeea3b441.
029cca88c4260a38d2ba649dca88817a18356206
by plankatron <fleeky@gmail.com> · 2026-09-03T17:01:25.000Z

Changed files (3) +1 -29

src/dc_compute.cpp +1 -1
……@@ -397,7 +397,7 @@ void DCCompute::_upload_atlas(const float* data, int n) {
397397 if (atlas_tex_.is_valid()) { rd_->free_rid(atlas_tex_); atlas_tex_ = RID(); }
398398 if (atlas_staging_.is_valid()) { rd_->free_rid(atlas_staging_); atlas_staging_ = RID(); }
399399
400 const int W = ATLAS_W; // see dc_compute.h — the generator emits this same number
400 const int W = 4096;
401401 int count = (data == nullptr || n <= 0) ? 1 : n;
402402 int H = (count + W - 1) / W;
403403 atlas_w_ = W; atlas_h_ = H;
src/dc_compute.h +0 -7
……@@ -138,13 +138,6 @@ private:
138138 // shader chooses with HBLK_USE_ATLAS, so the two can be compared against
139139 // each other rather than the swap being taken on faith. A half-migration
140140 // here is exactly what shipped #55's count/size SIGSEGV.
141 // THE atlas width. ONE definition: _upload_atlas lays the texture out with
142 // it and the generator emits it into the shader as HBLK_ATLAS_W. Two copies
143 // of this number that disagree is a shear, not a crash — every sample lands
144 // on the wrong row and the terrain is silently wrong.
145public:
146 static constexpr int ATLAS_W = 4096;
147private:
148141 RID atlas_tex_; // R32F, linear index -> (x, y); binding 14
149142 RID atlas_staging_; // one row-block, for texture_update + copy
150143 int atlas_w_ = 0;
src/dc_terrain_generator_procnodes.cpp +0 -21
……@@ -16,9 +16,7 @@
1616// comment still stands. It is a shared math header and nothing more.
1717#include "erosion_cpp_shim.h"
1818#include "erosion_wrapper_glsl.h"
19#include "dc_compute.h"
2019#include <godot_cpp/classes/file_access.hpp>
21#include <godot_cpp/classes/os.hpp>
2220
2321namespace godot {
2422
……@@ -528,21 +526,6 @@ void DCTerrainGeneratorProcNodes::set_graph(const Ref<Resource> &p_graph) {
528526//
529527// One producer for now, which matches one bound buffer. More than one wants an
530528// offset table emitted alongside, which is the same change a grid of tiles needs.
531// Read the SAME floats through binding 14 (the atlas image) instead of binding
532// 13 (the SSBO). Both hold identical values at identical indices, so this is a
533// pure TRANSPORT swap and gate_dc_vs_lookdev must agree to 0.001 m either way.
534//
535// An ENV VAR rather than a property, deliberately: the point is to run the gate
536// BOTH ways over one unchanged scene, and a property would have to be authored
537// into the map to be flipped.
538//
539// HBLK_USE_ATLAS=1 godot4 --path . --script res://scenes/test/...
540static bool _use_atlas() {
541 String v = OS::get_singleton()->get_environment("HBLK_USE_ATLAS");
542 return v == "1" || v.to_lower() == "true";
543}
544
545
546529void DCTerrainGeneratorProcNodes::_collect_node_data() {
547530 if (graph_.is_null()) return;
548531 Variant nc_var = graph_->call("get_node_count");
……@@ -750,8 +733,6 @@ void DCTerrainGeneratorProcNodes::_recompile_glsl() {
750733 if (heightfield_only_ && hblk_n_ > 0) {
751734 String hb =
752735 String("const int HBLK_N = ") + itos(hblk_n_) + ";\n"
753 "const int HBLK_ATLAS_W = " + itos(DCCompute::ATLAS_W) + ";\n"
754 "const bool HBLK_USE_ATLAS = " + String(_use_atlas() ? "true" : "false") + ";\n"
755736 "const float HBLK_OX = " + String::num(hblk_ox_, 4) + ";\n"
756737 "const float HBLK_OZ = " + String::num(hblk_oz_, 4) + ";\n"
757738 "const float HBLK_MPP = " + String::num(hblk_mpp_, 6) + ";\n"
……@@ -880,8 +861,6 @@ void DCTerrainGeneratorProcNodes::_recompile_glsl() {
880861 // that never compiled and a world with no terrain.
881862 hblk_glsl_sampler =
882863 String("const int HBLK_N = ") + itos(hblk_n_) + ";\n"
883 "const int HBLK_ATLAS_W = " + itos(DCCompute::ATLAS_W) + ";\n"
884 "const bool HBLK_USE_ATLAS = " + String(_use_atlas() ? "true" : "false") + ";\n"
885864 "const float HBLK_OX = " + String::num(hblk_ox_, 4) + ";\n"
886865 "const float HBLK_OZ = " + String::num(hblk_oz_, 4) + ";\n"
887866 "const float HBLK_MPP = " + String::num(hblk_mpp_, 6) + ";\n"