ANYONE Interested in my sharing the code to do this? Leave a comment, 10 comments and I'll blog it.
I'm using SDL2 as the background framework for providing cross platform input and window handling, but I'm writing my own renderers for various platforms (DirectX11, 12, OpenGL and Vulkan).
All of them support coloured shape and line renderering to one extent or another, so I decided to take the leap into texture mapping.
First of all I put in all the framework to represent textures in my engine in a cross platform manner, and for ease I decided to use SDL2_Image to load my pixel data. And I started with a simple PNG file I created in MSPaint....
Immediately I ran into issues, PNG is RGBA, the png I created had a transparent background as far as I knew it should all work. I swapped to RAW pixels and I was getting 4 bytes per pixel, it was only after a bunch of reading and then stepping into the SDL_Surface format did I realise the data might be whatever format but the surface was clearly 3 bytes per pixel. And funky things were happening.
My assumption that MSPaint was outputting 4 bytes per pixel was just wrong, instead it's 3 bytes, RGB. And there's no matching DXGI_FORMAT for just RGB - least none I could spot.
A quick reexport in GIMP setting the explicit pixel format to 8bpc RGBA, which then of course just worked....