Skip to content

fix(glsm): answer enable-cap glGet queries from tracked state - #115

Merged
DHJComical merged 3 commits into
mainfrom
fix/issue-41-texture-state-desync
Sep 4, 2026
Merged

fix(glsm): answer enable-cap glGet queries from tracked state#115
DHJComical merged 3 commits into
mainfrom
fix/issue-41-texture-state-desync

Conversation

@DHJComical

Copy link
Copy Markdown
Owner

改了什么

  • GLStateManager.glGetInteger / glGetFloat 对 enable 能力位(GL_TEXTURE_2DGL_BLEND 等全部 glIsEnabled 覆盖的 cap)改为从 glsm 跟踪状态应答(新增 isEnableCap),与兼容 profile 语义一致;core profile 后端本拒绝这些 pname,此前转发真实 GL 恒返回 0。
  • GL_BLEND_SRC / GL_BLEND_DST 旧式别名(0x0BE1/0x0BE0)映射到 RGB 混合因子,避免保存值被读成 0 后恢复成 blendFunc(0, 0)
  • 新增 GLStateManager.setTexture2DEnabled(unit, enabled)DeferredDrawBatcher.applyStateKey 改走该路径,恢复纹理单元开关时补发 TEXTURE_UNIT_STATE 事件(原来直接改状态不发事件,Iris 输入追踪会静默脱钩——同类隐患)。
  • 附带诊断能力:actinium.glDebug sysprop 无需游戏内选项即可开启世界渲染调试日志;streaming 绘制落在光影 program 上时记录 program-draw 日志。

为什么(根因)

OreLib(Dynamic Surroundings 依赖)的 OpenGlState.push()glGetInteger(GL_TEXTURE_2D) 等非法方式查询状态保存现场。兼容 profile 下该查询合法,但 Actinium 的 core profile 后端拒绝,glsm 此前直接转发 → 恒返回 0 → OreLib 认为纹理处于关闭 → pop()无条件 disableTexture2D() → Iris 输入追踪认为 unit-0 无纹理 → 当帧剩余 pass(雨、粒子、手、半透明地形、世界边界)全部错配无纹理程序变体 → 白屏。

这解释了 #41 的触发条件:打怪(伤害数字 popoff 每帧执行 push/pop 制造污染)+ 下雨(错配的雨 quad 满屏无纹理渲染形成白屏洗刷,前景雨 quad 还会把动物涂成白色剪影);只打怪时仅手/手持物变白(与 issue 评论一致)。日志实证:污染帧与 OreLib 首次重定向同帧同秒,PARTICLES 96→95、RAIN_SNOW 139→93/95、HAND→131/133 错配序列完整。

如何验证

  • ./gradlew build --no-daemon 通过(含 check 全部测试与 remap jar 契约测试)。
  • dev 客户端回归:ComplementaryUnbound r5.5.1 + DynamicSurroundings 3.6.3.0BETA + OreLib 3.6.0.1,/weather rain 下打怪触发伤害数字——修复前稳定白屏(雨 quad 无纹理洗刷、手与动物变白),修复后雨丝纹理正常、不再白屏、popoff 消失后画面保持正常。

Closes #41

The actinium.glDebug system property enables GLSMDebug world-render logging
without requiring the in-game debug option, and logDrawOnActiveProgram records
streaming/immediate draws that land on a shader-pipeline program. Added while
diagnosing issue #41.
OreLib's OpenGlState (used by Dynamic Surroundings popoffs and rain-splash
particle collections) queries enable caps such as GL_TEXTURE_2D through
glGetInteger. Compatibility GL answers these queries, but the core-profile
backend rejects them, so every read returned 0 and OpenGlState.pop()
force-disabled texturing after each popoff. Iris input tracking then matched
no-texture program variants for the rest of the frame (rain, particles, hand,
translucent terrain), producing the white screen from issue #41; combat plus
rain reproduced it reliably.

- glGetInteger/glGetFloat now answer enable caps from tracked state via
  isEnableCap, matching compatibility-profile semantics
- map the legacy GL_BLEND_SRC/GL_BLEND_DST aliases to the RGB blend factors
  so saved blend state round-trips instead of becoming blendFunc(0, 0)
- DeferredDrawBatcher.applyStateKey restores texture-unit enables through the
  new GLStateManager.setTexture2DEnabled so TEXTURE_UNIT_STATE events are
  posted instead of silently desyncing pipeline inputs

Closes #41
Local scratch for crash-dump analysis (debuggers, symbols, parsed WER reports).
@DHJComical
DHJComical merged commit 3509a01 into main Sep 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] DynamicSurroundings动态环绕冲突白屏

1 participant