RandomTiger,
d3d_create_texture_sub() is a utility function defined in GrD3DTexture.cpp, starting on line 495. As far as I can tell, it's essentially a wrapper for CreateSurface().
It checks whether the texture's got Alpha, (line 535)
checks the texture's size against the max texture size (for the 256x256 limit on Voodoo cards), makes rectangular textures square if the renderer so desires. (line 548, calling a function defined on 431).
Then it ets scaling factor (line 555), so that textures larger than whatever the max texsize is get downsampled to the max texsize (but I can't find where that happes).
Then it creates and locks the surface, copies the pixels into it (setting the alpha values on the fly (604)), unlocks the texture (681)
checks to see whether the renderer accepts the texture (?) (684) and bugs out if it doesn't.
Then it does a lot of stuff with the video ram that my D3D knowledge is insufficient to understand (696-765) sets a couple more values
and then it exits.
Not the most succesful function specification I ever gave, but it might just put you back on track. Let us know how you fare
.