Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Pioneer crashes when loading Deneb and Venturestar models when using ATI opensource drivers (mesa 9.2.0). Exits with GL_INVALID_ENUM. #2435

Closed
Tichy opened this Issue · 14 comments

5 participants

@Tichy

I move here the issues reported on #2401

My specs are:
ArchLinux, Kernel 3.11.1-1-ARCH, Mesa 9.2.0-2, Ati Radeon HD 6770 (R600) with open source drivers, Xorg 1.14.2

In my setup I can't use the OpenGL debug (KHR_debug extension missing). I tried to trace the problem with apitrace: https://github.com/apitrace/apitrace

The last lines of the trace:

6131 glPushAttrib(mask = GL_ENABLE_BIT)
6132 glEnableClientState(array = GL_VERTEX_ARRAY)
6133 glEnableClientState(array = GL_COLOR_ARRAY)
6134 glEnableClientState(array = GL_TEXTURE_COORD_ARRAY)
6135 glTexCoordPointer(size = 2, type = GL_FLOAT, stride = 0, pointer = blob(1056))
6136 glColorPointer(size = 4, type = GL_FLOAT, stride = 0, pointer = blob(2112))
6137 glVertexPointer(size = 3, type = GL_FLOAT, stride = 0, pointer = blob(1584))
6138 glDrawArrays(mode = GL_TRIANGLES, first = 0, count = 132)
6139 glPopAttrib()
6140 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
6141 glDisable(cap = GL_TEXTURE_2D)
6142 glUseProgram(program = 0)
6143 glDisableClientState(array = GL_VERTEX_ARRAY)
6144 glDisableClientState(array = GL_COLOR_ARRAY)
6145 glDisableClientState(array = GL_TEXTURE_COORD_ARRAY)
6146 glDisable(cap = GL_SCISSOR_TEST)
6147 glGetError() = GL_INVALID_ENUM

I pasted the full trace, from program launch to crash, here: http://www.ipaste.eu/view?id=5063

Top of my opengl.txt

OpenGL version 3.0 Mesa 9.2.0, running on X.Org Gallium 0.4 on AMD JUNIPER
GLEW version 1.10.0
Shading language version: 1.30

Rest of my opengl.txt: http://www.ipaste.eu/view?id=5070

Console output:

Initialized GL2 renderer
started 3 worker threads
ship definition for 'amphiesma' has deprecated 'camera_offset' field
ship definition for 'amphiesma' has deprecated 'gun_mounts' field
ship definition for 'deneb' has deprecated 'camera_offset' field
ship definition for 'deneb' has deprecated 'gun_mounts' field
ship definition for 'dsminer' has deprecated 'camera_offset' field
ship definition for 'kanara' has deprecated 'gun_mounts' field
ship definition for 'lunarshuttle' has deprecated 'camera_offset' field
ship definition for 'lunarshuttle' has deprecated 'gun_mounts' field
ship definition for 'molamola' has deprecated 'camera_offset' field
ship definition for 'molamola' has deprecated 'gun_mounts' field
ship definition for 'natrix' has deprecated 'camera_offset' field
ship definition for 'natrix' has deprecated 'gun_mounts' field
ship definition for 'pumpkinseed' has deprecated 'camera_offset' field
ship definition for 'pumpkinseed' has deprecated 'gun_mounts' field
ship definition for 'venturestar' has deprecated 'camera_offset' field
ship definition for 'venturestar' has deprecated 'gun_mounts' field
ship definition for 'wave' has deprecated 'camera_offset' field
ship definition for 'wave' has deprecated 'gun_mounts' field
Number of factions added: 103
libpng warning: iCCP: known incorrect sRGB profile
(...cut...)
libpng warning: iCCP: known incorrect sRGB profile
Error: OpenGL error(s) during frame:
GL_INVALID_ENUM

Aborted (core dumped)

What I tried:
pioneer -modelviewer starts, but always crashes whe I load deneb and venturestar. it crashed randomly with wave and once with kbuilding01.

Changes in config.ini:

  • disable antialias
  • shaders
  • vsync
  • texture compression
  • textures
  • fullscreen
  • changed resolution

Full console output when loading deneb with modelviewer: http://www.ipaste.eu/view?id=5071
Last lines:

LOD 4
Nodes: 27
Geoms: 9 opaque, 2 transparent
Triangles: 7098

Materials: 1
Collision triangles: 184

Error: OpenGL error(s) during frame:
GL_INVALID_ENUM

apitrace: warning: caught signal 6
apitrace: flushing trace due to an exception
apitrace: info: taking default action for signal 6

The full apitrace dump is very big, over 600000 lines, and I can't upload it. If you need to see more, just ask and I'll upload some other pieces.

Last apitrace dump lines:

636875 glUseProgram(program = 12)
636876 glUniform1f(location = 0, v0 = 0.07525668)
636877 glActiveTexture(texture = GL_TEXTURE0)
636878 glEnable(cap = GL_TEXTURE_2D)
636879 glBindTexture(target = GL_TEXTURE_2D, texture = 9)
636880 glUniform1i(location = 1, v0 = 0)
636881 glPushAttrib(mask = GL_ENABLE_BIT)
636882 glEnableClientState(array = GL_VERTEX_ARRAY)
636883 glEnableClientState(array = GL_COLOR_ARRAY)
636884 glEnableClientState(array = GL_TEXTURE_COORD_ARRAY)
636885 glTexCoordPointer(size = 2, type = GL_FLOAT, stride = 0, pointer = blob(192))
636886 glColorPointer(size = 4, type = GL_FLOAT, stride = 0, pointer = blob(384))
636887 glVertexPointer(size = 3, type = GL_FLOAT, stride = 0, pointer = blob(288))
636888 glDrawArrays(mode = GL_TRIANGLES, first = 0, count = 24)
636889 glPopAttrib()
636890 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
636891 glDisable(cap = GL_TEXTURE_2D)
636892 glUseProgram(program = 0)
636893 glDisableClientState(array = GL_VERTEX_ARRAY)
636894 glDisableClientState(array = GL_COLOR_ARRAY)
636895 glDisableClientState(array = GL_TEXTURE_COORD_ARRAY)
636896 glDisable(cap = GL_SCISSOR_TEST)
636897 glGetError() = GL_INVALID_ENUM

For a comparsion, this is the last part of the trace when loading a ship that does't crash modelviewer (ampemisia):

2101716 glActiveTexture(texture = GL_TEXTURE0)
2101717 glEnable(cap = GL_TEXTURE_2D)
2101718 glBindTexture(target = GL_TEXTURE_2D, texture = 7)
2101719 glUniform1i(location = 1, v0 = 0)
2101720 glPushAttrib(mask = GL_ENABLE_BIT)
2101721 glEnableClientState(array = GL_VERTEX_ARRAY)
2101722 glEnableClientState(array = GL_COLOR_ARRAY)
2101723 glEnableClientState(array = GL_TEXTURE_COORD_ARRAY)
2101724 glTexCoordPointer(size = 2, type = GL_FLOAT, stride = 0, pointer = blob(96))
2101725 glColorPointer(size = 4, type = GL_FLOAT, stride = 0, pointer = blob(192))
2101726 glVertexPointer(size = 3, type = GL_FLOAT, stride = 0, pointer = blob(144))
2101727 glDrawArrays(mode = GL_TRIANGLES, first = 0, count = 12)
2101728 glPopAttrib()
2101729 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
2101730 glDisable(cap = GL_TEXTURE_2D)
2101731 glUseProgram(program = 0)
2101732 glDisableClientState(array = GL_VERTEX_ARRAY)
2101733 glDisableClientState(array = GL_COLOR_ARRAY)
2101734 glDisableClientState(array = GL_TEXTURE_COORD_ARRAY)
2101735 glEnable(cap = GL_BLEND)
2101736 glBlendFunc(sfactor = GL_ONE, dfactor = GL_ONE_MINUS_SRC_ALPHA)
2101737 glEnable(cap = GL_BLEND)
2101738 glBlendFunc(sfactor = GL_ONE, dfactor = GL_ONE_MINUS_SRC_ALPHA)
2101739 glDisable(cap = GL_SCISSOR_TEST)
2101741 glXSwapBuffers(dpy = 0x225cb50, drawable = 25165839)

(Full trace is too big)

@Tichy

When I removed deneb and venturestar models, the game didn't crashed.

@johnbartholomew

When I removed deneb and venturestar models, the game didn't crashed.

The deneb and venturestar are the only ships that use DDS format texture files. This suggests it's a problem when loading these textures. You mentioned you've changed the texture compression setting -- could you check whether that setting affects the crash? (ie, does it crash with both uncompressed and compressed textures?)

@Tichy

Yes. UseTextureCompression was 0 in all my tests, and it crashes also with compression enabled.
Anyway, I don't think that compression works with this setup (anyway, in my opengl.txt I see "compression" mentioned), even when enabled. The loading time is the same. Instead, when I was using compression with proprietary drivers, the game took much longer to load.

@Luomu
Owner

Instead, when I was using compression with proprietary drivers, the game took much longer to load.

That's sort of expected. When UseTextureCompression is enabled most textures (not UI I think) are compressed at load time. This extra processing may take some time, but in the end the textures use less video memory.

@johnbartholomew

Could you try installing extra/libtxc_dxtn? As you may be aware, there are patent problems with texture compression in Mesa, which may or may not affect you depending on what country you're in.

The DDS file format is designed to store texture data in a form that can be uploaded directly to the graphics card without significant extra processing; this makes loading faster. As part of this, DDS files support storing images directly in the most common hardware supported compressed texture formats, and the deneb and venturestar textures take advantage of this (they're stored in DXT1/BC1 format).

However, it looks like we don't have a code-path to decompress these before we send them to the driver, which means that if the graphics driver doesn't support compressed formats then it will complain. There are a couple of possible fixes: We can add a code-path to decompress the textures before giving them to OpenGL, or we can change those models to store the textures in an uncompressed form (or as PNG files, which we already decompress at some cost of CPU time). But until we do that, libtxc_dxtn may solve the problem for you.

@Tichy

Great! Thank you! With libtxc_dxtn installed it doesn't crash anymore.

I think that I'll ask the package mantainer to add libtxc_dxtn as an optional dependency.

Should I close the issue or you prefer to keep it open as a reminder for implementing some kind of fallback when dtx libraries are missing?

@johnbartholomew

Leave it open for now, thanks.

@Zordey

Hi, I have only skim read bits of this (mainly because I dont understand most of it) but do you need me to recreate the Deneb / Venturestar textures as .png or something if the .dds format is going to be an issue?

I have to revisit the models anyway to put in camera / gun tags to get rid of those error messages.

@fluffyfreak
Owner

Ah, I didn't know about this issue - do these patent issues affect all S3TC derivatives?
Are there any compressed texture formats that MESA does unequivocally support?
How are patents a problem in this situation? My code does the loading, the driver only needs to take a chunk of memory, copy it to GPU and set a flag as part of the texture format header block saying how that memory is compressed. It doesn't actually do anything too the DXTn compressed memory since that's the point of it.

@Zordey I'd leave them as DDS for now. If I wanted I could just load them as DDS, unpack them in memory and then submit them to the GPU uncompressed. Compressing DDS is hard, but decompressing them is trivial.

@fluffyfreak
Owner

Ok I've just read up on it, it's because they have to support the compression and decompression in software too and seem to have to use this to plug a gap in the hardware drivers(?) libraries.

Surely, you could skip all of that and still use the data directly with the GPU and the proprietary drivers who do have licenses for the S3TC patents? You'd still lose the compress-at-runtime stuff unless you used the libtxc_dxtn but even then you should just be calling a function in the driver layer to do that and leaving the licensing the to driver layer.

Yuck that whole things just fucked up.

@johnbartholomew

I think the way forward is:

  • Add checks for compressed texture support (the opengl.txt posted by Tichy in this issue includes ARB_texture_compression in the extension list, but not EXT_texture_compression_s3tc; it also returns a value of 0 for GL_NUM_COMPRESSED_TEXTURE_FORMATS). Force texture compression off if DXT support is not found.
  • Use the crunch library to decompress DXT textures to plain RGB(A) if texture compression is turned off. In the future we can actually store textures on disk in CRN format, but that's a separate issue. This might be able to replace PicoDDS entirely, I'm not sure whether the functionality between them just overlaps or if crunch can do everything PicoDDS can do.

I would also take the texture compression option out of the settings GUI (but leave it in the config file). The only reason for turning texture compression off if it's supported by the hardware is to test during development (which doesn't need the GUI), or if the hardware support detection fails (which should be very rare or never happen), or to get maximum visual quality by avoiding texture compression artefacts. That last one is fine except that if the texture is stored in DXT format on disk then the quality loss has already happened and turning texture compression off in the game won't improve anything.

@fluffyfreak Do you have any comments on this plan?

@fluffyfreak
Owner

Yeah:

  • This matters the most I think. If we can accurately detect the lack of the compressed texture support then we can replace any DDS texture with the default error texture and then the game will at least run reliably on more drivers.
  • PicoDDS is quite lacking but I'll need more time to think about whether crunch is a suitable replacement. The advantage of DDS is that many packages support it whereas CRN might as well just be our own format instead. We could easily extract the DXTn data and then lz/lzma compress it with an offline tool so I'm not sure what else it gives us.
  • Removing the compressed texture toggle option in the UI is fine by me, it was a sop to keep the vocal hoards happy when I added the compression in the first place :)

Also, some textures are never compressed, anything to do with the UI/GUI is uncompressed at the moment even with the flag set. There are visual differences that show up most glaringly with static elements especially when streched which of course much of the GUI is.

Andy

@ghost Unknown referenced this issue
Closed

OpenGL error #2829

@fluffyfreak
Owner

I'm closing this issue now, the game has all textures for models compressed as DDS files.
It still supports PNG for development/mods/etc however it compresses them on load by default.

Closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.