Skip to content

Commit 77e4094

Browse files
authored
Merge pull request #5756 from QrowZK/master
AMD cable fix attempt
2 parents bf75409 + e0ae49f commit 77e4094

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

LuaRules/Gadgets/Shaders/gfx_overdrive_cables.frag.glsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ uniform float losViewEnabled; // 1.0 = LOS overlay is on (GetMapDrawMode=="los")
1414

1515
// Same SSBO as the GS — per-edge coverage bitmask, gates per-segment
1616
// ghost rendering for enemy fragments.
17+
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
1718
layout (std430, binding = 6) coherent buffer cableCoverageBuffer {
1819
uvec4 cableCoverage[];
1920
};
21+
#endif
2022

2123
in DataGS {
2224
vec3 worldPos;
@@ -349,6 +351,7 @@ void main() {
349351
vec2 losUV0 = clamp(worldPos.xz, vec2(0.0), mapSize.xy) / mapSize.zw;
350352
float los0 = texture(infoTex, losUV0).r;
351353
if (los0 >= ENEMY_LOS_CUT) discard;
354+
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
352355
uint cov0 = (gsSlot >= 0) ? cableCoverage[gsSlot].x : 0u;
353356
// Per-segment ghost gating, mirroring the calc done lower in the FS
354357
// for live fragments. spawnAlongMain carries lenPerSeg for main
@@ -362,6 +365,7 @@ void main() {
362365
segBit0 = 0xFFFFFFu;
363366
}
364367
if ((cov0 & segBit0) == 0u) discard;
368+
#endif
365369

366370
// Flat ghost shade: light gray, slight capacity-driven brightening,
367371
// branches a touch dimmer. Alpha-blend over terrain (depth-write off
@@ -522,8 +526,10 @@ void main() {
522526
if (enemyOutOfLOS) {
523527
// Ghosts disabled: no SSBO read, no branch evaluation; just discard.
524528
if (ghostsEnabled < 0.5) discard;
529+
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
525530
uint cov = (gsSlot >= 0) ? cableCoverage[gsSlot].x : 0u;
526531
if ((cov & segBit) == 0u) discard;
532+
#endif
527533
// Same flat translucent shading as the ghost-VBO fast path so
528534
// live-out-of-LOS and orphaned ghosts read identically.
529535
float capT2 = clamp(capacity / 100.0, 0.0, 1.0);

LuaRules/Gadgets/Shaders/gfx_overdrive_cables.geom.glsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ uniform float ghostsEnabled; // 1.0 = run coverage SSBO updates, 0.0 = by
3535
//
3636
// Slots are declared as uvec4 because Spring's VBO API requires vec4-aligned
3737
// attributes; we only use `.x` and ignore `.yzw`.
38+
#if !defined(SHADOW_PASS) && !defined(DEFERRED_PASS)
3839
layout (std430, binding = 6) coherent buffer cableCoverageBuffer {
3940
uvec4 cableCoverage[];
4041
};
42+
#endif
4143

4244
in DataVS {
4345
vec2 vsWorldXZ;

0 commit comments

Comments
 (0)