From a20a1ce7fc20505d21aa137577c72ba49dddc762 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:08:38 +1000 Subject: [PATCH] Fix amd --- build.gradle | 6 ++++-- .../me/cortex/voxy/client/core/VoxelCore.java | 2 +- .../rendering/building/RenderDataFactory.java | 3 +++ .../cortex/voxy/common/world/WorldEngine.java | 4 +++- .../assets/voxy/shaders/post/ssao.comp | 20 +++++++++---------- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 34982931..e3e76ea8 100644 --- a/build.gradle +++ b/build.gradle @@ -105,6 +105,8 @@ dependencies { include(runtimeOnly "org.lwjgl:lwjgl-lmdb:$lwjglVersion:natives-linux") include(runtimeOnly "org.lwjgl:lwjgl-zstd:$lwjglVersion:natives-linux") - include(implementation 'org.rocksdb:rocksdbjni:8.10.0') - include(implementation 'redis.clients:jedis:5.1.0') + //include(implementation 'org.rocksdb:rocksdbjni:8.10.0') + //include(implementation 'redis.clients:jedis:5.1.0') + implementation 'org.rocksdb:rocksdbjni:8.10.0' + implementation 'redis.clients:jedis:5.1.0' } \ No newline at end of file diff --git a/src/main/java/me/cortex/voxy/client/core/VoxelCore.java b/src/main/java/me/cortex/voxy/client/core/VoxelCore.java index d9962f86..d589e65a 100644 --- a/src/main/java/me/cortex/voxy/client/core/VoxelCore.java +++ b/src/main/java/me/cortex/voxy/client/core/VoxelCore.java @@ -57,7 +57,7 @@ public class VoxelCore { SharedIndexBuffer.INSTANCE.id(); this.renderer = new Gl46FarWorldRenderer(VoxyConfig.CONFIG.geometryBufferSize, VoxyConfig.CONFIG.maxSections); System.out.println("Renderer initialized"); - this.world = new WorldEngine(new CompressionStorageAdaptor(new ZSTDCompressor(VoxyConfig.CONFIG.savingCompressionLevel), new RocksDBStorageBackend(new File(VoxyConfig.CONFIG.storagePath))), VoxyConfig.CONFIG.ingestThreads, VoxyConfig.CONFIG.savingThreads, 5); + this.world = new WorldEngine(new CompressionStorageAdaptor(new ZSTDCompressor(VoxyConfig.CONFIG.savingCompressionLevel), new FragmentedStorageBackendAdaptor(new File(VoxyConfig.CONFIG.storagePath))), VoxyConfig.CONFIG.ingestThreads, VoxyConfig.CONFIG.savingThreads, 5); System.out.println("World engine"); this.renderTracker = new RenderTracker(this.world, this.renderer); diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory.java b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory.java index 4946ea8e..475ad9fa 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory.java @@ -142,6 +142,8 @@ public class RenderDataFactory { int selfBlockId = Mapper.getBlockId(self); long selfMetadata = this.modelMan.getModelMetadata(selfBlockId); + + boolean putFace = false; //Branch into 2 paths, the + direction and -direction, doing it at once makes it much faster as it halves the number of loops @@ -249,6 +251,7 @@ public class RenderDataFactory { } + int clientModelId = this.modelMan.getModelId(selfBlockId); long otherFlags = 0; otherFlags |= ModelManager.isTranslucent(metadata)?1L<<33:0; diff --git a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java index f22b749c..061e3e42 100644 --- a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java +++ b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java @@ -48,7 +48,9 @@ public class WorldEngine { this.storage.deleteSectionData(into.key); //TODO: regenerate the section from children Arrays.fill(into.data, Mapper.AIR); - System.err.println("Section " + into.lvl + ", " + into.x + ", " + into.y + ", " + into.z + " was unable to load, setting to air"); + System.err.println("Section " + into.lvl + ", " + into.x + ", " + into.y + ", " + into.z + " was unable to load, removing"); + + this.storage.deleteSectionData(into.key); return -1; } else { return 0; diff --git a/src/main/resources/assets/voxy/shaders/post/ssao.comp b/src/main/resources/assets/voxy/shaders/post/ssao.comp index a18a64e8..c5167559 100644 --- a/src/main/resources/assets/voxy/shaders/post/ssao.comp +++ b/src/main/resources/assets/voxy/shaders/post/ssao.comp @@ -8,18 +8,18 @@ layout(location = 2) uniform mat4 MVP; layout(location = 3) uniform mat4 invMVP; vec3 rev3d(vec3 clip) { - vec4 view = invMVP * vec4(clip*2-1,1); + vec4 view = invMVP * vec4(clip*2.0-1.0,1.0); return view.xyz/view.w; } vec3 reDeProject(vec3 pos) { - vec4 view = MVP * vec4(pos, 1); + vec4 view = MVP * vec4(pos, 1.0); view.xy /= view.w; - vec2 UV = clamp(view.xy*0.5+0.5, 0, 1); + vec2 UV = clamp(view.xy*0.5+0.5, 0.0, 1.0); //TODO: sample the colour texture and check if the alpha has the hasAO flag - view.z = texture(depthTex, UV).x*2-1; - view.w = 1; + view.z = texture(depthTex, UV).x*2.0-1.0; + view.w = 1.0; view = invMVP * view; return view.xyz/view.w; } @@ -38,7 +38,7 @@ void main() { return; } vec4 colour = imageLoad(colourTex, ivec2(gl_GlobalInvocationID.xy)); - uint metadata = uint(colour.w*255f); + uint metadata = uint(colour.w*255.0f); uint face = metadata&7; uint lod = (metadata>>3)&7; bool hasAO = (metadata>>6)!=0; @@ -50,15 +50,15 @@ void main() { float d = 0.0; if (hasAO) { - d = computeAOAngle(pos, 1*(1<