From: Daniel V. <vo...@lo...> - 2000-12-14 09:49:49
|
hi` I tried running UT with the Mesa software renderer and when I turned on trilinear filtering it crashed in sample_2d_linear being called with a NULL pointer for the image from sample_2d_linear_mipmap_linear. The problem seems to be that UT uses GL_TEXTURE_MAX_LEVEL and tObj->_P was 7 and tObj->_M was 5. From what I can read in mtypes.h shouldn't _M be used instead of _P in the following code? Changing the code to use _M at least made it work ;) BTW, why is _M a float and not an integer? s_texture.c:840 [sample_2d_linear_mipmap_linear] if (level >= tObj->_P) { sample_2d_linear( tObj, tObj->Image[tObj->_P], s, t, rgba); } else { GLchan t0[4], t1[4]; /* texels */ const GLfloat f = myFrac(lambda); sample_2d_linear( tObj, tObj->Image[level ], s, t, t0 ); sample_2d_linear( tObj, tObj->Image[level+1], s, t, t1 ); rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); } Daniel Vogel, Programmer, Loki Software Inc. |
From: Brian P. <br...@va...> - 2000-12-14 17:13:48
|
Daniel Vogel wrote: > > hi` > > I tried running UT with the Mesa software renderer and when I turned on > trilinear filtering it crashed in sample_2d_linear being called with a > NULL pointer for the image from sample_2d_linear_mipmap_linear. The > problem seems to be that UT uses GL_TEXTURE_MAX_LEVEL and tObj->_P was 7 > and tObj->_M was 5. From what I can read in mtypes.h shouldn't _M be > used instead of _P in the following code? Changing the code to use _M at > least made it work ;) BTW, why is _M a float and not an integer? > > s_texture.c:840 [sample_2d_linear_mipmap_linear] > > if (level >= tObj->_P) { > sample_2d_linear( tObj, tObj->Image[tObj->_P], s, t, rgba); > } > else { > GLchan t0[4], t1[4]; /* texels */ > const GLfloat f = myFrac(lambda); > sample_2d_linear( tObj, tObj->Image[level ], s, t, t0 ); > sample_2d_linear( tObj, tObj->Image[level+1], s, t, t1 ); > rgba[RCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); > rgba[GCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); > rgba[BCOMP] = (GLchan) (GLint) ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); > rgba[ACOMP] = (GLchan) (GLint) ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); > } Are you settting GL_TEXTURE_BASE_LEVEL? I think I see an error in the calculation in _P. I think I should add the base level to it. However, that would increase _P. I'll have to review the spec and write a test program. I do think there is a bug here. Thanks for flagging it. -Brian |
From: Daniel V. <vo...@lo...> - 2000-12-14 19:27:22
|
On Thu, Dec 14, 2000 at 10:16:58AM -0700, Brian Paul wrote: > > Are you settting GL_TEXTURE_BASE_LEVEL? No, I only set GL_TEXTURE_MAX_LEVEL and cut off the last two mip levels. It also looks like the filters use the wrong base mipmap. Everything looks overblurry from an angle and a naive guess would be that it's taking everything 2 levels too far down. > I think I see an error in the calculation in _P. I think I should > add the base level to it. However, that would increase _P. from mtypes.h: GLint _P; /* Highest mipmap level */ GLfloat _M; /* = MIN(MaxLevel, P) - BaseLevel */ What do _P and _M actually mean? Is _P the highest mip level based on the size of the image (e.g. 5 for 32x32) and _M supposed to be the one after "clipping"? Daniel Vogel, Programmer, Loki Software Inc. |
From: Brian P. <br...@va...> - 2000-12-14 19:46:36
|
Daniel Vogel wrote: > > On Thu, Dec 14, 2000 at 10:16:58AM -0700, Brian Paul wrote: > > > > Are you settting GL_TEXTURE_BASE_LEVEL? > > No, I only set GL_TEXTURE_MAX_LEVEL and cut off the last two mip levels. > It also looks like the filters use the wrong base mipmap. Everything > looks overblurry from an angle and a naive guess would be that it's > taking everything 2 levels too far down. > > > I think I see an error in the calculation in _P. I think I should > > add the base level to it. However, that would increase _P. > > from mtypes.h: > > GLint _P; /* Highest mipmap level */ > GLfloat _M; /* = MIN(MaxLevel, P) - BaseLevel */ > > What do _P and _M actually mean? Is _P the highest mip level based on > the size of the image (e.g. 5 for 32x32) and _M supposed to be the one > after "clipping"? I should rename _P to _q (which is what the 1.2 spec uses now). q is the highest-numbered mipmap level that can actually be used, after taking in account the image sizes and the value of GL_TEXTURE_MAX_LEVEL. _M is the max usable lambda value. It should be = _MaxLevel - BaseLevel. If you're looking at equation 3.21 in the 1.2 spec, then _M = q - b. I should probably rename that variable too (_MaxLambda). The incoming lambda value is added to BaseLevel to select a mipmap level. The idea is that lambda=0 will correspond to the BaseLevel texture and lambda = _M will correspond to the GL_MAX_LEVEL texture. I'm not sure why you're seeing blurry images. I haven't tried running UT with 3.5 yet. -Brian |
From: Daniel V. <vo...@lo...> - 2000-12-14 20:16:55
|
On Thu, Dec 14, 2000 at 12:49:45PM -0700, Brian Paul wrote: > > I should rename _P to _q (which is what the 1.2 spec uses now). q is the > highest-numbered mipmap level that can actually be used, after taking in > account the image sizes and the value of GL_TEXTURE_MAX_LEVEL. > > _M is the max usable lambda value. It should be = _MaxLevel - BaseLevel. > If you're looking at equation 3.21 in the 1.2 spec, then _M = q - b. I > should probably rename that variable too (_MaxLambda). > > The incoming lambda value is added to BaseLevel to select a mipmap level. > > The idea is that lambda=0 will correspond to the BaseLevel texture > and lambda = _M will correspond to the GL_MAX_LEVEL texture. Thanks. > I'm not sure why you're seeing blurry images. I haven't tried running > UT with 3.5 yet. Most noticeable with the floor textures in DM-Stalwart. Daniel Vogel, Programmer, Loki Software Inc. |
From: Brian P. <br...@va...> - 2000-12-14 20:26:24
|
Daniel Vogel wrote: > > On Thu, Dec 14, 2000 at 12:49:45PM -0700, Brian Paul wrote: > > > > I should rename _P to _q (which is what the 1.2 spec uses now). q is the > > highest-numbered mipmap level that can actually be used, after taking in > > account the image sizes and the value of GL_TEXTURE_MAX_LEVEL. > > > > _M is the max usable lambda value. It should be = _MaxLevel - BaseLevel. > > If you're looking at equation 3.21 in the 1.2 spec, then _M = q - b. I > > should probably rename that variable too (_MaxLambda). > > > > The incoming lambda value is added to BaseLevel to select a mipmap level. > > > > The idea is that lambda=0 will correspond to the BaseLevel texture > > and lambda = _M will correspond to the GL_MAX_LEVEL texture. > > Thanks. > > > I'm not sure why you're seeing blurry images. I haven't tried running > > UT with 3.5 yet. > > Most noticeable with the floor textures in DM-Stalwart. I just checked in some changes. Want to give it a try again? -Brian |
From: Daniel V. <vo...@lo...> - 2000-12-14 20:43:37
|
On Thu, Dec 14, 2000 at 01:29:32PM -0700, Brian Paul wrote: > > I just checked in some changes. Want to give it a try again? Fixes the segfault but is still blurry. Daniel Vogel, Programmer, Loki Software Inc. |