|
9 | 9 | import me.cortex.voxy.common.Logger; |
10 | 10 | import net.irisshaders.iris.shaderpack.ShaderPack; |
11 | 11 | import net.irisshaders.iris.shaderpack.include.AbsolutePackPath; |
| 12 | +import org.apache.commons.logging.Log; |
12 | 13 | import org.lwjgl.opengl.ARBDrawBuffersBlend; |
13 | 14 |
|
14 | 15 | import java.lang.reflect.Modifier; |
@@ -140,6 +141,7 @@ public Int2ObjectMap<BlendState> deserialize(JsonElement json, Type typeOfT, Jso |
140 | 141 | } |
141 | 142 | } |
142 | 143 | } else { |
| 144 | + Logger.error("Unknown blend state "+val); |
143 | 145 | state = null; |
144 | 146 | } |
145 | 147 | if (bs != null) { |
@@ -175,16 +177,33 @@ private static class PatchGson { |
175 | 177 | public boolean excludeLodsFromVanillaDepth; |
176 | 178 | public float[] renderScale; |
177 | 179 | public boolean useViewportDims; |
178 | | - public boolean checkValid() { |
| 180 | + public String checkValid() { |
179 | 181 | if (this.blending != null) { |
| 182 | + int i = 0; |
180 | 183 | for (BlendState state : this.blending.values()) { |
181 | 184 | 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 | + } |
183 | 190 | } |
| 191 | + i++; |
184 | 192 | } |
185 | 193 | } |
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; |
188 | 207 | } |
189 | 208 | } |
190 | 209 |
|
@@ -319,27 +338,31 @@ public static IrisShaderPatch makePatch(ShaderPack ipack, AbsolutePackPath direc |
319 | 338 | } |
320 | 339 | patchData = GSON.fromJson(voxyPatchData, PatchGson.class); |
321 | 340 | 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"); |
323 | 342 | } |
324 | 343 |
|
325 | 344 | {//Inject data from the auxilery files if they are present |
326 | 345 | var opaque = sourceProvider.apply(directory.resolve("voxy_opaque.glsl")); |
327 | 346 | if (opaque != null) { |
| 347 | + Logger.info("External opaque shader patch applied"); |
328 | 348 | patchData.opaquePatchData = opaque; |
329 | 349 | } |
330 | 350 | var translucent = sourceProvider.apply(directory.resolve("voxy_translucent.glsl")); |
331 | 351 | if (translucent != null) { |
| 352 | + Logger.info("External translucent shader patch applied"); |
332 | 353 | patchData.translucentPatchData = translucent; |
333 | 354 | } |
334 | 355 | //This might be ok? not.. sure if is nice or not |
335 | 356 | var taa = sourceProvider.apply(directory.resolve("voxy_taa.glsl")); |
336 | 357 | if (taa != null) { |
| 358 | + Logger.info("External taa shader patch applied"); |
337 | 359 | patchData.taaOffset = taa; |
338 | 360 | } |
339 | 361 | } |
340 | 362 |
|
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); |
343 | 366 | } |
344 | 367 | } catch (Exception e) { |
345 | 368 | patchData = null; |
|
0 commit comments