tracks wether or not a cubemap has been fully intitialised (as well as defautls for other shared entries). skips out including an uninitialized cuebmap in probe array (inthoery. in practice, need to root arround a bit more)

This commit is contained in:
Azaezel 2019-01-22 02:03:14 -06:00
parent d6ae28b58e
commit e1c72b5aa2
5 changed files with 19 additions and 4 deletions

View file

@ -31,7 +31,6 @@ GFXD3D11Cubemap::GFXD3D11Cubemap() : mTexture(NULL), mSRView(NULL), mDSView(NULL
mDynamic = false; mDynamic = false;
mAutoGenMips = false; mAutoGenMips = false;
mFaceFormat = GFXFormatR8G8B8A8; mFaceFormat = GFXFormatR8G8B8A8;
for (U32 i = 0; i < CubeFaces; i++) for (U32 i = 0; i < CubeFaces; i++)
{ {
for(U32 j=0; j < MaxMipMaps; j++) for(U32 j=0; j < MaxMipMaps; j++)
@ -142,7 +141,7 @@ void GFXD3D11Cubemap::initStatic(GFXTexHandle *faces)
mSRView->GetDesc(&viewDesc); mSRView->GetDesc(&viewDesc);
mMipMapLevels = viewDesc.TextureCube.MipLevels; mMipMapLevels = viewDesc.TextureCube.MipLevels;
} }
mInitialized = true;
} }
void GFXD3D11Cubemap::initStatic(DDSFile *dds) void GFXD3D11Cubemap::initStatic(DDSFile *dds)
@ -209,6 +208,7 @@ void GFXD3D11Cubemap::initStatic(DDSFile *dds)
{ {
AssertFatal(false, "GFXD3D11Cubemap::initStatic(DDSFile *dds) - CreateTexture2D call failure"); AssertFatal(false, "GFXD3D11Cubemap::initStatic(DDSFile *dds) - CreateTexture2D call failure");
} }
mInitialized = true;
} }
void GFXD3D11Cubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLevels) void GFXD3D11Cubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLevels)
@ -331,7 +331,7 @@ void GFXD3D11Cubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLeve
} }
SAFE_RELEASE(depthTex); SAFE_RELEASE(depthTex);
mInitialized = true;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -26,6 +26,13 @@
#include "gfx/gfxTextureManager.h" #include "gfx/gfxTextureManager.h"
GFXCubemap::GFXCubemap()
{
mPath = "";
mMipMapLevels = 0;
mInitialized = false;
}
GFXCubemap::~GFXCubemap() GFXCubemap::~GFXCubemap()
{ {
// If we're not dynamic and we were loaded from a // If we're not dynamic and we were loaded from a

View file

@ -49,6 +49,7 @@ protected:
U32 mMipMapLevels; U32 mMipMapLevels;
bool mInitialized;
public: public:
/// Create a static cubemap from a list of 6 face textures. /// Create a static cubemap from a list of 6 face textures.
@ -61,7 +62,7 @@ public:
virtual void initDynamic( U32 texSize, GFXFormat faceFormat = GFXFormatR8G8B8A8, U32 mipLevels = 0 ) = 0; virtual void initDynamic( U32 texSize, GFXFormat faceFormat = GFXFormatR8G8B8A8, U32 mipLevels = 0 ) = 0;
void initNormalize(U32 size); void initNormalize(U32 size);
GFXCubemap();
virtual ~GFXCubemap(); virtual ~GFXCubemap();
/// Returns the size of the faces. /// Returns the size of the faces.
@ -82,6 +83,7 @@ public:
/// Get Z up face index of the cubemap. DDS files will be stored Y up /// Get Z up face index of the cubemap. DDS files will be stored Y up
static U32 zUpFaceIndex(const U32 index); static U32 zUpFaceIndex(const U32 index);
bool isInitialised() { return mInitialized; }
}; };

View file

@ -126,6 +126,7 @@ void GFXGLCubemap::initStatic(GFXTexHandle* faces)
glGenTextures(1, &mCubemap); glGenTextures(1, &mCubemap);
fillCubeTextures(faces); fillCubeTextures(faces);
} }
mInitialized = true;
} }
void GFXGLCubemap::initStatic( DDSFile *dds ) void GFXGLCubemap::initStatic( DDSFile *dds )
@ -179,6 +180,7 @@ void GFXGLCubemap::initStatic( DDSFile *dds )
GFXGLTextureFormat[mFaceFormat], GFXGLTextureType[mFaceFormat], dds->mSurfaces[i]->mMips[mip]); GFXGLTextureFormat[mFaceFormat], GFXGLTextureType[mFaceFormat], dds->mSurfaces[i]->mMips[mip]);
} }
} }
mInitialized = true;
} }
void GFXGLCubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLevels) void GFXGLCubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLevels)
@ -220,6 +222,7 @@ void GFXGLCubemap::initDynamic(U32 texSize, GFXFormat faceFormat, U32 mipLevels)
if( !isCompressed ) if( !isCompressed )
glGenerateMipmap(GL_TEXTURE_CUBE_MAP); glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
mInitialized = true;
} }
void GFXGLCubemap::zombify() void GFXGLCubemap::zombify()

View file

@ -353,6 +353,9 @@ void RenderProbeMgr::render( SceneRenderState *state )
if (curEntry->mCubemap.isNull() || curEntry->mIrradianceCubemap.isNull()) if (curEntry->mCubemap.isNull() || curEntry->mIrradianceCubemap.isNull())
continue; continue;
if (!curEntry->mCubemap->isInitialised())
continue;
//Setup //Setup
const Point3F &probePos = curEntry->getPosition(); const Point3F &probePos = curEntry->getPosition();
probePositions[i] = probePos + curEntry->mProbePosOffset; probePositions[i] = probePos + curEntry->mProbePosOffset;