with the following Kotlin/JVM/LWJGL + java.nio.ByteBuffer + OpenGL code it seems I can crash some driver of mine:
val texture = glGenTextures() glBindTexture(GL_TEXTURE_2D, texture) val w = 1026 val h = 1029 val byteBuffer = ByteBuffer .allocateDirect(w*h) .position(0) glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, byteBuffer)
Executing this after the usual GLFW+OpenGL init, this results in a crash of the application and the following message:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff98593509c, pid=13572, tid=15424 # # JRE version: OpenJDK Runtime Environment (12.0.1+12) (build 12.0.1+12) # Java VM: OpenJDK 64-Bit Server VM (12.0.1+12, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64) # Problematic frame: # C [atio6axx.dll+0x1bb509c] # # No core dump will be written. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\Users\Antonio\Documents\IdeaProjects\VideoStudio\hs_err_pid13572.log # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. #
Is there something I can do about this, but to avoid non-power-of-2-textures?
I tested some resolutions, and only got crashes with textures with width or height > 1024. In the case of 1026 x 1029 (and some more, e.g. 1590 x 2244) I get a crash in 100% of the cases.
I am using an RX 580, R5 2600, Win 10, Radeon Drivers updated to Recommended, just in case it would change something.
The default alignment for rows in the image data is 4 bytes. Unless your texture has a width which is a multiple of 4, you have to supply additional bytes for padding at the end of each row.
The other option is to change the unpack alignment to 1 byte by calling
User contributions licensed under CC BY-SA 3.0