1

Question: How do you calculate what the result of trilinear filtering should be?

I am working on getting a video driver working and am running into an issue where I am not passing a test that looks at mipmap levels. A 32x32 texture is created and the mipmap levels are maunally populated as seen below.

texsize_____mip lvl_____R____G_____B

32__________0________ff____00____00

16__________1________00____ff____00

8___________2________00____00____ff

4___________3________ff_____ff____00

2___________4________ff_____00____ff

1___________5________00_____ff____ff

Now I pass my test when using GL_NEAREST_MIPMAP_NEAREST/GL_LINEAR_MIPMAP_NEAREST but when I use GL_NEAREST_MIPMAP_LINEAR/GL_LINEAR_MIPMAP_LINEAR (which from what I can gather both use trilinear filtering) I fail the test which compares my results against an expected of the data above +/- 8 plus an additional small amount of error. When I draw I am drawing using a texture size of 32/16/8/4/2/1 I am getting

texsize_____mip lvl_____R____G_____B

32__________0________ff____00____00

16__________1________01____fe____00

8___________2________00____00____ff

4___________3________f9_____f9____06

2___________4________ff_____0c____f3

1___________5________00_____ff____ff

Where I am failing is at tex size 2 since the error is +/- 12. It also seems like I may be missing somethign since I would expect all of the levels to fail or none of the levels to fail, anyone have any insight into if it is normal for different levels to be filtered differently?

My question is given the results and inputs above what would one expect the results to be? From what I understand if I choose a texture size that correlates to a given level, it should interpolate between that level (lowest) and the level above it (highest). Is there a weighting that also comes into play that I am missing?

genpfault
  • 51,148
  • 11
  • 85
  • 139
brad
  • 11
  • 1
  • When you say "... drawing using a texture size...", does this mean that you're drawing a texture mapped quad of that size? Also, did you write this test, or is this a test that other drivers pass? Just trying to understand if the problem is potentially with the test, or if you established that it's definitely a problem with your driver. – Reto Koradi Aug 16 '14 at 06:13
  • Yes, I am drawing a texture mapped quad of that size. This is a test that other drivers pass and the problem is likely in our driver. I have tried to adjust the LOD_BIAS but that does not seem to be working well. – brad Aug 18 '14 at 15:34
  • LOD_BIAS was the answer in the driver level. I was adjusting the wrong LOD_BIAS, there ended up being three areas on the chip that affected the LOD_Bias. I found one with a -36/36 range where changing it directly correlated with an increase or decrease of results. I ended up changing it -5 which brought all of the comparison into spec. Thanks for everyones help. – brad Aug 18 '14 at 18:03

0 Answers0