-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.20.1 - EXCEPTION_ACCESS_VIOLATION when using Create #181
Comments
Another crash - both iris-flw-compat/common/src/main/java/top/leonx/irisflw/vertex/block/ExtendedBlockWriterUnsafe.java Line 23 in 0ee87c6
being the culprit Might be worth adding some debug logging that we can enable via config to try and determine where the error is occuring and maybe the stacktrace? |
Another log with hopefully a bit more info in since I enabled minidumps |
Replicated the issue with a custom jar modified code @Override
public void writeVertex(VertexList list, int i) {
if(buffer.isReadOnly()) {
IrisFlw.LOGGER.error("Buffer is readonly!");
return;
}
IrisFlw.LOGGER.info("Buffer Capacity: {}", buffer.capacity());
float x = list.getX(i);
float y = list.getY(i);
float z = list.getZ(i);
float xN = list.getNX(i);
float yN = list.getNY(i);
float zN = list.getNZ(i);
float u = list.getU(i);
float v = list.getV(i);
byte r = list.getR(i);
byte g = list.getG(i);
byte b = list.getB(i);
byte a = list.getA(i);
int light = list.getLight(i);
putFloat(ptr, 0, x);
putFloat(ptr, 4, y);
putFloat(ptr, 8, z);
putByte(ptr, 12, r);
putByte(ptr, 13, g);
putByte(ptr, 14, b);
putByte(ptr, 15, a);
putFloat(ptr, 16, u);
putFloat(ptr, 20, v);
putInt(ptr, 24, light << 8); // light is packed in the low byte of each short
putByte(ptr, 28, RenderMath.nb(xN));
putByte(ptr, 29, RenderMath.nb(yN));
putByte(ptr, 30, RenderMath.nb(zN));
if (list instanceof IrisBlockVertexReader irisVertexList) {
float midU = irisVertexList.getMidTexU(i);
float midV = irisVertexList.getMidTexV(i);
int tangent = irisVertexList.getTangent(i);
tangent = repackTangent(tangent);
int midBlock = irisVertexList.getMidBlock(i);
midBlock = repackMidBlock(midBlock);
short entityX = irisVertexList.getEntityX(i);
short entityY = irisVertexList.getEntityY(i);
putFloat(ptr, 32, midU);
putFloat(ptr, 36, midV);
putFloat(ptr, 40, Float.intBitsToFloat(tangent));
putFloat(ptr, 44, Float.intBitsToFloat(midBlock));
putShort(ptr, 48, entityX);
putShort(ptr, 50, entityY);
} else {
putLong(ptr, 32, 0);
putLong(ptr, 40, 0);
putInt(ptr, 48, 0);
}
ptr += ExtendedBlockVertex.EXTEND_FORMAT.getStride();
advance();
}
private int repackTangent(int packedTangent) {
// Add 1.0f to each component to avoid negative values
var x = NormI8.unpackX(packedTangent) + 1.0f;
var y = NormI8.unpackY(packedTangent) + 1.0f;
var z = NormI8.unpackZ(packedTangent) + 1.0f;
var w = NormI8.unpackW(packedTangent) + 1.0f;
return NormI8.pack(x, y, z, w);
}
private int repackMidBlock(int midBlock) {
// Add 2.0f to each component to avoid negative values
float x = (midBlock & 0xFF) * 0.015625F + 2.0f;
float y = ((midBlock >> 8) & 0xFF) * 0.015625F + 2.0f;
float z = ((midBlock >> 16) & 0xFF) * 0.015625F + 2.0f;
int emission = (midBlock >> 24) & 0xFF;
return (int)(x * 64.0F) & 255 | ((int)(y * 64.0F) & 255) << 8 | ((int)(z * 64.0F) & 255) << 16 | emission << 24;
}
void putFloat(long optr, long offset, float f) {
long ptr = optr + offset;
IrisFlw.LOGGER.info("buffer ptr: {}, buffer pos: {}, optr: {}, offset: {}, value: {}", MemoryUtil.memAddress(buffer), buffer.position(), optr, offset, f);
MemoryUtil.memPutFloat(ptr, f);
}
void putByte(long optr, long offset, byte b) {
long ptr = optr + offset;
IrisFlw.LOGGER.info("buffer ptr: {}, buffer pos: {}, optr: {}, offset: {}, value: {}", MemoryUtil.memAddress(buffer), buffer.position(), optr, offset, b);
MemoryUtil.memPutByte(ptr, b);
}
void putInt(long optr, long offset, int i) {
long ptr = optr + offset;
IrisFlw.LOGGER.info("buffer ptr: {}, buffer pos: {}, optr: {}, offset: {}, value: {}", MemoryUtil.memAddress(buffer), buffer.position(), optr, offset, i);
MemoryUtil.memPutInt(ptr, i);
}
void putShort(long optr, long offset, short s) {
long ptr = optr + offset;
IrisFlw.LOGGER.info("buffer ptr: {}, buffer pos: {}, optr: {}, offset: {}, value: {}", MemoryUtil.memAddress(buffer), buffer.position(), optr, offset, s);
MemoryUtil.memPutShort(ptr, s);
}
void putLong(long optr, long offset, long l) {
long ptr = optr + offset;
IrisFlw.LOGGER.info("buffer ptr: {}, buffer pos: {}, optr: {}, offset: {}, value: {}", MemoryUtil.memAddress(buffer), buffer.position(), optr, offset, l);
MemoryUtil.memPutLong(ptr, l);
} log
I've managed to consistently replicate the error by using a Shader that doesn't properly load when in the Nether & running The error I see from Iris when it attempts to load the shader in the Nether is the following:
Shader wise, I'm using Seems like if a shader doesn't properly load, it's possible for any writes at Hopefully this helps you diagnose the issue @leon-o Without fully understanding low-level memory management in Java, I'd assume some kind of check for whether a target pointer is within writeable memory would be the best solution |
For reference, this is the pack I'm playing with some others which is having the issues https://www.curseforge.com/minecraft/modpacks/tekkit-from-wish |
I am having the same issue and would like to see a fix. |
Thanks for the detailed report, I also am having identical issues on newer versions of the mod and flywheel/oculus |
Originally reported on the Flywheel issues page: Engine-Room/Flywheel#272
Describe the Bug
When using shaders, flywheel can crash with
EXCEPTION_ACCESS_VIOLATION
in the Render thread.Reproduction Steps
Expected Result
No crash
Operating System
Windows 11
What is your GPU?
Nvidia Geforce RTX 4090
Minecraft Version
1.20.1
Loader Version
Forge 47.3.12
Additional Context
latest.log
hs_err_pid19892.log
The text was updated successfully, but these errors were encountered: