PDA

View Full Version : Query linear sampling support(PCF, float tex)



Nighthawk
02-24-2012, 04:01 AM
Is is possible to detect whether linear sampling is supported for:
a.) float16/32 textures
b.) Percentage closer filtering(PCF) for shadow comparisons

For example, the Ati X800 can sample them only with GL_NEAREST, and will report an error when trying GL_LINEAR. ATI X3850 can sample them correctly with GL_LINEAR.

Is there a specific extension or texture state to query the capability?

Alfonse Reinheart
02-24-2012, 08:38 AM
No, there is not. The GL spec requires that these are supported, and it is a driver bug if they are not.

The best you can do is use the VENDOR string to try to detect which hardware you're running on. The wiki has an article with some tips (http://www.opengl.org/wiki/Floating_point_and_mipmapping_and_filtering) on this.

arekkusu
02-24-2012, 07:44 PM
You can just try it, see it if works, then choose a rendering path.

I.e. create a 2x1 texture with one black texel and one white texel. Draw a quad covering a 3x1 area. Now read back the middle pixel; was it grey?

ZbuffeR
02-25-2012, 12:44 AM
Even better if it reports an error.

Nighthawk
02-25-2012, 11:00 AM
Thank you for your answers. So there is no "clean" check.

The gl error occured when creating a FBO with a shadow comparison texture as target with GL_LINEAR(error=framebuffer incomplete on X800).

The check i use now: If (maxTextureSize>=8192 or nvidia_only_extension) => use PCF / float hardware filtering.

(PCF, float tex filtering and maxTextureSize=8192 are requirements of DX10, afaik)

Alfonse Reinheart
02-25-2012, 11:02 AM
You could just check for GL 3.0+ or NVIDIA extensions. No need to test the texture size.

Nighthawk
02-25-2012, 12:01 PM
I'm stuck with the old catalyst 8.8 driver(closed box legacy product), so no GL3.0 for the 3850 yet.
Otherwise yes, checking GL3.0 would be the best way.

(I use the 8K texture size to indirectly determine DX10 hardware support. There is no pre-DX10 card which can handle 8K textures i think)

Alfonse Reinheart
02-25-2012, 01:35 PM
I would strongly suggest not developing on such a machine. Your users are going to have to use up-to-date drivers anyway to avoid crashing. It's best if your development environment mirrors what your users will have.

aqnuep
02-26-2012, 09:29 PM
I'm stuck with the old catalyst 8.8 driver(closed box legacy product), so no GL3.0 for the 3850 yet.
Otherwise yes, checking GL3.0 would be the best way.

You mean a Radeon HD3850? That's a still supported product and should support GL3.3.

Alfonse Reinheart
02-26-2012, 09:43 PM
I'm guessing that by "closed box", he means that he can't update the driver. I don't know how that's possible, but there could be some restriction.

Nighthawk
02-27-2012, 09:03 AM
Closed box=shipped product with a "hidden" PC which has to run only one program, with no regular keyboard/mouse input.

Driver update must happen automated without user interaction, multiscreen setup have to been restored, program has to verfied on driver, on error it's a dead brick, etc.

I did it once and it worked, but (knowing how much work it was) i will avoid it as long as possible;)

Alfonse Reinheart
02-27-2012, 09:08 AM
You've avoided it for three years now. Have you considered that maybe yearly updates would be a better idea?

After all, this is your only AMD test machine; it is only useful as a test machine if it actually represents what exists in the real world.