mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-10-25 20:22:22 +00:00
Fix shadow pass receiving a full-bright lightmap constant and misreporting terrain renderStage (#2170)
* Fix shadow pass lightmap availability * Report per-layer terrain renderStage --------- Co-authored-by: Eclipse-Sol <phillips-l@outlook.com>
This commit is contained in:
1 parent
cd0a9608d3
commit
cbd16b1a76
2 files changed
+29
-4
No files matched your search
@@ -612,8 +612,8 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
this.shadowRenderer = new ShadowRenderer(programs.getShadow().orElse(null),
|
||||
programs.getPackDirectives(), shadowRenderTargets, shadowCompositeRenderer,
|
||||
() -> usesSampler(IrisSamplers.USAGE_SHADOWTEX1));
|
||||
Program shadowProgram = table.match(RenderCondition.SHADOW, InputAvailability.of(true, true)).getProgram();
|
||||
Program shadowWaterProgram = table.match(RenderCondition.SHADOW_TRANSLUCENT, InputAvailability.of(true, true)).getProgram();
|
||||
Program shadowProgram = table.match(RenderCondition.SHADOW, SHADOW_INPUTS).getProgram();
|
||||
Program shadowWaterProgram = table.match(RenderCondition.SHADOW_TRANSLUCENT, SHADOW_INPUTS).getProgram();
|
||||
shadowRenderer.setUsesImages((shadowProgram != null && shadowProgram.getActiveImages() > 0) || (shadowWaterProgram != null && shadowWaterProgram.getActiveImages() > 0));
|
||||
shadowRenderer.setPlayerReflectionCaptureEnabled((shadowProgram != null && GLStateManager.glGetUniformLocation(shadowProgram.getProgramId(), "playerAtlas_img") != -1) || (shadowWaterProgram != null && GLStateManager.glGetUniformLocation(shadowWaterProgram.getProgramId(), "playerAtlas_img") != -1));
|
||||
} else {
|
||||
@@ -1031,9 +1031,25 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
private void matchPass(RenderCondition condition) {
|
||||
if (DisplayListManager.getRecordMode() == DisplayListManager.RecordMode.COMPILE) return;
|
||||
currentCondition = condition;
|
||||
beginPass(table.match(condition, inputs));
|
||||
beginPass(table.match(condition, inputsFor(condition)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shadow passes always get the lightmap attribute: every vertex format they submit carries the lightmap
|
||||
* element, while the live {@code inputs} flag tracks whether unit 1 has GL_TEXTURE_2D enabled - which the
|
||||
* shadow pass never does. Keep this consistent with the shadow program lookups in the constructor.
|
||||
*/
|
||||
private InputAvailability inputsFor(RenderCondition condition) {
|
||||
if (condition == RenderCondition.SHADOW || condition == RenderCondition.SHADOW_TRANSLUCENT) {
|
||||
return SHADOW_INPUTS;
|
||||
}
|
||||
|
||||
return inputs;
|
||||
}
|
||||
|
||||
/** Availability used for every shadow pass draw and for the shadow program lookups at load time. */
|
||||
private static final InputAvailability SHADOW_INPUTS = InputAvailability.of(true, true);
|
||||
|
||||
@Override
|
||||
public void onEntityRenderBoundary() {
|
||||
GLSMHooks.resolvePendingProgram();
|
||||
|
||||
+10
-1
@@ -138,7 +138,7 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
} else {
|
||||
pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
if (pass == 0) {
|
||||
pipeline.setPhase(WorldRenderingPhase.TERRAIN_CUTOUT);
|
||||
pipeline.setPhase(WorldRenderingPhase.TERRAIN_SOLID);
|
||||
} else if (pass == 1) {
|
||||
if (!ShadowRenderingState.areShadowsCurrentlyBeingRendered()) {
|
||||
iris$beginTranslucents(pipeline, Camera.INSTANCE);
|
||||
@@ -173,8 +173,10 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
try {
|
||||
if (pass == 0) {
|
||||
mc.mcProfiler.endStartSection(shadow ? SECTION_SHADOW_SOLID : SECTION_SOLID);
|
||||
iris$setTerrainPhase(pipeline, WorldRenderingPhase.TERRAIN_SOLID);
|
||||
this.celeritas$renderer.drawChunkLayer(BlockRenderLayer.SOLID, camX, camY, camZ);
|
||||
mc.mcProfiler.endStartSection(shadow ? SECTION_SHADOW_CUTOUT_MIPPED : SECTION_CUTOUT_MIPPED);
|
||||
iris$setTerrainPhase(pipeline, WorldRenderingPhase.TERRAIN_CUTOUT_MIPPED);
|
||||
this.celeritas$renderer.drawChunkLayer(BlockRenderLayer.CUTOUT_MIPPED, camX, camY, camZ);
|
||||
} else {
|
||||
mc.mcProfiler.endStartSection(shadow ? SECTION_SHADOW_TRANSLUCENT : SECTION_TRANSLUCENT);
|
||||
@@ -323,6 +325,13 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Unique
|
||||
private static void iris$setTerrainPhase(WorldRenderingPipeline pipeline, WorldRenderingPhase phase) {
|
||||
if (pipeline != null) {
|
||||
pipeline.setPhase(phase);
|
||||
}
|
||||
}
|
||||
|
||||
@Unique
|
||||
private void iris$beginTranslucents(WorldRenderingPipeline pipeline, Camera camera) {
|
||||
pipeline.beginHand();
|
||||
|
||||
Reference in new issue
Block a user