Entity Shadow Replay (#2294)

This commit is contained in:
Eclipse-Sol authored and GitHub committed 2026-10-24 16:21:33 -07:00
1 parent 102c6cad86
commit 713509a87b
39 files changed
+3750 -157

No files matched your search

@@ -1437,10 +1437,24 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
void rebindProgram() {
if (program != null) program.use();
DeferredWorldRenderingPipeline.this.customUniforms.push(this);
final boolean suspended = GLStateManager.suspendExitCapture();
try {
DeferredWorldRenderingPipeline.this.customUniforms.push(this);
} finally {
GLStateManager.resumeExitCapture(suspended);
}
}
private void useNow() {
final boolean suspended = GLStateManager.suspendExitCapture();
try {
applyState();
} finally {
GLStateManager.resumeExitCapture(suspended);
}
}
private void applyState() {
DepthColorStorage.unlockDepthColor();
if (isBeforeTranslucent) {
@@ -1485,14 +1499,19 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
}
public void stopUsing() {
DepthColorStorage.unlockDepthColor();
final boolean suspended = GLStateManager.suspendExitCapture();
try {
DepthColorStorage.unlockDepthColor();
if (alphaTestOverride != null) {
AlphaTestOverride.restore();
}
if (alphaTestOverride != null) {
AlphaTestOverride.restore();
}
if (blendModeOverride != null || (bufferBlendOverrides != null && !bufferBlendOverrides.isEmpty())) {
BlendModeOverride.restore();
if (blendModeOverride != null || (bufferBlendOverrides != null && !bufferBlendOverrides.isEmpty())) {
BlendModeOverride.restore();
}
} finally {
GLStateManager.resumeExitCapture(suspended);
}
}
@@ -1604,6 +1623,11 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
return current != null && current.instancedVariant(kind) != null;
}
public boolean hasInstancedVariant(RenderCondition condition, InputAvailability availability, Instancing kind) {
final Pass pass = table.match(condition, availability);
return pass != null && pass.instancedVariant(kind) != null;
}
@Override
public void bindInstancedVariant(Instancing kind) {
activeInstancing = kind;
@@ -2496,25 +2520,34 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
@Override
public void onBindTexture(int id) {
if (shouldBindPBR && isRenderingWorld) {
final PBRTextureHolder pbrHolder = PBRTextureManager.INSTANCE.getOrLoadHolder(id);
currentNormalTexture = pbrHolder.getNormalTexture().getGlTextureId();
currentSpecularTexture = pbrHolder.getSpecularTexture().getGlTextureId();
BatchStateGuard.suspend();
final boolean suspended = GLStateManager.suspendExitCapture();
try {
final TextureFormat textureFormat = TextureFormatLoader.getFormat();
if (textureFormat != null) {
textureFormat.setupTextureParameters(PBRType.NORMAL, pbrHolder.getNormalTexture());
textureFormat.setupTextureParameters(PBRType.SPECULAR, pbrHolder.getSpecularTexture());
}
PBRTextureManager.notifyPBRTexturesChanged();
updatePbrTextures(id);
} finally {
BatchStateGuard.resume();
GLStateManager.resumeExitCapture(suspended);
}
}
}
private void updatePbrTextures(int id) {
final PBRTextureHolder pbrHolder = PBRTextureManager.INSTANCE.getOrLoadHolder(id);
currentNormalTexture = pbrHolder.getNormalTexture().getGlTextureId();
currentSpecularTexture = pbrHolder.getSpecularTexture().getGlTextureId();
BatchStateGuard.suspend();
try {
final TextureFormat textureFormat = TextureFormatLoader.getFormat();
if (textureFormat != null) {
textureFormat.setupTextureParameters(PBRType.NORMAL, pbrHolder.getNormalTexture());
textureFormat.setupTextureParameters(PBRType.SPECULAR, pbrHolder.getSpecularTexture());
}
PBRTextureManager.notifyPBRTexturesChanged();
} finally {
BatchStateGuard.resume();
}
}
private static CompletableFuture<Map<PatchShaderType, String>> submitCompositeTransform(ProgramSource source, TextureStage stage,
Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap) {
return Iris.ShaderTransformExecutor.submitTracked(() -> TransformPatcher.patchComposite(