OpenGL驱动程序在glTexture2D上崩溃

问题描述 投票:0回答:1

使用以下Kotlin / JVM / LWJGL + java.nio.ByteBuffer + OpenGL代码,看来我可以使我的某些驱动程序崩溃:

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)

在通常的GLFW + OpenGL初始化之后执行此操作,这将导致应用程序崩溃并显示以下消息:

#
# 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.
#

我可以对此做些什么,但要避免使用2的幂次幂吗?

我测试了一些分辨率,但只有宽度或高度> 1024的纹理才崩溃。在1026 x 1029(甚至更多,例如1590 x 2244)的情况下,我在100%的情况下都崩溃了。

我正在将RX 580,R5 2600,Win 10,Radeon驱动程序更新为“推荐,以防万一。”>

使用以下Kotlin / JVM / LWJGL + java.nio.ByteBuffer + OpenGL代码,看来我可以使我的某些驱动程序崩溃:val texture = glGenTextures()glBindTexture(GL_TEXTURE_2D,texture)val w = 1026 val ...] >

opengl crash driver lwjgl
1个回答
0
投票

图像数据中行的默认对齐方式是4个字节。除非您的纹理的宽度是4的倍数,否则必须在每行的末尾提供用于填充的其他字节。

另一个选项是通过调用将解压缩对齐方式更改为1个字节

© www.soinside.com 2019 - 2024. All rights reserved.