During the course of a project that I’m working on, I’ve needed real-time texture modification, and render targets are too slow to write pixel data to. So, I’ve created a module that will allow the creation and modification of procedural textures (it does other things, but that’s not important). I’ve noticed that when you create a procedural texture, you often don’t get the texture format you asked for. I need to know how consistent this behavior is across multiple video cards and operating systems, so I’ve created a little test script. I would appreciate it if the users of Facepunch would try this out, and report their findings.
There’s a clientside autorun script in there, with a binary module for Windows and Linux. I don’t have a Mac, so I can’t compile it for Mac. The test creates textures of various formats and attempts to write data that would be sensible for the requested formats. Pressing your +use key will toggle it between doing that, and writing data that would be sensible for the image formats I think it actually creates.
(ignore IMAGE_FORMAT_UVLX8888, I’ve removed it from the test due to crashing opengl)
If you get results that are different from what I’ve posted, I would like to see it.
Here’s what information I’ve gathered so far:
IMAGE_FORMAT_RGBA8888 - is actually BGRA8888
IMAGE_FORMAT_BGRA8888 - works as expected. 1 byte for each color channel, in the order BGRA
IMAGE_FORMAT_ARGB8888 - is actually BGRA8888
IMAGE_FORMAT_ABGR8888 - is actually BGRA8888
IMAGE_FORMAT_RGB888 - is actually BGR888
IMAGE_FORMAT_BGR888 - in directx, has an 4th padding byte, but is 3 bytes per pixel in opengl
IMAGE_FORMAT_I8 - 1 byte grayscale format
IMAGE_FORMAT_IA88 - 3 bytes for grayscale, 1 for alpha
IMAGE_FORMAT_A8 - 3 unused color bytes, 1 for alpha
IMAGE_FORMAT_BGRX8888 - no difference from BGR888
IMAGE_FORMAT_BGR565 - is actually BGR888
IMAGE_FORMAT_BGRX5551 - is actually BGR888
IMAGE_FORMAT_BGRA4444 - is actually BGRA8888
IMAGE_FORMAT_BGRA5551 - is actually BGRA8888
IMAGE_FORMAT_RGBA16161616 - works as expected. 2 bytes for each color channel, in the order RGBA
IMAGE_FORMAT_RGB888_BLUESCREEN - appears to be invalid
IMAGE_FORMAT_BGR888_BLUESCREEN - appears to be invalid
IMAGE_FORMAT_P8 - appears to be invalid
IMAGE_FORMAT_UV88 - appears to be invalid
IMAGE_FORMAT_UVWQ8888 - no idea what this is supposed to be, but has very different results on directx and opengl
IMAGE_FORMAT_UVLX8888 - also no idea here, but I get different results between graphics cards on directx, crashes opengl.