Font crashes engine with OpenGL error

Still trying to pinpoint the cause, but after the update to 1.2.139, our game crashes when loading a particular screen:

EDIT: Pinpointed crash to the loading of a font see below.

INFO:DLIB: Log server started on port 65107
INFO:ENGINE: Engine service started on port 65112
INFO:ENGINE: Defold Engine 1.2.139 (eedf9a7)
INFO:ENGINE: Loading data from: build/default
INFO:ENGINE: Initialised sound device 'default'

DEBUG:SCRIPT: Creating TCP server
DEBUG:SCRIPT: Starting TCP server on port 3648
ERROR:GRAPHICS: gl error 1281: invalid value

Assertion failed: (0), function SetTexture, file ../src/opengl/graphics_opengl.cpp, line 2017.
INFO:fmod: Running in the editor. Will attempt to load libraries from project
INFO:CRASH: Successfully wrote Crashdump to file: /Users/da_petcu21/Library/Application Support/Defold/_crash

The crash dump:
_crash.zip (2.6 KB)

And the crash log:
crash_log.txt.zip (17.9 KB)

I have probably the same error.

1 Like

I tracked it down to this font being used in a label:
Archive.zip (44.9 KB)

1 Like

Huh, something for @jhonny.goransson and maybe @sven to take a look at tomorrow morning.

1 Like

Rats, probably related to the recent font cache changes I made :frowning: I’ll take a look first thing in the morning!

Hi again! Could you give me the font metrics you have used? I’ve done a few preliminary tests now with your font and it took me quite a while to get a crash, but I eventually got it. However, running the simulation again with the exact same parameters doesn’t yield the crash. Did you have a similar experience or does it crash every time for you guys?

Yes, it crashes every time that scene is loaded. Since then though I’ve narrowed it down to using the “$” character with that particular font. Removing every occurence of the dollar sign in that scene seems to fix the issue. Here are the .font propreties:

font: "/main/fonts/cooperhewitt-medium.otf"
material: "/builtins/fonts/font.material"
size: 30
antialias: 1
alpha: 1.0
outline_alpha: 0.0
outline_width: 0.0
shadow_alpha: 0.0
shadow_blur: 0
shadow_x: 0.0
shadow_y: 0.0
extra_characters: ""
output_format: TYPE_BITMAP
all_chars: false
cache_width: 0
cache_height: 0
3 Likes

Interesting! Thanks for the info, looking into this issue now.

2 Likes

And here’s the label where it’s used:

embedded_components {
  id: "cost"
  type: "label"
  data: "size {\n"
  "  x: 128.0\n"
  "  y: 32.0\n"
  "  z: 0.0\n"
  "  w: 0.0\n"
  "}\n"
  "scale {\n"
  "  x: 0.7\n"
  "  y: 0.7\n"
  "  z: 1.0\n"
  "  w: 0.0\n"
  "}\n"
  "color {\n"
  "  x: 0.101960786\n"
  "  y: 0.101960786\n"
  "  z: 0.101960786\n"
  "  w: 1.0\n"
  "}\n"
  "outline {\n"
  "  x: 0.0\n"
  "  y: 0.0\n"
  "  z: 0.0\n"
  "  w: 1.0\n"
  "}\n"
  "shadow {\n"
  "  x: 0.0\n"
  "  y: 0.0\n"
  "  z: 0.0\n"
  "  w: 1.0\n"
  "}\n"
  "leading: 1.0\n"
  "tracking: 0.0\n"
  "pivot: PIVOT_NE\n"
  "blend_mode: BLEND_MODE_ALPHA\n"
  "line_break: false\n"
  "text: \"$2130\"\n"
  "font: \"/main/fonts/document.font\"\n"
  "material: \"/builtins/fonts/label.material\"\n"
  ""
  position {
    x: 364.0
    y: 0.0
    z: 0.0
  }
  rotation {
    x: 0.0
    y: 0.0
    z: 0.0
    w: 1.0
  }
}
2 Likes

There’s that “$” character again. Is that what trips up the engine @jhonny.goransson?

1 Like

Yeah, looks like we are getting two different value from the internal metrics calculations - the glyphs get a larger ascent value than what the font says. Basically, we cannot trust that we are given a correct max ascent from the font :slight_smile: Working on the fix now!

9 Likes