Jump to content
  • Advertisement
Sign in to follow this  
51mon

Strange Error

This topic is 4285 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I encountered a strange error today. I read off samples from a mip-map chain on the GPU and send them to the CPU; to find the sample spots I use a lookup texture. I create the lookup texture so that every sample in the same level is neighboring, but once in a while the samples sent back to the CPU is incorrect, they belongs to wrong level. It appears to me that when the GPU tries to optimize the code and batch many reads from the same level it sometimes goes too far. However I was able to remedy this by putting a dummy sample between every level change. Has anyone else experienced the same error? Is it a well known bug? Of coarse the error could be because of me being a dumbarse but I have done a lot of testing, for example the samples are collected correctly when all belongs to the same level, but when I concatenate several of these “correct” subgroups they becomes incorrect.

Share this post


Link to post
Share on other sites
Advertisement
Are you sure you don't have a mip-filter installed? By default, DirectX 9 installs a linear filter on the mipmap-lookup interface, so that the nearest two mip-levels are sampled and the result is interpolated. To ensure that the texture sample comes from only one mip level, you need to set a point-filter (D3DXTEXF_POINT / GL_NEAREST, I believe) on the sampler.

I didn't fully understand your post, but you may also want to make sure that your texture coordinates are properly-aligned.

Admiral

Share this post


Link to post
Share on other sites
Quote:
Original post by TheAdmiral
Are you sure you don't have a mip-filter installed? By default, DirectX 9 installs a linear filter on the mipmap-lookup interface, so that the nearest two mip-levels are sampled and the result is interpolated. To ensure that the texture sample comes from only one mip level, you need to set a point-filter (D3DXTEXF_POINT / GL_NEAREST, I believe) on the sampler.

I didn't fully understand your post, but you may also want to make sure that your texture coordinates are properly-aligned.

Admiral


I use point filters and half texel offset, the samples coordinates are stored in a 1D texture and the output/returning samples values are rendered to a 1D map with the same dimensions. I use a regular full screen quad when operating, like this:

// In Vertex Shader
Output.ScreenPos.x = vQuadCoord.x + g_fHalfLookupCoord;
Output.ScreenPos.yzw = float3(0.5f, 0.0f, 0.0f);

// In Pixel Shader
float4 SampleCoord = tex2D(LookupSampler, Input.ScreenPos);



(I changed to tex1D but it didn't matter)
Are there some wrong with this code? The reason that I suspected hardware was that:

• The lookup coordinates are correct before they are sent to GPU.
• When reading all texels from the same level everything is right.
• A dummy sample in-between the "level groups" solve the error.

Maybe my assumptions are fault?

[Edited by - 51mon on January 26, 2007 4:15:02 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!