uninitialized variables-gfx

This commit is contained in:
AzaezelX 2020-05-11 15:00:25 -05:00
parent 1efb687867
commit b9c207765e
33 changed files with 108 additions and 43 deletions

View file

@ -90,6 +90,8 @@ GFXD3D11Device::GFXD3D11Device(U32 index)
mDeviceSwizzle24 = &Swizzles::bgr; mDeviceSwizzle24 = &Swizzles::bgr;
mAdapterIndex = index; mAdapterIndex = index;
mSwapChain = NULL;
mD3DDevice = NULL; mD3DDevice = NULL;
mD3DDeviceContext = NULL; mD3DDeviceContext = NULL;
mVolatileVB = NULL; mVolatileVB = NULL;
@ -107,6 +109,8 @@ GFXD3D11Device::GFXD3D11Device(U32 index)
mPixVersion = 0.0; mPixVersion = 0.0;
mFeatureLevel = D3D_FEATURE_LEVEL_9_1; //lowest listed. should be overridden by init
mVertexShaderTarget = String::EmptyString; mVertexShaderTarget = String::EmptyString;
mPixelShaderTarget = String::EmptyString; mPixelShaderTarget = String::EmptyString;
mShaderModel = String::EmptyString; mShaderModel = String::EmptyString;
@ -123,7 +127,8 @@ GFXD3D11Device::GFXD3D11Device(U32 index)
mCreateFenceType = -1; // Unknown, test on first allocate mCreateFenceType = -1; // Unknown, test on first allocate
mCurrentConstBuffer = NULL; mCurrentConstBuffer = NULL;
mMultisampleDesc.Count = 0;
mMultisampleDesc.Quality = 0;
mOcclusionQuerySupported = false; mOcclusionQuerySupported = false;
mDebugLayers = false; mDebugLayers = false;

View file

@ -79,6 +79,7 @@ protected:
class D3D11VertexDecl : public GFXVertexDecl class D3D11VertexDecl : public GFXVertexDecl
{ {
public: public:
D3D11VertexDecl() :decl(NULL) {}
virtual ~D3D11VertexDecl() virtual ~D3D11VertexDecl()
{ {
SAFE_RELEASE( decl ); SAFE_RELEASE( decl );

View file

@ -73,11 +73,11 @@ inline GFXD3D11PrimitiveBuffer::GFXD3D11PrimitiveBuffer( GFXDevice *device,
mLocked = false; mLocked = false;
#ifdef TORQUE_DEBUG #ifdef TORQUE_DEBUG
mDebugGuardBuffer = NULL; mDebugGuardBuffer = NULL;
mLockedBuffer = NULL;
mLockedSize = 0; mLockedSize = 0;
#endif
mIndexStart = 0; mIndexStart = 0;
mIndexEnd = 0; mIndexEnd = 0;
#endif mLockedBuffer = NULL;
} }
#endif #endif

View file

@ -77,17 +77,17 @@ enum REGISTER_TYPE
struct ConstantDesc struct ConstantDesc
{ {
String Name; String Name = String::EmptyString;
S32 RegisterIndex; S32 RegisterIndex = 0;
S32 RegisterCount; S32 RegisterCount = 0;
S32 Rows; S32 Rows = 0;
S32 Columns; S32 Columns = 0;
S32 Elements; S32 Elements = 0;
S32 StructMembers; S32 StructMembers = 0;
REGISTER_TYPE RegisterSet; REGISTER_TYPE RegisterSet = D3DRS_FLOAT4;
CONST_CLASS Class; CONST_CLASS Class = D3DPC_SCALAR;
CONST_TYPE Type; CONST_TYPE Type = D3DPT_FLOAT;
U32 Bytes; U32 Bytes = 0;
}; };
class ConstantTable class ConstantTable

View file

@ -324,6 +324,8 @@ GFXD3D11WindowTarget::GFXD3D11WindowTarget()
mDepthStencilView = NULL; mDepthStencilView = NULL;
mDepthStencil = NULL; mDepthStencil = NULL;
mBackBufferView = NULL; mBackBufferView = NULL;
mSwapChain = NULL;
dMemset(&mPresentationParams, 0, sizeof(mPresentationParams));
mSecondaryWindow = false; mSecondaryWindow = false;
} }

View file

@ -46,10 +46,13 @@ GFXD3D11TextureObject::GFXD3D11TextureObject( GFXDevice * d, GFXTextureProfile *
mLocked = false; mLocked = false;
mD3DSurface = NULL; mD3DSurface = NULL;
dMemset(&mLockRect, 0, sizeof(mLockRect));
dMemset(&mLockBox, 0, sizeof(mLockBox));
mLockedSubresource = 0; mLockedSubresource = 0;
mDSView = NULL; mDSView = NULL;
mRTView = NULL; mRTView = NULL;
mSRView = NULL; mSRView = NULL;
isManaged = false;
} }
GFXD3D11TextureObject::~GFXD3D11TextureObject() GFXD3D11TextureObject::~GFXD3D11TextureObject()
@ -318,4 +321,4 @@ ID3D11RenderTargetView** GFXD3D11TextureObject::getRTViewPtr()
ID3D11DepthStencilView** GFXD3D11TextureObject::getDSViewPtr() ID3D11DepthStencilView** GFXD3D11TextureObject::getDSViewPtr()
{ {
return &mDSView; return &mDSView;
} }

View file

@ -68,10 +68,10 @@ inline GFXD3D11VertexBuffer::GFXD3D11VertexBuffer() : GFXVertexBuffer(0,0,0,0,(G
mIsFirstLock = true; mIsFirstLock = true;
lockedVertexEnd = lockedVertexStart = 0; lockedVertexEnd = lockedVertexStart = 0;
mClearAtFrameEnd = false; mClearAtFrameEnd = false;
mLockedBuffer = NULL;
#ifdef TORQUE_DEBUG #ifdef TORQUE_DEBUG
mDebugGuardBuffer = NULL; mDebugGuardBuffer = NULL;
mLockedBuffer = NULL;
#endif #endif
} }
@ -92,4 +92,4 @@ inline GFXD3D11VertexBuffer::GFXD3D11VertexBuffer( GFXDevice *device,
#endif #endif
} }
#endif // _GFXD3D_VERTEXBUFFER_H_ #endif // _GFXD3D_VERTEXBUFFER_H_

View file

@ -187,7 +187,7 @@ public:
const GFXVertexFormat *vertexFormat, const GFXVertexFormat *vertexFormat,
U32 vertexSize, U32 vertexSize,
GFXBufferType bufferType ) : GFXBufferType bufferType ) :
GFXVertexBuffer(device, numVerts, vertexFormat, vertexSize, bufferType) { }; GFXVertexBuffer(device, numVerts, vertexFormat, vertexSize, bufferType) {tempBuf =NULL;};
virtual void lock(U32 vertexStart, U32 vertexEnd, void **vertexPtr); virtual void lock(U32 vertexStart, U32 vertexEnd, void **vertexPtr);
virtual void unlock(); virtual void unlock();
virtual void prepare(); virtual void prepare();

View file

@ -176,7 +176,15 @@ struct DDSFile
// For debugging fun! // For debugging fun!
static S32 smActiveCopies; static S32 smActiveCopies;
DDSFile() DDSFile():
mBytesPerPixel(0),
mHeight(0),
mWidth(0),
mDepth(0),
mFormat(GFXFormat_FIRST),
mFourCC(0),
mMipMapCount(0),
mPitchOrLinearSize(0)
{ {
VECTOR_SET_ASSOCIATION( mSurfaces ); VECTOR_SET_ASSOCIATION( mSurfaces );
smActiveCopies++; smActiveCopies++;
@ -203,4 +211,4 @@ struct DDSFile
bool decompressToGBitmap(GBitmap *dest); bool decompressToGBitmap(GBitmap *dest);
}; };
#endif // _DDSFILE_H_ #endif // _DDSFILE_H_

View file

@ -50,8 +50,7 @@ GBitmap::GBitmap()
mNumMipLevels(0), mNumMipLevels(0),
mHasTransparency(false) mHasTransparency(false)
{ {
for (U32 i = 0; i < c_maxMipLevels; i++) std::fill_n(mMipLevelOffsets, c_maxMipLevels, 0xffffffff);
mMipLevelOffsets[i] = 0xffffffff;
} }
GBitmap::GBitmap(const GBitmap& rCopy) GBitmap::GBitmap(const GBitmap& rCopy)

View file

@ -82,6 +82,9 @@ public:
Registration() Registration()
{ {
readFunc = NULL;
writeFunc = NULL;
defaultCompression = 0;
priority = 0; priority = 0;
VECTOR_SET_ASSOCIATION( extensions ); VECTOR_SET_ASSOCIATION( extensions );
} }

View file

@ -69,7 +69,6 @@ namespace ImageUtil
{ {
S32 width; S32 width;
S32 height; S32 height;
S32 flags;
const U8 *pSrc; const U8 *pSrc;
U8 *pDst; U8 *pDst;
GFXFormat format; GFXFormat format;
@ -306,4 +305,4 @@ namespace ImageUtil
{ {
return mFloor(mLog2(mMax(width, height))) + 1; return mFloor(mLog2(mMax(width, height))) + 1;
} }
} }

View file

@ -198,14 +198,17 @@ GFont::GFont()
VECTOR_SET_ASSOCIATION(mCharInfoList); VECTOR_SET_ASSOCIATION(mCharInfoList);
VECTOR_SET_ASSOCIATION(mTextureSheets); VECTOR_SET_ASSOCIATION(mTextureSheets);
for (U32 i = 0; i < (sizeof(mRemapTable) / sizeof(S32)); i++) std::fill_n(mRemapTable, Font_Table_MAX,-1);
mRemapTable[i] = -1;
mCurX = mCurY = mCurSheet = -1; mCurX = mCurY = mCurSheet = -1;
mPlatformFont = NULL; mPlatformFont = NULL;
mSize = 0; mSize = 0;
mCharSet = 0; mCharSet = 0;
mHeight = 0;
mBaseline = 0;
mAscent = 0;
mDescent = 0;
mNeedSave = false; mNeedSave = false;
mMutex = Mutex::createMutex(); mMutex = Mutex::createMutex();

View file

@ -42,6 +42,7 @@
GFX_DeclareTextureProfile(GFXFontTextureProfile); GFX_DeclareTextureProfile(GFXFontTextureProfile);
#define Font_Table_MAX 65536
class GFont class GFont
{ {
@ -159,7 +160,7 @@ private:
Vector<PlatformFont::CharInfo> mCharInfoList; Vector<PlatformFont::CharInfo> mCharInfoList;
/// Index remapping /// Index remapping
S32 mRemapTable[65536]; S32 mRemapTable[Font_Table_MAX];
}; };
inline U32 GFont::getCharXIncrement(const UTF16 in_charIndex) inline U32 GFont::getCharXIncrement(const UTF16 in_charIndex)

View file

@ -82,6 +82,7 @@ public:
mShaderModel = 0.f; mShaderModel = 0.f;
mIndex = 0; mIndex = 0;
dMemset(&mLUID, '\0', sizeof(mLUID)); dMemset(&mLUID, '\0', sizeof(mLUID));
mType = GFXAdapterType::NullDevice;
} }
~GFXAdapter() ~GFXAdapter()

View file

@ -125,7 +125,7 @@ protected:
GFXFormat mFormat; GFXFormat mFormat;
public: public:
GFXCubemapArray() :mNumCubemaps(0), mSize(0), mMipMapLevels(0), mFormat(GFXFormat_FIRST) {}
virtual ~GFXCubemapArray() {}; virtual ~GFXCubemapArray() {};
/// Initialize from an array of cubemaps /// Initialize from an array of cubemaps
virtual void init(GFXCubemapHandle *cubemaps, const U32 cubemapCount) = 0; virtual void init(GFXCubemapHandle *cubemaps, const U32 cubemapCount) = 0;

View file

@ -25,6 +25,8 @@
FontRenderBatcher::FontRenderBatcher() : mStorage(8096) FontRenderBatcher::FontRenderBatcher() : mStorage(8096)
{ {
mFont = NULL;
mLength = 0;
if (!mFontSB) if (!mFontSB)
{ {
GFXStateBlockDesc f; GFXStateBlockDesc f;
@ -246,4 +248,4 @@ void FontRenderBatcher::init( GFont *font, U32 n )
mFont = font; mFont = font;
mLength = n; mLength = n;
} }

View file

@ -57,7 +57,7 @@ struct GFXFormatInfo
/// If true, channels are in floating-point. /// If true, channels are in floating-point.
bool mIsFloatingPoint; bool mIsFloatingPoint;
Data() {} Data() :mBytesPerPixel(0), mHasAlpha(false), mIsCompressed(false), mIsFloatingPoint(false) {}
Data( U32 bpp, bool hasAlpha = false, bool isCompressed = false, bool isFP = false ) Data( U32 bpp, bool hasAlpha = false, bool isCompressed = false, bool isFP = false )
: mBytesPerPixel( bpp ), : mBytesPerPixel( bpp ),
mHasAlpha( hasAlpha ), mHasAlpha( hasAlpha ),

View file

@ -159,7 +159,12 @@ struct GFXPrimitive
GFXPrimitive() GFXPrimitive()
{ {
dMemset( this, 0, sizeof( GFXPrimitive ) ); type = GFXPT_FIRST;
startVertex = 0;
minIndex = 0;
startIndex = 0;
numPrimitives = 0;
numVertices = 0;
} }
}; };

View file

@ -68,6 +68,10 @@ public:
mVertexSize( vertexSize ), mVertexSize( vertexSize ),
mBufferType( bufferType ), mBufferType( bufferType ),
mDevice( device ), mDevice( device ),
isLocked(false),
lockedVertexStart(0),
lockedVertexEnd(0),
lockedVertexPtr(NULL),
mVolatileStart( 0 ) mVolatileStart( 0 )
{ {
if ( vertexFormat ) if ( vertexFormat )

View file

@ -77,6 +77,7 @@ GFXVertexFormat::GFXVertexFormat()
mHasColor( false ), mHasColor( false ),
mHasTangent( false ), mHasTangent( false ),
mHasInstancing( false ), mHasInstancing( false ),
mHasBlendIndices(false),
mTexCoordCount( 0 ), mTexCoordCount( 0 ),
mSizeInBytes( 0 ), mSizeInBytes( 0 ),
mDecl( NULL ) mDecl( NULL )

View file

@ -174,7 +174,8 @@ public:
struct struct
{ {
U32 mOffset, mSize; U32 mOffset = 0;
U32 mSize = 0;
}_getBufferData; }_getBufferData;
void lock(const U32 size, U32 offsetAlign, U32 &outOffset, void* &outPtr) void lock(const U32 size, U32 offsetAlign, U32 &outOffset, void* &outPtr)

View file

@ -41,6 +41,8 @@ static GLenum faceList[6] =
GFXGLCubemap::GFXGLCubemap() : GFXGLCubemap::GFXGLCubemap() :
mCubemap(0), mCubemap(0),
mDynamicTexSize(0), mDynamicTexSize(0),
mWidth(0),
mHeight(0),
mFaceFormat( GFXFormatR8G8B8A8 ) mFaceFormat( GFXFormatR8G8B8A8 )
{ {
for(U32 i = 0; i < 6; i++) for(U32 i = 0; i < 6; i++)
@ -313,6 +315,7 @@ U8* GFXGLCubemap::getTextureData(U32 face, U32 mip)
GFXGLCubemapArray::GFXGLCubemapArray() GFXGLCubemapArray::GFXGLCubemapArray()
{ {
mCubemap = NULL;
} }
GFXGLCubemapArray::~GFXGLCubemapArray() GFXGLCubemapArray::~GFXGLCubemapArray()

View file

@ -235,6 +235,7 @@ GFXGLDevice::GFXGLDevice(U32 adapterIndex) :
mActiveTextureType[i] = GL_ZERO; mActiveTextureType[i] = GL_ZERO;
mNumVertexStream = 2; mNumVertexStream = 2;
mSupportsAnisotropic = false;
for(int i = 0; i < GS_COUNT; ++i) for(int i = 0; i < GS_COUNT; ++i)
mModelViewProjSC[i] = NULL; mModelViewProjSC[i] = NULL;

View file

@ -53,7 +53,7 @@ public:
typedef Data DataType; typedef Data DataType;
GLTimer(GFXDevice *device, Data &data) : mData(&data) GLTimer(GFXDevice *device, Data &data) : mName(NULL), mData(&data)
{ {
glGenQueries(1, &mQueryId); glGenQueries(1, &mQueryId);
} }

View file

@ -38,7 +38,9 @@ GLCircularVolatileBuffer* getCircularVolatileIndexBuffer()
GFXGLPrimitiveBuffer::GFXGLPrimitiveBuffer(GFXDevice *device, U32 indexCount, U32 primitiveCount, GFXBufferType bufferType) : GFXGLPrimitiveBuffer::GFXGLPrimitiveBuffer(GFXDevice *device, U32 indexCount, U32 primitiveCount, GFXBufferType bufferType) :
GFXPrimitiveBuffer(device, indexCount, primitiveCount, bufferType), GFXPrimitiveBuffer(device, indexCount, primitiveCount, bufferType),
mBufferOffset(0), mBufferOffset(0),
mZombieCache(NULL) mZombieCache(NULL),
lockedIndexEnd(0),
lockedIndexStart(0)
{ {
if( mBufferType == GFXBufferTypeVolatile ) if( mBufferType == GFXBufferTypeVolatile )
{ {
@ -185,4 +187,4 @@ MODULE_BEGIN( GFX_GL_PrimitiveBuffer )
{ {
GFXDevice::getDeviceEventSignal( ).remove( &onGFXDeviceSignal ); GFXDevice::getDeviceEventSignal( ).remove( &onGFXDeviceSignal );
} }
MODULE_END MODULE_END

View file

@ -69,6 +69,7 @@ public:
GFXGLShaderConstHandle::GFXGLShaderConstHandle( GFXGLShader *shader ) GFXGLShaderConstHandle::GFXGLShaderConstHandle( GFXGLShader *shader )
: mShader( shader ), mLocation(0), mOffset(0), mSize(0), mSamplerNum(-1), mInstancingConstant(false) : mShader( shader ), mLocation(0), mOffset(0), mSize(0), mSamplerNum(-1), mInstancingConstant(false)
{ {
dMemset(&mDesc, 0, sizeof(mDesc));
mValid = false; mValid = false;
} }

View file

@ -33,15 +33,24 @@
GFXGLTextureObject::GFXGLTextureObject(GFXDevice * aDevice, GFXTextureProfile *profile) : GFXGLTextureObject::GFXGLTextureObject(GFXDevice * aDevice, GFXTextureProfile *profile) :
GFXTextureObject(aDevice, profile), GFXTextureObject(aDevice, profile),
mIsNPoT2(false),
mBinding(GL_TEXTURE_2D), mBinding(GL_TEXTURE_2D),
mBytesPerTexel(4), mBytesPerTexel(4),
mLockedRectRect(0, 0, 0, 0), mLockedRectRect(0, 0, 0, 0),
mGLDevice(static_cast<GFXGLDevice*>(mDevice)), mGLDevice(static_cast<GFXGLDevice*>(mDevice)),
mIsZombie(false),
mZombieCache(NULL), mZombieCache(NULL),
mNeedInitSamplerState(true), mNeedInitSamplerState(true),
mFrameAllocatorMark(0), mFrameAllocatorMark(0),
mFrameAllocatorPtr(NULL) mFrameAllocatorPtr(NULL)
{ {
#if TORQUE_DEBUG
mFrameAllocatorMarkGuard == FrameAllocator::getWaterMark();
#endif
dMemset(&mLockedRect, 0, sizeof(mLockedRect));
AssertFatal(dynamic_cast<GFXGLDevice*>(mDevice), "GFXGLTextureObject::GFXGLTextureObject - Invalid device type, expected GFXGLDevice!"); AssertFatal(dynamic_cast<GFXGLDevice*>(mDevice), "GFXGLTextureObject::GFXGLTextureObject - Invalid device type, expected GFXGLDevice!");
glGenTextures(1, &mHandle); glGenTextures(1, &mHandle);
glGenBuffers(1, &mBuffer); glGenBuffers(1, &mBuffer);

View file

@ -7,7 +7,7 @@ class GFXGLDevice;
class GFXGLVertexDecl : public GFXVertexDecl class GFXGLVertexDecl : public GFXVertexDecl
{ {
public: public:
GFXGLVertexDecl() : mFormat(NULL), mVertexAttribActiveMask(0) {} GFXGLVertexDecl() : mFormat(NULL), mVertexAttribActiveMask(0) { std::fill_n(mVertexSize, 4, 0); }
void init(const GFXVertexFormat *format); void init(const GFXVertexFormat *format);
void prepareVertexFormat() const; void prepareVertexFormat() const;
@ -36,4 +36,4 @@ protected:
void _initVerticesFormat2(); void _initVerticesFormat2();
}; };
#endif //GFX_GL_VERTEX_DECL #endif //GFX_GL_VERTEX_DECL

View file

@ -278,7 +278,9 @@ bool TheoraTexture::AsyncState::isAtEnd()
TheoraTexture::TheoraTexture() TheoraTexture::TheoraTexture()
: mCurrentFrame( NULL ), : mCurrentFrame( NULL ),
mPlaybackQueue( NULL ), mPlaybackQueue( NULL ),
mIsPaused( true ) mIsPaused( true ),
mLastFrameNumber(0),
mNumDroppedFrames(0)
{ {
GFXTextureManager::addEventDelegate( this, &TheoraTexture::_onTextureEvent ); GFXTextureManager::addEventDelegate( this, &TheoraTexture::_onTextureEvent );
} }

View file

@ -52,12 +52,16 @@ MODULE_BEGIN( VideoCapture )
MODULE_END; MODULE_END;
VideoCapture::VideoCapture() : VideoCapture::VideoCapture() :
mCapturedFramePos(-1.0f),
mEncoder(NULL), mEncoder(NULL),
mFrameGrabber(NULL), mFrameGrabber(NULL),
mCanvas(NULL), mCanvas(NULL),
mIsRecording(false), mIsRecording(false),
mVideoCaptureStartTime(0),
mNextFramePosition(0.0f),
mFrameRate(30.0f), mFrameRate(30.0f),
mMsPerFrame(1000.0f / mFrameRate),
mResolution(0,0), mResolution(0,0),
mWaitingForCanvas(false), mWaitingForCanvas(false),
mEncoderName("THEORA"), mEncoderName("THEORA"),

View file

@ -126,12 +126,12 @@ private:
/// Frame to be captured next /// Frame to be captured next
F32 mNextFramePosition; F32 mNextFramePosition;
/// The per-frame time (in milliseconds)
F32 mMsPerFrame;
/// The framerate we'll use to record /// The framerate we'll use to record
F32 mFrameRate; F32 mFrameRate;
/// The per-frame time (in milliseconds)
F32 mMsPerFrame;
/// Accumulated error when converting the per-frame-time to integer /// Accumulated error when converting the per-frame-time to integer
/// this is used to dither the value and keep overall time advancing /// this is used to dither the value and keep overall time advancing
/// correct /// correct

View file

@ -195,6 +195,11 @@ public:
VideoEncoderTheora() : VideoEncoderTheora() :
mCurrentFrame(0), td(NULL), mLastFrame(NULL) mCurrentFrame(0), td(NULL), mLastFrame(NULL)
{ {
dMemset(&to, 0, sizeof(to));
dMemset(&ti, 0, sizeof(ti));
dMemset(&tc, 0, sizeof(tc));
dMemset(&mBuffer, 0, sizeof(mBuffer));
setStatus(false); setStatus(false);
} }
@ -458,4 +463,4 @@ public:
REGISTER_VIDEO_ENCODER(VideoEncoderTheora, THEORA) REGISTER_VIDEO_ENCODER(VideoEncoderTheora, THEORA)
#endif #endif