Merge branch 'main' into sceneapi_script_autotest

This commit is contained in:
jackalbe
2021-04-13 17:54:57 -05:00
1725 changed files with 35703 additions and 520825 deletions
@@ -856,9 +856,6 @@ void C3DEngine::RenderWorld(const int nRenderFlags, const SRenderingPassInfo& pa
return;
}
#ifdef ENABLE_LW_PROFILERS
int64 renderStart = CryGetTicks();
#endif
FUNCTION_PROFILER_3DENGINE;
if (GetCVars()->e_ScreenShot)
@@ -3609,15 +3606,6 @@ void C3DEngine::SetupDistanceFog()
{
FUNCTION_PROFILER_3DENGINE;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// render to texture does not support volumetric fog
if (GetRenderer()->IsRenderToTextureActive() && (GetCVars()->e_VolumetricFog != 0))
{
GetRenderer()->EnableFog(false);
return;
}
#endif // AZ_RENDER_TO_TEXTURE_GEM_ENABLED
GetRenderer()->SetFogColor(ColorF(m_vFogColor.x, m_vFogColor.y, m_vFogColor.z, 1.0f));
GetRenderer()->EnableFog(GetCVars()->e_Fog > 0);
}
-3
View File
@@ -1548,8 +1548,6 @@ void C3DEngine::OnExplosion(Vec3 vPos, float fRadius, [[maybe_unused]] bool bDef
}
// reduce ground decals size depending on distance to the ground
float terrainHeight = terrain->GetHeightFromFloats(vPos.x, vPos.y);
float fExploHeight = vPos.z - terrainHeight;
// delete decals what can not be correctly updated
Vec3 vRadius(fRadius, fRadius, fRadius);
@@ -2051,7 +2049,6 @@ bool C3DEngine::SetStatInstGroup(int nGroupId, const IStatInstGroup& siGroup, in
rGroup.bAllowIndoor = siGroup.bAllowIndoor;
rGroup.fAlignToTerrainCoefficient = siGroup.fAlignToTerrainCoefficient;
bool previousAutoMerged = rGroup.bAutoMerged;
rGroup.bAutoMerged = siGroup.bAutoMerged;
rGroup.minConfigSpec = siGroup.minConfigSpec;
@@ -552,7 +552,6 @@ namespace NAsyncCull
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Renderer);
int bHWZBuffer = GetCVars()->e_CoverageBufferReproj;
int PolyLimit = GetCVars()->e_CoverageBufferRastPolyLimit;
if (bHWZBuffer > 3 && m_OCMBuffer.empty())
{
@@ -701,7 +700,6 @@ namespace NAsyncCull
const AABB PosAABB = AABB(m_Position, 0.5f);
const float Bias = GetCVars()->e_CoverageBufferAABBExpand;
rMatFinalT = m_MatScreenViewProj.GetTransposed();
bool bEnabled = m_Enabled;
// Debugging stats in green to screen here with how many octree nodes pass/fail and how many terrain nodes pass/fail
unsigned int octreeNodesCulled = 0;
+4 -3
View File
@@ -1545,8 +1545,6 @@ namespace ProcessSkinningHelpers
vmax = i2;
}
}
uint32 a = pMesh->m_subsets[m].nFirstVertId;
uint32 b = pMesh->m_subsets[m].nNumVerts;
if (pMesh->m_subsets[m].nFirstVertId != vmin ||
pMesh->m_subsets[m].nNumVerts != vmax - vmin + 1)
{
@@ -2255,7 +2253,9 @@ bool CLoaderCGF::ProcessSkinning()
//init internal morph-targets
MorphTargets* pMorphtarget = pSkinningInfo->m_arrMorphTargets[it];
uint32 numMorphVerts = pMorphtarget->m_arrIntMorph.size();
#if !defined(NDEBUG)
uint32 intVertexCount = pSkinningInfo->m_arrIntVertices.size();
#endif
for (uint32 i = 0; i < numMorphVerts; i++)
{
uint32 idx = pMorphtarget->m_arrIntMorph[i].nVertexId;
@@ -3982,7 +3982,8 @@ bool CLoaderCGF::LoadFoliageInfoChunk(IChunkFile::ChunkDesc* pChunkDesc)
SFoliageInfoCGF& fi = *m_pCGF->GetFoliageInfo();
bool isSkinned = m_pCGF->GetExportInfo()->bSkinnedCGF;
if (fi.nSpines = chunk.nSpines)
fi.nSpines = chunk.nSpines;
if (fi.nSpines)
{
fi.nSkinnedVtx = chunk.nSkinnedVtx;
@@ -362,7 +362,6 @@ void CSaverCGF::SaveNodes(
for (uint i = 0; i < numNodes; i++)
{
CNodeCGF* pNode = m_pCGF->GetNode(i);
const char* pNodeName = pNode->name;
SaveNode(pNode, bSwapEndian, bStorePositionsAsF16, bUseQtangents, bStoreIndicesAsU16);
}
}
@@ -459,7 +458,6 @@ int CSaverCGF::SaveNode(
: SaveHelperChunk(pNode, bSwapEndian);
}
int nextChunk = m_pChunkFile->NumChunks();
int positionIndex = pNode->pos_cont_id;
int rotationIndex = pNode->rot_cont_id;
int scaleIndex = pNode->scl_cont_id;
@@ -43,7 +43,6 @@ void CZBufferCuller::BeginFrame(const SRenderingPassInfo& passInfo)
m_Camera = rCam;
m_Position = rCam.GetPosition();
uint32 oldSizeX = m_SizeX;
uint32 oldSizeY = m_SizeY;
const uint32 sizeX = min(max(1, GetCVars()->e_CoverageBufferResolution), 1024);
const uint32 sizeY = sizeX;
-2
View File
@@ -253,8 +253,6 @@ void CDecal::Render(const float fCurTime, int nAfterWater, float fDistanceFading
m_arrBigDecalRMCustomData[14] = vNormal.z * (m_fSize / m_fWSSize);
m_arrBigDecalRMCustomData[15] = 0;
CStatObj* pBody = NULL;
bool bUseBending = GetCVars()->e_VegetationBending != 0;
// draw complex decal using new indices and original object vertices
pObj->m_fAlpha = fAlpha;
+6 -4
View File
@@ -191,10 +191,10 @@ bool CDecalManager::SpawnHierarchical(const CryEngineDecalInfo& rootDecalInfo, C
for (int nEntitySlotId = 0; nEntitySlotId < 16; nEntitySlotId++)
{
CStatObj* _pStatObj = NULL;
Matrix34A entSlotMatrix;
entSlotMatrix.SetIdentity();
if (_pStatObj = (CStatObj*)rootDecalInfo.ownerInfo.pRenderNode->GetEntityStatObj(nEntitySlotId, ~0, &entSlotMatrix, true))
CStatObj* _pStatObj = (CStatObj*)rootDecalInfo.ownerInfo.pRenderNode->GetEntityStatObj(nEntitySlotId, ~0, &entSlotMatrix, true);
if (_pStatObj)
{
if (_pStatObj->m_nFlags & STATIC_OBJECT_COMPOUND)
{
@@ -1014,7 +1014,9 @@ void CDecalManager::MoveToEdge(IRenderMesh* pRM, const float fRadius, Vec3& vOut
return;
}
#if !defined(NDEBUG)
int nInds = pRM->GetIndicesCount();
#endif
// if(nInds>6000)
// return; // skip insane objects
@@ -1758,8 +1760,8 @@ IStatObj* SDecalOwnerInfo::GetOwner(Matrix34A& objMat)
return NULL;
}
IStatObj* pStatObj = NULL;
if (pStatObj = pRenderNode->GetEntityStatObj(nRenderNodeSlotId, nRenderNodeSlotSubObjectId, &objMat, true))
IStatObj* pStatObj = pRenderNode->GetEntityStatObj(nRenderNodeSlotId, nRenderNodeSlotSubObjectId, &objMat, true);
if (pStatObj)
{
if (nRenderNodeSlotSubObjectId >= 0 && nRenderNodeSlotSubObjectId < pStatObj->GetSubObjectCount())
{
@@ -216,7 +216,8 @@ IDeferredPhysicsEvent* CDeferredPhysicsEventManager::GetLastCollisionEventForEnt
EventPhysCollision* pLastPhysEvent;
for (int i = m_activeDeferredEvents.size() - 1; i >= 0; i--)
{
if ((pLastPhysEvent = (EventPhysCollision*)m_activeDeferredEvents[i]->PhysicsEvent()) && pLastPhysEvent->idval == EventPhysCollision::id && pLastPhysEvent->pEntity[0] == pPhysEnt)
pLastPhysEvent = (EventPhysCollision*)m_activeDeferredEvents[i]->PhysicsEvent();
if (pLastPhysEvent && pLastPhysEvent->idval == EventPhysCollision::id && pLastPhysEvent->pEntity[0] == pPhysEnt)
{
return m_activeDeferredEvents[i];
}
@@ -444,13 +444,7 @@ void CFogVolumeRenderNode::Render(const SRendParams& rParam, const SRenderingPas
m_cachedFogColor = GetFogColor();
m_cachedSoftEdgesLerp = GetSoftEdgeLerp(viewerPosOS);
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// volumetric fog is not supported in the render scene to texture pass
bool bVolFog = (GetCVars()->e_VolumetricFog != 0) && !passInfo.IsRenderSceneToTexturePass();
#else
bool bVolFog = (GetCVars()->e_VolumetricFog != 0);
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// reset elapsed time for noise when FogVolume stayed out of viewport for 30 frames.
// this prevents the time from being too large number.
-1
View File
@@ -538,7 +538,6 @@ IGeomCache::SStatistics CGeomCache::GetStatistics() const
std::set<uint16> materialIds;
CGeomCacheMeshManager& meshManager = GetGeomCacheManager()->GetMeshManager();
const uint numMeshes = m_staticMeshData.size();
for (uint i = 0; i < numMeshes; ++i)
@@ -323,7 +323,6 @@ namespace GeomCacheDecoder
const uint numSIMDIterations = numVertices / numVerticesPerIteration;
float* pPrevPositionsF = updateContext.m_prevPositions.size() > 0 ? (float*)&updateContext.m_prevPositions[0] : NULL;
float* pStaticPositionsF = staticMeshData.m_positions.size() > 0 ? (float*)&staticMeshData.m_positions[0] : NULL;
float* pVelocitiesF = (float*)&updateContext.m_pVelocities[0];
__m128i* pFloorPositions128 = (__m128i*)&pFloorPositions[0];
__m128i* pCeilPositions128 = (__m128i*)&pCeilPositions[0];
@@ -569,7 +568,6 @@ namespace GeomCacheDecoder
continue;
}
const GeomCacheFile::SMeshFrameHeader* pFrameHeader = reinterpret_cast<GeomCacheFile::SMeshFrameHeader*>(pData);
pData += sizeof(GeomCacheFile::SMeshFrameHeader);
const GeomCacheFile::EStreams streamMask = currentStaticMeshData.m_animatedStreams;
@@ -855,7 +855,6 @@ void CGeomCacheManager::LaunchDecompressJobs(SGeomCacheStreamInfo* pStreamInfo,
assert(gEnv->mMainThreadId == CryGetCurrentThreadId());
const CGeomCacheRenderNode* pRenderNode = pStreamInfo->m_pRenderNode;
const CGeomCache* pGeomCache = pStreamInfo->m_pGeomCache;
const GeomCacheFile::EBlockCompressionFormat blockCompressionFormat = pGeomCache->GetBlockCompressionFormat();
const float currentCacheStreamingTime = pStreamInfo->m_pRenderNode->GetStreamingTime();
@@ -1009,7 +1008,6 @@ void CGeomCacheManager::DecompressFrame_JobEntry(SGeomCacheStreamInfo* pStreamIn
{
FUNCTION_PROFILER_3DENGINE;
const CGeomCacheRenderNode* pRenderNode = pStreamInfo->m_pRenderNode;
const CGeomCache* pGeomCache = pStreamInfo->m_pGeomCache;
const uint frameIndex = pDecompressHandle->m_startFrame + blockIndex;
@@ -1379,7 +1377,6 @@ void CGeomCacheManager::RetireHandles(SGeomCacheStreamInfo& streamInfo)
{
FUNCTION_PROFILER_3DENGINE;
CGeomCacheRenderNode* pRenderNode = streamInfo.m_pRenderNode;
const CGeomCache* pGeomCache = streamInfo.m_pGeomCache;
const float currentCacheStreamingTime = streamInfo.m_pRenderNode->GetStreamingTime();
const uint wantedFloorFrame = pGeomCache->GetFloorFrameIndex(currentCacheStreamingTime);
@@ -1712,7 +1709,6 @@ void CGeomCacheManager::DrawDebugInfo()
const float streamInfoBoxSize = 10.0f;
uint numActiveStreams = 0;
uint numFramesMissed = 0;
const uint kNumColors = 8;
ColorF colors[kNumColors] = { Col_Red, Col_Green, Col_Yellow, Col_Blue, Col_Aquamarine, Col_Thistle, Col_Tan, Col_Salmon };
@@ -1725,7 +1721,6 @@ void CGeomCacheManager::DrawDebugInfo()
CGeomCacheRenderNode* pRenderNode = streamInfo.m_pRenderNode;
CGeomCache* pGeomCache = streamInfo.m_pGeomCache;
const char* pName = streamInfo.m_pRenderNode->GetName();
const char* pFilter = GetCVars()->e_GeomCacheDebugFilter->GetString();
const bool bDisplay = ((GetCVars()->e_GeomCacheDebug != 2) || (pRenderNode->IsStreaming() || streamInfo.m_pOldestDecompressHandle || streamInfo.m_pNewestReadRequestHandle))
&& strstr(pName, GetCVars()->e_GeomCacheDebugFilter->GetString()) != NULL;
@@ -630,7 +630,6 @@ bool CGeomCacheRenderNode::FillFrameAsync(const char* const pFloorFrameData, con
// Update meshes & clear instances
for (uint meshId = 0; meshId < numMeshes; ++meshId)
{
const SGeomCacheStaticMeshData& meshData = staticMeshData[meshId];
for (TRenderElementMap::iterator iter = m_pRenderElements.begin(); iter != m_pRenderElements.end(); ++iter)
{
SGeomCacheRenderElementData& data = iter->second;
@@ -827,8 +826,6 @@ void CGeomCacheRenderNode::FillRenderObject(const SRendParams& rendParams, [[may
{
FUNCTION_PROFILER_3DENGINE;
IRenderNode* const pRenderNode = rendParams.pRenderNode;
IRenderer* const pRenderer = GetRenderer();
pRenderObject->m_pRenderNode = rendParams.pRenderNode;
pRenderObject->m_fSort = rendParams.fCustomSortOffset;
@@ -1450,7 +1447,6 @@ void CGeomCacheRenderNode::UpdatePhysicalMaterials()
void CGeomCacheRenderNode::UpdateStreamableComponents(float fImportance, float fDistance, bool bFullUpdate, int nLod, const float fInvScale, bool bDrawNear)
{
IObjManager* pObjManager = GetObjManager();
Matrix34A matrix = GetMatrix();
const bool bAllowStandIn = GetCVars()->e_Lods != 0;
@@ -483,7 +483,6 @@ bool CLightEntity::ProcessFrustum(int nLod, float fGSMBoxSize, float fDistanceFr
assert(pFr);
bool bDoGSM = fGSMBoxSize != 0;
bool bDoNextLod = false;
if (bDoGSM)// && (m_light.m_Flags & DLF_SUN || m_light.m_Flags & DLF_PROJECT))
{
@@ -555,8 +554,6 @@ void CLightEntity::InitShadowFrustum_SUN_Conserv(ShadowMapFrustum* pFr, [[maybe_
//Sampling parameters
//Calculate proper projection of frustum to the terrain receiving area but not based on fBoxRadius
float fGsmInitRange = Get3DEngine()->m_fGsmRange;
float fGsmStep = Get3DEngine()->m_fGsmRangeStep;
float arrWidthS[] = {1.94f, 1.0f, 0.8f, 0.5f, 0.3f, 0.3f, 0.3f, 0.3f};
+4 -1
View File
@@ -874,7 +874,10 @@ static void shGetVector4(const char* buf, float v[4])
{
return;
}
int res = azsscanf(buf, "%f,%f,%f,%f", &v[0], &v[1], &v[2], &v[3]);
#if !defined(NDEBUG)
int res =
#endif
azsscanf(buf, "%f,%f,%f,%f", &v[0], &v[1], &v[2], &v[3]);
assert(res);
}
@@ -773,8 +773,10 @@ void MaterialHelpers::SetShaderParamsFromXml(SInputShaderResources& pShaderResou
SShaderParam Param;
Param.m_Name = key;
Param.m_Value.m_Color[0] = Param.m_Value.m_Color[1] = Param.m_Value.m_Color[2] = Param.m_Value.m_Color[3] = 0;
int res = azsscanf(val, "%f,%f,%f,%f", &Param.m_Value.m_Color[0], &Param.m_Value.m_Color[1], &Param.m_Value.m_Color[2], &Param.m_Value.m_Color[3]);
#if !defined(NDEBUG)
int res =
#endif
azsscanf(val, "%f,%f,%f,%f", &Param.m_Value.m_Color[0], &Param.m_Value.m_Color[1], &Param.m_Value.m_Color[2], &Param.m_Value.m_Color[3]);
assert(res);
pShaderResources.m_ShaderParams.push_back(Param);
@@ -63,18 +63,54 @@ namespace mesh_compiler
for (uint streamIndex = 0; streamIndex < CMesh::maxStreamsPerType; ++streamIndex)
{
SMeshTexCoord* texCoords = mesh.GetStreamPtr<SMeshTexCoord>(CMesh::TEXCOORDS, streamIndex);
if (texCoords && (res = memcmp(&texCoords[a], &texCoords[b], sizeof(texCoords[a]))))
if (texCoords)
{
res = memcmp(&texCoords[a], &texCoords[b], sizeof(texCoords[a]));
if (res)
{
return res < 0;
}
}
}
if (mesh.m_pNorms)
{
res = memcmp(&mesh.m_pNorms[a], &mesh.m_pNorms[b], sizeof(mesh.m_pNorms[a]));
if (res)
{
return res < 0;
}
}
if ((mesh.m_pNorms && (res = memcmp(&mesh.m_pNorms[a], &mesh.m_pNorms[b], sizeof(mesh.m_pNorms[a])))) ||
(mesh.m_pColor0 && (res = memcmp(&mesh.m_pColor0[a], &mesh.m_pColor0[b], sizeof(mesh.m_pColor0[a])))) ||
(mesh.m_pColor1 && (res = memcmp(&mesh.m_pColor1[a], &mesh.m_pColor1[b], sizeof(mesh.m_pColor1[a])))) ||
(mesh.m_pVertMats && (res = memcmp(&mesh.m_pVertMats[a], &mesh.m_pVertMats[b], sizeof(mesh.m_pVertMats[a])))) ||
(mesh.m_pTangents && (res = memcmp(&mesh.m_pTangents[a], &mesh.m_pTangents[b], sizeof(mesh.m_pTangents[a])))))
if (mesh.m_pColor0)
{
return res < 0;
res = memcmp(&mesh.m_pColor0[a], &mesh.m_pColor0[b], sizeof(mesh.m_pColor0[a]));
if (res)
{
return res < 0;
}
}
if (mesh.m_pColor1)
{
res = memcmp(&mesh.m_pColor1[a], &mesh.m_pColor1[b], sizeof(mesh.m_pColor1[a]));
if (res)
{
return res < 0;
}
}
if (mesh.m_pVertMats)
{
res = memcmp(&mesh.m_pVertMats[a], &mesh.m_pVertMats[b], sizeof(mesh.m_pVertMats[a]));
if (res)
{
return res < 0;
}
}
if (mesh.m_pTangents)
{
res = memcmp(&mesh.m_pTangents[a], &mesh.m_pTangents[b], sizeof(mesh.m_pTangents[a]));
if (res)
{
return res < 0;
}
}
return false;
+3 -2
View File
@@ -89,7 +89,9 @@ void CObjManager::UnloadObjects(bool bDeleteAll)
m_lstLoadedObjects.clear();
}
#if !defined(_RELEASE)
int nNumLeaks = 0;
#endif
std::vector<CStatObj*> garbage;
for (CStatObj* pStatObj = CStatObj::get_intrusive_list_root(); pStatObj; pStatObj = pStatObj->m_next_intrusive)
{
@@ -1120,8 +1122,7 @@ bool CObjManager::SphereRenderMeshIntersection(IRenderMesh* pRenderMesh, const V
// get indices
vtx_idx* pInds = pRenderMesh->GetIndexPtr(FSL_READ);
int nInds = pRenderMesh->GetIndicesCount();
assert(nInds % 3 == 0);
assert(pRenderMesh->GetIndicesCount() % 3 == 0);
// test tris
TRenderChunkArray& Chunks = pRenderMesh->GetChunks();
@@ -34,11 +34,6 @@ void CObjManager::RenderDecalAndRoad(IRenderNode* pEnt,
{
FUNCTION_PROFILER_3DENGINE;
#ifdef _DEBUG
const char* szName = pEnt->GetName();
const char* szClassName = pEnt->GetEntityClassName();
#endif // _DEBUG
// do not draw if marked to be not drawn or already drawn in this frame
unsigned int nRndFlags = pEnt->GetRndFlags();
@@ -136,11 +131,6 @@ void CObjManager::RenderObject(IRenderNode* pEnt,
const CVars* pCVars = GetCVars();
#ifdef _DEBUG
const char* szName = pEnt->GetName();
const char* szClassName = pEnt->GetEntityClassName();
#endif // _DEBUG
// do not draw if marked to be not drawn or already drawn in this frame
unsigned int nRndFlags = pEnt->GetRndFlags();
@@ -287,8 +277,8 @@ void CObjManager::RenderObject(IRenderNode* pEnt,
if (eERType != eERType_Light && (pEnt->m_nInternalFlags & IRenderNode::REQUIRES_NEAREST_CUBEMAP))
{
uint16 nCubemapTexId = 0;
if (!(nCubemapTexId = CheckCachedNearestCubeProbe(pEnt)) || !pCVars->e_CacheNearestCubePicking)
uint16 nCubemapTexId = CheckCachedNearestCubeProbe(pEnt);
if (!nCubemapTexId || !pCVars->e_CacheNearestCubePicking)
{
nCubemapTexId = GetNearestCubeProbe(pVisArea, objBox);
}
@@ -304,7 +294,8 @@ void CObjManager::RenderObject(IRenderNode* pEnt,
if (pCVars->e_Dissolve && eERType != eERType_Light && passInfo.IsGeneralPass())
{
if (DrawParams.nDissolveRef = GetDissolveRef(fEntDistance, pEnt->m_fWSMaxViewDist))
DrawParams.nDissolveRef = GetDissolveRef(fEntDistance, pEnt->m_fWSMaxViewDist);
if (DrawParams.nDissolveRef)
{
DrawParams.dwFObjFlags |= FOB_DISSOLVE | FOB_DISSOLVE_OUT;
if (DrawParams.nDissolveRef == 255)
@@ -462,8 +453,7 @@ bool CObjManager::RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3
// get indices
vtx_idx* pInds = pRenderMesh->GetIndexPtr(FSL_READ);
int nInds = pRenderMesh->GetIndicesCount();
assert(nInds % 3 == 0);
assert(pRenderMesh->GetIndicesCount() % 3 == 0);
float fClosestHitDistance = -1;
@@ -98,7 +98,7 @@ void CObjManager::UnregisterForStreaming(IStreamable* pObj)
if (m_arrStreamableObjects.size() > 0)
{
SStreamAbleObject streamAbleObject(pObj, false);
bool deleted = m_arrStreamableObjects.Delete(streamAbleObject);
[[maybe_unused]] bool deleted = m_arrStreamableObjects.Delete(streamAbleObject);
#ifdef OBJMAN_STREAM_STATS
if (deleted && m_pStreamListener)
@@ -754,7 +754,6 @@ void CObjManager::ProcessObjectsStreaming_Finish()
LOADING_TIME_PROFILE_SECTION;
int nNumStreamableObjects = m_arrStreamableObjects.Count();
m_bNeedProcessObjectsStreaming_Finish = false;
FRAME_PROFILER("ProcessObjectsStreaming_Finish", GetSystem(), PROFILE_3DENGINE);
@@ -814,7 +813,6 @@ void CObjManager::ProcessObjectsStreaming_Finish()
// the pool size in the renderer is sufficient. NOTE: This is a weak
// test. Better test would be to actually preallocate the memory here and
// only submit the streaming job if the memory could be obtained.
int size = pStatObj->GetStreamableContentMemoryUsage();
if (GetCVars()->e_StreamCgfDebug == 2)
{
@@ -1016,7 +1014,6 @@ void CObjManager::PrecacheStatObjMaterial(_smart_ptr<IMaterial> pMaterial, const
if (CMatInfo* pMatInfo = static_cast<CMatInfo*>(pMaterial.get()))
{
CStatObj* pCStatObj = static_cast<CStatObj*>(pStatObj);
pMatInfo->PrecacheMaterial(fEntDistance, (pStatObj ? pStatObj->GetRenderMesh() : NULL), bFullUpdate, bDrawNear);
}
}
@@ -250,7 +250,6 @@ void COctreeNode::CompileObjects()
m_lstCasters.reserve(numCasters);
IObjManager* pObjManager = GetObjManager();
// update node
for (int l = 0; l < eRNListType_ListsNum; l++)
@@ -786,7 +785,6 @@ void COctreeNode::GetMemoryUsage(ICrySizer* pSizer) const
{
for (IRenderNode* pObj = m_arrObjects[l].m_pFirstNode; pObj; pObj = pObj->m_pNext)
{
EERType eType = pObj->GetRenderNodeType();
pObj->GetMemoryUsage(pSizer);
}
}
@@ -1504,16 +1502,6 @@ bool COctreeNode::UpdateStreamingPriority(PodArray<COctreeNode*>& arrRecursion,
continue;
}
#ifdef _DEBUG
const char* szName = pObj->GetName();
const char* szClassName = pObj->GetEntityClassName();
if (pObj->GetRndFlags() & ERF_SELECTED)
{
int selected = 1;
}
#endif // _DEBUG
pObj->FillBBox(objBox);
// stream more in zoom mode if in frustum
@@ -580,8 +580,6 @@ void COctreeNode::UpdateObjects(IRenderNode* pObj)
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::ThreeDEngineDetailed);
float fObjMaxViewDistance = 0;
size_t numCasters = 0;
IObjManager* pObjManager = GetObjManager();
bool bVegetHasAlphaTrans = false;
int nFlags = pObj->GetRndFlags();
@@ -659,7 +657,6 @@ void COctreeNode::UpdateObjects(IRenderNode* pObj)
}
bool bUpdateParentShadowFlags = false;
bool bUpdateParentOcclusionFlags = false;
// fill shadow casters list
const bool bHasPerObjectShadow = GetCVars()->e_ShadowsPerObject && p3DEngine->GetPerObjectShadow(pObj);
@@ -1138,26 +1135,11 @@ bool CObjManager::IsBoxOccluded(const AABB& objBox,
CVisAreaManager* pVisAreaManager = GetVisAreaManager();
if (GetCVars()->e_OcclusionVolumes && pVisAreaManager && pVisAreaManager->IsOccludedByOcclVolumes(objBox, passInfo))
{
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// do not set the lastOccludedMainFrameID because it is camera agnostic so the main pass might occlude
// objects that should only be occluded in the render scene to texture pass
if (!passInfo.IsRenderSceneToTexturePass())
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
{
pOcclTestVars->nLastOccludedMainFrameID = mainFrameID;
}
pOcclTestVars->nLastOccludedMainFrameID = mainFrameID;
return true;
}
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// don't use coverage buffer results if we are checking occlusion for a render to texture camera
// because the render to texture pass does not currently write to the coverage buffer and
// the frame IDs will not work correctly.
if (GetCVars()->e_CoverageBuffer && !passInfo.IsRenderSceneToTexturePass())
#else
if (GetCVars()->e_CoverageBuffer)
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
{
return pOcclTestVars->nLastOccludedMainFrameID == mainFrameID - 1;
}
@@ -522,12 +522,12 @@ void COctreeNode::LoadSingleObject(byte*& pPtr, [[maybe_unused]] std::vector<ISt
{
for (uint32 j(0); j < pChunk->m_numVertices; ++j)
{
SWaterVolumeVertex* pVertex(StepData<SWaterVolumeVertex>(pPtr, eEndian));
StepData<SWaterVolumeVertex>(pPtr, eEndian);
}
for (uint32 j(0); j < pChunk->m_numVerticesPhysAreaContour; ++j)
{
SWaterVolumeVertex* pVertex(StepData<SWaterVolumeVertex>(pPtr, eEndian));
StepData<SWaterVolumeVertex>(pPtr, eEndian);
}
return;
@@ -537,7 +537,7 @@ void COctreeNode::LoadSingleObject(byte*& pPtr, [[maybe_unused]] std::vector<ISt
int auxCntSrc = pChunk->m_volumeTypeAndMiscBits >> 24, auxCntDst;
float* pAuxDataDst = pObj->GetAuxSerializationDataPtr(auxCntDst);
const float* pAuxDataSrc = StepData<float>(pPtr, auxCntSrc, eEndian);
StepData<float>(pPtr, auxCntSrc, eEndian);
memcpy(pAuxDataDst, pAuxDataDst, min(auxCntSrc, auxCntDst) * sizeof(float));
// read common node data
-7
View File
@@ -129,7 +129,6 @@ void COcean::Update(const SRenderingPassInfo& passInfo)
}
const CCamera& rCamera = passInfo.GetCamera();
int32 nFillThreadID = passInfo.ThreadID();
uint32 nBufID = passInfo.GetFrameID() % CYCLE_BUFFERS_NUM;
Vec3 vCamPos = rCamera.GetPosition();
@@ -291,7 +290,6 @@ void COcean::Create()
//sqrt_tpl(fx*fx + fy * fy);
vv.z = fEdgeDisplace; //!((y==0 ||y == nScrGridSize-1) || (x==0 || x == nScrGridSize-1));
int32 n = m_pMeshVerts.Count();
tmp.xyz = vv;
m_pMeshVerts.Add(tmp);
}
@@ -463,7 +461,6 @@ void COcean::Render(const SRenderingPassInfo& passInfo)
C3DEngine* p3DEngine = (C3DEngine*)Get3DEngine();
IRenderer* pRenderer(GetRenderer());
int32 nBufID = (passInfo.GetFrameID() & 1);
Vec3 vCamPos = passInfo.GetCamera().GetPosition();
float fWaterLevel = OceanToggle::IsActive() ? OceanRequest::GetOceanLevel() : p3DEngine->GetWaterLevel();
@@ -482,8 +479,6 @@ void COcean::Render(const SRenderingPassInfo& passInfo)
// test for multiple lights and shadows support
SRenderObjData* pOD = pRenderer->EF_GetObjData(pObject, true, passInfo.ThreadID());
m_Camera = passInfo.GetCamera();
pObject->m_fAlpha = 1.f;
@@ -588,7 +583,6 @@ void COcean::SetMaterial(_smart_ptr<IMaterial> pMat)
void COcean::RenderBottomCap(const SRenderingPassInfo& passInfo)
{
C3DEngine* p3DEngine = (C3DEngine*)Get3DEngine();
Vec3 vCamPos = passInfo.GetCamera().GetPosition();
@@ -828,7 +822,6 @@ bool COcean::IsVisible(const SRenderingPassInfo& passInfo)
m_fLastVisibleFrameTime = 0.0f;
}
ITimer* pTimer(gEnv->pTimer);
m_fLastVisibleFrameTime += gEnv->pTimer->GetFrameTime();
if (m_fLastVisibleFrameTime > 2.0f) // at least 2 seconds
@@ -44,11 +44,6 @@ int CRenderMeshMerger::Cmp_Materials(_smart_ptr<IMaterial> pMat1, _smart_ptr<IMa
SShaderItem& shaderItem1 = pMat1->GetShaderItem();
SShaderItem& shaderItem2 = pMat2->GetShaderItem();
#ifdef _DEBUG
const char* pName1 = shaderItem1.m_pShader->GetName();
const char* pName2 = shaderItem2.m_pShader->GetName();
#endif
// vert format
AZ::Vertex::Format vertexFormat1 = shaderItem1.m_pShader->GetVertexFormat();
AZ::Vertex::Format vertexFormat2 = shaderItem2.m_pShader->GetVertexFormat();
@@ -323,7 +318,6 @@ void CRenderMeshMerger::MakeListOfAllCRenderChunks(SMergeInfo& info)
pRM->GetBBox(vMin, vMax);
// get indices
uint32 nIndCount = pRM->GetIndicesCount();
vtx_idx* pSrcInds = pRM->GetIndexPtr(FSL_READ);
Vec3 vOSPos(0, 0, 0);
@@ -346,6 +340,7 @@ void CRenderMeshMerger::MakeListOfAllCRenderChunks(SMergeInfo& info)
CRenderChunk newMatInfo = pRM->GetChunks()[pRMI->nChunkId];
#ifdef _DEBUG
uint32 nIndCount = pRM->GetIndicesCount();
CRenderChunk Ch = newMatInfo;
for (uint32 i = Ch.nFirstIndexId; i < Ch.nFirstIndexId + Ch.nNumIndices; i++)
{
@@ -971,7 +966,6 @@ void CRenderMeshMerger::TryMergingChunks(SMergeInfo& info)
else
{
_smart_ptr<IMaterial> pMat = mergChunk.pMaterial;
SShaderItem& shaderItem = pMat->GetShaderItem();
chunkVertexFormat = mergChunk.rChunk.m_vertexFormat;
}
@@ -30,15 +30,6 @@ void ShadowCache::InitShadowFrustum(ShadowMapFrustum*& pFr, int nLod, int nFirst
return;
}
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// ShadowCache not supported in render scene to texture passes yet.
// It is very common to jump large distances.
if (passInfo.IsRenderSceneToTexturePass())
{
return;
}
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
if (!pFr)
{
pFr = new ShadowMapFrustum;
+5 -2
View File
@@ -974,11 +974,14 @@ IStatObj* CStatObj::Clone(bool bCloneGeometry, bool bCloneChildren, bool bMeshes
pNewObj->m_bSharesChildren = true;
}
if (pNewObj->m_hasClothTangentsData = m_hasClothTangentsData)
pNewObj->m_hasClothTangentsData = m_hasClothTangentsData;
if (pNewObj->m_hasClothTangentsData)
{
pNewObj->m_pClothTangentsData = m_pClothTangentsData;
}
if (pNewObj->m_hasSkinInfo = m_hasSkinInfo)
pNewObj->m_hasSkinInfo = m_hasSkinInfo;
if (pNewObj->m_hasSkinInfo)
{
pNewObj->m_pSkinInfo = m_pSkinInfo;
}
+209 -104
View File
@@ -148,8 +148,17 @@ int CStatObj::SetDeformationMorphTarget(IStatObj* pDeformed)
{
((CStatObj*)pDeformed)->MakeRenderMesh();
}
if (!(pMeshA = GetRenderMesh()) || !(pMeshB = pDeformed->GetRenderMesh()) ||
!(pFaceToFace0A = m_pMapFaceToFace0) || !(pFaceToFace0B = ((CStatObj*)pDeformed)->m_pMapFaceToFace0))
if (!(pMeshA = GetRenderMesh()) || !(pMeshB = pDeformed->GetRenderMesh()))
{
return 0;
}
pFaceToFace0A = m_pMapFaceToFace0;
if (!pFaceToFace0A)
{
return 0;
}
pFaceToFace0B = ((CStatObj*)pDeformed)->m_pMapFaceToFace0;
if (!pFaceToFace0B)
{
return 0;
}
@@ -1088,11 +1097,20 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
for (i = 0; i < nObj; i++)
{
if ((pSubObj = GetSubObject(i))->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj && pSubObj->pStatObj->GetPhysGeom() &&
pSubObj->bHidden &&
(!strncmp(pSubObj->name, "childof_", 8) && (pSubObj1 = FindSubObject((const char*)pSubObj->name + 8)) ||
(pSubObj1 = GetSubObject(pSubObj->nParent)) && strstr(pSubObj1->properties, "group")))
pSubObj->bHidden && (!strncmp(pSubObj->name, "childof_", 8)))
{
pSubObj->bHidden = pSubObj1->bHidden;
pSubObj1 = FindSubObject((const char*)pSubObj->name + 8);
if (pSubObj1)
{
pSubObj1 = GetSubObject(pSubObj->nParent);
if (pSubObj1)
{
if (strstr(pSubObj1->properties, "group"))
{
pSubObj->bHidden = pSubObj1->bHidden;
}
}
}
}
}
@@ -1127,12 +1145,19 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
float mindist = 1e10f, curdist;
for (j = 0, i0 = i; j < nObj; j++)
{
if (j != i && (pSubObj1 = GetSubObject(j)) && pSubObj1->pStatObj && ((CStatObj*)pSubObj1->pStatObj)->m_nRenderTrisCount > 0 &&
(curdist = (pSubObj1->localTM * (((CStatObj*)pSubObj1->pStatObj)->m_vBoxMin +
((CStatObj*)pSubObj1->pStatObj)->m_vBoxMax) * 0.5f - center).len2()) < mindist)
if (j != i)
{
mindist = curdist;
i0 = j;
pSubObj1 = GetSubObject(j);
if (pSubObj1 && pSubObj1->pStatObj && ((CStatObj*)pSubObj1->pStatObj)->m_nRenderTrisCount > 0)
{
curdist = (pSubObj1->localTM * (((CStatObj*)pSubObj1->pStatObj)->m_vBoxMin +
((CStatObj*)pSubObj1->pStatObj)->m_vBoxMax) * 0.5f - center).len2();
if (curdist < mindist)
{
mindist = curdist;
i0 = j;
}
}
}
}
pSubObj->pStatObj->GetPhysGeom()->pGeom->SetForeignData(GetSubObject(i0)->pStatObj, 0);
@@ -1357,7 +1382,8 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
psj.axisx = pMtx->TransformVector(psj.axisx).normalized();
}
if ((pval = strstr(properties, "limit")) && (pval - 11 < properties - 11 || strncmp(pval - 11, "constraint_", 11)))
pval = strstr(properties, "limit");
if (pval && (pval - 11 < properties - 11 || strncmp(pval - 11, "constraint_", 11)))
{
for (pval += 5; *pval && !isdigit(*pval); pval++)
{
@@ -1373,7 +1399,8 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
// psj.maxForcePush = psj.maxForcePull*2.5f;
psj.bBreakable = 1;
}
if (pval = strstr(properties, "twist"))
pval = strstr(properties, "twist");
if (pval)
{
for (pval += 5; *pval && !isdigit(*pval); pval++)
{
@@ -1384,7 +1411,8 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
psj.maxTorqueTwist = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "bend"))
pval = strstr(properties, "bend");
if (pval)
{
for (pval += 4; *pval && !isdigit(*pval); pval++)
{
@@ -1395,7 +1423,8 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
psj.maxTorqueBend = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "push"))
pval = strstr(properties, "push");
if (pval)
{
for (pval += 4; *pval && !isdigit(*pval); pval++)
{
@@ -1406,7 +1435,8 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
psj.maxForcePush = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "pull"))
pval = strstr(properties, "pull");
if (pval)
{
for (pval += 4; *pval && !isdigit(*pval); pval++)
{
@@ -1417,7 +1447,8 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
psj.maxForcePull = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "shift"))
pval = strstr(properties, "shift");
if (pval)
{
for (pval += 5; *pval && !isdigit(*pval); pval++)
{
@@ -1428,7 +1459,8 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
psj.maxForceShift = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "damage_accum"))
pval = strstr(properties, "damage_accum");
if (pval)
{
for (pval += 5; *pval && !isdigit(*pval); pval++)
{
@@ -1439,7 +1471,8 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
psj.damageAccum = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "damage_accum_threshold"))
pval = strstr(properties, "damage_accum_threshold");
if (pval)
{
for (pval += 5; *pval && !isdigit(*pval); pval++)
{
@@ -1470,50 +1503,101 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
psj.bDirectBreaksOnly = strstr(properties, "hits_only") != 0;
psj.limitConstraint.zero();
psj.bConstraintWillIgnoreCollisions = 1;
if ((len = 16, pval = strstr(properties, "constraint_limit")) || (len = 5, pval = strstr(properties, "C_lmt")))
len = 16;
pval = strstr(properties, "constraint_limit");
if (pval)
{
for (pval += len; *pval && !isdigit(*pval); pval++)
{
;
}
for (pval += len; *pval && !isdigit(*pval); pval++);
if (pval)
{
psj.limitConstraint.z = aznumeric_caster(atof(pval));
}
}
if ((len = 17, pval = strstr(properties, "constraint_minang")) || (len = 5, pval = strstr(properties, "C_min")))
else
{
for (pval += len; *pval && !isdigit(*pval) && *pval != '-'; pval++)
len = 5;
pval = strstr(properties, "C_lmt");
if (pval)
{
;
for (pval += len; *pval && !isdigit(*pval); pval++)
;
if (pval)
{
psj.limitConstraint.z = aznumeric_caster(atof(pval));
}
}
}
len = 17;
pval = strstr(properties, "constraint_minang");
if (pval)
{
for (pval += len; *pval && !isdigit(*pval) && *pval != '-'; pval++);
if (pval)
{
psj.limitConstraint.x = aznumeric_caster(DEG2RAD(atof(pval)));
}
}
if ((len = 17, pval = strstr(properties, "constraint_maxang")) || (len = 5, pval = strstr(properties, "C_max")))
else
{
for (pval += len; *pval && !isdigit(*pval) && *pval != '-'; pval++)
len = 5;
pval = strstr(properties, "C_min");
if (pval)
{
;
for (pval += len; *pval && !isdigit(*pval) && *pval != '-'; pval++)
;
if (pval)
{
psj.limitConstraint.x = aznumeric_caster(DEG2RAD(atof(pval)));
}
}
}
len = 17;
pval = strstr(properties, "constraint_maxang");
if (pval)
{
for (pval += len; *pval && !isdigit(*pval) && *pval != '-'; pval++);
if (pval)
{
psj.limitConstraint.y = aznumeric_caster(DEG2RAD(atof(pval)));
}
}
if ((len = 18, pval = strstr(properties, "constraint_damping")) || (len = 5, pval = strstr(properties, "C_dmp")))
else
{
for (pval += len; *pval && !isdigit(*pval); pval++)
len = 5;
pval = strstr(properties, "C_max");
if (pval)
{
;
for (pval += len; *pval && !isdigit(*pval) && *pval != '-'; pval++);
if (pval)
{
psj.limitConstraint.y = aznumeric_caster(DEG2RAD(atof(pval)));
}
}
}
len = 18;
pval = strstr(properties, "constraint_damping");
if (pval)
{
for (pval += len; *pval && !isdigit(*pval); pval++);
if (pval)
{
psj.dampingConstraint = aznumeric_caster(atof(pval));
}
}
else
{
len = 5;
pval = strstr(properties, "C_dmp");
if (pval)
{
for (pval += len; *pval && !isdigit(*pval); pval++);
if (pval)
{
psj.dampingConstraint = aznumeric_caster(atof(pval));
}
}
}
if (strstr(properties, "constraint_collides") || strstr(properties, "C_coll"))
{
psj.bConstraintWillIgnoreCollisions = 0;
@@ -1565,94 +1649,107 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
for (i = 0; i < nObj; i++)
{
if ((pSubObj = GetSubObject(i))->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj && pSubObj->pStatObj->GetPhysGeom() && !pSubObj->bHidden &&
!strncmp(pSubObj->name, "skeleton_", 9) && (pSubObj1 = FindSubObject((const char*)pSubObj->name + 9)))
!strncmp(pSubObj->name, "skeleton_", 9))
{
pe_params_skeleton ps;
properties = szPropsOverride ? szPropsOverride : (const char*)pSubObj->properties;
if (pval = strstr(properties, "stiffness"))
pSubObj1 = FindSubObject((const char*)pSubObj->name + 9);
if (pSubObj1)
{
for (pval += 9; *pval && !isdigit(*pval); pval++)
{
;
}
pe_params_skeleton ps;
properties = szPropsOverride ? szPropsOverride : (const char*)pSubObj->properties;
pval = strstr(properties, "stiffness");
if (pval)
{
ps.stiffness = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "thickness"))
{
for (pval += 9; *pval && !isdigit(*pval); pval++)
{
;
for (pval += 9; *pval && !isdigit(*pval); pval++)
{
;
}
if (pval)
{
ps.stiffness = aznumeric_caster(atof(pval));
}
}
pval = strstr(properties, "thickness");
if (pval)
{
ps.thickness = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "max_stretch"))
{
for (pval += 11; *pval && !isdigit(*pval); pval++)
{
;
for (pval += 9; *pval && !isdigit(*pval); pval++)
{
;
}
if (pval)
{
ps.thickness = aznumeric_caster(atof(pval));
}
}
pval = strstr(properties, "max_stretch");
if (pval)
{
ps.maxStretch = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "max_impulse"))
{
for (pval += 11; *pval && !isdigit(*pval); pval++)
{
;
for (pval += 11; *pval && !isdigit(*pval); pval++)
{
;
}
if (pval)
{
ps.maxStretch = aznumeric_caster(atof(pval));
}
}
pval = strstr(properties, "max_impulse");
if (pval)
{
ps.maxImpulse = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "skin_dist"))
{
for (pval += 9; *pval && !isdigit(*pval); pval++)
{
;
for (pval += 11; *pval && !isdigit(*pval); pval++)
{
;
}
if (pval)
{
ps.maxImpulse = aznumeric_caster(atof(pval));
}
}
pval = strstr(properties, "skin_dist");
if (pval)
{
pp.minContactDist = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "hardness"))
{
for (pval += 8; *pval && !isdigit(*pval); pval++)
{
;
for (pval += 9; *pval && !isdigit(*pval); pval++)
{
;
}
if (pval)
{
pp.minContactDist = aznumeric_caster(atof(pval));
}
}
pval = strstr(properties, "hardness");
if (pval)
{
ps.hardness = aznumeric_caster(atof(pval));
}
}
if (pval = strstr(properties, "explosion_scale"))
{
for (pval += 15; *pval && !isdigit(*pval); pval++)
{
;
for (pval += 8; *pval && !isdigit(*pval); pval++)
{
;
}
if (pval)
{
ps.hardness = aznumeric_caster(atof(pval));
}
}
pval = strstr(properties, "explosion_scale");
if (pval)
{
ps.explosionScale = aznumeric_caster(atof(pval));
for (pval += 15; *pval && !isdigit(*pval); pval++)
{
;
}
if (pval)
{
ps.explosionScale = aznumeric_caster(atof(pval));
}
}
}
pp.partid = ps.partid = aznumeric_cast<int>((pSubObj1 - &m_subObjects[0])) + id0;
pp.idSkeleton = i + id0;
pent->SetParams(&pp);
pent->SetParams(&ps);
((CStatObj*)pSubObj1->pStatObj)->PrepareSkinData(pSubObj1->localTM.GetInverted() * pSubObj->localTM, pSubObj->pStatObj->GetPhysGeom()->pGeom,
is_unused(pp.minContactDist) ? 0.0f : pp.minContactDist);
pp.partid = ps.partid = aznumeric_cast<int>((pSubObj1 - &m_subObjects[0])) + id0;
pp.idSkeleton = i + id0;
pent->SetParams(&pp);
pent->SetParams(&ps);
((CStatObj*)pSubObj1->pStatObj)
->PrepareSkinData(
pSubObj1->localTM.GetInverted() * pSubObj->localTM, pSubObj->pStatObj->GetPhysGeom()->pGeom,
is_unused(pp.minContactDist) ? 0.0f : pp.minContactDist);
}
}
}
}
@@ -1660,14 +1757,22 @@ int CStatObj::PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx,
new(&pp)pe_params_part;
for (i = 0; i < nObj; i++)
{
if ((pSubObj = GetSubObject(i))->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj && pSubObj->pStatObj->GetPhysGeom() && !pSubObj->bHidden &&
(!strncmp(pSubObj->name, "childof_", 8) && (pSubObj1 = FindSubObject((const char*)pSubObj->name + 8)) ||
(pSubObj1 = GetSubObject(pSubObj->nParent)) && strstr(pSubObj1->properties, "group")))
pSubObj = GetSubObject(i);
if (pSubObj->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj && pSubObj->pStatObj->GetPhysGeom() && !pSubObj->bHidden &&
!strncmp(pSubObj->name, "childof_", 8))
{
pp.partid = i + id0;
pp.idParent = aznumeric_caster(pSubObj1 - &m_subObjects[0]);
pent->SetParams(&pp);
pSubObj->bHidden = true;
pSubObj1 = FindSubObject((const char*)pSubObj->name + 8);
if (pSubObj1)
{
pSubObj1 = GetSubObject(pSubObj->nParent);
if (pSubObj1 && strstr(pSubObj1->properties, "group"))
{
pp.partid = i + id0;
pp.idParent = aznumeric_caster(pSubObj1 - &m_subObjects[0]);
pent->SetParams(&pp);
pSubObj->bHidden = true;
}
}
}
}
@@ -155,7 +155,6 @@ void CStatObj::FillRenderObject(const SRendParams& rParams, IRenderNode* pRender
// Specify transformation
////////////////////////////////////////////////////////////////////////////////////////////////////
IRenderer* pRend = GetRenderer();
assert(pObj);
if (!pObj)
-2
View File
@@ -612,7 +612,6 @@ void CTimeOfDay::UpdateEnvLighting(bool forceUpdate)
// Calculating the energy multiplier where mid-day sun is 1.0 and night is 0
const float noonTime = 12.0f;
float dayTime = p3DEngine->m_duskEnd - p3DEngine->m_dawnStart;
if (m_fTime <= noonTime)
{
@@ -911,7 +910,6 @@ void CTimeOfDay::MigrateLegacyData(bool bSunIntensity, const XmlNodeRef& node)
varHDRPower.pInterpolator->InterpolateFloat(time, hdrPower);
const float HDRDynamicMultiplier = 2.0f;
float hdrMult = powf(HDRDynamicMultiplier, hdrPower);
float sunColorLum = sunColor[0] * 0.2126f + sunColor[1] * 0.7152f + sunColor[2] * 0.0722f;
float sunIntensity = sunMult * sunColorLum * 10000.0f * gf_PI;
@@ -27,7 +27,6 @@ bool CVisAreaManager::GetCompiledData([[maybe_unused]] byte* pData, [[maybe_unus
# else
float fStartTime = GetCurAsyncTimeSec();
bool bObjs(!pExportInfo || pExportInfo->nObjTypeMask);
// PrintMessage("Exporting indoor data (%s, %.2f MB) ...",
@@ -206,8 +205,6 @@ bool CVisAreaManager::Load_T(T& f, int& nDataSize, SVisAreaManChunkHeader* pVisA
return 0;
}
bool bObjs(!pExportInfo || pExportInfo->nObjTypeMask);
AABB* pBox = (pExportInfo && !pExportInfo->areaBox.IsReset()) ? &pExportInfo->areaBox : NULL;
EEndian eEndian = (pVisAreaManagerChunkHeader->nFlags & SERIALIZATION_FLAG_BIG_ENDIAN) ? eBigEndian : eLittleEndian;
@@ -1357,12 +1357,17 @@ int OnWaterUpdate(const EventPhysAreaChange* pEvent)
void CWaterVolumeRenderNode::SyncToPhysMesh(const QuatT& qtSurface, IGeometry* pSurface, float depth)
{
mesh_data* pmd;
if (!pSurface || pSurface->GetType() != GEOM_TRIMESH || !(pmd = (mesh_data*)pSurface->GetData()))
if (!pSurface || pSurface->GetType() != GEOM_TRIMESH)
{
return;
}
bool bResized = false;
if (bResized = m_waterSurfaceVertices.size() != pmd->nVertices)
pmd = (mesh_data*)pSurface->GetData();
if (!pmd)
{
return;
}
bool bResized = m_waterSurfaceVertices.size() != pmd->nVertices;
if (bResized)
{
m_waterSurfaceVertices.resize(pmd->nVertices);
}
+4 -2
View File
@@ -130,11 +130,13 @@ void CCoverageBuffer::ClipPolygon(PodArray<Vec3>& PolygonOut, const PodArray<Vec
}
// check result
#if !defined(NDEBUG)
for (int i = 0; i < PolygonOut.Count(); i++)
{
float d1 = -ClipPlane.DistFromPlane(PolygonOut.GetAt(i));
float d1 = -ClipPlane.DistFromPlane(PolygonOut.GetAt(i));
assert(d1 >= -0.01f);
}
#endif
assert(PolygonOut.Count() == 0 || PolygonOut.Count() >= 3);
}
@@ -209,4 +211,4 @@ void CPolygonClipContext::GetMemoryUsage(ICrySizer* pSizer) const
{
pSizer->AddObject(m_lstPolygonA);
pSizer->AddObject(m_lstPolygonB);
}
}
+1 -1
View File
@@ -205,7 +205,7 @@ void CVars::Init()
#ifndef _RELEASE
DefineConstIntCVar(e_DebugDrawListSize, 24, VF_DEV_ONLY, "num objects in the list for e_DebugDraw list infodebug");
ICVar* e_DebugDrawListFilter = REGISTER_STRING_CB_DEV_ONLY("e_DebugDrawListFilter", "", VF_NULL,
REGISTER_STRING_CB_DEV_ONLY("e_DebugDrawListFilter", "", VF_NULL,
"filter for e_DebugDraw list. Combine object type letters to create the filter\n"
"(example: e_DebugDrawListFilter BVC = shows Characters+StatObject). 'all' = no filter.\n"
" C: Character\n"
+4
View File
@@ -71,10 +71,14 @@ COMPILE_TIME_ASSERT(sizeof(uint32) == 4);
COMPILE_TIME_ASSERT(sizeof(sint32) == 4);
typedef slonglong int64;
#ifndef O3DE_INT64_DEFINED
#define O3DE_INT64_DEFINED
typedef slonglong sint64;
typedef ulonglong uint64;
COMPILE_TIME_ASSERT(sizeof(uint64) == 8);
COMPILE_TIME_ASSERT(sizeof(sint64) == 8);
#endif
typedef float f32;
+6 -2
View File
@@ -48,8 +48,12 @@
// Using AZ_Assert for all assert kinds (assert =, CRY_ASSERT, AZ_Assert).
// see Trace::Assert for implementation
#if defined(USE_AZ_ASSERT)
#undef assert
#define assert(condition) AZ_Assert(condition, "%s", #condition)
#undef assert
#if !defined(NDEBUG)
#define assert(condition) AZ_Assert(condition, "%s", #condition)
#else
#define assert(condition)
#endif
#endif //defined(USE_AZ_ASSERT)
//-----------------------------------------------------------------------------------------------------
+4 -1
View File
@@ -511,7 +511,10 @@ public:
void UnlockModify() const
{
SetDebugLocked(false);
int counter = CryInterlockedDecrement(&m_modifyCount); // decrement write counter
#if !defined(NDEBUG)
int counter =
#endif
CryInterlockedDecrement(&m_modifyCount); // decrement write counter
assert(counter >= 0);
m_writeLock.Unlock(); // release exclusive lock
}
@@ -466,7 +466,9 @@ inline void CThreadSafeRendererContainer<T>::CoalesceMemory()
// mark state as not accessable
m_bElementAccessSafe = false;
#if !defined(NDEBUG)
size_t nOldSize = m_nSize;
#endif
// compute required memory
size_t nRequieredElements = 0;
@@ -542,7 +544,7 @@ inline CThreadSafeRendererContainer<T>::CMemoryPage::CMemoryPage()
nMemoryBlockBegin = (nMemoryBlockBegin + nObjectAlignment - 1) & ~(nObjectAlignment - 1);
// compute number of avaible elements
assert((nMemoryBlockEnd - nMemoryBlockBegin) > 0);
assert(nMemoryBlockEnd > nMemoryBlockBegin);
m_nCapacity = (LONG)((nMemoryBlockEnd - nMemoryBlockBegin) / sizeof(T));
// store pointer to store data to
+4 -2
View File
@@ -290,8 +290,10 @@ float NumToFromString(float val, int digits, bool floating, char buffer[], int b
{
sprintf_s(buffer, buf_size, "%.*f", digits, float(val));
}
int readCount = azsscanf(buffer, "%g", &val);
#if !defined(NDEBUG)
int readCount =
#endif
azsscanf(buffer, "%g", &val);
assert(readCount == 1);
return val;
}
+10 -3
View File
@@ -154,8 +154,15 @@ struct CTypeInfo
bool IsBaseClass() const { return bBaseClass; }
bool IsInline() const
{
const CVarInfo* pFirst;
return bBaseClass && Offset == 0 && (pFirst = Type.NextSubVar(0)) && pFirst->IsBaseClass();
if (bBaseClass && Offset == 0)
{
const CVarInfo* pFirst = Type.NextSubVar(0);
if (pFirst)
{
return pFirst->IsBaseClass();
}
}
return false;
}
bool GetLimit(ENumericLimit eLimit, float& fVal) const
@@ -198,7 +205,7 @@ struct CTypeInfo
inline bool HasSubVars() const
{ return NextSubVar(0) != 0; }
#define AllSubVars(pVar, Info) \
(const CTypeInfo::CVarInfo* pVar = 0; pVar = (Info).NextSubVar(pVar); )
(const CTypeInfo::CVarInfo* pVar = (Info).NextSubVar(0); pVar; pVar = (Info).NextSubVar(pVar))
// Named var search.
virtual const CVarInfo* FindSubVar([[maybe_unused]] cstr name) const
+9 -5
View File
@@ -48,23 +48,27 @@ struct SFileVersion
char* p;
char* next = nullptr;
size_t strmax = sizeof(t);
if (!(p = azstrtok(t, &strmax, ".", &next)))
[[maybe_unused]] size_t strmax = sizeof(t);
p = azstrtok(t, &strmax, ".", &next);
if (!p)
{
return;
}
v[3] = atoi(p);
if (!(p = azstrtok(nullptr, &strmax, ".", &next)))
p = azstrtok(nullptr, &strmax, ".", &next);
if (!p)
{
return;
}
v[2] = atoi(p);
if (!(p = azstrtok(nullptr, &strmax, ".", &next)))
p = azstrtok(nullptr, &strmax, ".", &next);
if (!p)
{
return;
}
v[1] = atoi(p);
if (!(p = azstrtok(nullptr, &strmax, ".", &next)))
p = azstrtok(nullptr, &strmax, ".", &next);
if (!p)
{
return;
}
+12 -43
View File
@@ -25,10 +25,6 @@
#include <Cry_XOptimise.h>
//DOC-IGNORE-END
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
#include <AzCore/Component/EntityId.h>
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
//////////////////////////////////////////////////////////////////////
#define CAMERA_MIN_NEAR 0.001f
#define DEFAULT_NEAR 0.2f
@@ -416,8 +412,6 @@ inline void CameraViewParameters::CalcTiledRegionVerts(Vec3* V, Vec2& vMin, Vec2
vTileMax.x = abs(fWR - fWL) * vMax.x;
vTileMax.y = abs(fWT - fWB) * vMax.y;
float TileWidth = abs(fWR - fWL) / nGridSizeX;
float TileHeight = abs(fWT - fWB) / nGridSizeY;
float TileL = fWL + vTileMin.x;
float TileR = fWL + vTileMax.x;
@@ -439,8 +433,6 @@ inline void CameraViewParameters::CalcTiledRegionVerts(Vec3* V, Vec2& vMin, Vec2
vTileFarMax.x = abs(fwR - fwL) * vMax.x;
vTileFarMax.y = abs(fwT - fwB) * vMax.y;
float TileFarWidth = abs(fwR - fwL) / nGridSizeX;
float TileFarHeight = abs(fwT - fwB) / nGridSizeY;
float TileFarL = fwL + vTileFarMin.x;
float TileFarR = fwL + vTileFarMax.x;
@@ -604,11 +596,6 @@ public:
ILINE const Plane* GetFrustumPlane(int numplane) const { return &m_fp[numplane]; }
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
ILINE const AZ::EntityId GetEntityId() const { return m_entityId; }
ILINE void SetEntityId( AZ::EntityId entityId ) { m_entityId = entityId; }
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
//////////////////////////////////////////////////////////////////////////
// Z-Buffer ranges.
// This values are defining near/far clipping plane, it only used to specify z-buffer range.
@@ -675,10 +662,6 @@ public:
m_nPosX = m_nPosY = m_nSizeX = m_nSizeY = 0;
m_entityPos = Vec3(0, 0, 0);
m_entityRot = Quat(0, 0, 0, 1);
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
m_frameUpdateId = 0;
m_entityId = AZ::EntityId();
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
}
~CCamera() {}
@@ -709,15 +692,6 @@ public:
CameraViewParameters m_viewParameters;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// Get this camera's sequential frame update ID.
uint32_t GetFrameUpdateId() const { return m_frameUpdateId; }
// Increment this camera's sequential frame update ID. This should be
// called every time the camera is used to render the scene.
void IncrementFrameUpdateId() { m_frameUpdateId++; }
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
private:
bool AdditionalCheck(const AABB& aabb) const;
bool AdditionalCheck(const Vec3& wpos, const OBB& obb, f32 uscale) const;
@@ -756,17 +730,6 @@ private:
int m_nPosX, m_nPosY, m_nSizeX, m_nSizeY;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// A sequential counter that is incremented every time this camera is used
// to render a frame. This id is not the same as the frame update ID used
// by the renderer which handles multiple cameras. Systems that rely on
// per-camera temporal buffers can use this to index temporal data.
uint32_t m_frameUpdateId;
// This camera's Entity ID, useful when multiple cameras are active.
AZ::EntityId m_entityId;
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
//------------------------------------------------------------------------
//--- OLD STUFF
//------------------------------------------------------------------------
@@ -2017,42 +1980,48 @@ inline bool CCamera::IsOBBVisible_E(const Vec3& wpos, const OBB& obb, f32 uscale
//is larger then the "radius" of the OBB, then the OBB is outside the frustum.
f32 t0, t1, t2, t3, t4, t5;
bool mt0, mt1, mt2, mt3, mt4, mt5;
if (mt0 = (t0 = m_fp[0] | p) > 0.0f)
mt0 = (t0 = m_fp[0] | p) > 0.0f;
if (mt0)
{
if (t0 > (fabsf(m_fp[0].n | ax) + fabsf(m_fp[0].n | ay) + fabsf(m_fp[0].n | az)))
{
return CULL_EXCLUSION;
}
}
if (mt1 = (t1 = m_fp[1] | p) > 0.0f)
mt1 = (t1 = m_fp[1] | p) > 0.0f;
if (mt1)
{
if (t1 > (fabsf(m_fp[1].n | ax) + fabsf(m_fp[1].n | ay) + fabsf(m_fp[1].n | az)))
{
return CULL_EXCLUSION;
}
}
if (mt2 = (t2 = m_fp[2] | p) > 0.0f)
mt2 = (t2 = m_fp[2] | p) > 0.0f;
if (mt2)
{
if (t2 > (fabsf(m_fp[2].n | ax) + fabsf(m_fp[2].n | ay) + fabsf(m_fp[2].n | az)))
{
return CULL_EXCLUSION;
}
}
if (mt3 = (t3 = m_fp[3] | p) > 0.0f)
mt3 = (t3 = m_fp[3] | p) > 0.0f;
if (mt3)
{
if (t3 > (fabsf(m_fp[3].n | ax) + fabsf(m_fp[3].n | ay) + fabsf(m_fp[3].n | az)))
{
return CULL_EXCLUSION;
}
}
if (mt4 = (t4 = m_fp[4] | p) > 0.0f)
mt4 = (t4 = m_fp[4] | p) > 0.0f;
if (mt4)
{
if (t4 > (fabsf(m_fp[4].n | ax) + fabsf(m_fp[4].n | ay) + fabsf(m_fp[4].n | az)))
{
return CULL_EXCLUSION;
}
}
if (mt5 = (t5 = m_fp[5] | p) > 0.0f)
mt5 = (t5 = m_fp[5] | p) > 0.0f;
if (mt5)
{
if (t5 > (fabsf(m_fp[5].n | ax) + fabsf(m_fp[5].n | ay) + fabsf(m_fp[5].n | az)))
{
@@ -77,7 +77,6 @@ CEngineSettingsBackendWin32::CEngineSettingsBackendWin32(CEngineSettingsManager*
std::wstring CEngineSettingsBackendWin32::GetModuleFilePath() const
{
HMODULE hInstance = GetModuleHandleW(moduleName().c_str());
wchar_t szFilename[_MAX_PATH];
GetModuleFileNameW((HINSTANCE)&__ImageBase, szFilename, _MAX_PATH);
wchar_t drive[_MAX_DRIVE];
-14
View File
@@ -2417,9 +2417,6 @@ struct SRenderingPassInfo
CUBEMAP_GEN = BIT(16),
GEOM_CACHES = BIT(17),
DISABLE_RENDER_CHUNK_MERGE = BIT(18),
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
RENDER_SCENE_TO_TEXTURE = BIT(20),
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// below are precombined flags
STATIC_OBJECTS = ENTITIES,
@@ -2445,9 +2442,6 @@ struct SRenderingPassInfo
bool IsCachedShadowPass() const;
EShadowMapType GetShadowMapType() const;
bool IsDisableRenderChunkMerge() const;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
bool IsRenderSceneToTexturePass() const;
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
bool IsAuxWindow() const;
@@ -2562,14 +2556,6 @@ inline bool SRenderingPassInfo::IsShadowPass() const
return static_cast<EShadowMapType>(m_eShadowMapRendering) != SHADOW_MAP_NONE;
}
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
///////////////////////////////////////////////////////////////////////////////
inline bool SRenderingPassInfo::IsRenderSceneToTexturePass() const
{
return (m_nRenderingFlags & RENDER_SCENE_TO_TEXTURE) != 0;
}
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
///////////////////////////////////////////////////////////////////////////////
inline bool SRenderingPassInfo::IsCachedShadowPass() const
{
-1
View File
@@ -1983,7 +1983,6 @@ public:
for (size_t i = 0, count = m_subsets.size(); i < count; ++i)
{
const SMeshSubset& subset = m_subsets[i];
float posArea;
float texArea;
-9
View File
@@ -1673,15 +1673,6 @@ struct IRenderer
//Pass false to get a frameID that increments by one each frame. For this case the increment happens in the game thread at the beginning of the frame.
virtual int GetFrameID(bool bIncludeRecursiveCalls = true) = 0;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// Returns a frame ID that is sequential for the active camera. This is
// useful for camera-specific temporal data like motion vectors.
virtual int GetCameraFrameID() const = 0;
// Returns true when rendering the scene to a texture
virtual bool IsRenderToTextureActive() const { return false; };
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
virtual void MakeMatrix(const Vec3& pos, const Vec3& angles, const Vec3& scale, Matrix34* mat) = 0;
// Description:
@@ -196,7 +196,6 @@ void IResourceCompilerHelper::GetOutputFilename(const char* szFilePath, char* bu
IResourceCompilerHelper::ERcCallResult IResourceCompilerHelper::InvokeResourceCompiler(const char* szSrcFilePath, const char* szDstFilePath, const bool bUserDialog)
{
ERcExitCode eRet = eRcExitCode_Pending;
const char* szDstFileName = RCPathUtil::GetFile(szDstFilePath);
std::string pathOnly = RCPathUtil::GetPath(szDstFilePath);
-14
View File
@@ -1521,11 +1521,6 @@ struct STexSamplerRT
bool m_bGlobal;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
// CRC of texture name if this is an engine texture
uint32_t m_nCrc;
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
STexSamplerRT()
{
m_nTexState = -1;
@@ -1537,9 +1532,6 @@ struct STexSamplerRT
m_nSamplerSlot = -1;
m_nTextureSlot = -1;
m_bGlobal = false;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
m_nCrc = 0;
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
}
~STexSamplerRT()
{
@@ -1590,9 +1582,6 @@ struct STexSamplerRT
m_nSamplerSlot = src.m_nSamplerSlot;
m_nTextureSlot = src.m_nTextureSlot;
m_bGlobal = src.m_bGlobal;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
m_nCrc = src.m_nCrc;
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
}
NO_INLINE STexSamplerRT& operator = (const STexSamplerRT& src)
{
@@ -1615,9 +1604,6 @@ struct STexSamplerRT
m_nSamplerSlot = -1;
m_nTextureSlot = -1;
m_bGlobal = (src.m_nTexFlags & FT_FROMIMAGE) != 0;
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
m_nCrc = 0;
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
}
inline bool operator != (const STexSamplerRT& m) const
{
-1
View File
@@ -198,7 +198,6 @@ Spin:
}
# else
// NOTE: The code below will fail on 64bit architectures!
uint loops = 0;
while (_InterlockedCompareExchange((volatile LONG*)pLock, setVal, checkVal) != checkVal)
{
_mm_pause();
@@ -34,7 +34,7 @@ namespace PakLoadDataUtils
{
while (nDataSize & 3)
{
size_t nRes = GetISystem()->GetIPak()->FSeek(fileHandle, 1, SEEK_CUR);
[[maybe_unused]] size_t nRes = GetISystem()->GetIPak()->FSeek(fileHandle, 1, SEEK_CUR);
AZ_Assert(nRes == 0, "FSeek failed for 1 byte");
AZ_Assert(nDataSize, "nDataSize reached zero" );
nDataSize--;
-90
View File
@@ -1,90 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
// AZ_RENDER_TO_TEXTURE_GEM_ENABLED is defined by the RenderToTexture Gem
#if !defined(AZ_RENDER_TO_TEXTURE_GEM_ENABLED)
#define AZ_RENDER_TO_TEXTURE_GEM_ENABLED (0)
#endif
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
#include <RenderContextConfig.h>
#include <AzCore/EBus/EBus.h>
class CCamera;
namespace AzRTT
{
class RTTBus
: public AZ::EBusTraits
{
public:
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
virtual ~RTTBus() = default;
/**
* Creates an instance of an RenderContext.
* @return Shared pointer to the created IRenderContext.
* @param config The RenderContextConfig settings to apply.
*/
virtual RenderContextId CreateContext(const RenderContextConfig& config) = 0;
/**
* Returns true if the IRenderContext exists and is valid.
* @return True if context exists and is valid.
* @param contextId the RenderContextId to check for validity
*/
virtual bool ContextIsValid(RenderContextId contextId) const = 0;
/**
* Destroys an RenderContext instance.
* @param contextId The RenderContextId for an existing context to destroy
*/
virtual void DestroyContext(RenderContextId contextId) = 0;
/**
* Gets the configuration for a context instance.
* @param contextId the RenderContextId for an existing context.
*/
virtual RenderContextConfig GetContextConfig(RenderContextId contextId) const = 0;
/**
* Sets the active IRenderContext. This will deactivate any existing context.
* @return True if context was activated, false if not activated.
* @param contextId the RenderContextId for an existing context to activate
*/
virtual bool SetActiveContext(RenderContextId contextId) = 0;
/**
* Sets the configuration for a context instance.
* @param contextId the RenderContextId for an existing context.
* @param config the RenderContextConfig settings to apply.
*/
virtual void SetContextConfig(RenderContextId contextId, const RenderContextConfig& config) = 0;
/**
* Render the world from the provided camera to a render target using the provided render context.
* @param renderTargetTextureHandle Texture handle of target to render to.
* @param camera The camera to use for rendering.
* @param contextId The RenderContextId to use.
*/
virtual void RenderWorld(int renderTargetTextureHandle, const CCamera& camera, RenderContextId contextId) = 0;
};
using RTTRequestBus = AZ::EBus<RTTBus>;
}
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
+1 -1
View File
@@ -112,7 +112,7 @@ public:
void Free()
{
m_nCount = 0;
if (m_nAllocatedCount)
if (m_nAllocatedCount && AZ::AllocatorInstance<CryLegacySTLAllocator>::IsReady())
{
AZ::AllocatorInstance<CryLegacySTLAllocator>::Get().DeAllocate(m_pElements);
}
@@ -945,7 +945,6 @@ namespace Unicode
const size_t fixedOffset = Append && offset >= extent<T>::value
? extent<T>::value - 1 // In case the buffer is already full and not terminated.
: offset;
CharType* base = static_cast<CharType*>(out);
Super::ptr = out + fixedOffset; // Qualification for Super required for two-phase lookup.
}
};
@@ -103,7 +103,6 @@ set(FILES
VRCommon.h
StereoRendererBus.h
HeightmapUpdateNotificationBus.h
RTTBus.h
IObjManager.h
INavigationSystem.h
IMNM.h
+4 -1
View File
@@ -527,7 +527,10 @@ inline void CryHeapCheck()
#define AZ_RESTRICTED_SECTION PLATFORM_H_SECTION_11
#include AZ_RESTRICTED_FILE(platform_h)
#elif !defined(LINUX) && !defined(APPLE) // todo: this might be readded with later xdks?
int Result = _heapchk();
#if !defined(NDEBUG)
int Result =
#endif
_heapchk();
assert(Result != _HEAPBADBEGIN);
assert(Result != _HEAPBADNODE);
assert(Result != _HEAPBADPTR);
+5 -2
View File
@@ -311,7 +311,7 @@ void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], [[ma
firstIteration = false;
}
// Check if the engineroot exists
wcscat_s(szPath, L"\\engineroot.txt");
wcscat_s(szPath, L"\\engine.json");
WIN32_FILE_ATTRIBUTE_DATA data;
BOOL res = GetFileAttributesExW(szPath, GetFileExInfoStandard, &data);
if (res != 0 && data.dwFileAttributes != INVALID_FILE_ATTRIBUTES)
@@ -376,7 +376,10 @@ void* CryInterlockedExchangePointer(void* volatile* dst, void* exchange)
void CryInterlockedAdd(volatile size_t* pVal, ptrdiff_t iAdd)
{
#if defined (PLATFORM_64BIT)
size_t v = (size_t)InterlockedAdd64((volatile int64*)pVal, iAdd);
#if !defined(NDEBUG)
size_t v = (size_t)
#endif
InterlockedAdd64((volatile int64*)pVal, iAdd);
#else
size_t v = (size_t)CryInterlockedExchangeAdd((volatile long*)pVal, (long)iAdd);
v += iAdd;
+1 -1
View File
@@ -19,6 +19,6 @@ ly_add_target(
.
BUILD_DEPENDENCIES
PRIVATE
3rdParty::FreeType2
3rdParty::freetype
Legacy::CryCommon
)
-1
View File
@@ -713,7 +713,6 @@ uint32 CFFont::WriteTextQuadsToBuffers(SVF_P2F_C4B_T2F_F4B* verts, uint16* indic
{
};
IRenderer* pRenderer = gEnv->pRenderer;
CreateQuadsForText(x, y, z, pStr, asciiMultiLine, ctx, AddQuad, BeginPass);
+1 -1
View File
@@ -308,7 +308,7 @@ Vec2 CFontRenderer::GetKerning(uint32_t leftGlyph, uint32_t rightGlyph)
const FT_UInt leftGlyphIndex = FT_Get_Char_Index(m_pFace, leftGlyph);
const FT_UInt rightGlyphIndex = FT_Get_Char_Index(m_pFace, rightGlyph);
FT_Error ftError = FT_Get_Kerning(m_pFace, leftGlyphIndex, rightGlyphIndex, FT_KERNING_DEFAULT, &kerningOffsets);
[[maybe_unused]] FT_Error ftError = FT_Get_Kerning(m_pFace, leftGlyphIndex, rightGlyphIndex, FT_KERNING_DEFAULT, &kerningOffsets);
#if !defined(_RELEASE)
if (0 != ftError)
+2 -1
View File
@@ -267,8 +267,9 @@ int CFontTexture::PreCacheString(const char* szString, int* pUpdated, float size
int iUpdated = 0;
uint32 cChar;
for (Unicode::CIterator<const char*, false> it(szString); cChar = *it; ++it)
for (Unicode::CIterator<const char*, false> it(szString); *it; ++it)
{
cChar = *it;
CTextureSlot* pSlot = GetCharSlot(cChar, clampedGlyphSize);
if (!pSlot)
+1
View File
@@ -30,6 +30,7 @@ CGlyphBitmap::CGlyphBitmap()
//-------------------------------------------------------------------------------------------------
CGlyphBitmap::~CGlyphBitmap()
{
Release();
}
//-------------------------------------------------------------------------------------------------
+1 -3
View File
@@ -1357,9 +1357,7 @@ void CCpuFeatures::Detect(void)
#if AZ_LEGACY_CRYSYSTEM_TRAIT_HASAFFINITYMASK
CryLogAlways("");
DWORD_PTR process_affinity_mask;
uint32 thread_processor_mask = 1;
process_affinity_mask = 1;
DWORD_PTR process_affinity_mask = 1;
/* get the system info to derive the number of processors within the system. */
+3 -1
View File
@@ -160,7 +160,8 @@ string CCmdLine::Next(char*& src)
char ch = 0;
char* org = src;
while (ch = *src++)
ch = *src++;
while (ch)
{
switch (ch)
{
@@ -194,6 +195,7 @@ string CCmdLine::Next(char*& src)
return string(org, src);
}
ch = *src++;
}
return string();
@@ -338,7 +338,9 @@ AZ_POP_DISABLE_WARNING
//////////////////////////////////////////////////////////////////////////
DWORD& floatMxCsr = ctx.MxCsr; // Hold FPE Mask and Status for MMX (SSE) floating point registers
WORD& floatControlWord = ctx.FltSave.ControlWord; // Hold FPE Mask for floating point registers
#ifndef _RELEASE
WORD& floatStatuslWord = ctx.FltSave.StatusWord; // Holds FPE Status for floating point registers
#endif
#else
DWORD& floatMxCsr = *(DWORD*)(&ctx.ExtendedRegisters[24]); // Hold FPE Mask and Status for MMX (SSE) floating point registers
DWORD& floatControlWord = ctx.FloatSave.ControlWord; // Hold FPE Mask for floating point registers
+6 -5
View File
@@ -382,11 +382,12 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex)
string path("");
if ((gEnv) && (gEnv->pFileIO))
{
const char* logAlias = nullptr;
if (
(logAlias = gEnv->pFileIO->GetAlias("@log@")) ||
(logAlias = gEnv->pFileIO->GetAlias("@root@"))
)
const char* logAlias = gEnv->pFileIO->GetAlias("@log@");
if (!logAlias)
{
logAlias = gEnv->pFileIO->GetAlias("@root@");
}
if (logAlias)
{
path = logAlias;
path += "/";
+3 -6
View File
@@ -316,8 +316,6 @@ bool CDefragAllocator::AppendSegment(UINT_PTR capacity)
SDefragAllocChunk& freeChunk = m_chunks[freeBlockIdx];
SDefragAllocChunk& addrEndSentinal = m_chunks[AddrEndSentinal];
uint32 segIdx = (uint32)m_segments.size();
uint32 allocCapacity = m_capacity;
headSentinalChunk.ptr = allocCapacity;
@@ -370,7 +368,7 @@ void CDefragAllocator::UnAppendSegment()
// Can't remove the last segment!
CDBA_ASSERT(m_segments.size() > 1);
bool bHasMoves = Defrag_CompletePendingMoves();
[[maybe_unused]] bool bHasMoves = Defrag_CompletePendingMoves();
// All outstanding moves should be completed.
CDBA_ASSERT(!bHasMoves);
@@ -390,8 +388,6 @@ void CDefragAllocator::UnAppendSegment()
SDefragAllocChunk* pChunk = &m_chunks[chunkIdx];
int numValidSegs = (int)m_segments.size() - 1;
while (pChunk->ptr != endAddress)
{
CDBA_ASSERT(!pChunk->attr.IsBusy());
@@ -1255,7 +1251,6 @@ size_t CDefragAllocator::Defrag_FindMovesBwd(PendingMove** pMoves, size_t maxMov
{
for (Index candidateIdx = m_chunks[freeChunkIdx].addrPrevIdx; numMoves < maxMoves && curAmount < maxAmount; )
{
SDefragAllocChunk& freeChunk = m_chunks[freeChunkIdx];
SDefragAllocChunk& candidateChunk = m_chunks[candidateIdx];
SDefragAllocChunkAttr candidateChunkAttr = candidateChunk.attr;
@@ -1947,6 +1942,7 @@ void CDefragAllocator::ValidateAddressChain()
void CDefragAllocator::ValidateFreeLists()
{
#if defined(CDBA_DEBUG)
for (size_t bucket = 0; bucket < NumBuckets; ++bucket)
{
size_t rootIdx = m_freeBuckets[bucket];
@@ -1976,4 +1972,5 @@ void CDefragAllocator::ValidateFreeLists()
CDBA_ASSERT(m_chunks[chunk.freePrevIdx].freeNextIdx == idx);
}
}
#endif
}
+1 -1
View File
@@ -243,7 +243,7 @@ void IDebugCallStack::WriteLineToLog(const char* format, ...)
va_list ArgList;
char szBuffer[MAX_WARNING_LENGTH];
va_start(ArgList, format);
int count = vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, format, ArgList);
vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, format, ArgList);
cry_strcat(szBuffer, "\n");
szBuffer[sizeof(szBuffer) - 1] = '\0';
va_end(ArgList);
+1 -1
View File
@@ -22,7 +22,7 @@
#endif
#if !(defined(ANDROID) || defined(IOS) || defined(LINUX)) && AZ_LEGACY_CRYSYSTEM_TRAIT_IMAGEHANDLER_TIFFIO // Rally US1050 - Compile libtiff for Android and IOS
#include <libtiff/tiffio.h>
#include <tiffio.h>
static_assert(sizeof(thandle_t) >= sizeof(AZ::IO::HandleType), "Platform defines thandle_t to be smaller than required");
#endif
@@ -84,7 +84,6 @@ namespace LegacyLevelSystem
{
return;
}
auto pPak = gEnv->pCryPak;
AzFramework::RootSpawnableNotificationBus::Handler::BusConnect();
}
@@ -240,6 +239,9 @@ namespace LegacyLevelSystem
}
}
// This is a workaround until the replacement for GameEntityContext is done
AzFramework::GameEntityContextEventBus::Broadcast(&AzFramework::GameEntityContextEventBus::Events::OnPreGameEntitiesStarted);
// Reset the camera to (1,1,1) (not (0,0,0) which is the invalid/uninitialised state,
// to avoid the hack in the renderer to not show anything if the camera is at the origin).
CCamera defaultCam;
@@ -323,6 +325,9 @@ namespace LegacyLevelSystem
m_rootSpawnableId = rootSpawnableAssetId;
m_rootSpawnableGeneration = AzFramework::RootSpawnableInterface::Get()->AssignRootSpawnable(rootSpawnable);
// This is a workaround until the replacement for GameEntityContext is done
AzFramework::GameEntityContextEventBus::Broadcast(&AzFramework::GameEntityContextEventBus::Events::OnGameEntitiesStarted);
//////////////////////////////////////////////////////////////////////////
// Movie system must be reset after entities.
//////////////////////////////////////////////////////////////////////////
@@ -695,6 +700,8 @@ namespace LegacyLevelSystem
// Cleanup all containers
GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_POST_UNLOAD, 0, 0);
AzFramework::InputChannelRequestBus::Broadcast(&AzFramework::InputChannelRequests::ResetState);
AzFramework::GameEntityContextEventBus::Broadcast(&AzFramework::GameEntityContextEventBus::Events::OnGameEntitiesReset);
}
void SpawnableLevelSystem::OnRootSpawnableAssigned(
@@ -172,7 +172,6 @@ void CLocalizedStringsManager::LocalizationDumpLoadedInfo([[maybe_unused]] ICons
{
CLocalizedStringsManager* pLoca = (CLocalizedStringsManager*) gEnv->pSystem->GetLocalizationManager();
const char* pTagName = "";
for (TTagFileNames::iterator tagit = pLoca->m_tagFileNames.begin(); tagit != pLoca->m_tagFileNames.end(); ++tagit)
{
CryLogAlways("Tag %s (%d)", tagit->first.c_str(), tagit->second.id);
@@ -1817,8 +1816,6 @@ bool CLocalizedStringsManager::LocalizeStringInternal(const char* pStr, size_t l
string out;
// scan the string
bool done = false;
int curpos = 0;
const char* pPos = pStr;
const char* pEnd = pStr + len;
while (true)
@@ -1955,7 +1952,10 @@ string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const
nDecompTicks = CryGetTicks() - nDecompTicks;
#endif //LOG_DECOMP_TIMES
size_t len = strnlen((const char*)decompressionBuffer, COMPRESSION_FIXED_BUFFER_LENGTH);
#if !defined(NDEBUG)
size_t len =
#endif
strnlen((const char*)decompressionBuffer, COMPRESSION_FIXED_BUFFER_LENGTH);
assert(len < COMPRESSION_FIXED_BUFFER_LENGTH && "Buffer not null-terminated");
+2 -2
View File
@@ -305,7 +305,7 @@ void CLog::LogWarning(const char* szFormat, ...)
va_list ArgList;
char szBuffer[MAX_WARNING_LENGTH];
va_start(ArgList, szFormat);
int count = vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, szFormat, ArgList);
vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, szFormat, ArgList);
szBuffer[sizeof(szBuffer) - 1] = '\0';
va_end(ArgList);
@@ -325,7 +325,7 @@ void CLog::LogError(const char* szFormat, ...)
va_list ArgList;
char szBuffer[MAX_WARNING_LENGTH];
va_start(ArgList, szFormat);
int count = vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, szFormat, ArgList);
vsnprintf_s(szBuffer, sizeof(szBuffer), sizeof(szBuffer) - 1, szFormat, ArgList);
szBuffer[sizeof(szBuffer) - 1] = '\0';
va_end(ArgList);
@@ -98,8 +98,6 @@ void CDrawContext::StopDrawing()
// Restore old flags that where set before our draw context.
m_pAuxRender->SetRenderFlags(m_prevRenderFlags);
int width = gEnv->pRenderer->GetWidth();
int height = gEnv->pRenderer->GetHeight();
gEnv->pRenderer->Unset2DMode(m_backupSceneMatrices);
}
@@ -159,4 +157,4 @@ void CDrawContext::PopClientRect()
m_currentStackLevel--;
}
}
MINIGUI_END
MINIGUI_END
@@ -151,7 +151,6 @@ void CMiniTable::AutoResize()
if (nColumns)
{
int numEntries = m_columns[0].cells.size();
int numPages = numEntries / m_pageSize;
//page index is now invalid, cap at max
if ((m_pageNum * m_pageSize) > numEntries)
@@ -45,8 +45,6 @@ public:
return;
}
const char* path = nullptr; // Don't call GetGameFolder here, it returns a full absolute path and we just really want the game name
AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
if (projectPath.empty())
{
-6
View File
@@ -660,8 +660,6 @@ bool CPerfHUD::OnInputChannelEventFiltered(const AzFramework::InputChannel& inpu
if (deviceId == AzFramework::InputDeviceGamepad::IdForIndex0)
{
int frameNum = gEnv->pRenderer->GetFrameID(false);
if (inputChannel.IsStateBegan())
{
bool checkState = false;
@@ -1729,8 +1727,6 @@ CStreamingStatsWidget::CStreamingStatsWidget(IMiniCtrl* pParentMenu, ICryPerfHUD
//////////////////////////////////////////////////////////////////////////
void CStreamingStatsWidget::Update()
{
IRenderer* pRenderer = gEnv->pRenderer;
char entryBuffer[CMiniInfoBox::MAX_TEXT_LENGTH] = {0};
//Clear old entries
@@ -1971,8 +1967,6 @@ void CRenderBatchWidget::Enable(int mode)
mode = min(mode, DISPLAY_MODE_NUM - 1);
EDisplayMode newMode = (EDisplayMode)mode;
bool bValidMode = false;
if (m_displayMode != newMode)
{
//workaround for now,
@@ -117,7 +117,8 @@ void CProfileLogSystem::SetTime(ILogElement* pElement, float time)
return;
}
if (m_pLastElelent = pElement->SetTime(time))
m_pLastElelent = pElement->SetTime(time);
if (m_pLastElelent)
{
return;
}
@@ -130,4 +131,4 @@ void CProfileLogSystem::SetTime(ILogElement* pElement, float time)
void CProfileLogSystem::Release()
{
delete this;
}
}
@@ -320,7 +320,6 @@ bool CResourceManager::LoadFastLoadPaks(bool bToMemory)
}
const char* const assetsDir = "@assets@";
const char* shaderPakDir = assetsDir;
const char* shaderPakPath = "ShaderCacheStartup.pak";
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -826,8 +825,6 @@ void CResourceManager::OnSystemEvent(ESystemEvent event, [[maybe_unused]] UINT_P
//////////////////////////////////////////////////////////////////////////
void CResourceManager::GetMemoryStatistics(ICrySizer* pSizer)
{
auto pResList = gEnv->pCryPak->GetResourceList(AZ::IO::IArchive::RFOM_Level);
pSizer->AddContainer(m_openedPaks);
}
@@ -477,7 +477,9 @@ namespace Serialization {
{
while (isComment(*cur.end))
{
#if 0
const char* commentStart = ptr;
#endif
while (*cur.end && *cur.end != '\n')
{
++cur.end;
@@ -968,7 +970,10 @@ namespace Serialization {
ser(*this);
CRY_ASSERT(!stack_.empty());
stack_.pop_back();
bool closed = closeBracket();
#if !defined(NDEBUG)
bool closed =
#endif
closeBracket();
CRY_ASSERT(closed);
return true;
}
@@ -864,9 +864,6 @@ void CLocalMemoryUsage::OnRender(IRenderer* pRenderer, const CCamera* camera)
}
}
float localMemoryTextureStreamingSpeedLimit = sys_LocalMemoryTextureStreamingSpeedLimit * 1024.f * 1024.f;
float localMemoryStatObjStreamingSpeedLimit = sys_LocalMemoryGeometryStreamingSpeedLimit * 1024.f * 1024.f;
sector++;
}
}
@@ -1335,7 +1332,6 @@ void CLocalMemoryUsage::CollectMaterialInfo_Recursive(SMaterialInfo* materialInf
for (auto iter = rItem.m_pShaderResources->GetTexturesResourceMap()->begin();
iter != rItem.m_pShaderResources->GetTexturesResourceMap()->end(); ++iter)
{
uint16 texId = iter->first;
const SEfResTexture* pTextureRes = &iter->second;
if (pTextureRes->m_Sampler.m_pITex)
@@ -512,7 +512,8 @@ uint32 CAsyncIOFileRequest::ReadFile(CStreamingIOThread* pIOThread)
}
CCryFile file;
if ((nError = OpenFile(file)))
nError = OpenFile(file);
if (nError)
{
return nError;
}
@@ -555,12 +556,14 @@ uint32 CAsyncIOFileRequest::ReadFile(CStreamingIOThread* pIOThread)
}
auto pZipEntry = ((AZ::IO::Archive*)(gEnv->pCryPak))->GetOpenedFileDataInZip(file.GetHandle());
if ((nError = ConfigureRead(pZipEntry.get())))
nError = ConfigureRead(pZipEntry.get());
if (nError)
{
return nError;
}
if ((nError = AllocateOutput(pZipEntry.get())))
nError = AllocateOutput(pZipEntry.get());
if (nError)
{
return nError;
}
@@ -578,14 +581,16 @@ uint32 CAsyncIOFileRequest::ReadFileResume(CStreamingIOThread* pIOThread)
}
CCryFile file;
if ((nError = OpenFile(file)))
nError = OpenFile(file);
if (nError)
{
return nError;
}
auto pZipEntry = ((AZ::IO::Archive*)(gEnv->pCryPak))->GetOpenedFileDataInZip(file.GetHandle());
if ((nError = AllocateOutput(pZipEntry.get())))
nError = AllocateOutput(pZipEntry.get());
if (nError)
{
return nError;
}
@@ -653,7 +658,8 @@ uint32 CAsyncIOFileRequest::ReadFileInPages(CStreamingIOThread* pIOThread, CCryF
}
//check if job needs to be pre-empted
if ((nError = ReadFileCheckPreempt(pIOThread)))
nError = ReadFileCheckPreempt(pIOThread);
if (nError)
{
return nError;
}
@@ -121,14 +121,14 @@ int SStreamJobQueue::Pop()
void CAsyncIOFileRequest::AddRef()
{
int nRef = CryInterlockedIncrement(&m_nRefCount);
//int nRef =
CryInterlockedIncrement(&m_nRefCount);
STREAM_DECOMPRESS_TRACE("[StreamDecompress],AddRef,0x%x,%s,0x%p,%i\n", CryGetCurrentThreadId(), m_strFileName.c_str(), this, nRef);
}
int CAsyncIOFileRequest::Release()
{
int nRef = CryInterlockedDecrement(&m_nRefCount);
STREAM_DECOMPRESS_TRACE("[StreamDecompress],Release,0x%x,%s,0x%p,%i\n", CryGetCurrentThreadId(), m_strFileName.c_str(), this, nRef);
#ifndef _RELEASE
@@ -251,7 +251,6 @@ size_t CStreamEngine::StartBatchRead(IReadStreamPtr* pStreamsOut, const StreamRe
if (numReqs > 0)
{
size_t nStreamsInBatch = 0;
numReqs = AZStd::min(numReqs, aznumeric_cast<size_t>(MaxStreamsPerBatch));
AZStd::vector<FileRequestPtr> batch;
@@ -279,7 +279,7 @@ void CStreamingIOThread::Run()
if (pFileRequest->m_eMediaType != eStreamSourceTypeMemory)
{
pFileRequest->m_nReadHeadOffsetKB = (int32)(((int64)pFileRequest->m_nDiskOffset - m_nLastReadDiskOffset) >> 10); // in KB
m_nLastReadDiskOffset = pFileRequest->m_nDiskOffset + pFileRequest->m_nSizeOnMedia;
m_nLastReadDiskOffset = pFileRequest->m_nDiskOffset + nSizeOnMedia;
#ifdef STREAMENGINE_ENABLE_STATS
m_NotInMemoryStats.m_nTempReadOffset += abs(pFileRequest->m_nReadHeadOffsetKB);
@@ -288,7 +288,7 @@ void CStreamingIOThread::Run()
m_NotInMemoryStats.m_nTempRequestCount++;
// Calc IO bandwidth only for non memory files.
m_NotInMemoryStats.m_nTempBytesRead += pFileRequest->m_nSizeOnMedia;
m_NotInMemoryStats.m_nTempBytesRead += nSizeOnMedia;
m_NotInMemoryStats.m_TempReadTime += pFileRequest->m_readTime;
#endif
}
@@ -298,7 +298,7 @@ void CStreamingIOThread::Run()
m_InMemoryStats.m_nTempRequestCount++;
// Calc IO bandwidth only for in memory files.
m_InMemoryStats.m_nTempBytesRead += pFileRequest->m_nSizeOnMedia;
m_InMemoryStats.m_nTempBytesRead += nSizeOnMedia;
m_InMemoryStats.m_TempReadTime += pFileRequest->m_readTime;
#endif
}
@@ -753,9 +753,14 @@ void CStreamingWorkerThread::Run()
{
case eWorkerAsyncCallback:
{
#ifndef _RELEASE
float fTime = gEnv->pTimer->GetAsyncCurTime();
#endif
m_pStreamEngine->ReportAsyncFileRequestComplete(pFileRequest);
#ifndef _RELEASE
float fTime1 = gEnv->pTimer->GetAsyncCurTime();
#endif
#ifdef STREAMENGINE_ENABLE_STATS
CryInterlockedDecrement(&m_pStreamEngine->GetStreamingStatistics().nCurrentAsyncCount);
+5 -3
View File
@@ -944,7 +944,6 @@ public:
LARGE_INTEGER stepStart, stepEnd;
#endif
LARGE_INTEGER waitStart, waitEnd;
uint64 yieldBegin = 0U;
MarkThisThreadForDebugging("Physics");
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -1635,7 +1634,7 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode)
// AI gets to steer entities before they travel over cliffs etc.
const float maxTimeStep = 0.25f;
int maxSteps = 1;
float fCurTime = m_Time.GetCurrTime();
//float fCurTime = m_Time.GetCurrTime();
float timeToDo = m_Time.GetFrameTime();//fCurTime - fPrevTime;
if (m_env.bMultiplayer)
{
@@ -2697,7 +2696,10 @@ void CSystem::RegisterWindowMessageHandler(IWindowMessageHandler* pHandler)
void CSystem::UnregisterWindowMessageHandler(IWindowMessageHandler* pHandler)
{
#if AZ_LEGACY_CRYSYSTEM_TRAIT_USE_MESSAGE_HANDLER
bool bRemoved = stl::find_and_erase(m_windowMessageHandlers, pHandler);
#if !defined(NDEBUG)
bool bRemoved =
#endif
stl::find_and_erase(m_windowMessageHandlers, pHandler);
assert(pHandler && bRemoved && "This IWindowMessageHandler was not registered");
#else
CRY_ASSERT(false && "This platform does not support window message handlers");
+4 -15
View File
@@ -362,7 +362,7 @@ static void CmdCrashTest(IConsoleCmdArgs* pArgs)
case 3:
while (true)
{
char* element = new char[10240];
new char[10240];
}
break;
case 4:
@@ -371,7 +371,7 @@ static void CmdCrashTest(IConsoleCmdArgs* pArgs)
case 5:
while (true)
{
char* element = new char[128]; //testing the crash handler an exception in the cry memory allocation occurred
new char[128]; //testing the crash handler an exception in the cry memory allocation occurred
}
case 6:
{
@@ -1000,7 +1000,9 @@ bool CSystem::InitializeEngineModule(const char* dllName, const char* moduleClas
{
GetIMemoryManager()->GetProcessMemInfo(memEnd);
#if defined(AZ_ENABLE_TRACING)
uint64 memUsed = memEnd.WorkingSetSize - memStart.WorkingSetSize;
#endif
AZ_TracePrintf(AZ_TRACE_SYSTEM_WINDOW, "Initializing %s %s, MemUsage=%uKb", dllName, pModule ? "done" : "failed", uint32(memUsed / 1024));
}
@@ -2383,8 +2385,6 @@ AZ_POP_DISABLE_WARNING
#if !defined(CONSOLE)
#if !defined(_RELEASE)
bool isDaemonMode = (m_pCmdLine->FindArg(eCLAT_Pre, "daemon") != 0);
#else
bool isDaemonMode = false;
#endif // !defined(_RELEASE)
#if defined(USE_DEDICATED_SERVER_CONSOLE)
@@ -3733,17 +3733,6 @@ void CSystem::CreateSystemVars()
m_cvMemStatsThreshold = REGISTER_INT ("MemStatsThreshold", 32000, VF_NULL, "");
m_cvMemStatsMaxDepth = REGISTER_INT("MemStatsMaxDepth", 4, VF_NULL, "");
// allows for loading gems and map files for release mode dedicated servers
int dwPakPriorityFlags = VF_READONLY | VF_CHEAT;
#if defined(_RELEASE)
if (gEnv->IsDedicated())
{
dwPakPriorityFlags = VF_DEDI_ONLY;
}
#endif
attachVariable("sys_PakReadSlice", &g_cvars.archiveVars.nReadSlice, "If non-0, means number of kilobytes to use to read files in portions. Should only be used on Win9x kernels");
attachVariable("sys_PakInMemorySizeLimit", &g_cvars.archiveVars.nInMemoryPerPakSizeLimit, "Individual pak size limit for being loaded into memory (MB)");
+10 -11
View File
@@ -441,7 +441,7 @@ int CSystem::GetApplicationInstance()
{
suffix.Format("(%d)", instance);
HANDLE instanceMutex = CreateMutex(NULL, TRUE, "LumberyardApplication" + suffix);
CreateMutex(NULL, TRUE, "LumberyardApplication" + suffix);
// search for duplicates
if (GetLastError() != ERROR_ALREADY_EXISTS)
{
@@ -466,7 +466,7 @@ int CSystem::GetApplicationLogInstance([[maybe_unused]] const char* logFilePath)
{
suffix.Format("(%d)", instance);
HANDLE instanceMutex = CreateMutex(NULL, TRUE, logFilePath + suffix);
CreateMutex(NULL, TRUE, logFilePath + suffix);
if (GetLastError() != ERROR_ALREADY_EXISTS)
{
break;
@@ -589,12 +589,13 @@ void CSystem::DebugStats([[maybe_unused]] bool checkpoint, [[maybe_unused]] bool
CloseHandle (hSnapshot);
}
//////////////////////////////////////////////////////////////////////////
ILog* log = GetILog();
int totalal = 0, totalbl = 0, nolib = 0;
int nolib = 0;
#ifdef _DEBUG
ILog* log = GetILog();
int totalal = 0;
int totalbl = 0;
int extrastats[10];
#endif
@@ -704,7 +705,9 @@ void CSystem::DebugStats([[maybe_unused]] bool checkpoint, [[maybe_unused]] bool
phe.lpData = NULL;
int nCommitted = 0, nUncommitted = 0, nOverhead = 0;
int nCommittedPieces = 0, nUncommittedPieces = 0;
#if !defined(NDEBUG)
int nPrevRegionIndex = -1;
#endif
while (HeapWalk(hHeap, &phe))
{
if (phe.wFlags & PROCESS_HEAP_REGION)
@@ -743,9 +746,7 @@ void CSystem::DebugStats([[maybe_unused]] bool checkpoint, [[maybe_unused]] bool
nOverhead += phe.cbOverhead;
}
;
int nCommittedMin = min(nCommitted, nCommittedPieces);
int nCommittedMax = max(nCommitted, nCommittedPieces);
CryLogAlways("* heap %8x: %6d (or ~%6d) K in use, %6d..%6d K uncommitted, %6d K overhead (%s)\n",
handles[i], nCommittedPieces / 1024, nCommitted / 1024, nUncommittedPieces / 1024, nUncommitted / 1024, nOverhead / 1024, hinfo);
@@ -877,7 +878,6 @@ void CSystem::GetExeSizes (ICrySizer* pSizer, MemStatsPurposeEnum nPurpose)
{
// the sizes of each module group
StringToSizeMap mapGroupSize;
DWORD dwTotalModuleSize = 0;
do
{
dwProcessID = me.th32ProcessID;
@@ -1251,7 +1251,6 @@ void CSystem::LogSystemInfo()
char szProfileBuffer[128];
char szLanguageBuffer[64];
//char szCPUModel[64];
char* pChar = 0;
MEMORYSTATUSEX MemoryStatus;
MemoryStatus.dwLength = sizeof(MemoryStatus);
@@ -313,8 +313,6 @@ TEST_F(CryPrimitives, CUT_CryString)
string str4aNF("b-a");
string str4bNF("12");
size_t nPosition3A(string::npos);
nPosition = strTestFindLastNotOfOverload1.find_last_not_of('d', 7);
EXPECT_TRUE(nPosition == 5);
@@ -441,8 +441,6 @@ void CThreadConfigManager::LoadPriority(const XmlNodeRef& rXmlThreadRef, int32&
//////////////////////////////////////////////////////////////////////////
void CThreadConfigManager::LoadDisablePriorityBoost(const XmlNodeRef& rXmlThreadRef, bool& rPriorityBoost, SThreadConfig::TThreadParamFlag& rParamActivityFlag)
{
const char* sValidCharacters = "-,0123456789";
// Validate node
if (!rXmlThreadRef->haveAttr("DisablePriorityBoost"))
{
@@ -483,8 +481,6 @@ void CThreadConfigManager::LoadStackSize(const XmlNodeRef& rXmlThreadRef, uint32
if (rXmlThreadRef->haveAttr("StackSizeKB"))
{
int32 nPos = 0;
// Read stack size
CryFixedStringT<32> stackSize(rXmlThreadRef->getAttr("StackSizeKB"));
+4 -1
View File
@@ -313,7 +313,10 @@ CThreadTaskManager::~CThreadTaskManager()
AUTO_MODIFYLOCK(m_threadsPoolsLock);
while (!m_threadsPools.empty())
{
bool res = DestroyThreadsPool(m_threadsPools.begin()->m_hHandle);
#if !defined(NDEBUG)
bool res =
#endif
DestroyThreadsPool(m_threadsPools.begin()->m_hHandle);
assert(res);
}
}
@@ -103,8 +103,6 @@ void CView::Update(float frameTime, bool isActive)
// [VR] specific
// Modify FOV based on the HMD device configuration
bool hmdActive = false;
bool isRenderingToHMD = gEnv->pRenderer ? gEnv->pRenderer->GetIStereoRenderer()->IsRenderingToHMD() : false;
if (isRenderingToHMD)
{
@@ -533,8 +533,6 @@ void CViewSystem::BeginCutScene(IAnimSequence* pSeq, [[maybe_unused]] unsigned l
{
m_cutsceneCount++;
IConsole* pCon = gEnv->pConsole;
if (m_cutsceneCount == 1)
{
gEnv->p3DEngine->ResetPostEffects();
@@ -548,8 +546,6 @@ void CViewSystem::EndCutScene(IAnimSequence* pSeq, [[maybe_unused]] unsigned lon
{
m_cutsceneCount -= (m_cutsceneCount > 0);
IConsole* pCon = gEnv->pConsole;
if (m_cutsceneCount == 0)
{
gEnv->p3DEngine->ResetPostEffects();
+6 -5
View File
@@ -273,7 +273,10 @@ void CWindowsConsole::OnInit(ISystem* pSystem)
m_pInputThread = new CWindowsConsoleInputThread(*this);
m_pInputThread->Start();
BOOL handlerInstalled = SetConsoleCtrlHandler(CtrlHandler, TRUE);
#if !defined(NDEBUG)
BOOL handlerInstalled =
#endif
SetConsoleCtrlHandler(CtrlHandler, TRUE);
CRY_ASSERT(handlerInstalled);
m_initialized = true;
@@ -670,7 +673,6 @@ void CWindowsConsole::DrawStatus()
// Current update rate and player count on the right.
const char* pMapName = m_pCVarSvMap->GetString();
const char* pGameRules = m_pCVarSvGameRules->GetString();
const char* pMissionName = m_pCVarSvMission ? m_pCVarSvMission->GetString() : "";
azsnprintf(bufferLeft, sizeof bufferLeft, " mission: %s map:%s", pMissionName, pMapName);
@@ -730,9 +732,7 @@ void CWindowsConsole::DrawStatus()
pStatusRight = "";
}
int leftWidth = strlen(pStatusLeft);
int rightWidth = strlen(pStatusRight);
int pad = 0;
m_statusBuffer.Clear();
m_statusBuffer.PutText(0, 0, pStatusLeft);
@@ -991,7 +991,8 @@ void CWindowsConsole::CCellBuffer::Print(const char* pInszText, SPosition& posit
break;
}
case '\\':
if (m_escape = !m_escape)
m_escape = !m_escape;
if (m_escape)
{
break;
}
@@ -31,10 +31,7 @@ static WCHAR szFR[] = L"\\System32\\FaultRep.dll";
WCHAR* GetFullPathToFaultrepDll(void)
{
CHAR* lpRet = NULL;
UINT rc;
rc = GetSystemWindowsDirectoryW(szPath, ARRAYSIZE(szPath));
UINT rc = GetSystemWindowsDirectoryW(szPath, ARRAYSIZE(szPath));
if (rc == 0 || rc > ARRAYSIZE(szPath) - ARRAYSIZE(szFR) - 1)
{
return NULL;
@@ -140,7 +137,7 @@ LONG WINAPI CryEngineExceptionFilterWER(struct _EXCEPTION_POINTERS* pExceptionPo
pfn_REPORTFAULT pfn = (pfn_REPORTFAULT)GetProcAddress(hFaultRepDll, "ReportFault");
if (pfn)
{
EFaultRepRetVal rc = pfn(pExceptionPointers, 0);
pfn(pExceptionPointers, 0);
lRet = EXCEPTION_EXECUTE_HANDLER;
}
FreeLibrary(hFaultRepDll);
+4 -6
View File
@@ -293,8 +293,6 @@ void ConsoleHide(IConsoleCmdArgs*)
void Bind(IConsoleCmdArgs* cmdArgs)
{
int count = cmdArgs->GetArgCount();
if (cmdArgs->GetArgCount() >= 3)
{
string arg;
@@ -2230,11 +2228,12 @@ void CXConsole::DisplayHelp(const char* help, const char* name)
else
{
char* start, * pos;
for (pos = (char*)help, start = (char*)help; pos = strstr(pos, "\n"); start = ++pos)
for (pos = strstr((char*)help, "\n"), start = (char*)help; pos; start = ++pos)
{
string s = start;
s.resize(pos - start);
ConsoleLogInputResponse(" $3%s", s.c_str());
pos = strstr(pos, "\n");
}
ConsoleLogInputResponse(" $3%s", start);
}
@@ -2507,7 +2506,7 @@ void CXConsole::ExecuteDeferredCommands()
// float curX = 10;
// float curY = 10;
IRenderer* pRenderer = gEnv->pRenderer;
//IRenderer* pRenderer = gEnv->pRenderer;
// Print the deferred messages
// it = m_deferredCommands.begin();
@@ -3532,9 +3531,8 @@ uint64 CXConsole::GetCheatVarHash()
void CXConsole::SetCheatVarHashRange(size_t firstVar, size_t lastVar)
{
// check inputs are sane
#ifndef _RELEASE
#if !defined(NDEBUG)
size_t numVars = GetNumCheatVars();
assert(firstVar < numVars && lastVar < numVars && lastVar >= firstVar);
#endif
@@ -344,8 +344,6 @@ string CXConsoleVariableCVarGroup::GetDetailedInfo() const
for (it2 = m_CVarGroupStates.begin(); it2 != end2; ++it2)
{
SCVarGroup* pGrp = it2->second;
sRet += GetValueSpec(rKey, &(it2->first));
sRet += "/";
}
@@ -559,7 +559,6 @@ bool LoadTableInner(const SParseParams& parseParams, XmlNodeRef& definition, Xml
}
}
const char* tag = definition->getTag();
if (parseParams.useAlways != (IXmlNode*)NULL)
{
assert(!definition->haveAttr("type"));
+2 -3
View File
@@ -390,9 +390,8 @@ void CXMLPatcher::DumpFiles(
{
CryLog("Dumping before and after data files for '%s'", pInXMLFileName);
const char* pOrigFileName;
if (pOrigFileName = strrchr(pInXMLFileName, '/'))
const char* pOrigFileName = strrchr(pInXMLFileName, '/');
if (pOrigFileName)
{
pOrigFileName++;
@@ -36,8 +36,6 @@ void CDeferredRenderUtils::CreateUnitFrustumMesh(int tessx, int tessy, t_arrDefe
float szx = 1.0f;
float szy = 1.0f;
float hsizex = szx / 2;
float hsizey = szy / 2;
float deltax = szx / (tessx - 1.0f);
float deltay = szy / (tessy - 1.0f);
@@ -169,8 +167,6 @@ void CDeferredRenderUtils::CreateUnitFrustumMeshTransformed(SRenderLight* pLight
float szx = 1.0f;
float szy = 1.0f;
float hsizex = szx / 2;
float hsizey = szy / 2;
float deltax = szx / (tessx - 1);
float deltay = szy / (tessy - 1);
@@ -254,10 +254,6 @@ void PerInstanceConstantBufferPool::SetConstantBuffer(SRendItem* renderItem)
m_CurrentRenderItem = renderItem;
AZ::u32 bufferIndex = directId / SPI_NUM_INSTS_PER_CB;
AZ::u32 itemIndex = directId % SPI_NUM_INSTS_PER_CB;
AZ::u32 first[1] = { itemIndex * static_cast<AZ::u32>(sizeof(HLSL_PerInstanceConstantBuffer)) };
AZ::u32 count[1] = { static_cast<AZ::u32>(sizeof(HLSL_PerInstanceConstantBuffer)) };
auto& deviceManager = gRenDev->m_DevMan;
@@ -316,4 +312,4 @@ void PerInstanceConstantBufferPool::UpdateConstantBuffer(ConstantUpdateCB consta
devManager.BindConstantBuffer(eHWSC_Vertex, m_UpdateIndirectConstantBuffer, eConstantBufferShaderSlot_SPIIndex);
devManager.BindConstantBuffer(eHWSC_Pixel, m_UpdateIndirectConstantBuffer, eConstantBufferShaderSlot_SPIIndex);
#endif
}
}

Some files were not shown because too many files have changed in this diff Show More