PDA

View Full Version : linear min/mag filtering with 16fp nv_float_buffer



VCarnage
02-17-2005, 04:57 PM
Hi,

I was wondering if anyone has had any luck trying to get linear min/mag filtering working with a bound fp16 nv_float_buffer/texture_rectangle_nv.
According to the latest NVIDIA GPU Programming Guide section 4.5, Geforce 6 Series GPU should offer mipmaps, bilinear, and trilinear filtering for 16-bit floating point textures. But I've tried setting nearest neighbor and linear, and I just get the same "blocky" result.

Thanks,
VC

Relic
02-17-2005, 10:28 PM
Show some code.

-NiCo-
02-18-2005, 12:06 AM
Originally posted by VCarnage:
According to the latest NVIDIA GPU Programming Guide section 4.5, Geforce 6 Series GPU should offer mipmaps, bilinear, and trilinear filtering for 16-bit floating point textures.Geforce 6 series do indeed support mipmaps and biliniar/triliniar filtering for fp16 textures, but not through the nv_float_buffer extension. Texture rectangles do not support mipmapping and therefor also no triliniar filtering and do not support any filtering other than nearest. For these features on fp16 textures you'll have to use the ati_texture_float extension.

Nico

VCarnage
02-18-2005, 05:30 AM
Sorry, I didn't post any code b/c the source would be confusing.

But I understand now. NV_float_buffer just doesn't support filtering. It's not supposed to support blending either, but I've rendered textures with alpha without problems. I was hoping the filtering would work.

My problem with going to ATI_texture_float is that there doesn't seem to be a GLX version of the WGL_TYPE_RGBA_FLOAT_ATI. I'm trying to keep my code cross platform.

-NiCo-
02-18-2005, 06:26 AM
Originally posted by VCarnage:
My problem with going to ATI_texture_float is that there doesn't seem to be a GLX version of the WGL_TYPE_RGBA_FLOAT_ATI. I'm trying to keep my code cross platform.The ATI and NV floating point format both follow the IEEE fp16 and fp32 standard. So you can use ati_texture_float and write to an nv_float_buffer and vice versa use copytex(sub)image to copy from nv_float_buffer to an ati_texture_float. I've implemented this in linux and works fine.

Nico

VCarnage
02-18-2005, 07:13 AM
Actually, I'm rendering to fp16 pbuffers and using them as textures, with rendertexture on wgl and copytexsubimage2d on linux.
I would have used ATI_texture_float, but I just could not get a floating point pbuffer created on linux without NV_float_buffer. I don't want to have to render into a NV_float_buffer and copy it over to an ATI float texture for both windows and linux. Here's some code which may hopefully make it more clear:

On windows, I did this:


int attr[] =
{
WGL_SUPPORT_OPENGL_ARB, TRUE,
WGL_DRAW_TO_PBUFFER_ARB, TRUE,
WGL_BIND_TO_TEXTURE_RGBA_ARB, TRUE,
WGL_PIXEL_TYPE_ARB,WGL_TYPE_RGBA_FLOAT_ATI,
WGL_RED_BITS_ARB, 16,
WGL_GREEN_BITS_ARB, 16,
WGL_BLUE_BITS_ARB, 16,
WGL_ALPHA_BITS_ARB, 16,
WGL_STENCIL_BITS_ARB, 8,
WGL_DEPTH_BITS_ARB, 24,
0
};

unsigned int count = 0;
int pixelFormat = 0;
float fattributes[1];
fattributes[0]=0;

wglChoosePixelFormatARB(hGLDC, (const int*)attr, fattributes, 1, &pixelFormat, &count);

int pAttrib[] =
{
WGL_PBUFFER_LARGEST_ARB, TRUE,
WGL_TEXTURE_FORMAT_ARB, GL_TEXTURE_RGBA_ARB,
WGL_TEXTURE_TARGET_ARB, WGL_TEXTURE_2D_ARB,
0,0
};

hPBuffer = wglCreatePbufferARB(hGLDC, pixelFormat, width, height, pAttrib);
On Linux, I'm not sure what to do. ???
I don't see a GLX equivalent to "WGL_PIXEL_TYPE_ARB,WGL_TYPE_RGBA_FLOAT_ATI" so I had to use GLX_FLOAT_COMPONENTS_NV which requires TEXTURE_RECTANGLE_NV.


int attr[] =
{
GLX_RENDER_TYPE_SGIX, GLX_RGBA_BIT_SGIX, //GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE_SGIX, GLX_PBUFFER_BIT_SGIX, //GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,// | GLX_WINDOW_BIT,
GLX_FLOAT_COMPONENTS_NV, True,
GLX_RED_SIZE, 16,
GLX_GREEN_SIZE, 16,
GLX_BLUE_SIZE, 16,
GLX_ALPHA_SIZE, 16,
GLX_STENCIL_SIZE, 8,
GLX_DEPTH_SIZE, 24,
None
};

// define desired pbuffer attributes
int pAttrib[] =
{
GLX_PBUFFER_WIDTH, width,
GLX_PBUFFER_HEIGHT, height,
GLX_LARGEST_PBUFFER, True,
GLX_PRESERVED_CONTENTS, True,
None
};So this boils down to the question:
Can you create a fp16 pbuffer on linux not using GLX_FLOAT_COMPONENTS_NV ?

-NiCo-
02-18-2005, 09:52 AM
I really don't see what the problem is.

In Windows you're using render_to_texture, so in order to have mipmapping, filtering,etc. you have to use ati_texture_float. Because you're rendering to a texture you have to specify whether it is binding to a texture_2D or a texture_rectangle target. In your case this is a texture_2D target.

But in linux you're not using render_to_texture, therefor no target has to be set for the pbuffer. By using copytexsubimage it is irrelevant whether you are copying to a texture_rectangle or a texture_2D. So you can continue using the GLX_FLOAT_COMPONENTS_NV attribute for the pbuffer and perform a copytexsubimage to an ati_texture_float.

To make it compatible between WIN32 and linux add some preprocessor commands like

#ifdef WIN32
#ifdef UNIX

Nico

VCarnage
02-18-2005, 10:24 AM
I was just thinking the same thing...

Thanks for your help, Nico.

VCarnage
02-18-2005, 11:44 AM
I asked around on the GPGPU forums and found out that you can indeed create fp pbuffers on linux without using NV_float_buffer.

Just use GLX_RENDER_TYPE, GLX_RGBA_FLOAT_ATI_BIT
in your pixel format attribs.

So either float extension can be used with the solution Nico mentions above.

-VC