Sign in to follow this  
Ender1618

Updating 8-bit greyscale textures quickly

Recommended Posts

Ender1618    254
Using DirectX 9... I have rather large 8-bit per pixel greyscale image (720x512) being produced at ~60hz by a camera, and I need to update a texture as efficiently as possible with it, and render at near vsync rate. What i have done in the past is allocate an ARGB texture, lock it when a new image is available and essentially copy pixel by pixel my 8-bit luminance value into the r, g, and b channels, this works. But what i really want to do is allocate the texture as a D3DFMT_L8. This would cut down on the CPU -> GPU transfer time and reduce the amount of time I have the texture locked (which happens on the render thread) because i have less bytes to write. But if I create the texture as a D3DFMT_L8, when I lock it it appears the memory is laid out as ARGB image which I don't want. Has anyone had an experience with using D3DFMT_L8, and how to efficiently update/write to it? [Edited by - Ender1618 on February 11, 2010 2:08:13 PM]

Share this post


Link to post
Share on other sites
musawirali    199
what do you mean when you "lock it it appears the memory is laid out in ARGB"? When you lock it all you get is a sysmem pointer and the surface pitch. How are you determining this layout? If you are accessing this texture in a pixel shader, your 8bit value should be in the R channel, and on some hardware/driver, the same value is replicated in all 4 channels.

Are you dumping this texture to a file after lock/filling it, and then opening it up with some image viewer? Because then that would indicate that the problem is with the image viewer and not the image itself.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this