debug code for EXT-6791: Intel 965 Crash in glCopyTexSubImage2D.

master
Xiaohong Bao 2010-04-09 22:02:32 -06:00
parent c5756c3f0f
commit 0dee7a3ece
12 changed files with 71 additions and 6 deletions

View File

@ -105,9 +105,9 @@ void check_all_images()
}
}
void LLImageGL::checkTexSize() const
void LLImageGL::checkTexSize(bool forced) const
{
if (gDebugGL && mTarget == GL_TEXTURE_2D)
if ((forced || gDebugGL) && mTarget == GL_TEXTURE_2D)
{
GLint texname;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname);
@ -129,6 +129,8 @@ void LLImageGL::checkTexSize() const
glGetTexLevelParameteriv(mTarget, 0, GL_TEXTURE_WIDTH, (GLint*)&x);
glGetTexLevelParameteriv(mTarget, 0, GL_TEXTURE_HEIGHT, (GLint*)&y) ;
stop_glerror() ;
llcallstacks << "w: " << x << " h: " << y << llcallstacksendl ;
if(!x || !y)
{
return ;
@ -138,11 +140,13 @@ void LLImageGL::checkTexSize() const
error = TRUE;
if (gDebugSession)
{
gFailLog << "wrong texture size and discard level!" << std::endl;
gFailLog << "wrong texture size and discard level!" <<
mWidth << " Height: " << mHeight << " Current Level: " << mCurrentDiscardLevel << std::endl;
}
else
{
llerrs << "wrong texture size and discard level!" << llendl ;
llerrs << "wrong texture size and discard level: width: " <<
mWidth << " Height: " << mHeight << " Current Level: " << mCurrentDiscardLevel << llendl ;
}
}
@ -1044,7 +1048,9 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_
{
if (gGL.getTexUnit(0)->bind(this, false, true))
{
//checkTexSize() ;
checkTexSize(true) ;
llcallstacks << fb_x << " : " << fb_y << " : " << x_pos << " : " << y_pos << " : " << width << " : " << height << llcallstacksendl ;
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height);
mGLTextureCreated = true;
stop_glerror();

View File

@ -157,7 +157,7 @@ public:
void updatePickMask(S32 width, S32 height, const U8* data_in);
BOOL getMask(const LLVector2 &tc);
void checkTexSize() const ;
void checkTexSize(bool forced = false) const ;
// Sets the addressing mode used to sample the texture
// (such as wrapping, mirrored wrapping, and clamp)

View File

@ -167,6 +167,8 @@ void LLViewerDynamicTexture::postRender(BOOL success)
{
generateGLTexture() ;
}
llcallstacks << "class type: " << (S32)getType() << llcallstacksendl ;
success = mGLTexturep->setSubImageFromFrameBuffer(0, 0, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight);
}
}

View File

@ -41,6 +41,19 @@
class LLViewerDynamicTexture : public LLViewerTexture
{
public:
enum
{
LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
LL_TEX_LAYER_SET_BUFFER = LLViewerTexture::INVALID_TEXTURE_TYPE + 1,
LL_VISUAL_PARAM_HINT,
LL_VISUAL_PARAM_RESET,
LL_PREVIEW_ANIMATION,
LL_IMAGE_PREVIEW_SCULPTED,
LL_IMAGE_PREVIEW_AVATAR,
INVALID_DYNAMIC_TEXTURE
};
protected:
/*virtual*/ ~LLViewerDynamicTexture();

View File

@ -1069,6 +1069,12 @@ LLPreviewAnimation::~LLPreviewAnimation()
mDummyAvatar->markDead();
}
//virtual
S8 LLPreviewAnimation::getType() const
{
return LLViewerDynamicTexture::LL_PREVIEW_ANIMATION ;
}
//-----------------------------------------------------------------------------
// update()
//-----------------------------------------------------------------------------

View File

@ -50,6 +50,8 @@ protected:
public:
LLPreviewAnimation(S32 width, S32 height);
/*virtual*/ S8 getType() const ;
BOOL render();
void requestUpdate();
void rotate(F32 yaw_radians, F32 pitch_radians);

View File

@ -629,6 +629,11 @@ LLImagePreviewAvatar::~LLImagePreviewAvatar()
mDummyAvatar->markDead();
}
//virtual
S8 LLImagePreviewAvatar::getType() const
{
return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_AVATAR ;
}
void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male)
{
@ -808,6 +813,11 @@ LLImagePreviewSculpted::~LLImagePreviewSculpted()
{
}
//virtual
S8 LLImagePreviewSculpted::getType() const
{
return LLViewerDynamicTexture::LL_IMAGE_PREVIEW_SCULPTED ;
}
void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
{

View File

@ -54,6 +54,8 @@ protected:
public:
LLImagePreviewSculpted(S32 width, S32 height);
/*virtual*/ S8 getType() const ;
void setPreviewTarget(LLImageRaw *imagep, F32 distance);
void setTexture(U32 name) { mTextureName = name; }
@ -85,6 +87,8 @@ protected:
public:
LLImagePreviewAvatar(S32 width, S32 height);
/*virtual*/ S8 getType() const ;
void setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male);
void setTexture(U32 name) { mTextureName = name; }
void clearPreviewTexture(const std::string& mesh_name);

View File

@ -98,6 +98,12 @@ LLTexLayerSetBuffer::~LLTexLayerSetBuffer()
}
}
//virtual
S8 LLTexLayerSetBuffer::getType() const
{
return LLViewerDynamicTexture::LL_TEX_LAYER_SET_BUFFER ;
}
//virtual
void LLTexLayerSetBuffer::restoreGLTexture()
{

View File

@ -325,6 +325,7 @@ public:
LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
virtual ~LLTexLayerSetBuffer();
/*virtual*/ S8 getType() const ;
virtual void preRender(BOOL clear_depth);
virtual void postRender(BOOL success);
virtual BOOL render();

View File

@ -108,6 +108,12 @@ LLVisualParamHint::~LLVisualParamHint()
LLVisualParamHint::sInstances.erase( this );
}
//virtual
S8 LLVisualParamHint::getType() const
{
return LLViewerDynamicTexture::LL_VISUAL_PARAM_HINT ;
}
//-----------------------------------------------------------------------------
// static
// requestHintUpdates()
@ -290,6 +296,12 @@ LLVisualParamReset::LLVisualParamReset() : LLViewerDynamicTexture(1, 1, 1, ORDER
{
}
//virtual
S8 LLVisualParamReset::getType() const
{
return LLViewerDynamicTexture::LL_VISUAL_PARAM_RESET ;
}
//-----------------------------------------------------------------------------
// render()
//-----------------------------------------------------------------------------

View File

@ -64,6 +64,8 @@ public:
LLViewerVisualParam *param,
F32 param_weight);
/*virtual*/ S8 getType() const ;
BOOL needsRender();
void preRender(BOOL clear_depth);
BOOL render();
@ -107,6 +109,7 @@ protected:
public:
LLVisualParamReset();
/*virtual */ BOOL render();
/*virtual*/ S8 getType() const ;
static BOOL sDirty;
};