Hello Guest

3D models causing hard crash of JVM on dedicated GPU, integrated GPU runs fine

  • 2 Replies
  • 4150 Views
I'm developing a game using LWJGL that has been running fine on an integrated GPU on my processor. It had low FPS since it's not a dedicated GPU, so I installed a GeForce GTX 1050 TI SC. But now the game engine hard crashes when the scene contains 3D models. When I change the video connection from the dedicated GPU to the integrated GPU and restart the computer, the game loads the models and runs fine again. The game also runs fine on a separate laptop.

I've made sure to update my graphics drivers to the latest, and even tried using drivers from 6 months ago, and even one year ago. The game still crashes. The crash happens regardless of on JDK 8 or 9.

The crash happens at a call to
Code: [Select]
glfwSwapBuffers(window)
As a test I've downloaded Minecraft, which runs fine.

Anyone have any suggestions?

Repo I'm experiencing the crash from https://github.com/Benjman/game-engine.git

System Info
Code: [Select]
Status                                    : OK
Name                                      : Microsoft Windows 10 Pro|C:\Windows|\Device\Harddisk2\Partition4
FreePhysicalMemory                        : 10017280
FreeSpaceInPagingFiles                    : 2490368
FreeVirtualMemory                         : 9286352
Caption                                   : Microsoft Windows 10 Pro
Description                               :
InstallDate                               : 12/15/2017 8:59:21 PM
CreationClassName                         : Win32_OperatingSystem
CSCreationClassName                       : Win32_ComputerSystem
CSName                                    : DESKTOP-MKGRIBI
CurrentTimeZone                           : -420
Distributed                               : False
LastBootUpTime                            : 1/28/2018 2:35:50 PM
LocalDateTime                             : 1/28/2018 2:58:39 PM
MaxNumberOfProcesses                      : 4294967295
MaxProcessMemorySize                      : 137438953344
NumberOfLicensedUsers                     :
NumberOfProcesses                         : 178
NumberOfUsers                             : 2
OSType                                    : 18
OtherTypeDescription                      :
SizeStoredInPagingFiles                   : 2490368
TotalSwapSpaceSize                        :
TotalVirtualMemorySize                    : 19136220
TotalVisibleMemorySize                    : 16645852
Version                                   : 10.0.16299
BootDevice                                : \Device\HarddiskVolume5
BuildNumber                               : 16299
BuildType                                 : Multiprocessor Free
CodeSet                                   : 1252
CountryCode                               : 1
CSDVersion                                :
DataExecutionPrevention_32BitApplications : True
DataExecutionPrevention_Available         : True
DataExecutionPrevention_Drivers           : True
DataExecutionPrevention_SupportPolicy     : 2
Debug                                     : False
EncryptionLevel                           : 256
ForegroundApplicationBoost                : 2
LargeSystemCache                          :
Locale                                    : 0409
Manufacturer                              : Microsoft Corporation
MUILanguages                              : {en-US}
OperatingSystemSKU                        : 48
Organization                              :
OSArchitecture                            : 64-bit
OSLanguage                                : 1033
OSProductSuite                            : 256
PAEEnabled                                :
PlusProductID                             :
PlusVersionNumber                         :
PortableOperatingSystem                   : False
Primary                                   : True
ProductType                               : 1
RegisteredUser                            : Windows User
SerialNumber                              : 00330-80000-00000-AA462
ServicePackMajorVersion                   : 0
ServicePackMinorVersion                   : 0
SuiteMask                                 : 272
SystemDevice                              : \Device\HarddiskVolume8
SystemDirectory                           : C:\Windows\system32
SystemDrive                               : C:
WindowsDirectory                          : C:\Windows
PSComputerName                            :
CimClass                                  : root/cimv2:Win32_OperatingSystem
CimInstanceProperties                     : {Caption, Description, InstallDate, Name...}
CimSystemProperties                       : Microsoft.Management.Infrastructure.CimSystemProperties

« Last Edit: January 28, 2018, 22:06:16 by WeBeJammin »

*

Offline KaiHH

  • ****
  • 334
When running your code, it tells that it breaks in glDrawElements:
Code: [Select]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.GL11.nglDrawElements(IIIJ)V+0
j  org.lwjgl.opengl.GL11.glDrawElements(IIIJ)V+4

Use https://github.com/LWJGLX/debug as a Java Agent using -javaagent:lwjglx-debug-1.0.0.jar=n. When you did that, it would tell you multiple issues:
1. you are calling certain GLFW methods (such as glfwInit()) in a thread other than the main thread (i.e. the one running the main() method), which is not supported on all platforms (not the main issue though with your code)
2. You will get the following outputs:
Code: [Select]
[error][1] buffer has no remaining elements. Did you forget to flip()/rewind() it?
  Stacktrace: com.brecord.games.engine.graph.Mesh.<init>(Mesh.java:85)
              com.brecord.games.engine.graph.Mesh.<init>(Mesh.java:51)
              com.brecord.games.engine.loaders.assimp.StaticMeshesLoader.processMesh(StaticMeshesLoader.java:133)
and
Code: [Select]
[error][1] buffer has no remaining elements. Did you forget to flip()/rewind() it?
  Stacktrace: com.brecord.games.engine.graph.Mesh.<init>(Mesh.java:94)
              com.brecord.games.engine.graph.Mesh.<init>(Mesh.java:51)
              com.brecord.games.engine.loaders.assimp.StaticMeshesLoader.processMesh(StaticMeshesLoader.java:133)

This means that for the vertex arrays 1 and 2 you are uploading zero-length buffers, which when you call glDrawElements it will index out of the requested buffer range in the 1 and 2 vertex arrays (since you request to render some vertices but you haven't any data for them).

Thank you! I will work on fixing these issues.