Skip to content

Commit 2c62c87

Browse files
committed
more shader logging
1 parent a0512ef commit 2c62c87

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

src/main/java/me/cortex/voxy/client/iris/IrisShaderPatch.java

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import me.cortex.voxy.common.Logger;
1010
import net.irisshaders.iris.shaderpack.ShaderPack;
1111
import net.irisshaders.iris.shaderpack.include.AbsolutePackPath;
12+
import org.apache.commons.logging.Log;
1213
import org.lwjgl.opengl.ARBDrawBuffersBlend;
1314

1415
import java.lang.reflect.Modifier;
@@ -140,6 +141,7 @@ public Int2ObjectMap<BlendState> deserialize(JsonElement json, Type typeOfT, Jso
140141
}
141142
}
142143
} else {
144+
Logger.error("Unknown blend state "+val);
143145
state = null;
144146
}
145147
if (bs != null) {
@@ -175,16 +177,33 @@ private static class PatchGson {
175177
public boolean excludeLodsFromVanillaDepth;
176178
public float[] renderScale;
177179
public boolean useViewportDims;
178-
public boolean checkValid() {
180+
public String checkValid() {
179181
if (this.blending != null) {
182+
int i = 0;
180183
for (BlendState state : this.blending.values()) {
181184
if (state.buffer != -1 && (state.buffer<0||this.translucentDrawBuffers.length<=state.buffer)) {
182-
return false;
185+
if (state.buffer<0) {
186+
return "Blending buffer is <0 at index: " + i;
187+
} else {
188+
return "Blending buffer index out of bounds at "+i+" was "+state.buffer+" maximum is " +(this.translucentDrawBuffers.length-1);
189+
}
183190
}
191+
i++;
184192
}
185193
}
186-
187-
return this.opaqueDrawBuffers != null && this.translucentDrawBuffers != null && this.uniforms != null && this.opaquePatchData != null;
194+
if (this.opaquePatchData == null) {
195+
return "Opaque patch data is null";
196+
}
197+
if (this.uniforms == null) {
198+
return "Uniforms are null";
199+
}
200+
if (this.opaqueDrawBuffers == null) {
201+
return "Opaque draw buffers are null";
202+
}
203+
if (this.translucentDrawBuffers == null) {
204+
return "Translucent draw buffers are null";
205+
}
206+
return null;
188207
}
189208
}
190209

@@ -319,27 +338,31 @@ public static IrisShaderPatch makePatch(ShaderPack ipack, AbsolutePackPath direc
319338
}
320339
patchData = GSON.fromJson(voxyPatchData, PatchGson.class);
321340
if (patchData == null) {
322-
throw new IllegalStateException("Voxy patch json returned null");
341+
throw new IllegalStateException("Voxy patch json returned null, this is most likely due to malformed json file");
323342
}
324343

325344
{//Inject data from the auxilery files if they are present
326345
var opaque = sourceProvider.apply(directory.resolve("voxy_opaque.glsl"));
327346
if (opaque != null) {
347+
Logger.info("External opaque shader patch applied");
328348
patchData.opaquePatchData = opaque;
329349
}
330350
var translucent = sourceProvider.apply(directory.resolve("voxy_translucent.glsl"));
331351
if (translucent != null) {
352+
Logger.info("External translucent shader patch applied");
332353
patchData.translucentPatchData = translucent;
333354
}
334355
//This might be ok? not.. sure if is nice or not
335356
var taa = sourceProvider.apply(directory.resolve("voxy_taa.glsl"));
336357
if (taa != null) {
358+
Logger.info("External taa shader patch applied");
337359
patchData.taaOffset = taa;
338360
}
339361
}
340362

341-
if (!patchData.checkValid()) {
342-
throw new IllegalStateException("voxy json patch not valid: " + voxyPatchData);
363+
var invalidPatchDataReason = patchData.checkValid();
364+
if (invalidPatchDataReason!=null) {
365+
throw new IllegalStateException("voxy json patch not valid: " + invalidPatchDataReason);
343366
}
344367
} catch (Exception e) {
345368
patchData = null;

src/main/java/me/cortex/voxy/client/iris/IrisVoxyRenderPipelineData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ public record ImageSet(String layout, IntConsumer bindingFunction) {
321321
}
322322
private static ImageSet createImageSet(IrisRenderingPipeline ipipe, IrisShaderPatch patch) {
323323
var samplerDataSet = patch.getSamplerSet();
324+
if (samplerDataSet == null) return null;
324325
Set<String> samplerNameSet = new LinkedHashSet<>(samplerDataSet.keySet());
325326
if (samplerNameSet.isEmpty()) return null;
326327
Set<TextureWSampler> samplerSet = new LinkedHashSet<>();

0 commit comments

Comments
 (0)