Okay, so I was reading through the DX8 help files, and then I stumble on something which says something to the effect that, textures in the default pool cannot be locked using LockRect. Maybe I misunderstood something, or maybe my eyes are making me see things, but is this actually CORRECT??

Then I guess this means that, if I want to create a static texture from scratch, say, then I have to 1)create an ImageSurface IDirect3DSurface8 in D3DPOOL_SYSTEMMEM 2) load the ImageSurface with LockRect 3) create the actual texture in D3DPOOL_DEFAULT 4) CopyRects from the ImageSurface to the actual texture. All right, maybe I should just use D3DXCreateTextureFromFileInMemory and stop worrying about it.

Anyway I ask since I want to get rid of that durn big file d3dx8d.dll, apparently the d3dx8.lib requires a bunch of HLL libraries I don't have since I'm too cheap to buy an HLL compiler (unless it happens to be legal for me to acquire such libraries even without the compiler itself).
Posted on 2003-01-15 02:33:13 by AmkG
but is this actually CORRECT??

Indeed it is correct...
Posted on 2003-01-24 14:35:58 by IFooBar
Afternoon, AmkG.

Just create your texture using D3DPOOL_MANAGED.

Cheers,
Scronty
Posted on 2003-01-25 02:23:50 by Scronty

Afternoon, AmkG.

Just create your texture using D3DPOOL_MANAGED.

Cheers,
Scronty


Okay....

Hmm... wait a minute... that means I don't need to invalidate/recreate it at device loss condition, right? AND I don't have to worry about putting it into a D3DPOOL_DEFAULT texture for faster hardware rendering...

Posted on 2003-01-25 19:19:34 by AmkG
Well I guess the 'catch' would be that with D3DPOOL_MANAGED, D3D has to keep track of two copies on the resource, it keeps a copy in system memory incase the original one is lost.

BTW: you *can* lock textures created with D3DPOOL_MANAGED. But you have to make it a dynamic texture. Then you're allowed to lock it. So when you create a texture just specify D3DUSAGE_DYNAMIC in the usage parameter.
Posted on 2003-01-26 06:43:45 by IFooBar
But I only need to load data into a texture once, it's supposed to be static for the whole game....
Posted on 2003-01-26 20:39:39 by AmkG

BTW: you *can* lock textures created with D3DPOOL_MANAGED. But you have to make it a dynamic texture. Then you're allowed to lock it. So when you create a texture just specify D3DUSAGE_DYNAMIC in the usage parameter.

:grin: err.. heh I meant Creating a dynamic texture with D3DPOOL_DEFAULT enable syou to lock it. not D3DPOOL_MANAGED.... I dont remember typing managed

But I only need to load data into a texture once, it's supposed to be static for the whole game....

Then use D3DPOOL_MANAGED!
Posted on 2003-01-27 08:40:04 by IFooBar
Ah okay I see!

I kinda got confused there....

Anyway:

I wonder how recommended it is to use the D3DX helper routines, particularly D3DXCreateTextureFromFile. Is it, in general, good to use them in most cases, since they handle pretty much all you need to worry about (e.g. D3DPTEXTURECAPS_SQUAREONLY, D3DPTEXTURECAPS_POW2, and a bunch of other stuff which makes me head spin, etc.)?

Or am I better off writing a more specific use routine? For instance, say I invent a super-ultra-nice-cool-great image compression, would I be better off writing a 'CreateTextureFromSuperUltraNiceCoolGreatFile' routine, or should I just write a routine that creates a '.DDS' file in memory, then use D3DXCreateTextureFromFileInMemory?

Maybe I should just shut up, try it both ways, and tell you guys what I did instead?
Posted on 2003-01-30 06:20:11 by AmkG
Afternoon, AmkG.

If you're wanting a small exe size, then it'd be better *not* to use *any* D3DX* functions. Using the D3dx8.lib will garantee that your exe is at least a couple hundred kb.

On the other hand....
If you'd rather spend your time on creating a game/tool/whatever, then by all means use the D3DX* functions - no point reinventing the wheel if it can be helped;).

As you've said: The functions like D3DXCreateTextureFromFile are very versatile. It take quite a bit of effort to recreate a similar proc in asm.

Cheers,
Scronty
Posted on 2003-01-30 15:33:02 by Scronty