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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -187,7 +187,7 @@ public:
const GFXVertexFormat *vertexFormat,
U32 vertexSize,
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 unlock();
virtual void prepare();

View file

@ -176,7 +176,15 @@ struct DDSFile
// For debugging fun!
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 );
smActiveCopies++;
@ -203,4 +211,4 @@ struct DDSFile
bool decompressToGBitmap(GBitmap *dest);
};
#endif // _DDSFILE_H_
#endif // _DDSFILE_H_

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -159,7 +159,12 @@ struct 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 ),
mBufferType( bufferType ),
mDevice( device ),
isLocked(false),
lockedVertexStart(0),
lockedVertexEnd(0),
lockedVertexPtr(NULL),
mVolatileStart( 0 )
{
if ( vertexFormat )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -33,15 +33,24 @@
GFXGLTextureObject::GFXGLTextureObject(GFXDevice * aDevice, GFXTextureProfile *profile) :
GFXTextureObject(aDevice, profile),
mIsNPoT2(false),
mBinding(GL_TEXTURE_2D),
mBytesPerTexel(4),
mLockedRectRect(0, 0, 0, 0),
mGLDevice(static_cast<GFXGLDevice*>(mDevice)),
mIsZombie(false),
mZombieCache(NULL),
mNeedInitSamplerState(true),
mFrameAllocatorMark(0),
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!");
glGenTextures(1, &mHandle);
glGenBuffers(1, &mBuffer);

View file

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

View file

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

View file

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

View file

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

View file

@ -195,6 +195,11 @@ public:
VideoEncoderTheora() :
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);
}
@ -458,4 +463,4 @@ public:
REGISTER_VIDEO_ENCODER(VideoEncoderTheora, THEORA)
#endif
#endif