Integrating github/staging through commit ab87ed9
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,20 +104,6 @@ public:
|
||||
private:
|
||||
friend class CMotionBlurPass;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
//! Return the current buffer index to use (thread safe)
|
||||
static uint32_t GetCurrentBufferIndex()
|
||||
{
|
||||
return gRenDev->GetCameraFrameID() % s_maxObjectBuffers;
|
||||
}
|
||||
|
||||
//! Return the previous buffer index to use (thread safe)
|
||||
static uint32_t GetPrevBufferIndex()
|
||||
{
|
||||
return (gRenDev->GetCameraFrameID() + s_maxObjectBuffers - 1) % s_maxObjectBuffers;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
CEffectParam* m_pRadBlurAmount, * m_pRadBlurScreenPosX, * m_pRadBlurScreenPosY, * m_pRadBlurRadius;
|
||||
CEffectParam* m_pDirectionalBlurVec;
|
||||
|
||||
|
||||
@@ -47,22 +47,12 @@ bool SPostEffectsUtils::Create()
|
||||
{
|
||||
assert(gRenDev);
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// disregard size changes or texture creation for render scene to texture passes
|
||||
// or we will introduce texture create/delete thrashing
|
||||
if (gRenDev->m_RP.m_TI[gRenDev->m_RP.m_nProcessThreadID].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
const SViewport& MainVp = gRenDev->m_MainViewport;
|
||||
const bool bCreatePostAA = CRenderer::CV_r_AntialiasingMode && !CTexture::IsTextureExist(CTexture::s_ptexPrevBackBuffer[0][0]);
|
||||
//@NOTE: CV_r_watercaustics will be removed when the infinite ocean component feature toggle is removed.
|
||||
const bool bCreateCaustics = (CRenderer::CV_r_watervolumecaustics && CRenderer::CV_r_watercaustics) && !CTexture::IsTextureExist(CTexture::s_ptexWaterCaustics[0]);
|
||||
|
||||
static ICVar* DolbyCvar = gEnv->pConsole->GetCVar("r_HDRDolby");
|
||||
int DolbyCvarValue = DolbyCvar ? DolbyCvar->GetIVal() : eDVM_Disabled;
|
||||
|
||||
ETEX_Format nHDRReducedFormat = gRenDev->UseHalfFloatRenderTargets() ? eTF_R11G11B10F : eTF_R10G10B10A2;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ CRendElementBase* CREClientPoly::mfCopyConstruct(void)
|
||||
void CREClientPoly::mfPrepare(bool bCheckOverflow)
|
||||
{
|
||||
CRenderer* rd = gRenDev;
|
||||
CShader* ef = rd->m_RP.m_pShader;
|
||||
int i, n;
|
||||
|
||||
rd->m_RP.m_CurVFormat = eVF_P3F_C4B_T2F;
|
||||
|
||||
@@ -199,7 +199,6 @@ void* CREMeshImpl::mfGetPointer(ESrcPointer ePT, int* Stride, [[maybe_unused]] E
|
||||
|
||||
void CREMeshImpl::mfGetPlane(Plane& pl)
|
||||
{
|
||||
CRenderMesh* pRM = m_pRenderMesh->_GetVertexContainer();
|
||||
|
||||
// fixme: plane orientation based on biggest bbox axis
|
||||
Vec3 pMin, pMax;
|
||||
@@ -289,7 +288,6 @@ bool CREMeshImpl::mfPreDraw([[maybe_unused]] SShaderPass *sl)
|
||||
// Should never happen. Video buffer is missing
|
||||
if (!pRM->_HasVBStream(VSF_GENERAL) || !m_pRenderMesh->_HasIBStream())
|
||||
return false;
|
||||
CD3D9Renderer *rd = gcpRendD3D;
|
||||
|
||||
m_pRenderMesh->BindStreamsToRenderPipeline();
|
||||
|
||||
|
||||
@@ -121,9 +121,9 @@ bool CVolumeTexture::Update([[maybe_unused]] unsigned int width, [[maybe_unused]
|
||||
}
|
||||
|
||||
m_FrameIndex ^= m_FrameIndex;
|
||||
uint8_t* stagingData = GetCurrentStagingData();
|
||||
|
||||
#if !defined(NULL_RENDERER)
|
||||
uint8_t* stagingData = GetCurrentStagingData();
|
||||
unsigned int cpyWidth = min(width, m_width);
|
||||
unsigned int cpyHeight = min(height, m_height);
|
||||
unsigned int cpyDepth = min(depth, m_depth);
|
||||
|
||||
@@ -2039,7 +2039,7 @@ void CAuxGeomCB::RenderText(Vec3 pos, SDrawTextInfo& ti, const char* format, va
|
||||
{
|
||||
char str[512];
|
||||
|
||||
int written = vsnprintf_s(str, sizeof(str), sizeof(str) - 1, format, args);
|
||||
vsnprintf_s(str, sizeof(str), sizeof(str) - 1, format, args);
|
||||
str[sizeof(str) - 1] = '\0';
|
||||
gEnv->pRenderer->DrawTextQueued(pos, ti, str);
|
||||
}
|
||||
|
||||
@@ -527,8 +527,7 @@ inline bool CAuxGeomCB::IsThickLine(const SAuxGeomRenderFlags& renderFlags)
|
||||
|
||||
inline CAuxGeomCB::EAuxDrawObjType CAuxGeomCB::GetAuxObjType(const SAuxGeomRenderFlags& renderFlags)
|
||||
{
|
||||
EPrimType primType(GetPrimType(renderFlags));
|
||||
assert(e_Obj == primType);
|
||||
assert(e_Obj == GetPrimType(renderFlags));
|
||||
|
||||
uint32 objType((renderFlags.m_renderFlags & e_PrivateRenderflagsMask));
|
||||
switch (objType)
|
||||
|
||||
@@ -257,15 +257,18 @@ try_again:
|
||||
|
||||
static void FreeMeshInstanceData(void* ptr)
|
||||
{
|
||||
size_t size = 0u;
|
||||
if (s_MeshPool.m_MeshInstancePool && (size = s_MeshPool.m_MeshInstancePool->UsableSize(ptr)))
|
||||
if (s_MeshPool.m_MeshInstancePool)
|
||||
{
|
||||
size_t size = s_MeshPool.m_MeshInstancePool->UsableSize(ptr);
|
||||
if (size)
|
||||
{
|
||||
# if !defined(_RELEASE)
|
||||
AUTO_LOCK(s_MeshPool.m_MeshPoolCS);
|
||||
s_MeshPool.m_MeshDataPoolStats.nInstancePoolInUse -= size;
|
||||
AUTO_LOCK(s_MeshPool.m_MeshPoolCS);
|
||||
s_MeshPool.m_MeshDataPoolStats.nInstancePoolInUse -= size;
|
||||
# endif
|
||||
s_MeshPool.m_MeshInstancePool->Free(ptr);
|
||||
return;
|
||||
s_MeshPool.m_MeshInstancePool->Free(ptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
CryModuleMemalignFree(ptr);
|
||||
}
|
||||
@@ -646,7 +649,6 @@ void* CRenderMesh::LockVB(int nStream, uint32 nFlags, int nVerts, int* nStride,
|
||||
m_nFlags |= FRM_READYTOUPLOAD;
|
||||
|
||||
byte* pD;
|
||||
int nFrame = gRenDev->m_RP.m_TI[gRenDev->m_RP.m_nFillThreadID].m_nFrameUpdateID;
|
||||
|
||||
if (nFlags == FSL_SYSTEM_CREATE)
|
||||
{
|
||||
@@ -730,7 +732,8 @@ lSysUpdate:
|
||||
if (!MS->m_pLockedData)
|
||||
{
|
||||
MESSAGE_VIDEO_BUFFER_ACC_ATTEMPT;
|
||||
if (MS->m_pLockedData = gRenDev->m_DevBufMan.BeginRead(nVB))
|
||||
MS->m_pLockedData = gRenDev->m_DevBufMan.BeginRead(nVB);
|
||||
if (MS->m_pLockedData)
|
||||
{
|
||||
MS->m_nLockFlags |= FSL_LOCKED;
|
||||
}
|
||||
@@ -890,7 +893,8 @@ lSysUpdate:
|
||||
if (!m_IBStream.m_pLockedData)
|
||||
{
|
||||
MESSAGE_VIDEO_BUFFER_ACC_ATTEMPT;
|
||||
if (m_IBStream.m_pLockedData = gRenDev->m_DevBufMan.BeginRead(nIB))
|
||||
m_IBStream.m_pLockedData = gRenDev->m_DevBufMan.BeginRead(nIB);
|
||||
if (m_IBStream.m_pLockedData)
|
||||
{
|
||||
m_IBStream.m_nLockFlags |= FSL_LOCKED;
|
||||
}
|
||||
@@ -1826,7 +1830,6 @@ int CRenderMesh::GetRenderChunksCount(_smart_ptr<IMaterial> pMaterial, int& nRen
|
||||
int nCount = 0;
|
||||
nRenderTrisCount = 0;
|
||||
|
||||
CRenderer* rd = gRenDev;
|
||||
const uint32 ni = (uint32)m_Chunks.size();
|
||||
for (uint32 i = 0; i < ni; i++)
|
||||
{
|
||||
@@ -2425,7 +2428,6 @@ void CRenderMesh::BuildAdjacency(const byte* pVerts, const AZ::Vertex::Format& v
|
||||
std::vector<int> arrSortedVertIDs;
|
||||
// we allocate a bit more (by one) because we will need extra element for scan operation (lower)
|
||||
arrSortedVertIDs.resize(nVerts + 1);
|
||||
int* _iSortedVerts = &arrSortedVertIDs[0];
|
||||
for (int iv = 0; iv < nVerts; ++iv)
|
||||
{
|
||||
arrSortedVertIDs[iv] = iv;
|
||||
@@ -2472,7 +2474,6 @@ void CRenderMesh::BuildAdjacency(const byte* pVerts, const AZ::Vertex::Format& v
|
||||
{
|
||||
arrConnectedTrianglesCount[i] = 0;
|
||||
}
|
||||
int* _nConnectedTriangles = &arrConnectedTrianglesCount[0];
|
||||
for (int it = 0; it < nTrgs; ++it)
|
||||
{
|
||||
const vtx_idx* pTrg = &pIndexBuffer[it * 3];
|
||||
@@ -2695,7 +2696,6 @@ bool CRenderMesh::RT_CheckUpdate(CRenderMesh* pVContainer, uint32 nStreamMask, [
|
||||
else
|
||||
if (i != VSF_HWSKIN_INFO)
|
||||
{
|
||||
int nnn = 0;
|
||||
if (pMS->m_nID == ~0u)
|
||||
{
|
||||
return false;
|
||||
@@ -3042,7 +3042,6 @@ bool CRenderMesh::UpdateVidIndices(SMeshStream& IBStream, [[maybe_unused]] bool
|
||||
UnlockIndexStream();
|
||||
if (m_IBStream.m_pUpdateData)
|
||||
{
|
||||
bool bRes = true;
|
||||
return gRenDev->m_DevBufMan.UpdateBuffer(IBStream.m_nID, IBStream.m_pUpdateData, m_nInds * sizeof(vtx_idx));
|
||||
}
|
||||
}
|
||||
@@ -3055,7 +3054,6 @@ bool CRenderMesh::CreateVidVertices(int nStream)
|
||||
AZ_TRACE_METHOD();
|
||||
|
||||
SREC_AUTO_LOCK(m_sResLock);
|
||||
CRenderer* pRend = gRenDev;
|
||||
|
||||
if (gRenDev->m_bDeviceLost)
|
||||
{
|
||||
@@ -3342,7 +3340,6 @@ void CRenderMesh::AddRenderElements(_smart_ptr<IMaterial> pIMatInfo, CRenderObje
|
||||
|
||||
if (gRenDev->m_pDefaultMaterial && gRenDev->m_pTerrainDefaultMaterial)
|
||||
{
|
||||
IShader* pShader = pIMatInfo->GetShaderItem().m_pShader;
|
||||
pIMatInfo = gRenDev->m_pDefaultMaterial;
|
||||
}
|
||||
|
||||
@@ -3800,7 +3797,6 @@ void CRenderMesh::UpdateBBoxFromMesh()
|
||||
|
||||
int nVertCount = _GetVertexContainer()->GetVerticesCount();
|
||||
int nPosStride = 0;
|
||||
int nIndCount = GetIndicesCount();
|
||||
const byte* pPositions = GetPosPtr(nPosStride, FSL_READ);
|
||||
const vtx_idx* pIndices = GetIndexPtr(FSL_READ);
|
||||
|
||||
@@ -4050,7 +4046,8 @@ void CRenderMesh::GetRandomPos(PosNorm& ran, EGeomForm eForm, SSkinningData cons
|
||||
LockForThreadAccess();
|
||||
|
||||
SkinnedPosNormData vdata;
|
||||
if (vdata.aPos.data = (Vec3*)GetPosPtr(vdata.aPos.iStride, FSL_READ))
|
||||
vdata.aPos.data = (Vec3*)GetPosPtr(vdata.aPos.iStride, FSL_READ);
|
||||
if (vdata.aPos.data)
|
||||
{
|
||||
// Check possible sources for normals.
|
||||
#if ENABLE_NORMALSTREAM_SUPPORT
|
||||
@@ -4066,7 +4063,8 @@ void CRenderMesh::GetRandomPos(PosNorm& ran, EGeomForm eForm, SSkinningData cons
|
||||
|
||||
vtx_idx* pInds = GetIndexPtr(FSL_READ);
|
||||
|
||||
if (vdata.pSkinningData = pSkinning)
|
||||
vdata.pSkinningData = pSkinning;
|
||||
if (vdata.pSkinningData)
|
||||
{
|
||||
GetStridedArray(vdata.aSkinning, VSF_HWSKIN_INFO);
|
||||
#if SKIN_MORPHING
|
||||
@@ -4568,7 +4566,6 @@ void CRenderMesh::UpdateModified()
|
||||
void CRenderMesh::Tick()
|
||||
{
|
||||
ASSERT_IS_RENDER_THREAD(gRenDev->m_pRT)
|
||||
bool bKeepSystem = false;
|
||||
const threadID threadId = gRenDev->m_pRT->IsMultithreaded() ? gRenDev->m_RP.m_nProcessThreadID : threadID(1);
|
||||
int nFrame = gRenDev->m_RP.m_TI[gRenDev->m_RP.m_nProcessThreadID].m_nFrameUpdateID;
|
||||
|
||||
@@ -5135,7 +5132,6 @@ void CRenderMesh::BindStreamsToRenderPipeline()
|
||||
bool CRenderMesh::GetRemappedSkinningData([[maybe_unused]] uint32 guid, [[maybe_unused]] CRendElementBase::SGeometryStreamInfo &streamInfo)
|
||||
{
|
||||
#if !defined(NULL_RENDERER)
|
||||
CD3D9Renderer *rd = gcpRendD3D;
|
||||
size_t offset = 0;
|
||||
const void *pVB = 0;
|
||||
|
||||
|
||||
@@ -398,7 +398,6 @@ void SMeshSubSetIndicesJobEntry::CreateSubSetRenderMesh()
|
||||
|
||||
|
||||
pSrcMesh->LockForThreadAccess();
|
||||
int nIndCount = pSrcMesh->GetIndicesCount();
|
||||
if (vtx_idx* pInds = pSrcMesh->GetIndexPtr(FSL_READ))
|
||||
{
|
||||
TRenderChunkArray newChunks;
|
||||
|
||||
@@ -522,10 +522,6 @@ enum EBatchFlags
|
||||
#define RBPF_ENCODE_HDR (1 << 29)
|
||||
#define RBPF_OBLIQUE_FRUSTUM_CLIPPING (1 << 30)
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
#define RBPF_RENDER_SCENE_TO_TEXTURE (1 << 31)
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
|
||||
// m_RP.m_PersFlags1
|
||||
#define RBPF1_USESTREAM (1 << 0)
|
||||
|
||||
@@ -2628,7 +2628,6 @@ void SRenderThread::ProcessCommands(bool loadTimeProcessing)
|
||||
int flags = ReadCommand<int>(n);
|
||||
float fGround = ReadCommand<float>(n);
|
||||
|
||||
int d = *(int*)&m_Commands[threadId][n];
|
||||
|
||||
Vec3* pv = (Vec3*)&m_Commands[threadId][n += 4];
|
||||
n += nump * sizeof(Vec3);
|
||||
|
||||
@@ -26,7 +26,6 @@ CRenderView::~CRenderView()
|
||||
|
||||
void CRenderView::ClearRenderItems()
|
||||
{
|
||||
int nR = 0;
|
||||
|
||||
for (int i = 0; i < MAX_LIST_ORDER; i++)
|
||||
{
|
||||
|
||||
@@ -44,25 +44,6 @@ public:
|
||||
static CRenderView* CurrentFillView() { return gRenDev->m_RP.m_pCurrentFillView; }
|
||||
static CRenderView* GetRenderViewForThread(int thread) { return gRenDev->GetRenderViewForThread(thread); }
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
int GetWidth() const
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
int GetHeight() const
|
||||
{
|
||||
return m_height;
|
||||
}
|
||||
void SetWidth(int width)
|
||||
{
|
||||
m_width = width;
|
||||
}
|
||||
void SetHeight(int height)
|
||||
{
|
||||
m_height = height;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
private:
|
||||
CThreadSafeWorkerContainer<SRendItem> m_renderItems[MAX_LIST_ORDER][EFSLIST_NUM];
|
||||
|
||||
@@ -75,12 +56,6 @@ private:
|
||||
CCamera m_camera; // Current camera
|
||||
CameraViewParameters m_viewParameters;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
//! width and height of this view
|
||||
int m_width;
|
||||
int m_height;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<CRenderView> CRenderViewPtr;
|
||||
|
||||
@@ -37,10 +37,6 @@
|
||||
#include <LoadScreenBus.h>
|
||||
#include <IVideoRenderer.h>
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
#include <RTT/RTTContextManager.h>
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
|
||||
#include "RendElements/OpticsFactory.h"
|
||||
|
||||
#include "GraphicsPipeline/FurBendData.h"
|
||||
@@ -624,12 +620,6 @@ AllocateConstIntCVar(CRenderer, CV_r_PostProcessGameFx);
|
||||
|
||||
int CRenderer::CV_r_colorRangeCompression;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
int CRenderer::CV_r_FinalOutputsRGB;
|
||||
int CRenderer::CV_r_FinalOutputAlpha;
|
||||
int CRenderer::CV_r_RTT;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
int CRenderer::CV_r_colorgrading;
|
||||
int CRenderer::CV_r_colorgrading_selectivecolor;
|
||||
AllocateConstIntCVar(CRenderer, CV_r_colorgrading_levels);
|
||||
@@ -654,7 +644,6 @@ AllocateConstIntCVar(CRenderer, CV_r_graphstyle);
|
||||
AllocateConstIntCVar(CRenderer, CV_r_showbufferusage);
|
||||
|
||||
ICVar* CRenderer::CV_r_ShaderCompilerServer;
|
||||
ICVar* CRenderer::CV_r_ShaderCompilerFolderSuffix;
|
||||
ICVar* CRenderer::CV_r_ShaderEmailTags;
|
||||
ICVar* CRenderer::CV_r_ShaderEmailCCs;
|
||||
int CRenderer::CV_r_ShaderCompilerPort;
|
||||
@@ -1254,11 +1243,9 @@ static void OnChange_CV_r_CubeDepthMapResolution(ICVar* /*pCVar*/)
|
||||
{
|
||||
}
|
||||
|
||||
static void OnChange_CV_r_SkipRenderComposites(ICVar* pCVar)
|
||||
static void OnChange_CV_r_SkipRenderComposites([[maybe_unused]] ICVar* pCVar)
|
||||
{
|
||||
int value = pCVar->GetIVal();
|
||||
|
||||
AZ_Warning("Rendering", value == 0 || (value == 1 && CRenderer::CV_r_flares == 0), "r_SkipRenderComposites was set to 1 while r_Flares was enabled, setting r_Flares to 0.");
|
||||
AZ_Warning("Rendering", pCVar->GetIVal() == 0 || (pCVar->GetIVal() == 1 && CRenderer::CV_r_flares == 0), "r_SkipRenderComposites was set to 1 while r_Flares was enabled, setting r_Flares to 0.");
|
||||
CRenderer::CV_r_flares = 0;
|
||||
}
|
||||
|
||||
@@ -1530,9 +1517,6 @@ void RendererAssetListener::OnFileChanged(AZStd::string assetName)
|
||||
|
||||
CRenderer::CRenderer()
|
||||
: m_assetListener(this)
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
, m_contextManager(new AzRTT::RenderContextManager())
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
{
|
||||
static_assert(LegacyInternal::JobExecutorPool::NumPools == AZ_ARRAY_SIZE(CRenderer::m_SkinningDataPool), "JobExecutorPool and Skinning data pool size mismatch");
|
||||
CCryNameR::CreateNameTable();
|
||||
@@ -2394,10 +2378,6 @@ void CRenderer::InitRenderer()
|
||||
"Usage: r_ShaderCompilerServer 127.0.0.1 \n"
|
||||
"Default is 127.0.0.1 ");
|
||||
|
||||
CV_r_ShaderCompilerFolderSuffix = REGISTER_STRING("r_ShaderCompilerFolderSuffix", "", VF_NULL,
|
||||
"Usage: r_ShaderCompilerFolderSuffix suffix \n"
|
||||
"Default is empty. Set to some other value to append this suffix to the project name when compiling shaders");
|
||||
|
||||
{
|
||||
const SFileVersion& ver = gEnv->pSystem->GetFileVersion();
|
||||
|
||||
@@ -2481,23 +2461,6 @@ void CRenderer::InitRenderer()
|
||||
"Enabled Merging of RenderChunks for ShadowRendering\n"
|
||||
"Default is 1 (enabled). 0 disabled");
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
REGISTER_CVAR3("r_FinalOutputsRGB", CV_r_FinalOutputsRGB, 1, VF_NULL,
|
||||
"Enables sRGB final output.\n"
|
||||
"Usage: r_FinalOutputsRGB [0/1]");
|
||||
|
||||
REGISTER_CVAR3("r_FinalOutputAlpha", CV_r_FinalOutputAlpha, 0, VF_NULL,
|
||||
"Enables alpha in final output. 0\n"
|
||||
"Usage: r_FinalOutputAlpha [0/1/2]\n"
|
||||
"Usage: r_FinalOutputAlpha = 0: no alpha (default)\n"
|
||||
"Usage: r_FinalOutputAlpha = 1: full opaque\n"
|
||||
"Usage: r_FinalOutputAlpha = 2: depth-based\n");
|
||||
|
||||
REGISTER_CVAR3("r_RTT", CV_r_RTT, 1, VF_NULL,
|
||||
"Enables render scene to texture. \n"
|
||||
"Usage: r_RTT [0/1]\n");
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
REGISTER_CVAR3("r_ColorRangeCompression", CV_r_colorRangeCompression, 0, VF_NULL,
|
||||
"Enables color range compression to account for the limited RGB range of TVs.\n"
|
||||
" 0: Disabled (full extended range)\n"
|
||||
@@ -3974,12 +3937,6 @@ void CRenderer::PostInit()
|
||||
|
||||
// Initialize asset messaging listener
|
||||
m_assetListener.Connect();
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
if (m_contextManager)
|
||||
{
|
||||
m_contextManager->Init();
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
|
||||
#if !defined(NULL_RENDERER)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -4008,10 +3965,6 @@ void CRenderer::Release()
|
||||
{
|
||||
m_assetListener.Disconnect();
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
m_contextManager = nullptr;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
|
||||
// Reminder for Andrey/AntonKap: this needs to be properly handled
|
||||
//SAFE_DELETE(g_pSDynTexture_PoolAlloc)
|
||||
//g_pSDynTexture_PoolAlloc = NULL;
|
||||
@@ -4246,14 +4199,6 @@ void CRenderer::WriteXY(int x, int y, float xscale, float yscale, float r, float
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CRenderer::DrawTextQueued(Vec3 pos, SDrawTextInfo& ti, const char* text)
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
// don't add debug text from the render to texture pass
|
||||
return;
|
||||
}
|
||||
#endif // AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
int nT = m_pRT->GetThreadList();
|
||||
if (text && !gEnv->IsDedicated())
|
||||
{
|
||||
@@ -4268,14 +4213,6 @@ void CRenderer::DrawTextQueued(Vec3 pos, SDrawTextInfo& ti, const char* text)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CRenderer::DrawTextQueued(Vec3 pos, SDrawTextInfo& ti, const char* format, va_list args)
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
// don't add debug text from the render to texture pass
|
||||
return;
|
||||
}
|
||||
#endif // AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
int nT = m_pRT->GetThreadList();
|
||||
if (format && !gEnv->IsDedicated())
|
||||
{
|
||||
@@ -4297,14 +4234,6 @@ void CRenderer::EF_RenderTextMessages()
|
||||
{
|
||||
ASSERT_IS_MAIN_THREAD(m_pRT)
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
// don't draw debug text in the render to texture pass
|
||||
return;
|
||||
}
|
||||
#endif // AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
CTextMessages& textMessage = m_TextMessages[m_RP.m_nFillThreadID];
|
||||
if (!textMessage.empty())
|
||||
{
|
||||
@@ -4456,14 +4385,6 @@ void CRenderer::RT_RenderTextMessages()
|
||||
FUNCTION_PROFILER_LEGACYONLY(GetISystem(), PROFILE_RENDERER);
|
||||
AZ_TRACE_METHOD();
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
// don't draw debug text in the render to texture pass
|
||||
return;
|
||||
}
|
||||
#endif // AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
int nT = m_pRT->GetThreadList();
|
||||
|
||||
if (gEnv->IsDedicated() || (m_pRT && m_pRT->m_eVideoThreadMode != SRenderThread::eVTM_Disabled))
|
||||
@@ -6617,7 +6538,6 @@ void CRenderer::EF_QueryImpl(ERenderQueryTypes eQuery, void* pInOut0, uint32 nIn
|
||||
{
|
||||
nCurMip = 0;
|
||||
}
|
||||
int nMips = tp->GetNumMipsNonVirtual();
|
||||
nCurMip = min(nCurMip, nPersMip);
|
||||
|
||||
int nTexSize = tp->StreamComputeDevDataSize(nCurMip);
|
||||
@@ -6672,16 +6592,7 @@ void CRenderer::EF_QueryImpl(ERenderQueryTypes eQuery, void* pInOut0, uint32 nIn
|
||||
|
||||
case EFQ_GetFogCullDistance:
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// only return the culling distance for the main camera, this helps
|
||||
// prevent r_displayinfo flickering
|
||||
if (!IsRenderToTextureActive())
|
||||
{
|
||||
WriteQueryResult(pInOut0, nInOutSize0, m_fogCullDistance);
|
||||
}
|
||||
#else
|
||||
WriteQueryResult(pInOut0, nInOutSize0, m_fogCullDistance);
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -8648,55 +8559,3 @@ int CRenderer::GetDrawCallsPerNode(IRenderNode* pRenderNode)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
bool CRenderer::IsRenderToTextureActive() const
|
||||
{
|
||||
return ((m_RP.m_TI[m_pRT->GetThreadList()].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE) != 0);
|
||||
}
|
||||
|
||||
int CRenderer::GetWidth() const
|
||||
{
|
||||
return IsRenderToTextureActive() ? m_RP.m_pRenderViews[m_pRT->GetThreadList()]->GetWidth() : m_width;
|
||||
}
|
||||
|
||||
void CRenderer::SetWidth(int width)
|
||||
{
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
m_RP.m_pRenderViews[m_pRT->GetThreadList()]->SetWidth(width);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_width = width;
|
||||
}
|
||||
}
|
||||
|
||||
int CRenderer::GetHeight() const
|
||||
{
|
||||
return IsRenderToTextureActive() ? m_RP.m_pRenderViews[m_pRT->GetThreadList()]->GetHeight() : m_height;
|
||||
}
|
||||
|
||||
void CRenderer::SetHeight(int height)
|
||||
{
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
m_RP.m_pRenderViews[m_pRT->GetThreadList()]->SetHeight(height);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_height = height;
|
||||
}
|
||||
}
|
||||
|
||||
int CRenderer::GetOverlayWidth() const
|
||||
{
|
||||
return IsRenderToTextureActive() ? m_RP.m_pRenderViews[m_pRT->GetThreadList()]->GetWidth() : m_nativeWidth;
|
||||
}
|
||||
|
||||
int CRenderer::GetOverlayHeight() const
|
||||
{
|
||||
return IsRenderToTextureActive() ? m_RP.m_pRenderViews[m_pRT->GetThreadList()]->GetHeight() : m_nativeHeight;
|
||||
}
|
||||
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
@@ -25,13 +25,6 @@
|
||||
|
||||
#include <LoadScreenBus.h>
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
namespace AzRTT
|
||||
{
|
||||
class RenderContextManager;
|
||||
}
|
||||
#endif // AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#undef AZ_RESTRICTED_SECTION
|
||||
#define RENDERER_H_SECTION_1 1
|
||||
@@ -919,8 +912,8 @@ public:
|
||||
|
||||
virtual void GetCurrentNumberOfDrawCalls([[maybe_unused]] int& nGeneral, [[maybe_unused]] int& nShadowGen) const
|
||||
{
|
||||
int nDIPs = 0;
|
||||
#if defined(ENABLE_PROFILING_CODE)
|
||||
int nDIPs = 0;
|
||||
int nThr = m_pRT->GetThreadList();
|
||||
for (int i = 0; i < EFSLIST_NUM; i++)
|
||||
{
|
||||
@@ -1151,17 +1144,6 @@ public:
|
||||
ScaleCoordInternal(x, y);
|
||||
}
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
bool IsRenderToTextureActive() const override;
|
||||
|
||||
int GetWidth() const override;
|
||||
void SetWidth(int width);
|
||||
int GetHeight() const override;
|
||||
void SetHeight(int height);
|
||||
|
||||
int GetOverlayWidth() const override;
|
||||
int GetOverlayHeight() const override;
|
||||
#else
|
||||
void SetWidth(int nW) { m_width = nW; }
|
||||
void SetHeight(int nH) { m_height = nH; }
|
||||
|
||||
@@ -1170,7 +1152,6 @@ public:
|
||||
|
||||
virtual int GetOverlayWidth() const { return m_nativeWidth; }
|
||||
virtual int GetOverlayHeight() const { return m_nativeHeight; }
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
void SetPixelAspectRatio(float fPAR) {m_pixelAspectRatio = fPAR; }
|
||||
virtual float GetPixelAspectRatio() const { return (m_pixelAspectRatio); }
|
||||
@@ -1250,16 +1231,6 @@ public:
|
||||
|
||||
virtual void GetLogVBuffers() = 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
|
||||
{
|
||||
const int nThreadID = m_pRT ? m_pRT->GetThreadList() : 0;
|
||||
return m_RP.m_TI[nThreadID].m_cam.GetFrameUpdateId();
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
virtual int GetFrameID(bool bIncludeRecursiveCalls = true)
|
||||
{
|
||||
int nThreadID = m_pRT ? m_pRT->GetThreadList() : 0;
|
||||
@@ -1973,7 +1944,6 @@ public:
|
||||
static ICVar* CV_r_ShowDynTexturesFilter;
|
||||
static ICVar* CV_r_ShaderCompilerServer;
|
||||
static int CV_r_AssetProcessorShaderCompiler; // If true, will forward requests for shader compilation to the Asset Processor instead of the server directly.
|
||||
static ICVar* CV_r_ShaderCompilerFolderSuffix;
|
||||
static ICVar* CV_r_ShaderEmailTags;
|
||||
static ICVar* CV_r_ShaderEmailCCs;
|
||||
static ICVar* CV_r_excludeshader;
|
||||
@@ -2221,11 +2191,6 @@ public:
|
||||
static int CV_r_PostProcess;
|
||||
DeclareStaticConstIntCVar(CV_r_PostProcessFilters, 1);
|
||||
DeclareStaticConstIntCVar(CV_r_PostProcessGameFx, 1);
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
static int CV_r_FinalOutputsRGB;
|
||||
static int CV_r_FinalOutputAlpha;
|
||||
static int CV_r_RTT;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
static int CV_r_colorgrading;
|
||||
DeclareStaticConstIntCVar(CV_r_colorgrading_levels, 1);
|
||||
DeclareStaticConstIntCVar(CV_r_colorgrading_filters, 1);
|
||||
@@ -2760,10 +2725,6 @@ private:
|
||||
RendererAssetListener m_assetListener;
|
||||
|
||||
unsigned long m_nvidiaDriverVersion = 0;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
AZStd::unique_ptr<AzRTT::RenderContextManager> m_contextManager;
|
||||
#endif // AZ_RENDER_TO_TEXTURE_GEM_ENABLED && !defined(NULL_RENDERER)
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -251,7 +251,6 @@ void CRenderer::EF_AddEf_NotVirtual([[maybe_unused]] IRenderElement* re, [[maybe
|
||||
// Need to differentiate between something rendered with cloak layer material, and sorted with cloak.
|
||||
// e.g. ironsight glows on gun should be sorted with cloak to not write depth - can be inconsistent with no depth from gun.
|
||||
|
||||
SThreadInfo& RESTRICT_REFERENCE rTI = m_RP.m_TI[nThreadID];
|
||||
|
||||
// store AABBs for all FOB_NEAREST objects for r_DrawNearest
|
||||
// TODO (bethelz) TRENDRIL: Remove draw nearest shadow hackery.
|
||||
@@ -498,9 +497,8 @@ void CRenderer::GetFogVolumeContribution(uint16 idx, SFogVolumeData& fogVolData
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
uint32 CRenderer::EF_BatchFlags(SShaderItem& SH, CRenderObject* pObj, IRenderElement* renderElement, const SRenderingPassInfo& passInfo)
|
||||
uint32 CRenderer::EF_BatchFlags(SShaderItem& SH, CRenderObject* pObj, [[maybe_unused]] IRenderElement* renderElement, const SRenderingPassInfo& passInfo)
|
||||
{
|
||||
CRendElementBase* re = static_cast<CRendElementBase*>(renderElement);
|
||||
|
||||
uint32 nFlags = SH.m_nPreprocessFlags & FB_MASK;
|
||||
SShaderTechnique* const __restrict pTech = SH.GetTechnique();
|
||||
@@ -982,14 +980,6 @@ void CMotionBlur::SetupObject(CRenderObject* renderObject, const SRenderingPassI
|
||||
|
||||
uint32 fillThreadId = passInfo.ThreadID();
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// Motion blur is not yet supported in RTT passes
|
||||
if (passInfo.IsRenderSceneToTexturePass())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
if (passInfo.IsRecursivePass())
|
||||
{
|
||||
return;
|
||||
@@ -1004,13 +994,8 @@ void CMotionBlur::SetupObject(CRenderObject* renderObject, const SRenderingPassI
|
||||
renderObject->m_ObjFlags &= ~FOB_HAS_PREVMATRIX;
|
||||
if (renderObjectData->m_uniqueObjectId != 0 && renderObject->m_fDistance < CRenderer::CV_r_MotionBlurMaxViewDist)
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const AZ::u32 currentFrameId = gRenDev->GetCameraFrameID();
|
||||
const AZ::u32 bufferIndex = GetCurrentBufferIndex();
|
||||
#else
|
||||
const AZ::u32 currentFrameId = passInfo.GetMainFrameID();
|
||||
const AZ::u32 bufferIndex = (currentFrameId) % CMotionBlur::s_maxObjectBuffers;
|
||||
#endif
|
||||
const uintptr_t objectId = renderObjectData ? renderObjectData->m_uniqueObjectId : 0;
|
||||
if (!m_Objects[bufferIndex])
|
||||
{
|
||||
@@ -1020,11 +1005,7 @@ void CMotionBlur::SetupObject(CRenderObject* renderObject, const SRenderingPassI
|
||||
auto currentIt = m_Objects[bufferIndex]->find(objectId);
|
||||
if (currentIt != m_Objects[bufferIndex]->end())
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const AZ::u32 lastBufferIndex = GetPrevBufferIndex();
|
||||
#else
|
||||
const AZ::u32 lastBufferIndex = (currentFrameId - 1) % CMotionBlur::s_maxObjectBuffers;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
auto historyIt = m_Objects[lastBufferIndex]->find(objectId);
|
||||
if (historyIt != m_Objects[lastBufferIndex]->end())
|
||||
@@ -1090,7 +1071,6 @@ void SRendItem::mfSortByLight(SRendItem* First, int Num, bool bSort, const bool
|
||||
void SRendItem::mfSortByDist(SRendItem* First, int Num, bool bDecals, bool InvertedOrder)
|
||||
{
|
||||
//Note: Temporary use stable sort for flickering hair (meshes within the same skin attachment don't have a deterministic sort order)
|
||||
CRenderer* r = gRenDev;
|
||||
int i;
|
||||
if (!bDecals)
|
||||
{
|
||||
|
||||
@@ -534,7 +534,10 @@ bool CResFile::mfPrepareDir()
|
||||
}
|
||||
else
|
||||
{
|
||||
int nRes = mfLoadDir(m_pStreamInfo);
|
||||
#ifndef NDEBUG
|
||||
int nRes =
|
||||
#endif
|
||||
mfLoadDir(m_pStreamInfo);
|
||||
assert(nRes);
|
||||
}
|
||||
|
||||
|
||||
@@ -560,7 +560,8 @@ public:
|
||||
{
|
||||
CryComment("Load System Shader (refresh) '%s'...", szName);
|
||||
|
||||
if (pSysShader = mfForName(szName, EF_SYSTEM))
|
||||
pSysShader = mfForName(szName, EF_SYSTEM);
|
||||
if (pSysShader)
|
||||
{
|
||||
if (pSysShader->m_Flags & EF_NOTFOUND)
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ bool fxIsFirstPass(char* buf)
|
||||
char* s = com;
|
||||
while (*s != 0)
|
||||
{
|
||||
char* pStart = fxFillPr(&s, tok);
|
||||
fxFillPr(&s, tok);
|
||||
if (tok[0] == '%' && tok[1] == '_')
|
||||
{
|
||||
return false;
|
||||
@@ -328,7 +328,10 @@ float shGetFloat(const char* buf)
|
||||
}
|
||||
float f = 0;
|
||||
|
||||
int res = azsscanf(buf, "%f", &f);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(buf, "%f", &f);
|
||||
assert(res);
|
||||
|
||||
return f;
|
||||
@@ -365,12 +368,18 @@ int shGetInt(const char* buf)
|
||||
|
||||
if (buf[0] == '0' && buf[1] == 'x')
|
||||
{
|
||||
int res = azsscanf(&buf[2], "%x", &i);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(&buf[2], "%x", &i);
|
||||
assert(res);
|
||||
}
|
||||
else
|
||||
{
|
||||
int res = azsscanf(buf, "%i", &i);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(buf, "%i", &i);
|
||||
assert(res);
|
||||
}
|
||||
|
||||
@@ -384,8 +393,10 @@ int shGetHex(const char* buf)
|
||||
return 0;
|
||||
}
|
||||
int i = 0;
|
||||
|
||||
int res = azsscanf(buf, "%x", &i);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(buf, "%x", &i);
|
||||
assert(res);
|
||||
|
||||
return i;
|
||||
@@ -399,12 +410,18 @@ uint64 shGetHex64(const char* buf)
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
unsigned long long i = 0;
|
||||
int res = azsscanf(buf, "%llx", &i);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(buf, "%llx", &i);
|
||||
assert(res);
|
||||
return (uint64)i;
|
||||
#else
|
||||
uint64 i = 0;
|
||||
int res = azsscanf(buf, "%I64x", &i);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(buf, "%I64x", &i);
|
||||
assert(res);
|
||||
return i;
|
||||
#endif
|
||||
@@ -416,7 +433,10 @@ void shGetVector(char* buf, Vec3& v)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int res = azsscanf(buf, "%f %f %f", &v[0], &v[1], &v[2]);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(buf, "%f %f %f", &v[0], &v[1], &v[2]);
|
||||
assert(res);
|
||||
}
|
||||
|
||||
@@ -426,7 +446,10 @@ void shGetVector(char* buf, float v[3])
|
||||
{
|
||||
return;
|
||||
}
|
||||
int res = azsscanf(buf, "%f %f %f", &v[0], &v[1], &v[2]);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(buf, "%f %f %f", &v[0], &v[1], &v[2]);
|
||||
assert(res);
|
||||
}
|
||||
|
||||
@@ -436,7 +459,10 @@ void shGetVector4(char* buf, Vec4& v)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int res = azsscanf(buf, "%f %f %f %f", &v.x, &v.y, &v.z, &v.w);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(buf, "%f %f %f %f", &v.x, &v.y, &v.z, &v.w);
|
||||
assert(res);
|
||||
}
|
||||
|
||||
@@ -806,7 +832,8 @@ void SkipComments(char** buf, bool bSkipWhiteSpace)
|
||||
int n;
|
||||
static int m;
|
||||
|
||||
while (n = IsComment(buf))
|
||||
n = IsComment(buf);
|
||||
while (n)
|
||||
{
|
||||
switch (n)
|
||||
{
|
||||
@@ -856,6 +883,7 @@ void SkipComments(char** buf, bool bSkipWhiteSpace)
|
||||
}
|
||||
break;
|
||||
}
|
||||
n = IsComment(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1026,17 +1054,15 @@ bool fxCheckMacroses(char** str, int nPass)
|
||||
bool fxIgnorePreprBlock(char** buf)
|
||||
{
|
||||
int nLevel = 0;
|
||||
char* start = *buf;
|
||||
bool bEnded = false;
|
||||
SkipCharacters (buf, kWhiteSpace);
|
||||
SkipComments(buf, true);
|
||||
PREFAST_SUPPRESS_WARNING(6011)
|
||||
while (**buf != 0)
|
||||
{
|
||||
char ch;
|
||||
while ((ch = **buf) && SkipChar((unsigned)ch))
|
||||
char ch = **buf;
|
||||
while (ch && SkipChar((unsigned)ch))
|
||||
{
|
||||
char* b = *buf;
|
||||
while ((ch = **buf) != 0)
|
||||
{
|
||||
if (ch == '/' && IsComment(buf))
|
||||
@@ -1050,8 +1076,8 @@ bool fxIgnorePreprBlock(char** buf)
|
||||
++*buf;
|
||||
}
|
||||
SkipComments(buf, true);
|
||||
ch = **buf;
|
||||
}
|
||||
int n = 0;
|
||||
char* posS = *buf;
|
||||
char* st = posS;
|
||||
PREFAST_ASSUME(posS);
|
||||
@@ -1097,7 +1123,8 @@ bool fxIgnorePreprBlock(char** buf)
|
||||
*buf = posS + 4;
|
||||
}
|
||||
}
|
||||
while ((ch = **buf))
|
||||
ch = **buf;
|
||||
while (ch)
|
||||
{
|
||||
if (ch == '/' && IsComment(buf))
|
||||
{
|
||||
@@ -1108,6 +1135,7 @@ bool fxIgnorePreprBlock(char** buf)
|
||||
break;
|
||||
}
|
||||
++*buf;
|
||||
ch = **buf;
|
||||
}
|
||||
}
|
||||
PREFAST_ASSUME(*buf);
|
||||
|
||||
@@ -1414,7 +1414,6 @@ static void sCR(TArray<char>& Text, int nLevel)
|
||||
|
||||
bool CParserBin::CorrectScript(uint32* pTokens, uint32& i, uint32 nT, TArray<char>& Text)
|
||||
{
|
||||
bool bRes = true;
|
||||
|
||||
int nTex = Text.Num() - 1;
|
||||
int nTT = nTex;
|
||||
@@ -1453,7 +1452,6 @@ bool CParserBin::ConvertToAscii(uint32* pTokens, uint32 nT, FXShaderToken& Table
|
||||
uint32 i;
|
||||
bool bRes = true;
|
||||
|
||||
const char* szPrev = " ";
|
||||
int nLevel = 0;
|
||||
for (i = 0; i < nT; i++)
|
||||
{
|
||||
@@ -1635,7 +1633,6 @@ bool CParserBin::IgnorePreprocessBlock(const uint32* pTokens, uint32& nT, int nM
|
||||
{
|
||||
int nLevel = 0;
|
||||
bool bEnded = false;
|
||||
int nTFirst = nT;
|
||||
while (*pTokens != 0)
|
||||
{
|
||||
if ((int)nT >= nMaxTokens)
|
||||
@@ -1974,7 +1971,6 @@ bool CParserBin::PreprocessTokens(ShaderTokensVec& Tokens, int nPass, PodArray<u
|
||||
break;
|
||||
case eT_undefine:
|
||||
{
|
||||
uint32 nMacro = 0;
|
||||
nTokenParam = pTokens[nT++];
|
||||
int n = nPass;
|
||||
FXMacroBinItor it = m_Macros[nPass].find(nTokenParam);
|
||||
@@ -2416,14 +2412,15 @@ int32 CParserBin::FindToken(uint32 nStart, uint32 nLast, const uint32* pToks)
|
||||
while (nStart <= nLast)
|
||||
{
|
||||
int n = 0;
|
||||
uint32 nTok;
|
||||
while (nTok = pToks[n])
|
||||
uint32 nTok = pToks[n];
|
||||
while (nTok)
|
||||
{
|
||||
if (pTokens[nStart] == nTok)
|
||||
{
|
||||
return nStart;
|
||||
}
|
||||
n++;
|
||||
nTok = pToks[n];
|
||||
}
|
||||
nStart++;
|
||||
}
|
||||
@@ -2467,7 +2464,6 @@ int CParserBin::GetNextToken(uint32& nStart, ETokenStorageClass& nTokenStorageCl
|
||||
}
|
||||
|
||||
nStart = m_CurFrame.m_nCurToken;
|
||||
bool bFound = false;
|
||||
|
||||
if (nToken == eT_quote)
|
||||
{
|
||||
@@ -2643,9 +2639,6 @@ int CParserBin::GetNextToken(uint32& nStart, ETokenStorageClass& nTokenStorageCl
|
||||
else
|
||||
{
|
||||
m_eToken = (EToken)nToken;
|
||||
#ifdef _DEBUG
|
||||
const char* szToken = GetString(m_eToken);
|
||||
#endif
|
||||
assert(m_eToken < eT_user_first);
|
||||
m_CurFrame.m_nCurToken++;
|
||||
break;
|
||||
@@ -2810,7 +2803,6 @@ bool CParserBin::GetAssignmentData(SParserFrame& Frame)
|
||||
|
||||
bool CParserBin::GetSubData(SParserFrame& Frame, EToken eT1, EToken eT2)
|
||||
{
|
||||
bool bRes = true;
|
||||
|
||||
Frame.m_nFirstToken = 0;
|
||||
Frame.m_nLastToken = 0;
|
||||
|
||||
@@ -923,7 +923,10 @@ public:
|
||||
if (szStr[0] == '0' && szStr[1] == 'x')
|
||||
{
|
||||
int i = 0;
|
||||
int res = azsscanf(&szStr[2], "%x", &i);
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(&szStr[2], "%x", &i);
|
||||
assert(res != 0);
|
||||
return i;
|
||||
}
|
||||
@@ -977,20 +980,12 @@ public:
|
||||
int CopyTokens(SCodeFragment* pCF, PodArray<uint32>& SHData, TArray<SCodeFragment>& Replaces, TArray<uint32>& NewTokens, uint32 nID);
|
||||
static _inline void AddDefineToken(uint32 dwToken, ShaderTokensVec& Tokens)
|
||||
{
|
||||
if (dwToken == 611)
|
||||
{
|
||||
int nnn = 0;
|
||||
}
|
||||
Tokens.push_back(eT_define);
|
||||
Tokens.push_back(dwToken);
|
||||
Tokens.push_back(0);
|
||||
}
|
||||
static _inline void AddDefineToken(uint32 dwToken, uint32 dwToken2, ShaderTokensVec& Tokens)
|
||||
{
|
||||
if (dwToken == 611)
|
||||
{
|
||||
int nnn = 0;
|
||||
}
|
||||
Tokens.push_back(eT_define);
|
||||
Tokens.push_back(dwToken);
|
||||
Tokens.push_back(dwToken2);
|
||||
|
||||
@@ -444,7 +444,6 @@ void PoundPoundContext::Impl::ProcessInclude(char** buf)
|
||||
{
|
||||
auto tokens = TokenizeLine(buf, "\\s*\\(\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\)\\s*$");
|
||||
|
||||
auto oldLayer = m_ownedLayer;
|
||||
m_ownedLayer = new Layer(m_ownedLayer);
|
||||
m_ownedLayer->m_interdictionState = Layer::InterdictionState::interdictionPaused;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <AzCore/Socket/AzSocket.h>
|
||||
#include <AzCore/NativeUI/NativeUIRequests.h>
|
||||
#include <AzCore/PlatformId/PlatformId.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzFramework/Network/SocketConnection.h>
|
||||
#include <AzFramework/Asset/AssetSystemTypes.h>
|
||||
|
||||
@@ -307,20 +307,15 @@ namespace NRemoteCompiler
|
||||
|
||||
m_RequestLineRootFolder = "";
|
||||
|
||||
auto projectName = AZ::Utils::GetProjectName();
|
||||
ICVar* pCompilerFolderSuffix = CRenderer::CV_r_ShaderCompilerFolderSuffix;
|
||||
|
||||
if (!projectName.empty())
|
||||
AZ::IO::FixedMaxPathString projectUserPath;
|
||||
if (auto settingsRegistry{ AZ::SettingsRegistry::Get() }; settingsRegistry != nullptr)
|
||||
{
|
||||
if (pCompilerFolderSuffix)
|
||||
{
|
||||
string suffix = pCompilerFolderSuffix->GetString();
|
||||
suffix.Trim();
|
||||
projectName.append(suffix);
|
||||
}
|
||||
settingsRegistry->Get(projectUserPath, AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectUserPath);
|
||||
}
|
||||
|
||||
projectName.append("/");
|
||||
m_RequestLineRootFolder.assign(projectName.c_str(), projectName.size());
|
||||
if (!projectUserPath.empty())
|
||||
{
|
||||
m_RequestLineRootFolder.assign(projectUserPath.c_str(), projectUserPath.size());
|
||||
}
|
||||
|
||||
if (m_RequestLineRootFolder.empty())
|
||||
@@ -694,7 +689,9 @@ namespace NRemoteCompiler
|
||||
bool CShaderSrv::CommitPLCombinations(std::vector<SCacheCombination>& rVec)
|
||||
{
|
||||
const uint32 STEPSIZE = 32;
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
float T0 = iTimer->GetAsyncCurTime();
|
||||
#endif
|
||||
for (uint32 i = 0; i < rVec.size(); i += STEPSIZE)
|
||||
{
|
||||
string Line;
|
||||
@@ -713,7 +710,9 @@ namespace NRemoteCompiler
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
float T1 = iTimer->GetAsyncCurTime();
|
||||
#endif
|
||||
if(VerboseLogging())
|
||||
{
|
||||
AZ_TracePrintf("RemoteCompiler", "CShaderSrv::CommitPLCombinations() : %3.3f to commit %" PRISIZE_T " Combinations\n", T1 - T0, rVec.size());
|
||||
|
||||
@@ -1489,7 +1489,6 @@ public:
|
||||
|
||||
inline SShaderTechnique* SShaderItem::GetTechnique() const
|
||||
{
|
||||
SShaderTechnique* pTech = NULL;
|
||||
int nTech = m_nTechnique;
|
||||
if (nTech < 0)
|
||||
{
|
||||
|
||||
@@ -1650,7 +1650,6 @@ void CShaderMan::_PrecacheShaderList(bool bStatsOnly)
|
||||
m_bReload = true;
|
||||
m_nCombinationsCompiled = 0;
|
||||
m_nCombinationsEmpty = 0;
|
||||
uint64 nGLLast = -1;
|
||||
for (int i = 0; i < Cmbs.size(); i++)
|
||||
{
|
||||
SCacheCombination* cmb = &Cmbs[i];
|
||||
@@ -2311,14 +2310,22 @@ void CShaderMan::_MergeShaders()
|
||||
uint32 nLen = strlen(szName1);
|
||||
pCache = CHWShader::mfInitCache(szNameA, NULL, false, CRC32, false);
|
||||
SResFileLookupData* pData;
|
||||
if (pCache->m_pRes[CACHE_USER] && (pData = pCache->m_pRes[CACHE_USER]->GetLookupData(false, 0, 0)))
|
||||
if (pCache->m_pRes[CACHE_USER])
|
||||
{
|
||||
CRC32 = pData->m_CRC32;
|
||||
pData = pCache->m_pRes[CACHE_USER]->GetLookupData(false, 0, 0);
|
||||
if (pData)
|
||||
{
|
||||
CRC32 = pData->m_CRC32;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (pCache->m_pRes[CACHE_READONLY] && (pData = pCache->m_pRes[CACHE_READONLY]->GetLookupData(false, 0, 0)))
|
||||
if (pCache->m_pRes[CACHE_READONLY])
|
||||
{
|
||||
CRC32 = pData->m_CRC32;
|
||||
pData = pCache->m_pRes[CACHE_READONLY]->GetLookupData(false, 0, 0);
|
||||
if (pData)
|
||||
{
|
||||
CRC32 = pData->m_CRC32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2368,7 +2375,7 @@ void CShaderMan::_MergeShaders()
|
||||
pRes->mfClose();
|
||||
pRes->mfOpen(RA_CREATE, &gRenDev->m_cEF.m_ResLookupDataMan[CACHE_USER]);
|
||||
|
||||
SResFileLookupData* pLookup = pRes->GetLookupData(true, CRC32, FX_CACHE_VER);
|
||||
pRes->GetLookupData(true, CRC32, FX_CACHE_VER);
|
||||
pRes->mfFlush();
|
||||
|
||||
int nDeviceShadersCounter = 0x10000000;
|
||||
@@ -2571,7 +2578,7 @@ bool CShaderMan::mfPreloadBinaryShaders()
|
||||
const string& file = FilesCFI[i];
|
||||
cry_strcpy(sName, file.c_str());
|
||||
fpStripExtension(sName, sName);
|
||||
SShaderBin* pBin = m_Bin.GetBinShader(sName, true, 0);
|
||||
[[maybe_unused]] SShaderBin* pBin = m_Bin.GetBinShader(sName, true, 0);
|
||||
AZ_Error("Rendering", pBin, "Error pre-loading binary shader %s", file.c_str());
|
||||
}
|
||||
}
|
||||
@@ -2588,7 +2595,7 @@ bool CShaderMan::mfPreloadBinaryShaders()
|
||||
const string& file = FilesCFX[i];
|
||||
cry_strcpy(sName, file.c_str());
|
||||
fpStripExtension(sName, sName);
|
||||
SShaderBin* pBin = m_Bin.GetBinShader(sName, false, 0);
|
||||
[[maybe_unused]] SShaderBin* pBin = m_Bin.GetBinShader(sName, false, 0);
|
||||
AZ_Error("Rendering", pBin, "Error pre-loading binary shader %s", file.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,13 +148,15 @@ const char* CShaderMan::mfGetShaderParamName(ECGParam ePR)
|
||||
{
|
||||
int n = 0;
|
||||
const char* szName;
|
||||
while (szName = sParams[n].szName)
|
||||
szName = sParams[n].szName;
|
||||
while (szName)
|
||||
{
|
||||
if (sParams[n].eParamType == ePR)
|
||||
{
|
||||
return szName;
|
||||
}
|
||||
n++;
|
||||
szName = sParams[n].szName;
|
||||
}
|
||||
if (ePR == ECGP_PM_Tweakable)
|
||||
{
|
||||
@@ -167,7 +169,8 @@ SParamDB* CShaderMan::mfGetShaderParamDB(const char* szSemantic)
|
||||
{
|
||||
const char* szName;
|
||||
int n = 0;
|
||||
while (szName = sParams[n].szName)
|
||||
szName = sParams[n].szName;
|
||||
while (szName)
|
||||
{
|
||||
int nLen = strlen(szName);
|
||||
if (!_strnicmp(szName, szSemantic, nLen) || (sParams[n].szAliasName && !_strnicmp(sParams[n].szAliasName, szSemantic, strlen(sParams[n].szAliasName))))
|
||||
@@ -175,6 +178,7 @@ SParamDB* CShaderMan::mfGetShaderParamDB(const char* szSemantic)
|
||||
return &sParams[n];
|
||||
}
|
||||
n++;
|
||||
szName = sParams[n].szName;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -231,7 +235,8 @@ bool CShaderMan::mfParseParamComp(int comp, SCGParam* pCurParam, const char* szS
|
||||
}
|
||||
const char* szName;
|
||||
int n = 0;
|
||||
while (szName = sParams[n].szName)
|
||||
szName = sParams[n].szName;
|
||||
while (szName)
|
||||
{
|
||||
int nLen = strlen(szName);
|
||||
if (!_strnicmp(szName, szSemantic, nLen) || (sParams[n].szAliasName && !_strnicmp(sParams[n].szAliasName, szSemantic, strlen(sParams[n].szAliasName))))
|
||||
@@ -295,6 +300,7 @@ bool CShaderMan::mfParseParamComp(int comp, SCGParam* pCurParam, const char* szS
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
szName = sParams[n].szName;
|
||||
}
|
||||
if (!szName)
|
||||
{
|
||||
@@ -324,7 +330,9 @@ bool CShaderMan::mfParseCGParam(char* scr, const char* szAnnotations, SShaderFXP
|
||||
{0, 0}
|
||||
};
|
||||
SCGParam vpp;
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
int n = pParams->size();
|
||||
#endif
|
||||
bool bRes = true;
|
||||
|
||||
while ((cmd = shGetObject (&scr, commands, &name, ¶ms)) > 0)
|
||||
@@ -521,7 +529,8 @@ bool CShaderMan::mfParseFXSampler([[maybe_unused]] SShaderFXParams& FXParams, SF
|
||||
const char* szSemantic = pr->m_Semantic.c_str();
|
||||
const char* szName;
|
||||
int n = 0;
|
||||
while (szName = sSamplers[n].szName)
|
||||
szName = sSamplers[n].szName;
|
||||
while (szName)
|
||||
{
|
||||
if (!azstricmp(szName, szSemantic))
|
||||
{
|
||||
@@ -533,6 +542,7 @@ bool CShaderMan::mfParseFXSampler([[maybe_unused]] SShaderFXParams& FXParams, SF
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
szName = sSamplers[n].szName;
|
||||
}
|
||||
if (!szName)
|
||||
{
|
||||
@@ -668,7 +678,8 @@ bool CShaderMan::mfParseFXTexture(
|
||||
// Texture semantic exists and will be used to compare to the semantic texture table
|
||||
// Handling textures that are not material based textures, but parsed from the shader.
|
||||
// An example of this will be: Texture2D<float4> sceneGBufferA : TS_SceneNormals;
|
||||
while (szName = sTextures[n].szName)
|
||||
szName = sTextures[n].szName;
|
||||
while (szName)
|
||||
{ // Run over all slots and try to associates the semantic name.
|
||||
// The semantic enum will be used in 'mfSetTexture' for setting texture
|
||||
// loading and default properties.
|
||||
@@ -683,6 +694,7 @@ bool CShaderMan::mfParseFXTexture(
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
szName = sTextures[n].szName;
|
||||
}
|
||||
return szName != nullptr;
|
||||
}
|
||||
@@ -813,7 +825,8 @@ bool sGetPublic(const CCryNameR& n, float* v, int nID)
|
||||
bool bFound = false;
|
||||
CShaderResources* pRS;
|
||||
const char* cName = n.c_str();
|
||||
if (pRS = rd->m_RP.m_pShaderResources)
|
||||
pRS = rd->m_RP.m_pShaderResources;
|
||||
if (pRS)
|
||||
{
|
||||
bFound = SShaderParam::GetValue(cName, &pRS->m_ShaderParams, v, nID);
|
||||
}
|
||||
@@ -858,7 +871,8 @@ SCGTexture::SCGTexture(const SCGTexture& sp)
|
||||
if (!sp.m_pAnimInfo)
|
||||
{
|
||||
m_pAnimInfo = nullptr;
|
||||
if (m_pTexture = sp.m_pTexture)
|
||||
m_pTexture = sp.m_pTexture;
|
||||
if (m_pTexture)
|
||||
{
|
||||
m_pTexture->AddRef();
|
||||
}
|
||||
@@ -866,7 +880,8 @@ SCGTexture::SCGTexture(const SCGTexture& sp)
|
||||
else
|
||||
{
|
||||
m_pTexture = nullptr;
|
||||
if (m_pAnimInfo = sp.m_pAnimInfo)
|
||||
m_pAnimInfo = sp.m_pAnimInfo;
|
||||
if (m_pAnimInfo)
|
||||
{
|
||||
m_pAnimInfo->AddRef();
|
||||
}
|
||||
|
||||
@@ -793,12 +793,16 @@ void CShaderMan:: mfCreateCommonGlobalFlags([[maybe_unused]] const char* szName)
|
||||
pszShaderName.MakeUpper();
|
||||
m_pShadersRemapList += string("%") + pszShaderName;
|
||||
|
||||
while (pCurrOffset = strstr(pCurrOffset, "Name"))
|
||||
pCurrOffset = strstr(pCurrOffset, "Name");
|
||||
while (pCurrOffset)
|
||||
{
|
||||
pCurrOffset += 4;
|
||||
char dummy[256] = "\n";
|
||||
char name[256] = "\n";
|
||||
int res = azsscanf(pCurrOffset, "%s %s", dummy
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(pCurrOffset, "%s %s", dummy
|
||||
#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS
|
||||
, (unsigned int)AZ_ARRAY_SIZE(dummy)
|
||||
#endif
|
||||
@@ -810,7 +814,6 @@ void CShaderMan:: mfCreateCommonGlobalFlags([[maybe_unused]] const char* szName)
|
||||
assert(res);
|
||||
|
||||
string pszNameFlag = name;
|
||||
int nSzSize = pszNameFlag.size();
|
||||
pszNameFlag.MakeUpper();
|
||||
|
||||
MapNameFlagsItor pCheck = m_pShaderCommonGlobalFlag.find(pszNameFlag);
|
||||
@@ -823,6 +826,7 @@ void CShaderMan:: mfCreateCommonGlobalFlags([[maybe_unused]] const char* szName)
|
||||
break;
|
||||
}
|
||||
}
|
||||
pCurrOffset = strstr(pCurrOffset, "Name");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,12 +973,10 @@ bool CShaderMan::mfRemapCommonGlobalFlagsWithLegacy(void)
|
||||
|
||||
// Search for duplicates and swap with old mask
|
||||
MapNameFlagsItor pCommonGlobalsIter = m_pShaderCommonGlobalFlag.begin();
|
||||
uint64 test = (uint64)0x10;
|
||||
for (; pCommonGlobalsIter != pCommonGlobalsEnd; ++pCommonGlobalsIter)
|
||||
{
|
||||
if (pFoundMatch != pCommonGlobalsIter && pCommonGlobalsIter->second == nRemapedMask)
|
||||
{
|
||||
uint64 nPrev = pCommonGlobalsIter->second;
|
||||
pCommonGlobalsIter->second = nOldMask;
|
||||
bRemaped = true;
|
||||
break;
|
||||
@@ -1012,7 +1014,10 @@ void CShaderMan::mfInitCommonGlobalFlags(void)
|
||||
if (strstr(str, "FX_CACHE_VER"))
|
||||
{
|
||||
float fCacheVer = 0.0f;
|
||||
int res = azsscanf(str, "%s %f",
|
||||
#ifndef NDEBUG
|
||||
int res =
|
||||
#endif
|
||||
azsscanf(str, "%s %f",
|
||||
name,
|
||||
#if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS
|
||||
(unsigned int)AZ_ARRAY_SIZE(name),
|
||||
@@ -1944,7 +1949,6 @@ void CShaderMan::RT_SetShaderQuality(EShaderType eST, EShaderQuality eSQ)
|
||||
}
|
||||
if (eST == eST_All || eST == eST_General)
|
||||
{
|
||||
bool bPS20 = ((gRenDev->m_Features & (RFT_HW_SM2X | RFT_HW_SM30)) == 0) || (eSQ == eSQ_Low);
|
||||
m_Bin.InvalidateCache();
|
||||
mfReloadAllShaders(FRO_FORCERELOAD, 0);
|
||||
}
|
||||
@@ -2281,7 +2285,10 @@ void CShaderMan::mfGatherFilesList(const char* szPath, std::vector<CCryNameR>& N
|
||||
int CShaderMan::mfInitShadersList(std::vector<string>* Names)
|
||||
{
|
||||
// Detect include changes
|
||||
bool bChanged = mfGatherShadersList(m_ShadersPath.c_str(), true, false, Names);
|
||||
#ifndef NULL_RENDERER
|
||||
bool bChanged =
|
||||
#endif
|
||||
mfGatherShadersList(m_ShadersPath.c_str(), true, false, Names);
|
||||
|
||||
if (gRenDev->m_bShaderCacheGen)
|
||||
{
|
||||
@@ -2332,7 +2339,10 @@ void CShaderMan::mfPreloadShaderExts(void)
|
||||
}
|
||||
char s[256];
|
||||
fpStripExtension(handle.m_filename.data(), s);
|
||||
SShaderGen* pShGen = mfCreateShaderGenInfo(s, false);
|
||||
#ifndef NDEBUG
|
||||
SShaderGen* pShGen =
|
||||
#endif
|
||||
mfCreateShaderGenInfo(s, false);
|
||||
assert(pShGen);
|
||||
} while (handle = gEnv->pCryPak->FindNext(handle));
|
||||
|
||||
@@ -2691,7 +2701,6 @@ void SEfResTexture::UpdateWithModifier(int nTSlot)
|
||||
}
|
||||
|
||||
bool bTr = false;
|
||||
bool bTranspose = false;
|
||||
Plane Pl;
|
||||
Plane PlTr;
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ SShaderBin* CShaderManBin::SaveBinShader(
|
||||
fpStripExtension(com, com);
|
||||
|
||||
// Get or load the included shader
|
||||
SShaderBin* pBIncl = GetBinShader(com, true, 0);
|
||||
GetBinShader(com, true, 0);
|
||||
|
||||
dwToken = CParserBin::fxToken(com, NULL);
|
||||
dwToken = Parser.NewUserToken(dwToken, com, false);
|
||||
@@ -649,7 +649,7 @@ void CShaderManBin::mfGeneratePublicFXParams(CShader* pSH, CParserBin& Parser)
|
||||
{
|
||||
szVal++;
|
||||
}
|
||||
int n = azsscanf(szVal, "%f, %f, %f, %f", &sp.m_Value.m_Color[0], &sp.m_Value.m_Color[1], &sp.m_Value.m_Color[2], &sp.m_Value.m_Color[3]);
|
||||
[[maybe_unused]] int n = azsscanf(szVal, "%f, %f, %f, %f", &sp.m_Value.m_Color[0], &sp.m_Value.m_Color[1], &sp.m_Value.m_Color[2], &sp.m_Value.m_Color[3]);
|
||||
AZ_Warning("Shaders", n == 4, "color value only has %d components", n);
|
||||
}
|
||||
else if (szWidget == "colora")
|
||||
@@ -659,7 +659,7 @@ void CShaderManBin::mfGeneratePublicFXParams(CShader* pSH, CParserBin& Parser)
|
||||
{
|
||||
szVal++;
|
||||
}
|
||||
int n = azsscanf(szVal, "%f, %f, %f, %f", &sp.m_Value.m_Color[0], &sp.m_Value.m_Color[1], &sp.m_Value.m_Color[2], &sp.m_Value.m_Color[3]);
|
||||
[[maybe_unused]] int n = azsscanf(szVal, "%f, %f, %f, %f", &sp.m_Value.m_Color[0], &sp.m_Value.m_Color[1], &sp.m_Value.m_Color[2], &sp.m_Value.m_Color[3]);
|
||||
AZ_Warning("Shaders", n == 4, "color value only has %d components", n);
|
||||
}
|
||||
else
|
||||
@@ -1151,9 +1151,9 @@ SShaderBin* CShaderManBin::GetBinShader(const char* szName, bool bInclude, uint3
|
||||
memset(&Header, 0, 2 * sizeof(SShaderBinHeader));
|
||||
char nameFile[256], nameBin[256];
|
||||
AZ::IO::HandleType srcFileHandle = AZ::IO::InvalidHandle;
|
||||
uint32 nSourceCRC32 = 0;
|
||||
sprintf_s(nameFile, "%sCryFX/%s.%s", gRenDev->m_cEF.m_ShadersPath.c_str(), szName, bInclude ? "cfi" : "cfx");
|
||||
#if !defined(_RELEASE)
|
||||
uint32 nSourceCRC32 = 0;
|
||||
{
|
||||
srcFileHandle = gEnv->pCryPak->FOpen(nameFile, "rb");
|
||||
nSourceCRC32 = srcFileHandle != AZ::IO::InvalidHandle ? gEnv->pCryPak->ComputeCRC(nameFile) : 0;
|
||||
@@ -2517,7 +2517,6 @@ bool CShaderManBin::ParseBinFX_Sampler(CParserBin& Parser, SParserFrame& Frame,
|
||||
break;
|
||||
default:
|
||||
{
|
||||
const char* szFilter = Parser.GetString(nFilter);
|
||||
assert(0);
|
||||
}
|
||||
break;
|
||||
@@ -2746,13 +2745,10 @@ bool CShaderManBin::ParseBinFX_Sampler(CParserBin& Parser, SParserFrame& Frame,
|
||||
break;
|
||||
default:
|
||||
{
|
||||
const char* szFilter = Parser.GetString(nFilter);
|
||||
CRY_ASSERT(0);
|
||||
int nnn = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
int nnn = 0;
|
||||
}
|
||||
if (nFiltMag > 0 && nFiltMin > 0 && nFiltMip > 0)
|
||||
{
|
||||
@@ -3244,7 +3240,6 @@ bool CShaderManBin::ParseBinFX_Technique_Pass_PackParameters (CParserBin& Parser
|
||||
|
||||
std::vector<SFXRegisterBin> Registers;
|
||||
std::vector<SFXPackedName> PackedNames;
|
||||
uint32 nMergeMask = (eSHClass == eHWSC_Pixel) ? 1 : 2;
|
||||
for (i = 0; i < AffectedParams.size(); i++)
|
||||
{
|
||||
SFXParam* pr = &AffectedParams[i];
|
||||
@@ -4124,7 +4119,6 @@ bool CShaderManBin::ParseBinFX_Technique_Pass(CParserBin& Parser, SParserFrame&
|
||||
byte AlphaRef = 0;
|
||||
int State = GS_DEPTHWRITE;
|
||||
|
||||
int nMaxTMU = 0;
|
||||
signed char Cull = -1;
|
||||
int nIndex;
|
||||
EToken eSrcBlend = eT_unknown;
|
||||
@@ -4963,10 +4957,9 @@ bool CShaderManBin::ParseBinFX(SShaderBin* pBin, CShader* ef, uint64 nMaskGen)
|
||||
ef->mfFree();
|
||||
|
||||
assert (ef->m_HWTechniques.Num() == 0);
|
||||
int nInd = 0;
|
||||
|
||||
ETokenStorageClass nTokenStorageClass;
|
||||
while (nTokenStorageClass = Parser.ParseObject(sCommands))
|
||||
ETokenStorageClass nTokenStorageClass = Parser.ParseObject(sCommands);
|
||||
while (nTokenStorageClass)
|
||||
{
|
||||
EToken eT = Parser.GetToken();
|
||||
SCodeFragment Fr;
|
||||
@@ -4991,9 +4984,6 @@ bool CShaderManBin::ParseBinFX(SShaderBin* pBin, CShader* ef, uint64 nMaskGen)
|
||||
{
|
||||
SFXSampler Pr;
|
||||
Parser.CopyTokens(Parser.m_Name, Pr.m_dwName);
|
||||
#ifdef _DEBUG
|
||||
const char* sampName = Parser.GetString(Parser.m_Name);
|
||||
#endif
|
||||
if (eT == eT_SamplerState)
|
||||
{
|
||||
Pr.m_eType = eSType_Sampler;
|
||||
@@ -5022,11 +5012,6 @@ bool CShaderManBin::ParseBinFX(SShaderBin* pBin, CShader* ef, uint64 nMaskGen)
|
||||
{
|
||||
nTokAssign = Parser.m_Tokens[Parser.m_Assign.m_nFirstToken];
|
||||
}
|
||||
if (nTokAssign)
|
||||
{
|
||||
const char* assign = Parser.GetString(nTokAssign);
|
||||
int nnn = 0;
|
||||
}
|
||||
Pr.PostLoad(Parser, Parser.m_Name, Parser.m_Annotations, Parser.m_Value, Parser.m_Assign);
|
||||
|
||||
bRes &= ParseBinFX_Sampler(Parser, Parser.m_Data, Pr);
|
||||
@@ -5369,6 +5354,8 @@ bool CShaderManBin::ParseBinFX(SShaderBin* pBin, CShader* ef, uint64 nMaskGen)
|
||||
//CRY_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
nTokenStorageClass = Parser.ParseObject(sCommands);
|
||||
}
|
||||
|
||||
FXP.m_FXParams.swap(s_tempFXParams);
|
||||
@@ -5776,7 +5763,8 @@ bool CShaderManBin::ParseBinFX_Dummy(SShaderBin* pBin, std::vector<string>& Shad
|
||||
|
||||
ETokenStorageClass nTokenStorageClass;
|
||||
|
||||
while (nTokenStorageClass = Parser.ParseObject(sCommands))
|
||||
nTokenStorageClass = Parser.ParseObject(sCommands);
|
||||
while (nTokenStorageClass)
|
||||
{
|
||||
EToken eT = Parser.GetToken();
|
||||
SCodeFragment Fr;
|
||||
@@ -5836,7 +5824,7 @@ bool CShaderManBin::ParseBinFX_Dummy(SShaderBin* pBin, std::vector<string>& Shad
|
||||
{
|
||||
uint32 nToken = Parser.m_Tokens[Parser.m_Name.m_nFirstToken];
|
||||
bool bPublicTechnique = false;
|
||||
SShaderTechnique* pShTech = ParseBinFX_Technique(Parser, Parser.m_Data, Parser.m_Annotations, techParams, &bPublicTechnique);
|
||||
ParseBinFX_Technique(Parser, Parser.m_Data, Parser.m_Annotations, techParams, &bPublicTechnique);
|
||||
if (bPublicTechnique)
|
||||
{
|
||||
const char* name = Parser.GetString(nToken);
|
||||
@@ -5848,6 +5836,7 @@ bool CShaderManBin::ParseBinFX_Dummy(SShaderBin* pBin, std::vector<string>& Shad
|
||||
default:
|
||||
CRY_ASSERT(0);
|
||||
}
|
||||
nTokenStorageClass = Parser.ParseObject(sCommands);
|
||||
}
|
||||
|
||||
if (bPublic)
|
||||
@@ -6345,13 +6334,6 @@ CTexture* CShaderMan::mfParseFXTechnique_LoadShaderTexture (STexSamplerRT* smp,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// store the CRC for this sampler's texture name for fast lookup
|
||||
// this is particularly useful for shared engine textures
|
||||
CCryNameTSCRC crc(szName);
|
||||
smp->m_nCrc = crc.get();
|
||||
#endif // #if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
if (szName[0] == '$')
|
||||
{
|
||||
tp = mfCheckTemplateTexName(szName, (ETEX_Type)smp->m_eTexType);
|
||||
|
||||
@@ -608,7 +608,6 @@ string CShaderMan::mfGetShaderBitNamesFromMaskGen(const char* szFileName, uint64
|
||||
string pszShaderName = PathUtil::GetFileName(szFileName);
|
||||
pszShaderName.MakeUpper();
|
||||
|
||||
uint64 nMaskGenRemaped = 0;
|
||||
ShaderMapNameFlagsItor pShaderRmp = m_pShadersGlobalFlags.find(pszShaderName.c_str());
|
||||
if (pShaderRmp == m_pShadersGlobalFlags.end() || !pShaderRmp->second)
|
||||
{
|
||||
@@ -678,7 +677,6 @@ void CShaderMan::mfRemapShaderGenInfoBits(const char* szName, SShaderGen* pShGen
|
||||
pGenBit->m_Mask = pRemaped->second;
|
||||
}
|
||||
|
||||
int test = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -794,7 +792,6 @@ uint64 CShaderMan::mfGetRemapedShaderMaskGen(const char* szName, uint64 nMaskGen
|
||||
// found match - enable bit for remapped mask
|
||||
if ((pIter->second) & nMask)
|
||||
{
|
||||
const char* pFlagName = pIter->first.c_str();
|
||||
MapNameFlagsItor pMatchIter = m_pShaderCommonGlobalFlag.find(pIter->first);
|
||||
if (pMatchIter != m_pShaderCommonGlobalFlag.end())
|
||||
{
|
||||
|
||||
@@ -111,7 +111,6 @@ void CShaderResources::ConvertToInputResource(SInputShaderResources* pDst)
|
||||
|
||||
size_t CShaderResources::GetResourceMemoryUsage(ICrySizer* pSizer)
|
||||
{
|
||||
size_t nCurrentElement(0);
|
||||
size_t nCurrentElementSize(0);
|
||||
size_t nTotalSize(0);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ bool CShaderMan::mfReloadShaderIncludes(const char* szPath, int nFlags)
|
||||
{
|
||||
fpStripExtension(handle.m_filename.data(), nmf);
|
||||
bool bCh = false;
|
||||
SShaderBin* pBin = m_Bin.GetBinShader(nmf, true, 0, &bCh);
|
||||
m_Bin.GetBinShader(nmf, true, 0, &bCh);
|
||||
if (bCh)
|
||||
{
|
||||
bChanged = true;
|
||||
@@ -155,7 +155,7 @@ bool CShaderMan::mfReloadAllShaders([[maybe_unused]] int nFlags, [[maybe_unused]
|
||||
// Check include changing
|
||||
if IsCVarConstAccess(constexpr) (!CRenderer::CV_r_shadersignoreincludeschanging)
|
||||
{
|
||||
bool bChanged = mfReloadShaderIncludes(m_ShadersPath.c_str(), nFlags);
|
||||
mfReloadShaderIncludes(m_ShadersPath.c_str(), nFlags);
|
||||
}
|
||||
CCryNameTSCRC Name = CShader::mfGetClassName();
|
||||
SResourceContainer* pRL = CBaseResource::GetResourcesForClass(Name);
|
||||
@@ -858,7 +858,6 @@ SShaderItem CShaderMan::mfShaderItemForName (const char* nameEf, bool bShare, in
|
||||
}
|
||||
|
||||
SI.m_pShader = mfForName(shadName, flags, (CShaderResources*)SI.m_pShaderResources, nMaskGen);
|
||||
CShader* pSH = (CShader*)SI.m_pShader;
|
||||
|
||||
// Get technique
|
||||
if (strTechnique.size())
|
||||
@@ -1013,7 +1012,6 @@ CShader* CShaderMan::mfForName (const char* nameSh, int flags, const CShaderReso
|
||||
ef->m_NameShader = nameEf;
|
||||
ef->m_NameShaderICRC = CCrc32::ComputeLowercase(nameEf);
|
||||
|
||||
bool bSuccess = false;
|
||||
#ifndef NULL_RENDERER
|
||||
// Check for the new cryFX format
|
||||
sprintf_s(nameNew, "%sCryFX/%s.cfx", m_ShadersPath.c_str(), nameEf);
|
||||
|
||||
@@ -320,7 +320,6 @@ void CShaderSerialize::ClearSResourceCache()
|
||||
|
||||
bool CShaderSerialize::DoesSResourceExist(CShader* pSH)
|
||||
{
|
||||
SSShaderRes* pSR = NULL;
|
||||
stack_string shaderName = pSH->GetName();
|
||||
shaderName += "_GLOBAL";
|
||||
CCryNameTSCRC SName = CCryNameTSCRC(shaderName.c_str());
|
||||
@@ -569,7 +568,6 @@ bool CShaderSerialize::ExportShader(CShader* pSH, CShaderManBin& binShaderMgr)
|
||||
pOpenDir->nSize = de.size;
|
||||
|
||||
//Preserve modification time
|
||||
uint64 modTime = pSR->m_pRes[CACHE_USER]->mfGetModifTime();
|
||||
|
||||
pSR->m_pRes[CACHE_USER]->mfFlush();
|
||||
|
||||
@@ -670,7 +668,7 @@ CShaderSerialize::ShaderImportResults CShaderSerialize::ImportShader(CShader* pS
|
||||
gRenDev->m_RP.m_pShader = pSH;
|
||||
assert(gRenDev->m_RP.m_pShader != 0);
|
||||
|
||||
int nSize = pRes->mfFileRead(pDE);
|
||||
pRes->mfFileRead(pDE);
|
||||
byte* pData = (byte*)pRes->mfFileGetBuf(pDE);
|
||||
if (!pData)
|
||||
{
|
||||
|
||||
@@ -117,7 +117,9 @@ void sAddDataArray_POD(TArray<byte>& Dst, TArray<T>& Src, uint32& nOffs, uint32
|
||||
template <typename T>
|
||||
void sExport(TArray<byte>& dst, T& data)
|
||||
{
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
int startNum = dst.Num();
|
||||
#endif
|
||||
|
||||
data.Export(dst);
|
||||
|
||||
@@ -260,7 +262,7 @@ struct SSShader
|
||||
|
||||
void Export(TArray<byte>& dst)
|
||||
{
|
||||
uint32 startOffset = dst.Num();
|
||||
[[maybe_unused]] uint32 startOffset = dst.Num();
|
||||
|
||||
sAddData(dst, m_nMaskGenFX);
|
||||
sAddData(dst, (uint32)m_eSHDType);
|
||||
@@ -353,7 +355,7 @@ struct SSShaderParam
|
||||
|
||||
void Export(TArray<byte>& dst)
|
||||
{
|
||||
uint32 startOffset = dst.Num();
|
||||
[[maybe_unused]] uint32 startOffset = dst.Num();
|
||||
|
||||
sAddData(dst, m_nameIdx);
|
||||
sAddData(dst, (uint32)m_Type);
|
||||
@@ -609,7 +611,7 @@ struct SCHWShader
|
||||
|
||||
void Export(TArray<byte>& dst)
|
||||
{
|
||||
uint32 startOffset = dst.Num();
|
||||
[[maybe_unused]] uint32 startOffset = dst.Num();
|
||||
|
||||
sAddData(dst, m_nMaskGenShader);
|
||||
sAddData(dst, m_nMaskGenFX);
|
||||
@@ -687,7 +689,7 @@ struct SSTexSamplerFX
|
||||
|
||||
void Export(TArray<byte>& dst)
|
||||
{
|
||||
uint32 startOffset = dst.Num();
|
||||
[[maybe_unused]] uint32 startOffset = dst.Num();
|
||||
|
||||
sAddData(dst, m_nsName);
|
||||
sAddData(dst, m_nsNameTexture);
|
||||
@@ -846,7 +848,7 @@ struct SSFXParam
|
||||
|
||||
void Export(TArray<byte>& dst)
|
||||
{
|
||||
uint32 startOffset = dst.Num();
|
||||
[[maybe_unused]] uint32 startOffset = dst.Num();
|
||||
|
||||
sAddData(dst, m_nsName);
|
||||
sAddData(dst, m_nFlags);
|
||||
@@ -912,7 +914,7 @@ struct SSFXSampler
|
||||
|
||||
void Export(TArray<byte>& dst)
|
||||
{
|
||||
uint32 startOffset = dst.Num();
|
||||
[[maybe_unused]] uint32 startOffset = dst.Num();
|
||||
|
||||
sAddData(dst, m_nsName);
|
||||
sAddData(dst, m_nFlags);
|
||||
@@ -975,7 +977,7 @@ struct SSFXTexture
|
||||
|
||||
void Export(TArray<byte>& dst)
|
||||
{
|
||||
uint32 startOffset = dst.Num();
|
||||
[[maybe_unused]] uint32 startOffset = dst.Num();
|
||||
|
||||
sAddData(dst, m_nsName);
|
||||
sAddData(dst, m_nsNameTexture);
|
||||
|
||||
@@ -813,7 +813,8 @@ CTexAnim* CShaderMan::mfReadTexSequence(const char* na, int Flags, [[maybe_unuse
|
||||
{
|
||||
name[nm - nName] = 0;
|
||||
char* speed = &nName[nm - nName + 1];
|
||||
if (nm = strchr(speed, ')'))
|
||||
nm = strchr(speed, ')');
|
||||
if (nm)
|
||||
{
|
||||
speed[nm - speed] = 0;
|
||||
}
|
||||
@@ -912,7 +913,6 @@ CTexAnim* CShaderMan::mfReadTexSequence(const char* na, int Flags, [[maybe_unuse
|
||||
ta->m_Time = fSpeed;
|
||||
}
|
||||
|
||||
ITexture* pTex = (ITexture*)tp;
|
||||
ta->m_TexPics.AddElem(tp);
|
||||
n++;
|
||||
}
|
||||
@@ -1048,7 +1048,8 @@ bool CShaderMan::mfLoadResourceTexture(ResourceSlotIndex Id, CShaderResources& R
|
||||
TextureWarning(pTextureRes->m_Name.c_str(), "Texture file is missing: '%s%s' in material \'%s\'", RS.m_TexturePath.c_str(), pTextureRes->m_Name.c_str(), RS.m_szMaterialName);
|
||||
}
|
||||
|
||||
if (!(bTextureLoaded = texSampler.m_pTex->IsTextureLoaded()) && bReplaceMeOnFail)
|
||||
bTextureLoaded = texSampler.m_pTex->IsTextureLoaded();
|
||||
if (!bTextureLoaded && bReplaceMeOnFail)
|
||||
{
|
||||
texSampler.m_pTex = mfLoadResourceTexture("EngineAssets/TextureMsg/ReplaceMe.tif", RS.m_TexturePath.c_str(), texSampler.GetTexFlags() | CustomFlags, pTextureRes);
|
||||
}
|
||||
|
||||
@@ -16,21 +16,13 @@
|
||||
|
||||
bool CShadowUtils::bShadowFrustumCacheValid = false;
|
||||
|
||||
void CShadowUtils::CalcDifferentials(const CCamera& cam, float fViewWidth, float fViewHeight, float& fFragSizeX)
|
||||
void CShadowUtils::CalcDifferentials(const CCamera& cam, float fViewWidth, [[maybe_unused]] float fViewHeight, float& fFragSizeX)
|
||||
{
|
||||
Vec3 vNearEdge = cam.GetEdgeN();
|
||||
|
||||
float fFar = cam.GetFarPlane();
|
||||
float fNear = abs(vNearEdge.y);
|
||||
float fWorldWidthDiv2 = abs(vNearEdge.x);
|
||||
float fWorldHeightDiv2 = abs(vNearEdge.z);
|
||||
|
||||
fFragSizeX = (fWorldWidthDiv2 * 2.0f) / fViewWidth;
|
||||
float fFragSizeY = (fWorldHeightDiv2 * 2.0f) / fViewHeight;
|
||||
|
||||
float fDDZ = fWorldWidthDiv2 / fViewHeight;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void CShadowUtils::CalcScreenToWorldExpansionBasis(const CCamera& cam, const Vec2& vJitter, float fViewWidth, float fViewHeight, Vec3& vWBasisX, Vec3& vWBasisY, Vec3& vWBasisZ, bool bWPos)
|
||||
@@ -454,7 +446,6 @@ void CShadowUtils::mathMatrixLookAtSnap(Matrix44A* pMatr, const Vec3& Eye, const
|
||||
|
||||
float fTranslX = (*pMatr)(3, 0);
|
||||
float fTranslY = (*pMatr)(3, 1);
|
||||
float fTranslZ = (*pMatr)(3, 2);
|
||||
|
||||
(*pMatr)(3, 0) = snap_frac2(fTranslX, fSnapXY);
|
||||
(*pMatr)(3, 1) = snap_frac2(fTranslY, fSnapXY);
|
||||
|
||||
@@ -495,18 +495,16 @@ void SDynTexture::ReleaseDynamicRT(bool bForce)
|
||||
pSubset->erase(coTexture);
|
||||
s_iNumTextureBytesCheckedOut -= m_pTexture->GetDataSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
//assert(false);
|
||||
int nnn = 0;
|
||||
}
|
||||
|
||||
// Don't cache too many unused textures.
|
||||
if (bForce)
|
||||
{
|
||||
s_nMemoryOccupied -= m_pTexture->GetDataSize();
|
||||
assert(s_iNumTextureBytesCheckedOut + s_iNumTextureBytesCheckedIn == s_nMemoryOccupied);
|
||||
int refCount = m_pTexture->Release();
|
||||
#ifndef NDEBUG
|
||||
int refCount =
|
||||
#endif
|
||||
m_pTexture->Release();
|
||||
assert(refCount <= 0);
|
||||
m_pTexture = NULL;
|
||||
Unlink();
|
||||
|
||||
@@ -117,7 +117,6 @@ size_t ITextureStreamer::StatsComputeRequiredMipMemUsage()
|
||||
{
|
||||
int nPersMip = tp->m_nMips - tp->m_CacheFileHeader.m_nMipsPersistent;
|
||||
int nReqMip = tp->m_bForceStreamHighRes ? 0 : (bStale ? nPersMip : tp->GetRequiredMipNonVirtual());
|
||||
int nMips = tp->GetNumMipsNonVirtual();
|
||||
nReqMip = min(nReqMip, nPersMip);
|
||||
|
||||
int nWantedSize = tp->StreamComputeDevDataSize(nReqMip);
|
||||
|
||||
@@ -1000,9 +1000,6 @@ namespace DDSSplitted
|
||||
uint32 numSlices = (imageFlags& CImageExtensionHelper::EIF_Cubemap) ? 6 : 1;
|
||||
uint32 ddsSize = CTexture::TextureDataSize(ddsFileDesc.header.dwWidth, ddsFileDesc.header.dwHeight, ddsFileDesc.header.dwDepth, max(static_cast<DWORD>(1), ddsFileDesc.header.dwMipMapCount), numSlices, eTF, eTM);
|
||||
|
||||
size_t fileLength = file.GetLength();
|
||||
size_t trailLength = fileLength - ddsSize;
|
||||
|
||||
size_t headerEnd = file.Tell();
|
||||
|
||||
file.Seek(headerEnd + ddsSize);
|
||||
|
||||
@@ -72,7 +72,6 @@ namespace JpgImage {
|
||||
|
||||
static void jo_writeBits(joBufferedIO* fp, int& bitBuf, int& bitCnt, const unsigned short* bs)
|
||||
{
|
||||
auto pCryPak = gEnv->pCryPak;
|
||||
|
||||
bitCnt += bs[1];
|
||||
bitBuf |= bs[0] << (24 - bitCnt);
|
||||
|
||||
@@ -156,15 +156,12 @@ bool WriteTGA(const byte* data, int width, int height, const char* filename, int
|
||||
|
||||
int hxw = height * width;
|
||||
|
||||
int right = 0;
|
||||
|
||||
const DWORD* temp_dp = (const DWORD*)data; // data = input pointer
|
||||
|
||||
const DWORD* swap = 0;
|
||||
|
||||
UINT src_bytes_per_pixel = src_bits_per_pixel / 8;
|
||||
|
||||
UINT size_in_bytes = hxw * src_bytes_per_pixel;
|
||||
|
||||
if (src_bits_per_pixel == dest_bits_per_pixel)
|
||||
{
|
||||
|
||||
@@ -217,7 +217,6 @@ void CPlanningTextureStreamer::ApplySchedule(EApplyScheduleFlags asf)
|
||||
ptrdiff_t nMemFreeUpper = schedule.memState.nMemFreeUpper;
|
||||
ptrdiff_t nMemFreeLower = schedule.memState.nMemFreeLower;
|
||||
int nBalancePoint = schedule.nBalancePoint;
|
||||
int nOnScreenPoint = schedule.nOnScreenPoint;
|
||||
|
||||
// Everything < nBalancePoint can only be trimmed (trimmable list), everything >= nBalancePoint can be kicked
|
||||
// We should be able to load everything in the requested list
|
||||
@@ -381,10 +380,6 @@ bool CPlanningTextureStreamer::TryBegin_FromDisk(CTexture* pTex, uint32 nTexPers
|
||||
++estp;
|
||||
}
|
||||
|
||||
uint32 nWantedWidth = max(1, pTex->m_nWidth >> nTexWantedMip);
|
||||
uint32 nWantedHeight = max(1, pTex->m_nHeight >> nTexWantedMip);
|
||||
uint32 nAvailWidth = max(1, pTex->m_nWidth >> nTexAvailMip);
|
||||
uint32 nAvailHeight = max(1, pTex->m_nHeight >> nTexAvailMip);
|
||||
|
||||
ptrdiff_t nRequired = pTex->StreamComputeDevDataSize(nTexWantedMip) - pTex->StreamComputeDevDataSize(nTexAvailMip);
|
||||
|
||||
@@ -486,10 +481,6 @@ bool CPlanningTextureStreamer::TryBegin_Composite(CTexture* pTex, [[maybe_unused
|
||||
ptrdiff_t& nMemFreeLower, ptrdiff_t& nMemFreeUpper, int& nKickIdx,
|
||||
[[maybe_unused]] int& nNumSubmittedLoad, [[maybe_unused]] size_t& nAmtSubmittedLoad)
|
||||
{
|
||||
uint32 nWantedWidth = max(1, pTex->m_nWidth >> nTexWantedMip);
|
||||
uint32 nWantedHeight = max(1, pTex->m_nHeight >> nTexWantedMip);
|
||||
uint32 nAvailWidth = max(1, pTex->m_nWidth >> nTexAvailMip);
|
||||
uint32 nAvailHeight = max(1, pTex->m_nHeight >> nTexAvailMip);
|
||||
|
||||
ptrdiff_t nRequired = pTex->StreamComputeDevDataSize(nTexWantedMip) - pTex->StreamComputeDevDataSize(nTexAvailMip);
|
||||
|
||||
@@ -787,7 +778,6 @@ bool CPlanningTextureStreamer::TrimTexture(int nBias, TStreamerTextureVec& trimm
|
||||
{
|
||||
CTexture* pTrimTex = trimmable[i];
|
||||
|
||||
bool bRemove = false;
|
||||
|
||||
if (pTrimTex->m_bStreamPrepared)
|
||||
{
|
||||
@@ -881,10 +871,6 @@ ptrdiff_t CPlanningTextureStreamer::KickTextures(CTexture** pTextures, ptrdiff_t
|
||||
// unload textures that are older than 4 update cycles
|
||||
if (nKillPersMip > nKillMip)
|
||||
{
|
||||
uint32 nKillWidth = pKillTex->m_nWidth >> nKillMip;
|
||||
uint32 nKillHeight = pKillTex->m_nHeight >> nKillMip;
|
||||
int nKillMips = nKillPersMip - nKillMip;
|
||||
ETEX_Format nKillFormat = pKillTex->m_eTFSrc;
|
||||
|
||||
// How much is available?
|
||||
ptrdiff_t nProfit = pKillTex->StreamComputeDevDataSize(nKillMip) - pKillTex->StreamComputeDevDataSize(nKillPersMip);
|
||||
|
||||
@@ -546,7 +546,6 @@ void CPlanningTextureStreamer::Job_Sort()
|
||||
CTexture** pTextures = &(*sortState.pTextures)[0];
|
||||
size_t nTextures = sortState.nTextures;
|
||||
|
||||
int nOnScreenFrameId = sortState.nFrameId - 8;
|
||||
int nMinMip = sortState.fpMinMip >> 8;
|
||||
|
||||
size_t const nStreamLimit = sortState.nStreamLimit;
|
||||
@@ -617,7 +616,6 @@ void CPlanningTextureStreamer::Job_CommitKeys(CTexture** pTextures, SPlanningTex
|
||||
|
||||
void CPlanningTextureStreamer::Job_CheckEnqueueForStreaming(CTexture* pTexture, const float fMipFactor, bool bHighPriority)
|
||||
{
|
||||
STexStreamingInfo* pStrmInfo = pTexture->m_pFileTexMips;
|
||||
|
||||
// calculate the new lod value
|
||||
int fpMipIdSigned = pTexture->StreamCalculateMipsSignedFP(fMipFactor);
|
||||
|
||||
@@ -689,7 +689,6 @@ CTexture* CTexture::Create2DTexture(const char* szName, int nWidth, int nHeight,
|
||||
|
||||
CTexture* pTex = CreateTextureObject(szName, nWidth, nHeight, 1, eTT_2D, nFlags, eTFDst, -1);
|
||||
pTex->m_bAsyncDevTexCreation = bAsyncDevTexCreation;
|
||||
bool bFound = false;
|
||||
|
||||
pTex->Create2DTexture(nWidth, nHeight, nMips, nFlags, pData, eTFSrc, eTFDst);
|
||||
|
||||
@@ -723,7 +722,6 @@ bool CTexture::Create3DTexture(int nWidth, int nHeight, int nDepth, int nMips, [
|
||||
CTexture* CTexture::Create3DTexture(const char* szName, int nWidth, int nHeight, int nDepth, int nMips, int nFlags, const byte* pData, ETEX_Format eTFSrc, ETEX_Format eTFDst)
|
||||
{
|
||||
CTexture* pTex = CreateTextureObject(szName, nWidth, nHeight, nDepth, eTT_3D, nFlags, eTFDst, -1);
|
||||
bool bFound = false;
|
||||
|
||||
pTex->Create3DTexture(nWidth, nHeight, nDepth, nMips, nFlags, pData, eTFSrc, eTFDst);
|
||||
|
||||
@@ -930,7 +928,8 @@ void CTexture::RT_Precache()
|
||||
int pakLogFileAccess = 0;
|
||||
if IsCVarConstAccess(constexpr) (!CRenderer::CV_r_texturesstreaming)
|
||||
{
|
||||
if (sysPakLogInvalidAccess = gEnv->pConsole->GetCVar("sys_PakLogInvalidFileAccess"))
|
||||
sysPakLogInvalidAccess = gEnv->pConsole->GetCVar("sys_PakLogInvalidFileAccess");
|
||||
if (sysPakLogInvalidAccess)
|
||||
{
|
||||
pakLogFileAccess = sysPakLogInvalidAccess->GetIVal();
|
||||
}
|
||||
@@ -1473,7 +1472,9 @@ bool CTexture::ImagePreprocessing(STexData& td)
|
||||
{
|
||||
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_RENDERER, g_bProfilerEnabled);
|
||||
|
||||
#if !defined(_RELEASE)
|
||||
const char* pTexFileName = td.m_pFilePath ? td.m_pFilePath : "$Unknown";
|
||||
#endif
|
||||
|
||||
const ETEX_Format eTFDst = ClosestFormatSupported(m_eTFDst);
|
||||
if (eTFDst == eTF_Unknown)
|
||||
@@ -2412,7 +2413,6 @@ Ang3 sDeltAngles(Ang3& Ang0, Ang3& Ang1)
|
||||
|
||||
SEnvTexture* CTexture::FindSuitableEnvTex(Vec3& Pos, Ang3& Angs, bool bMustExist, [[maybe_unused]] int RendFlags, [[maybe_unused]] bool bUseExistingREs, [[maybe_unused]] CShader* pSH, [[maybe_unused]] CShaderResources* pRes, CRenderObject* pObj, bool bReflect, IRenderElement* pRE, bool* bMustUpdate)
|
||||
{
|
||||
SEnvTexture* cm = NULL;
|
||||
float time0 = iTimer->GetAsyncCurTime();
|
||||
|
||||
int i;
|
||||
@@ -2639,7 +2639,6 @@ bool CTexture::ReloadFile(const char* szFileName)
|
||||
char realNameBuffer[256];
|
||||
fpConvertDOSToUnixName(realNameBuffer, szFileName);
|
||||
|
||||
char* realName = realNameBuffer;
|
||||
|
||||
bool bStatus = false;
|
||||
|
||||
@@ -3233,10 +3232,10 @@ void CRenderer::EF_PrintRTStats(const char* szName)
|
||||
|
||||
bool CTexture::IsMSAAChanged()
|
||||
{
|
||||
const RenderTargetData* pRtdt = m_pRenderTargetData;
|
||||
#if defined(NULL_RENDERER)
|
||||
return false;
|
||||
#else
|
||||
const RenderTargetData* pRtdt = m_pRenderTargetData;
|
||||
return pRtdt && (pRtdt->m_nMSAASamples != gRenDev->m_RP.m_MSAAData.Type || pRtdt->m_nMSAAQuality != gRenDev->m_RP.m_MSAAData.Quality);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -32,10 +32,6 @@
|
||||
#include <AzCore/std/containers/map.h>
|
||||
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
#include <RenderContextConfig.h>
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#undef AZ_RESTRICTED_SECTION
|
||||
#define TEXTURE_H_SECTION_1 1
|
||||
@@ -2273,10 +2269,6 @@ public:
|
||||
static SEnvTexture* FindSuitableEnvTex(Vec3& Pos, Ang3& Angs, bool bMustExist, int RendFlags, bool bUseExistingREs, CShader* pSH, CShaderResources* pRes, CRenderObject* pObj, bool bReflect, IRenderElement* pRE, bool* bMustUpdate);
|
||||
static bool RenderEnvironmentCMHDR(int size, Vec3& Pos, TArray<unsigned short>& vecData);
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
static bool RenderToTexture(int handle, const CCamera& camera, AzRTT::RenderContextId contextId);
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
static void DrawCubeSide(Vec3& Pos, int tex_size, int side, float fMaxDist);
|
||||
static void DrawSceneToCubeSide(Vec3& Pos, int tex_size, int side);
|
||||
static void GetAverageColor(SEnvTexture* cm, int nSide);
|
||||
|
||||
@@ -617,7 +617,10 @@ void CTexture::StreamLoadFromCache([[maybe_unused]] const int Flags)
|
||||
// ignore error for optional attached alpha channel
|
||||
if (!m_bNoTexture && !(m_nFlags & FT_ALPHA) && (m_nFlags & FT_FROMIMAGE))
|
||||
{
|
||||
bool bRes = Reload();
|
||||
#ifndef NDEBUG
|
||||
bool bRes =
|
||||
#endif
|
||||
Reload();
|
||||
assert(bRes);
|
||||
}
|
||||
}
|
||||
@@ -725,7 +728,6 @@ bool CTexture::StreamPrepareComposition()
|
||||
|
||||
int nMipsPersistent = DDSSplitted::GetNumLastMips(nWidth, nHeight, nMips, nSides, eTFSrc, 0);
|
||||
|
||||
bool bStreamable = true;
|
||||
|
||||
m_nFlags &= ~(FT_SPLITTED | FT_TEX_WAS_NOT_PRE_TILED | FT_HAS_ATTACHED_ALPHA | FT_DONT_STREAM | FT_FROMIMAGE);
|
||||
|
||||
@@ -1681,7 +1683,6 @@ void CTexture::InitStreaming()
|
||||
s_pPoolMgr = new CTextureStreamPoolMgr();
|
||||
}
|
||||
|
||||
SSystemGlobalEnvironment* pEnv = iSystem->GetGlobalEnvironment();
|
||||
|
||||
#if !defined(CONSOLE)
|
||||
if (CRenderer::CV_r_texturesstreaming)
|
||||
@@ -1948,7 +1949,10 @@ void CTexture::AbortStreamingTasks(CTexture* pTex)
|
||||
}
|
||||
}
|
||||
|
||||
bool bCommitted = streamState.TryCommit();
|
||||
#ifndef NDEBUG
|
||||
bool bCommitted =
|
||||
#endif
|
||||
streamState.TryCommit();
|
||||
assert (bCommitted);
|
||||
|
||||
StreamState_ReleaseIn(&streamState);
|
||||
|
||||
@@ -430,7 +430,6 @@ public:
|
||||
// Update simulation
|
||||
void Update(SWaterUpdateThreadInfo& pThreadInfo)
|
||||
{
|
||||
int nFrameID = pThreadInfo.nFrameID;
|
||||
float fTime = pThreadInfo.fTime;
|
||||
bool bOnlyHeight = pThreadInfo.bOnlyHeight;
|
||||
|
||||
@@ -522,7 +521,6 @@ public:
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Renderer);
|
||||
|
||||
CRenderer* rd = gRenDev;
|
||||
|
||||
m_nFillThreadID = m_nWorkerThreadID = 0;
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ bool CD3D9Renderer::FX_DeferredCaustics()
|
||||
CreateDeferredUnitBox(arrDeferredInds, arrDeferredVerts);
|
||||
|
||||
Vec3 vCamPos = gRenDev->GetViewParameters().vOrigin;
|
||||
float fWaterPlaneSize = gRenDev->GetCamera().GetFarPlane();
|
||||
|
||||
Matrix44A origMatView = m_RP.m_TI[m_RP.m_nProcessThreadID].m_matView;
|
||||
Matrix34 mLocal;
|
||||
@@ -832,7 +831,6 @@ bool CD3D9Renderer::FX_DeferredSnowLayer()
|
||||
bool CD3D9Renderer::FX_DeferredSnowDisplacement()
|
||||
{
|
||||
const SSnowParams& snowVolParams = m_p3DEngineCommon.m_SnowInfo;
|
||||
const SRainParams& rainVolParams = m_p3DEngineCommon.m_RainInfo;
|
||||
CShader* pShader = CShaderMan::s_ShaderDeferredSnow;
|
||||
|
||||
if IsCVarConstAccess(constexpr) ((CRenderer::CV_r_snow < 1 || CRenderer::CV_r_snow_displacement < 1) || snowVolParams.m_fSnowAmount < 0.05f || snowVolParams.m_fRadius < 0.05f)
|
||||
|
||||
@@ -787,7 +787,6 @@ void CD3D9Renderer::FX_StencilFrustumCull(int nStencilID, const SRenderLight* pL
|
||||
CShader* pShader = CShaderMan::s_ShaderShadowMaskGen;
|
||||
static CCryNameTSCRC StencilCullTechName = "DeferredShadowPass";
|
||||
|
||||
float Z = 1.0f;
|
||||
|
||||
Matrix44A mProjection = m_IdentityMatrix;
|
||||
Matrix44A mView = m_IdentityMatrix;
|
||||
@@ -1556,7 +1555,6 @@ bool CD3D9Renderer::FX_DeferredShadows(SRenderLight* pLight, int maskRTWidth, in
|
||||
|
||||
// set shader
|
||||
CShader* pSH(CShaderMan::s_ShaderShadowMaskGen);
|
||||
uint32 nPasses = 0;
|
||||
static CCryNameR TechName("DeferredShadowPass");
|
||||
|
||||
if IsCVarConstAccess(constexpr) (CRenderer::CV_r_DeferredShadingLBuffersFmt == 2)
|
||||
|
||||
@@ -1256,11 +1256,9 @@ bool CDeferredShading::DeferredDecalPass(const SDeferredDecal& rDecal, uint32 in
|
||||
gcpRendD3D->m_RP.m_FlagsShader_RT &= ~(RT_LIGHTSMASK | g_HWSR_MaskBit[HWSR_SAMPLE4]);
|
||||
|
||||
CD3D9Renderer* const __restrict rd = gcpRendD3D;
|
||||
int nThreadID = rd->m_RP.m_nProcessThreadID;
|
||||
|
||||
rd->m_RP.m_nDeferredPrimitiveID = SHAPE_PROJECTOR;
|
||||
|
||||
bool bProj2D = true;
|
||||
bool bStencilMask = false;
|
||||
bool bUseLightVolumes = true;
|
||||
|
||||
@@ -1503,11 +1501,9 @@ void CDeferredShading::DeferredDecalEmissivePass(const SDeferredDecal& rDecal, [
|
||||
gcpRendD3D->m_RP.m_FlagsShader_RT &= ~(RT_LIGHTSMASK | g_HWSR_MaskBit[HWSR_SAMPLE4]);
|
||||
|
||||
CD3D9Renderer* const __restrict rd = gcpRendD3D;
|
||||
int nThreadID = rd->m_RP.m_nProcessThreadID;
|
||||
|
||||
rd->m_RP.m_nDeferredPrimitiveID = SHAPE_PROJECTOR;
|
||||
|
||||
bool bProj2D = true;
|
||||
bool bUseLightVolumes = true;
|
||||
|
||||
rd->EF_Scissor(false, 0, 0, 1, 1);
|
||||
@@ -3073,23 +3069,8 @@ void CDeferredShading::ScreenSpaceReflectionPass()
|
||||
0.5f, 0.5f, 0, 1.0f);
|
||||
const uint32 numGPUs = rd->GetActiveGPUCount();
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// render to texture supports view projections for multiple cameras
|
||||
const CCamera& camera = rd->m_RP.m_TI[rd->m_RP.m_nProcessThreadID].m_cam;
|
||||
const AZ::EntityId cameraID = camera.GetEntityId();
|
||||
const int frameID = camera.GetFrameUpdateId();
|
||||
const uint32 prevViewProjID = max((frameID - (int)numGPUs) % MAX_GPU_NUM, 0);
|
||||
auto iter = m_prevViewProj[prevViewProjID].find(cameraID);
|
||||
if (iter == m_prevViewProj[prevViewProjID].end())
|
||||
{
|
||||
// initialize with the current view projection in case this is a one-off render.
|
||||
m_prevViewProj[prevViewProjID].insert({ cameraID, mViewProj });
|
||||
}
|
||||
Matrix44 mViewProjPrev = m_prevViewProj[prevViewProjID][cameraID] * mViewport;
|
||||
#else
|
||||
const int frameID = GetUtils().m_iFrameCounter;
|
||||
Matrix44 mViewProjPrev = m_prevViewProj[max((frameID - (int)numGPUs) % MAX_GPU_NUM, 0)] * mViewport;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
PROFILE_LABEL_SCOPE("SS_REFLECTIONS");
|
||||
|
||||
@@ -3227,21 +3208,7 @@ void CDeferredShading::ScreenSpaceReflectionPass()
|
||||
rd->RT_SetViewport(prevVpX, prevVpY, prevVpWidth, prevVpHeight);
|
||||
|
||||
// Array used for MGPU support
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// Don't use array assignment to insert or Matrix44 will assert because
|
||||
// the allocator calls the constructor with an invalid Matrix44
|
||||
iter = m_prevViewProj[frameID % MAX_GPU_NUM].find(cameraID);
|
||||
if (iter == m_prevViewProj[frameID % MAX_GPU_NUM].end())
|
||||
{
|
||||
m_prevViewProj[frameID % MAX_GPU_NUM].insert({ cameraID, mViewProj });
|
||||
}
|
||||
else
|
||||
{
|
||||
iter->second = mViewProj;
|
||||
}
|
||||
#else
|
||||
m_prevViewProj[frameID % MAX_GPU_NUM] = mViewProj;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
}
|
||||
|
||||
void CDeferredShading::ApplySSReflections()
|
||||
@@ -3762,7 +3729,6 @@ void CDeferredShading::DeferredShadingPass()
|
||||
{
|
||||
CD3D9Renderer* const __restrict rd = gcpRendD3D;
|
||||
|
||||
int nRec = SRendItem::m_RecurseLevel[rd->m_RP.m_nProcessThreadID];
|
||||
|
||||
if (rd->IsShadowPassEnabled())
|
||||
{
|
||||
@@ -4180,7 +4146,6 @@ bool CDeferredShading::PackToPool(CPowerOf2BlockPacker* pBlockPack, SRenderLight
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int nBlockW = firstFrustum.nTexSize >> TEX_POOL_BLOCKLOGSIZE;
|
||||
int nBlockH = firstFrustum.nTexSize >> TEX_POOL_BLOCKLOGSIZE;
|
||||
int nLogBlockW = IntegerLog2((uint32)nBlockW);
|
||||
int nLogBlockH = nLogBlockW;
|
||||
|
||||
@@ -4571,7 +4536,6 @@ bool CDeferredShading::ShadowLightPasses(const SRenderLight& light)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int nShadowQuality = rd->FX_ApplyShadowQuality();
|
||||
|
||||
m_nCurLighID = light.m_lightId;
|
||||
|
||||
@@ -4876,8 +4840,10 @@ struct DeffDecalSort
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CDeferredShading::SetupGmemPath()
|
||||
{
|
||||
#if !defined(NDEBUG)
|
||||
bool bTiledDeferredShading = CRenderer::CV_r_DeferredShadingTiled >= 2;
|
||||
assert(!bTiledDeferredShading); // NOT SUPPORTED IN GMEM PATH!
|
||||
#endif
|
||||
|
||||
SetupPasses();
|
||||
TArray<SRenderLight>& rDeferredLights = m_pLights[eDLT_DeferredLight][m_nThreadID][m_nRecurseLevel];
|
||||
@@ -4887,9 +4853,8 @@ void CDeferredShading::SetupGmemPath()
|
||||
m_nCurrentShadowPoolLight = 0;
|
||||
m_nFirstCandidateShadowPoolLight = 0;
|
||||
|
||||
CD3D9Renderer* const __restrict rd = gcpRendD3D;
|
||||
|
||||
#if !defined(_RELEASE)
|
||||
CD3D9Renderer* const __restrict rd = gcpRendD3D;
|
||||
rd->m_RP.m_PS[m_nThreadID].m_NumShadowPoolFrustums = 0;
|
||||
rd->m_RP.m_PS[m_nThreadID].m_NumShadowPoolAllocsThisFrame = 0;
|
||||
rd->m_RP.m_PS[m_nThreadID].m_NumShadowMaskChannels = 0;
|
||||
|
||||
@@ -278,21 +278,10 @@ private:
|
||||
|
||||
m_nShadowPoolSize = 0;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// render to texture supports multiple cameras
|
||||
const AZ::EntityId defaultEntityId;
|
||||
Matrix44 identityMatrix;
|
||||
identityMatrix.SetIdentity();
|
||||
for (int i = 0; i < MAX_GPU_NUM; ++i)
|
||||
{
|
||||
m_prevViewProj[i].insert({ defaultEntityId, identityMatrix });
|
||||
}
|
||||
#else
|
||||
for (int i = 0; i < MAX_GPU_NUM; ++i)
|
||||
{
|
||||
m_prevViewProj[i].SetIdentity();
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
m_nRenderState = GS_BLSRC_ONE | GS_BLDST_ONE;
|
||||
|
||||
@@ -418,15 +407,7 @@ private:
|
||||
Matrix44A m_pViewProjI;
|
||||
Matrix44A m_pView;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// render to texture supports multiple cameras
|
||||
// we do not use Matrix44A here because this is used with Matrix44s and will
|
||||
// fail to compile in release mode due to alignment errors
|
||||
AZStd::unordered_map<AZ::EntityId, Matrix44> m_prevViewProj[MAX_GPU_NUM];
|
||||
#else
|
||||
Matrix44A m_prevViewProj[MAX_GPU_NUM];
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
|
||||
Vec4 vWorldBasisX, vWorldBasisY, vWorldBasisZ;
|
||||
|
||||
|
||||
@@ -452,7 +452,6 @@ void CD3D9Renderer::FX_SetActiveRenderTargets(bool /*bAllowDip*/)
|
||||
return;
|
||||
}
|
||||
FUNCTION_PROFILER_RENDER_FLAT
|
||||
HRESULT hr = S_OK;
|
||||
bool bDirty = false;
|
||||
if (m_nMaxRT2Commit >= 0)
|
||||
{
|
||||
@@ -1757,8 +1756,8 @@ void CD3D9Renderer::FX_CommitStates(const SShaderTechnique* pTech, const SShader
|
||||
rRP.m_FlagsShader_RT |= g_HWSR_MaskBit[HWSR_ALPHATEST];
|
||||
}
|
||||
|
||||
int nBlend;
|
||||
if (nBlend = (rRP.m_CurState & (GS_BLEND_MASK & ~GS_BLALPHA_MASK)))
|
||||
int nBlend = rRP.m_CurState & (GS_BLEND_MASK & ~GS_BLALPHA_MASK);
|
||||
if (nBlend)
|
||||
{
|
||||
//set alpha blend shader flag when the blend mode for color is set to alpha blend.
|
||||
if (nBlend == (GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA)
|
||||
@@ -2433,16 +2432,14 @@ TArray<CRenderObject*> CD3D9Renderer::s_tempObjects[2];
|
||||
TArray<SRendItem*> CD3D9Renderer::s_tempRIs;
|
||||
|
||||
// Actual drawing of instances
|
||||
void CD3D9Renderer::FX_DrawInstances([[maybe_unused]] CShader* ef, SShaderPass* slw, int nRE, uint32 nStartInst, uint32 nLastInst, uint32 nUsedAttr, [[maybe_unused]] byte* InstanceData, int nInstAttrMask, byte Attributes[], [[maybe_unused]] short dwCBufSlot)
|
||||
void CD3D9Renderer::FX_DrawInstances([[maybe_unused]] CShader* ef, SShaderPass* slw, [[maybe_unused]] int nRE, uint32 nStartInst, uint32 nLastInst, uint32 nUsedAttr, [[maybe_unused]] byte* InstanceData, int nInstAttrMask, byte Attributes[], [[maybe_unused]] short dwCBufSlot)
|
||||
{
|
||||
DETAILED_PROFILE_MARKER("FX_DrawInstances");
|
||||
uint32 i;
|
||||
|
||||
CHWShader_D3D* vp = (CHWShader_D3D*)slw->m_VShader;
|
||||
|
||||
SRenderPipeline& RESTRICT_REFERENCE rRP = m_RP;
|
||||
|
||||
SRendItem** rRIs = &(rRP.m_RIs[nRE][0]);
|
||||
|
||||
if (!CHWShader_D3D::s_pCurInstVS || !CHWShader_D3D::s_pCurInstPS || CHWShader_D3D::s_pCurInstVS->m_bFallback || CHWShader_D3D::s_pCurInstPS->m_bFallback)
|
||||
{
|
||||
@@ -2454,7 +2451,6 @@ void CD3D9Renderer::FX_DrawInstances([[maybe_unused]] CShader* ef, SShaderPass*
|
||||
{
|
||||
// Set the stream 3 to be per instance data and iterate once per instance
|
||||
rRP.m_PersFlags1 &= ~(RBPF1_USESTREAM << 3);
|
||||
int nCompared = 0;
|
||||
if (!FX_CommitStreams(slw, false))
|
||||
{
|
||||
return;
|
||||
@@ -2520,7 +2516,6 @@ void CD3D9Renderer::FX_DrawInstances([[maybe_unused]] CShader* ef, SShaderPass*
|
||||
int nInsts = nLastInst - nStartInst + 1;
|
||||
{
|
||||
//PROFILE_FRAME(Draw_ShaderIndexMesh);
|
||||
int nPolysPerInst = rRP.m_RendNumIndices / 3;
|
||||
#ifndef _RELEASE
|
||||
char instanceLabel[64];
|
||||
if (CV_r_geominstancingdebug)
|
||||
@@ -2551,6 +2546,7 @@ void CD3D9Renderer::FX_DrawInstances([[maybe_unused]] CShader* ef, SShaderPass*
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_PROFILING_CODE)
|
||||
int nPolysPerInst = rRP.m_RendNumIndices / 3;
|
||||
int nPolysAll = nPolysPerInst * nInsts;
|
||||
rRP.m_PS[rRP.m_nProcessThreadID].m_nPolygons[rRP.m_nPassGroupDIP] += rRP.m_RendNumIndices / 3;
|
||||
rRP.m_PS[rRP.m_nProcessThreadID].m_nDIPs[rRP.m_nPassGroupDIP] += nInsts;
|
||||
@@ -2766,7 +2762,6 @@ void CD3D9Renderer::FX_DrawShader_InstancedHW(CShader* ef, SShaderPass* slw)
|
||||
int nStreamMask = rRP.m_FlagsStreams_Stream >> 1;
|
||||
int nVFormat = rRP.m_CurVFormat.GetEnum();
|
||||
uint32 nCO = 0;
|
||||
int nCI = 0;
|
||||
uint32 dwDeclarationSize = 0;
|
||||
if (dwDeclarationSize + nUsedAttr - 1 > 16)
|
||||
{
|
||||
@@ -2785,7 +2780,6 @@ void CD3D9Renderer::FX_DrawShader_InstancedHW(CShader* ef, SShaderPass* slw)
|
||||
nLastInst = nCurInst + (nParamsPerInstAllowed / nUsedAttr) - 1;
|
||||
}
|
||||
}
|
||||
byte* inddata = NULL;
|
||||
{
|
||||
vb.Allocate(nLastInst - nCurInst + 1, nUsedAttr * INST_PARAM_SIZE);
|
||||
data = (byte*) vb.Lock();
|
||||
@@ -2946,7 +2940,6 @@ void CD3D9Renderer::FX_DrawBatchesSkinned(CShader* pSh, SShaderPass* pPass, SSki
|
||||
CREMeshImpl* pRE = (CREMeshImpl*) rRP.m_pRE;
|
||||
CRenderObject* const pSaveObj = rRP.m_pCurObject;
|
||||
|
||||
size_t size = 0, offset = 0;
|
||||
CHWShader_D3D* pCurGS = (CHWShader_D3D*)pPass->m_GShader;
|
||||
|
||||
|
||||
@@ -3137,9 +3130,8 @@ done:
|
||||
#if defined(DO_RENDERSTATS)
|
||||
void CD3D9Renderer::FX_TrackStats([[maybe_unused]] CRenderObject* pObj, [[maybe_unused]] IRenderMesh* pRenderMesh)
|
||||
{
|
||||
SRenderPipeline& RESTRICT_REFERENCE rRP = m_RP;
|
||||
#if !defined(_RELEASE)
|
||||
|
||||
SRenderPipeline& RESTRICT_REFERENCE rRP = m_RP;
|
||||
if (pObj)
|
||||
{
|
||||
if (IRenderNode* pRenderNode = (IRenderNode*)pObj->m_pRenderNode)
|
||||
@@ -3271,8 +3263,9 @@ void CD3D9Renderer::FX_DrawBatches(CShader* pSh, SShaderPass* pPass)
|
||||
if (bHWSkinning)
|
||||
{
|
||||
SRenderObjData* pOD = rRP.m_pCurObject->GetObjData();
|
||||
if (!pOD || !(pSkinningData = pOD->m_pSkinningData))
|
||||
if (!pOD || !pOD->m_pSkinningData)
|
||||
{
|
||||
pSkinningData = pOD->m_pSkinningData;
|
||||
bHWSkinning = false;
|
||||
Warning("Warning: Skinned geometry used without character instance");
|
||||
}
|
||||
@@ -3497,7 +3490,6 @@ void CD3D9Renderer::FX_DrawShader_General(CShader* ef, SShaderTechnique* pTech)
|
||||
|
||||
PROFILE_FRAME(DrawShader_Generic);
|
||||
|
||||
SThreadInfo& RESTRICT_REFERENCE rTI = m_RP.m_TI[m_RP.m_nProcessThreadID];
|
||||
|
||||
EF_Scissor(false, 0, 0, 0, 0);
|
||||
|
||||
@@ -3555,7 +3547,6 @@ void CD3D9Renderer::FX_DrawShader_Fur(CShader* ef, SShaderTechnique* pTech)
|
||||
{
|
||||
PROFILE_FRAME(DrawShader_Fur);
|
||||
|
||||
SThreadInfo& RESTRICT_REFERENCE rTI = m_RP.m_TI[m_RP.m_nProcessThreadID];
|
||||
|
||||
EF_Scissor(false, 0, 0, 0, 0);
|
||||
|
||||
@@ -3847,8 +3838,6 @@ void CD3D9Renderer::FX_DrawMultiLayers()
|
||||
{
|
||||
s_tempRIs.SetUse(0);
|
||||
|
||||
float fDistToCam = 500.0f;
|
||||
float fDist = CV_r_detaildistance;
|
||||
CRenderObject* pObj = m_RP.m_pCurObject;
|
||||
uint32 nObj = 0;
|
||||
|
||||
@@ -3870,7 +3859,6 @@ void CD3D9Renderer::FX_DrawMultiLayers()
|
||||
}
|
||||
}
|
||||
|
||||
SShaderItem& pMtlShaderItem = pCurrMtl->GetShaderItem();
|
||||
int nSaveLastRE = m_RP.m_nLastRE;
|
||||
m_RP.m_nLastRE = 0;
|
||||
|
||||
@@ -4112,7 +4100,6 @@ bool CD3D9Renderer::FX_SetResourcesState()
|
||||
m_RP.m_FlagsPerFlush &= ~RBSI_INSTANCED;
|
||||
}
|
||||
|
||||
bool bRes = true;
|
||||
if (uResFlags & MTL_FLAG_2SIDED)
|
||||
{
|
||||
D3DSetCull(eCULL_None);
|
||||
@@ -4715,8 +4702,7 @@ void CD3D9Renderer::FX_FlushShader_ShadowGen()
|
||||
}
|
||||
}
|
||||
|
||||
SThreadInfo& RESTRICT_REFERENCE rTI = rRP.m_TI[rRP.m_nProcessThreadID];
|
||||
assert(rTI.m_PersFlags & RBPF_SHADOWGEN);
|
||||
assert(rRP.m_TI[rRP.m_nProcessThreadID].m_PersFlags & RBPF_SHADOWGEN);
|
||||
|
||||
CRenderObject* pObj = rRP.m_pCurObject;
|
||||
|
||||
@@ -4734,7 +4720,6 @@ void CD3D9Renderer::FX_FlushShader_ShadowGen()
|
||||
}
|
||||
#endif
|
||||
|
||||
SPipeStat& rPS = rRP.m_PS[rRP.m_nProcessThreadID];
|
||||
#ifndef _RELEASE
|
||||
sBatchStats(rRP);
|
||||
#endif
|
||||
@@ -4874,8 +4859,7 @@ void CD3D9Renderer::FX_FlushShader_ZPass()
|
||||
}
|
||||
}
|
||||
|
||||
SThreadInfo& RESTRICT_REFERENCE rTI = rRP.m_TI[rRP.m_nProcessThreadID];
|
||||
assert(!(rTI.m_PersFlags & RBPF_SHADOWGEN));
|
||||
assert(!(rRP.m_TI[rRP.m_nProcessThreadID].m_PersFlags & RBPF_SHADOWGEN));
|
||||
assert(rRP.m_nBatchFilter & (FB_Z | FB_ZPREPASS | FB_POST_3D_RENDER));
|
||||
|
||||
#ifdef DO_RENDERLOG
|
||||
@@ -5098,7 +5082,6 @@ void TexBlurAnisotropicVertical(CTexture* pTex, int nAmount, float fScale, [[may
|
||||
gRenDev->FX_SetState(GS_NODEPTHTEST);
|
||||
|
||||
// setup texture offsets, for texture sampling
|
||||
float s1 = 1.0f / (float) pTex->GetWidth();
|
||||
float t1 = 1.0f / (float) pTex->GetHeight();
|
||||
|
||||
Vec4 pWeightsPS;
|
||||
@@ -5234,14 +5217,6 @@ bool CD3D9Renderer::FX_DrawToRenderTarget(CShader* pShader, CShaderResources* pR
|
||||
bMakeEnvironmentTexture = (!pEnvTex->m_pTex || pEnvTex->m_pTex->GetFormat() != eTF);
|
||||
}
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// do not re-create the environment texture for the RTT pass for now, just use the existing one.
|
||||
if (m_RP.m_TI[nThreadList].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE && pEnvTex->m_pTex)
|
||||
{
|
||||
bMakeEnvironmentTexture = false;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
// clamping to a reasonable texture size
|
||||
if (nWidth < 32)
|
||||
{
|
||||
@@ -5402,7 +5377,6 @@ bool CD3D9Renderer::FX_DrawToRenderTarget(CShader* pShader, CShaderResources* pR
|
||||
Vec3 camPos = GetCamera().GetPosition();
|
||||
float fDistCam = (camPos - m_RP.m_LastWaterPosUpdate).GetLength();
|
||||
float fDotView = camView * m_RP.m_LastWaterViewdirUpdate;
|
||||
float fDotUp = camUp * m_RP.m_LastWaterUpdirUpdate;
|
||||
float fFOV = GetCamera().GetFov();
|
||||
if (m_RP.m_fLastWaterUpdate - 1.0f > m_RP.m_TI[nThreadList].m_RealTime)
|
||||
{
|
||||
|
||||
@@ -602,7 +602,6 @@ void GetSampleOffsets_DownScale2x2(uint32 nWidth, uint32 nHeight, Vec4 avSampleO
|
||||
|
||||
void CHDRPostProcess::SetShaderParams()
|
||||
{
|
||||
CD3D9Renderer* r = gcpRendD3D;
|
||||
|
||||
Vec4 vHDRSetupParams[5];
|
||||
gEnv->p3DEngine->GetHDRSetupParams(vHDRSetupParams);
|
||||
@@ -883,15 +882,7 @@ void CHDRPostProcess::EyeAdaptation()
|
||||
const int32 lumMask = static_cast<int32>((sizeof(CTexture::s_ptexHDRAdaptedLuminanceCur) / sizeof(CTexture::s_ptexHDRAdaptedLuminanceCur[0]))) - 1;
|
||||
const int32 numTextures = static_cast<int32>(max(min(gRenDev->GetActiveGPUCount(), static_cast<uint32>(sizeof(CTexture::s_ptexHDRAdaptedLuminanceCur) / sizeof(CTexture::s_ptexHDRAdaptedLuminanceCur[0]))), 1u));
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// only increment the current luminance texture when drawing the main scene
|
||||
if (!(rd->m_RP.m_TI[rd->m_RP.m_nProcessThreadID].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE))
|
||||
{
|
||||
CTexture::s_nCurLumTextureIndex++;
|
||||
}
|
||||
#else
|
||||
CTexture::s_nCurLumTextureIndex++;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
CTexture* pTexPrev = CTexture::s_ptexHDRAdaptedLuminanceCur[(CTexture::s_nCurLumTextureIndex - numTextures) & lumMask];
|
||||
CTexture* pTexCur = CTexture::s_ptexHDRAdaptedLuminanceCur[CTexture::s_nCurLumTextureIndex & lumMask];
|
||||
@@ -1297,20 +1288,6 @@ void CHDRPostProcess::ToneMapping()
|
||||
rRP.m_FlagsShader_RT |= g_HWSR_MaskBit[HWSR_SAMPLE0];
|
||||
}
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// Disable gamma application if requested
|
||||
if (!CRenderer::CV_r_FinalOutputsRGB)
|
||||
{
|
||||
rRP.m_FlagsShader_RT |= g_HWSR_MaskBit[HWSR_SAMPLE2];
|
||||
}
|
||||
|
||||
// Output fully opaque alpha if rendering to texture without AA or depth
|
||||
if ((nAAMode & eAT_NOAA_MASK) && rd->IsRenderToTextureActive())
|
||||
{
|
||||
rRP.m_FlagsShader_RT |= g_HWSR_MaskBit[HWSR_SAMPLE3];
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
PostProcessUtils().SetSRGBShaderFlags();
|
||||
|
||||
rd->FX_SetColorDontCareActions(0, true, false);
|
||||
@@ -1492,7 +1469,6 @@ void CHDRPostProcess::ToneMapping()
|
||||
void CHDRPostProcess::EncodeDolbyVision(CTexture* source)
|
||||
{
|
||||
CD3D9Renderer* rd = gcpRendD3D;
|
||||
SRenderPipeline& RESTRICT_REFERENCE rRP = rd->m_RP;
|
||||
int NumPasses = 2;
|
||||
|
||||
for (int pass = 0; pass < NumPasses; pass++)
|
||||
@@ -1520,8 +1496,6 @@ void CHDRPostProcess::EncodeDolbyVision(CTexture* source)
|
||||
|
||||
// If any dolby output mode has been enabled, set required uniforms.
|
||||
{
|
||||
float width = (float)rd->GetOverlayWidth();
|
||||
float height = (float)rd->GetOverlayHeight();
|
||||
|
||||
static CCryNameR pszHDRDolbyParam0("HDRDolbyScurveParams0");
|
||||
static CCryNameR pszHDRDolbyParam1("HDRDolbyScurveParams1");
|
||||
@@ -1625,7 +1599,6 @@ void CHDRPostProcess::SetExposureTypeShaderFlags()
|
||||
|
||||
void CHDRPostProcess::ToneMappingDebug()
|
||||
{
|
||||
CD3D9Renderer* rd = gcpRendD3D;
|
||||
Vec4 avSampleOffsets[4];
|
||||
PROFILE_LABEL_SCOPE("TONEMAPPINGDEBUG");
|
||||
|
||||
@@ -2198,28 +2171,14 @@ void CD3D9Renderer::FX_FinalComposite()
|
||||
{
|
||||
FX_PopRenderTarget(0);
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const bool isRenderSceneToTexture = (m_RP.m_TI[m_RP.m_nProcessThreadID].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE) != 0;
|
||||
if (!isRenderSceneToTexture)
|
||||
{
|
||||
RT_SetViewport(0, 0, m_nativeWidth, m_nativeHeight);
|
||||
FX_SetRenderTarget(0, m_pBackBuffer, nullptr);
|
||||
FX_SetActiveRenderTargets();
|
||||
}
|
||||
#else
|
||||
RT_SetViewport(0, 0, m_nativeWidth, m_nativeHeight);
|
||||
FX_SetRenderTarget(0, m_pBackBuffer, nullptr);
|
||||
FX_SetActiveRenderTargets();
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
static ICVar* DolbyCvar = gEnv->pConsole->GetCVar("r_HDRDolby");
|
||||
int DolbyCvarValue = DolbyCvar ? DolbyCvar->GetIVal() : eDVM_Disabled;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (DolbyCvarValue == eDVM_Vision && !isRenderSceneToTexture)
|
||||
#else
|
||||
if (DolbyCvarValue == eDVM_Vision)
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
{
|
||||
CHDRPostProcess::GetInstance()->EncodeDolbyVision(upscaleSource);
|
||||
}
|
||||
|
||||
@@ -538,13 +538,7 @@ namespace
|
||||
{
|
||||
float* pData;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// render to texture uses custom data as a double buffer to prevent flicker
|
||||
// in the terrain texture base
|
||||
if (r->m_pRT->GetThreadList() == 0)
|
||||
#else
|
||||
if (SRendItem::m_RecurseLevel[r->m_RP.m_nProcessThreadID] <= 0)
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
{
|
||||
pData = (float*)pRE->GetCustomData();
|
||||
}
|
||||
@@ -834,10 +828,8 @@ namespace
|
||||
return params;
|
||||
}
|
||||
|
||||
NO_INLINE Vec4 sGetVolumetricFogScatteringParams(CD3D9Renderer* r)
|
||||
NO_INLINE Vec4 sGetVolumetricFogScatteringParams([[maybe_unused]] CD3D9Renderer* r)
|
||||
{
|
||||
const CameraViewParameters& rc = r->GetViewParameters();
|
||||
|
||||
Vec3 volFogScatterParams(0.0f, 0.0f, 0.0f);
|
||||
gEnv->p3DEngine->GetGlobalParameter(E3DPARAM_VOLFOG2_SCATTERING_PARAMS, volFogScatterParams);
|
||||
|
||||
@@ -1130,7 +1122,6 @@ namespace
|
||||
}
|
||||
const float fRecipThermalViewDist = 1.0f;
|
||||
|
||||
CShaderResources* pRes = gRenDev->m_RP.m_pShaderResources;
|
||||
float heatAmount = 0.0f;
|
||||
|
||||
sData[0].f[0] = heatAmount;
|
||||
@@ -1274,7 +1265,6 @@ namespace
|
||||
{
|
||||
float scale = 1.0f;
|
||||
|
||||
IRenderNode *pRenderNode = (IRenderNode *)pCurObject->m_pRenderNode;
|
||||
|
||||
float distance = pCurObject->m_fDistance * TANGENT30_2 / scale;
|
||||
int screenHeight = gRenDev->GetHeight();
|
||||
@@ -1336,7 +1326,6 @@ namespace
|
||||
{
|
||||
float scale = 1.0f;
|
||||
|
||||
IRenderNode *pRenderNode = (IRenderNode *)pCurObject->m_pRenderNode;
|
||||
|
||||
float distance = pCurObject->m_fDistance * TANGENT30_2 / scale;
|
||||
int screenHeight = gRenDev->GetHeight();
|
||||
@@ -1397,7 +1386,6 @@ namespace
|
||||
}
|
||||
NO_INLINE void sAmbientOpacity(CRenderObject* const renderObject, CD3D9Renderer* renderer, CShaderResources* shaderResources, UFloat4* sData, const CRenderObject::SInstanceInfo& instInfo)
|
||||
{
|
||||
PerFrameParameters& RESTRICT_REFERENCE PF = renderer->m_cEF.m_PF;
|
||||
SRenderPipeline& RESTRICT_REFERENCE rRP = renderer->m_RP;
|
||||
|
||||
float opacity = shaderResources ? shaderResources->GetStrengthValue(EFTT_OPACITY) : 1.0f;
|
||||
@@ -1440,7 +1428,6 @@ namespace
|
||||
CD3D9Renderer* const __restrict r = gcpRendD3D;
|
||||
SRenderPipeline& RESTRICT_REFERENCE rRP = r->m_RP;
|
||||
CRenderObject* pObj = rRP.m_pCurObject;
|
||||
CShaderResources* shaderResources = rRP.m_pShaderResources;
|
||||
sData[0].f[0] = instInfo.m_AmbColor[3];
|
||||
sData[0].f[1] = /*instInfo.m_AmbColor[3] * */ rRP.m_fCurOpacity * pObj->m_fAlpha;
|
||||
|
||||
@@ -1689,8 +1676,6 @@ namespace
|
||||
|
||||
CD3D9Renderer* r = gcpRendD3D;
|
||||
SRenderPipeline& rRP = r->m_RP;
|
||||
CRenderObject* renderObject = rRP.m_pCurObject;
|
||||
CShaderResources* shaderResources = rRP.m_pShaderResources;
|
||||
|
||||
for (AZ::u32 parameterIdx = 0; parameterIdx < parameterCount; parameterIdx++)
|
||||
{
|
||||
@@ -2290,7 +2275,6 @@ void CHWShader_D3D::UpdatePerFrameResourceGroup()
|
||||
|
||||
const PerFrameParameters& PF = gcpRendD3D->m_RP.m_TI[gcpRendD3D->m_RP.m_nProcessThreadID].m_perFrameParameters;
|
||||
CD3D9Renderer* const __restrict rd = gcpRendD3D;
|
||||
CDeviceManager& deviceManager = rd->m_DevMan;
|
||||
rd->GetGraphicsPipeline().UpdatePerFrameConstantBuffer(PF);
|
||||
rd->GetGraphicsPipeline().BindPerFrameConstantBuffer();
|
||||
}
|
||||
@@ -2487,7 +2471,6 @@ bool CHWShader_D3D::mfSetSamplers(const std::vector<SCGSampler>& Samplers, EHWSh
|
||||
return true;
|
||||
}
|
||||
CD3D9Renderer* __restrict rd = gcpRendD3D;
|
||||
CShaderResources* __restrict pSR = rd->m_RP.m_pShaderResources;
|
||||
|
||||
uint32 i;
|
||||
const SCGSampler* pSamp = &Samplers[0];
|
||||
@@ -2495,7 +2478,6 @@ bool CHWShader_D3D::mfSetSamplers(const std::vector<SCGSampler>& Samplers, EHWSh
|
||||
{
|
||||
const SCGSampler* pSM = pSamp++;
|
||||
int nSUnit = pSM->m_BindingSlot;
|
||||
int nTState = pSM->m_nStateHandle;
|
||||
|
||||
switch (pSM->m_eCGSamplerType)
|
||||
{
|
||||
@@ -2658,7 +2640,6 @@ bool CHWShader_D3D::mfSetTextures(const std::vector<SCGTexture>& Textures, EHWSh
|
||||
continue;
|
||||
}
|
||||
|
||||
CTexture* pT = nullptr;
|
||||
switch (pTexBind->m_eCGTextureType)
|
||||
{
|
||||
case ECGT_MatSlot_Diffuse:
|
||||
@@ -3216,8 +3197,9 @@ bool CHWShader_D3D::mfSetSamplers_Old(const std::vector<STexSamplerRT>& Samplers
|
||||
{
|
||||
pTex = CTexture::GetByID(nCustomID);
|
||||
}
|
||||
else if ((nTUnit < EFTT_MAX) && pSR && (overloadTexture = pSR->GetTextureResource(EFTT_ENV)))
|
||||
else if ((nTUnit < EFTT_MAX) && pSR && pSR->GetTextureResource(EFTT_ENV))
|
||||
{
|
||||
overloadTexture = pSR->GetTextureResource(EFTT_ENV);
|
||||
// Perhaps user wanted a specific cubemap instead?
|
||||
// This should still be allowed even if the sampler is "TO_FROMOBJ_CM" as the
|
||||
// end user can still select specific cubemaps from the material editor.
|
||||
@@ -3262,11 +3244,7 @@ bool CHWShader_D3D::mfSetSamplers_Old(const std::vector<STexSamplerRT>& Samplers
|
||||
|
||||
case TO_WATERVOLUMEREFLMAP:
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const uint32 nCurrWaterVolID = gRenDev->GetCameraFrameID() % 2;
|
||||
#else
|
||||
const uint32 nCurrWaterVolID = gRenDev->GetFrameID(false) % 2;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
CTexture* pTex = CTexture::s_ptexWaterVolumeRefl[nCurrWaterVolID] ? CTexture::s_ptexWaterVolumeRefl[nCurrWaterVolID] : CTextureManager::Instance()->GetBlackTexture();
|
||||
pTex->Apply(nTUnit, CTexture::GetTexState(STexState(FILTER_ANISO16X, true)), nTexMaterialSlot, nSUnit, SResourceView::DefaultView, eSHClass);
|
||||
}
|
||||
@@ -3274,11 +3252,7 @@ bool CHWShader_D3D::mfSetSamplers_Old(const std::vector<STexSamplerRT>& Samplers
|
||||
|
||||
case TO_WATERVOLUMEREFLMAPPREV:
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const uint32 nPrevWaterVolID = (gRenDev->GetCameraFrameID() + 1) % 2;
|
||||
#else
|
||||
const uint32 nPrevWaterVolID = (gRenDev->GetFrameID(false) + 1) % 2;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
CTexture* pTex = CTexture::s_ptexWaterVolumeRefl[nPrevWaterVolID] ? CTexture::s_ptexWaterVolumeRefl[nPrevWaterVolID] : CTextureManager::Instance()->GetBlackTexture();
|
||||
pTex->Apply(nTUnit, nTState, nTexMaterialSlot, nSUnit, SResourceView::DefaultView, eSHClass);
|
||||
@@ -3287,11 +3261,7 @@ bool CHWShader_D3D::mfSetSamplers_Old(const std::vector<STexSamplerRT>& Samplers
|
||||
|
||||
case TO_WATERVOLUMECAUSTICSMAP:
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const uint32 nCurrWaterVolID = gRenDev->GetCameraFrameID() % 2;
|
||||
#else
|
||||
const uint32 nCurrWaterVolID = gRenDev->GetFrameID(false) % 2;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
CTexture* pTex = CTexture::s_ptexWaterCaustics[nCurrWaterVolID];
|
||||
pTex->Apply(nTUnit, nTState, nTexMaterialSlot, nSUnit, SResourceView::DefaultView, eSHClass);
|
||||
}
|
||||
@@ -3299,11 +3269,7 @@ bool CHWShader_D3D::mfSetSamplers_Old(const std::vector<STexSamplerRT>& Samplers
|
||||
|
||||
case TO_WATERVOLUMECAUSTICSMAPTEMP:
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const uint32 nPrevWaterVolID = (gRenDev->GetCameraFrameID() + 1) % 2;
|
||||
#else
|
||||
const uint32 nPrevWaterVolID = (gRenDev->GetFrameID(false) + 1) % 2;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
CTexture* pTex = CTexture::s_ptexWaterCaustics[nPrevWaterVolID];
|
||||
pTex->Apply(nTUnit, nTState, nTexMaterialSlot, nSUnit, SResourceView::DefaultView, eSHClass);
|
||||
}
|
||||
@@ -3366,7 +3332,7 @@ bool CHWShader_D3D::mfSetSamplers_Old(const std::vector<STexSamplerRT>& Samplers
|
||||
STexState pTexStateLinearClamp;
|
||||
pTexStateLinearClamp.SetFilterMode(FILTER_LINEAR);
|
||||
pTexStateLinearClamp.SetClampMode(false, false, false);
|
||||
int nTexStateLinearClampID = CTexture::GetTexState(pTexStateLinearClamp);
|
||||
CTexture::GetTexState(pTexStateLinearClamp);
|
||||
|
||||
pCloudShadowTex->Apply(nTUnit, nTState, nTexMaterialSlot, nSUnit, SResourceView::DefaultView, eSHClass);
|
||||
}
|
||||
@@ -3587,7 +3553,6 @@ bool CHWShader_D3D::mfUpdateSamplers(CShader* shader)
|
||||
|
||||
if (pSRes)
|
||||
{
|
||||
AZ::u32 updateCount = 0;
|
||||
AZStd::map<uint16, SEfResTexture*> UpdatedTMap;
|
||||
|
||||
for (AZ::u32 i = 0; i < samplerCount; i++, pSamp++)
|
||||
@@ -3993,64 +3958,6 @@ void CHWShader_D3D::SHWSInstance::GetInstancingAttribInfo(uint8 Attributes[32],
|
||||
}
|
||||
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
void CHWShader_D3D::UpdateSamplerEngineTextures()
|
||||
{
|
||||
// get all pixel shaders and update all the sampler textures that point to engine render targets
|
||||
CCryNameTSCRC className = CHWShader::mfGetClassName(eHWSC_Pixel);
|
||||
SResourceContainer* pRL = CBaseResource::GetResourcesForClass(className);
|
||||
if (!pRL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto iter : pRL->m_RMap)
|
||||
{
|
||||
CHWShader_D3D* shader = static_cast<CHWShader_D3D*>(iter.second);
|
||||
if (!shader)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (CHWShader_D3D::SHWSInstance* shaderInstance : shader->m_Insts)
|
||||
{
|
||||
if (!shaderInstance || shaderInstance->m_bDeleted || shaderInstance->m_pSamplers.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (STexSamplerRT& sampler : shaderInstance->m_pSamplers)
|
||||
{
|
||||
CTexture* texture = sampler.m_pTex;
|
||||
if (!texture || !(texture->GetFlags() & FT_USAGE_RENDERTARGET))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* name = texture->GetName();
|
||||
if (name == nullptr || name[0] != '$')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CTexture* engineTexture = CTextureManager::Instance()->GetEngineTexture(CCryNameTSCRC(sampler.m_nCrc));
|
||||
if (engineTexture && sampler.m_pTex != engineTexture)
|
||||
{
|
||||
sampler.m_pTex->Release();
|
||||
sampler.m_pTex = engineTexture;
|
||||
|
||||
// don't add a reference to texture we can't Release()
|
||||
if (!(engineTexture->GetFlags() & FT_DONT_RELEASE))
|
||||
{
|
||||
engineTexture->AddRef();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
void CHWShader_D3D::ShutDown()
|
||||
{
|
||||
CCryNameTSCRC Name;
|
||||
@@ -4288,7 +4195,6 @@ uint64 CHWShader_D3D::CheckIfExpr_r(uint32* pTokens, uint32& nCur, uint32 nSize)
|
||||
|
||||
while (nCur < nSize)
|
||||
{
|
||||
int nRecurs = 0;
|
||||
uint32 nToken = pTokens[nCur++];
|
||||
if (nToken == eT_br_rnd_1) // check for '('
|
||||
{
|
||||
@@ -4851,7 +4757,6 @@ CHWShader_D3D::SHWSInstance* CHWShader_D3D::mfGetInstance(CShader* pSH, SShaderC
|
||||
s_nInstFrame++;
|
||||
cgi->m_Ident = Ident;
|
||||
cgi->m_eClass = m_eSHClass;
|
||||
size_t i = std::distance(pInstCont->begin(), it);
|
||||
pInstCont->insert(it, cgi);
|
||||
if (nFlags & HWSF_FAKE)
|
||||
{
|
||||
|
||||
@@ -823,7 +823,6 @@ public:
|
||||
|
||||
void mfBind()
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
if (mfIsValid(m_pCurInst, true) == ED3DShError_Ok)
|
||||
{
|
||||
if (gRenDev->m_nFrameSwapID != m_pCurInst->m_nUsedFrame)
|
||||
@@ -833,7 +832,6 @@ public:
|
||||
}
|
||||
gcpRendD3D->m_DevMan.BindShader(m_eSHClass, (ID3D11Resource*)m_pCurInst->m_Handle.m_pShader->m_pHandle);
|
||||
}
|
||||
assert (SUCCEEDED(hr));
|
||||
}
|
||||
|
||||
static inline void mfBindGS(SD3DShader* pShader, void* pHandle)
|
||||
@@ -1125,11 +1123,6 @@ public:
|
||||
|
||||
static void* GetVSDataForDecl(const D3D11_INPUT_ELEMENT_DESC* pDecl, int nCount, int& nDataSize);
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
//! Used by render to texture to fix-up all engine texture samplers
|
||||
static void UpdateSamplerEngineTextures();
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
static void ShutDown();
|
||||
|
||||
static Vec4 GetVolumetricFogParams();
|
||||
|
||||
@@ -211,7 +211,7 @@ void CHWShader_D3D::mfAddFXParameter(
|
||||
pParams = &OutParams.Params[0];
|
||||
}
|
||||
uint32 nOffs = pParams->size();
|
||||
bool bRes = gRenDev->m_cEF.mfParseFXParameter(FXParams, pr, ParamName, ef, bInstParam, pBind->m_RegisterCount, pParams, eSHClass, false);
|
||||
[[maybe_unused]] bool bRes = gRenDev->m_cEF.mfParseFXParameter(FXParams, pr, ParamName, ef, bInstParam, pBind->m_RegisterCount, pParams, eSHClass, false);
|
||||
AZ_Assert(bRes, "Error: CHWShader_D3D::mfAddFXParameter - bRes is false");
|
||||
|
||||
if (pParams->size() > nOffs)
|
||||
@@ -245,7 +245,6 @@ bool CHWShader_D3D::mfAddFXParameter(SHWSInstance* pInst, SParamsGroup& OutParam
|
||||
{
|
||||
bn->m_RegisterCount = pr->m_nArray;
|
||||
}
|
||||
bool bRes = mfAddFXTexture(pInst, FXParams, pr, param, bn, pFXShader, eSHClass);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -259,7 +258,6 @@ bool CHWShader_D3D::mfAddFXParameter(SHWSInstance* pInst, SParamsGroup& OutParam
|
||||
{
|
||||
bn->m_RegisterCount = pr->m_nArray;
|
||||
}
|
||||
bool bRes = mfAddFXSampler(pInst, FXParams, pr, param, bn, pFXShader, eSHClass);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -337,7 +335,6 @@ void CHWShader_D3D::mfCreateBinds(SHWSInstance* pInst, void* pConstantTable, [[m
|
||||
}
|
||||
for (i = 0; i < SBDesc.Variables; i++)
|
||||
{
|
||||
uint32 nCount = 1;
|
||||
ID3D11ShaderReflectionVariable* pCV = pCB->GetVariableByIndex(i);
|
||||
ID3D11ShaderReflectionType* pVT = pCV->GetType();
|
||||
D3D11_SHADER_VARIABLE_DESC CDesc;
|
||||
@@ -410,7 +407,6 @@ void CHWShader_D3D::mfGatherFXParameters(SHWSInstance* pInst, std::vector<SCGBin
|
||||
uint32 i, j;
|
||||
SAliasSampler samps[MAX_TMU];
|
||||
int nMaxSampler = -1;
|
||||
int nParam = 0;
|
||||
SParamsGroup Group;
|
||||
SShaderFXParams& FXParams = gRenDev->m_cEF.m_Bin.mfGetFXParams(pInst->m_bFallback ? CShaderMan::s_ShaderFallback : pFXShader);
|
||||
if (parameters.size())
|
||||
@@ -683,9 +679,11 @@ void CHWShader_D3D::mfGatherFXParameters(SHWSInstance* pInst, std::vector<SCGBin
|
||||
}
|
||||
}
|
||||
}
|
||||
#if !defined(NDEBUG)
|
||||
int nMax = AzRHI::GetConstantRegisterCountMax(pSH->m_eSHClass);
|
||||
assert(pInst->m_nMaxVecs[0] < nMax);
|
||||
assert(pInst->m_nMaxVecs[1] < nMax);
|
||||
#endif
|
||||
|
||||
if ((pInst->m_Ident.m_RTMask & g_HWSR_MaskBit[HWSR_INSTANCING_ATTR]) && pSH->m_eSHClass == eHWSC_Vertex)
|
||||
{
|
||||
@@ -704,7 +702,6 @@ void CHWShader_D3D::mfGatherFXParameters(SHWSInstance* pInst, std::vector<SCGBin
|
||||
SCGBind bn;
|
||||
bn.m_RegisterCount = b.m_RegisterCount;
|
||||
bn.m_RegisterOffset = nID;
|
||||
bool bRes = mfAddFXParameter(pInst, Group, FXParams, b.m_Name.c_str(), &bn, true, pSH->m_eSHClass, pFXShader);
|
||||
|
||||
nNumInst++;
|
||||
}
|
||||
@@ -858,7 +855,6 @@ AZ::Vertex::Format CHWShader_D3D::mfVertexFormat(SHWSInstance* pInst, CHWShader_
|
||||
bool bHWSkin = false;
|
||||
bool bVelocity = false;
|
||||
bool bMorph = false;
|
||||
bool bBoneSpace = false;
|
||||
bool bPSize = false;
|
||||
bool bSH[2] = {false, false};
|
||||
bool bTC0 = false;
|
||||
@@ -1357,7 +1353,6 @@ bool CHWShader_D3D::mfGetCacheTokenMap(FXShaderToken*& Table, TArray<uint32>*& p
|
||||
|
||||
bool CHWShader_D3D::mfGenerateScript(CShader* pSH, SHWSInstance*& pInst, std::vector<SCGBind>& InstBindVars, uint32 nFlags, FXShaderToken* Table, TArray<uint32>* pSHData, TArray<char>& sNewScr)
|
||||
{
|
||||
char* cgs = NULL;
|
||||
|
||||
bool bTempMap = (Table == NULL);
|
||||
assert((Table && pSHData) || (!Table && !pSHData));
|
||||
@@ -1897,7 +1892,6 @@ bool CHWShader_D3D::ConvertBinScriptToASCII(CParserBin& Parser, [[maybe_unused]]
|
||||
|
||||
uint32* pTokens = &Parser.m_Tokens[0];
|
||||
uint32 nT = Parser.m_Tokens.size();
|
||||
const char* szPrev = " ";
|
||||
int nLevel = 0;
|
||||
for (i = 0; i < nT; i++)
|
||||
{
|
||||
@@ -2209,7 +2203,6 @@ SShaderCache::~SShaderCache()
|
||||
if (m_pStreamInfo)
|
||||
{
|
||||
CResFile* pRes = m_pStreamInfo->m_pRes;
|
||||
bool bWarn = false;
|
||||
if (pRes)
|
||||
{
|
||||
assert(pRes == m_pRes[0] || pRes == m_pRes[1]);
|
||||
@@ -2911,7 +2904,7 @@ bool CHWShader::_OpenCacheFile(float fVersion, SShaderCache* pCache, CHWShader*
|
||||
return false;
|
||||
}
|
||||
|
||||
SResFileLookupData* pLookup = pRF->GetLookupData(true, CRC32, FX_CACHE_VER);
|
||||
pRF->GetLookupData(true, CRC32, FX_CACHE_VER);
|
||||
if (pSHHW)
|
||||
{
|
||||
pRF->mfFlush();
|
||||
@@ -3808,7 +3801,6 @@ bool CHWShader_D3D::mfRequestAsync(CShader* pSH, SHWSInstance* pInst, std::vecto
|
||||
pInst->m_pAsync->m_pFXShader->AddRef();
|
||||
pInst->m_pAsync->m_nCombination = gRenDev->m_cEF.m_nCombinationsProcess;
|
||||
assert(!azstricmp(m_NameSourceFX.c_str(), pInst->m_pAsync->m_pFXShader->m_NameFile.c_str()));
|
||||
InstContainer* pInstCont = &m_Insts;
|
||||
if (m_bUseLookUpTable)
|
||||
{
|
||||
pInst->m_pAsync->m_nHashInst = pInst->m_nContIndex;
|
||||
@@ -4051,10 +4043,8 @@ LPD3D10BLOB CHWShader_D3D::mfCompileHLSL(CShader* pSH, char* prog_text, void** p
|
||||
// LOADING_TIME_PROFILE_SECTION(iSystem);
|
||||
|
||||
// Test adding source text to context
|
||||
SHWSInstance* pInst = m_pCurInst;
|
||||
string strErr;
|
||||
LPD3D10BLOB pCode = NULL;
|
||||
HRESULT hr = S_OK;
|
||||
if (!prog_text)
|
||||
{
|
||||
assert(0);
|
||||
@@ -4065,7 +4055,7 @@ LPD3D10BLOB CHWShader_D3D::mfCompileHLSL(CShader* pSH, char* prog_text, void** p
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool bResult = mfCompileHLSL_Int(pSH, prog_text, &pCode, ppConstantTable, ppErrorMsgs, strErr, InstBindVars);
|
||||
mfCompileHLSL_Int(pSH, prog_text, &pCode, ppConstantTable, ppErrorMsgs, strErr, InstBindVars);
|
||||
if (!pCode)
|
||||
{
|
||||
if (CRenderer::CV_r_shadersasynccompiling)
|
||||
@@ -4312,7 +4302,6 @@ bool CHWShader_D3D::mfActivate(CShader* pSH, uint32 nFlags, FXShaderToken* Table
|
||||
//if (!(m_Flags & HWSG_PRECACHEPHASE) && !(nFlags & HWSF_NEXT))
|
||||
// mfSetHWStartProfile(nFlags);
|
||||
|
||||
bool bCreate = false;
|
||||
// We need a different source and desination for fpStripExtension
|
||||
// since a call to strcpy with the same src and dst results in
|
||||
// undefined behaviour
|
||||
@@ -4542,7 +4531,6 @@ void CAsyncShaderTask::FlushPendingShaders()
|
||||
}
|
||||
{
|
||||
AUTO_LOCK(g_cAILock);
|
||||
int n = 0;
|
||||
for (pAI = BuildList().m_Prev; pAI != &BuildList(); pAI = pAINext)
|
||||
{
|
||||
pAINext = pAI->m_Prev;
|
||||
@@ -4910,7 +4898,6 @@ bool STexSamplerFX::Export(SShaderSerializeContext& SC)
|
||||
if (m_nTexState > 0)
|
||||
{
|
||||
TS.m_bTexState = 1;
|
||||
STexState* pTS = &CTexture::s_TexStates[m_nTexState];
|
||||
memcpy(&TS.ST, &CTexture::s_TexStates[m_nTexState], sizeof(TS.ST));
|
||||
TS.ST.m_pDeviceState = NULL;
|
||||
}
|
||||
@@ -5180,7 +5167,6 @@ bool CHWShader_D3D::Export(SShaderSerializeContext& SC)
|
||||
SCHWShader SHWTemp = SHW;
|
||||
|
||||
SHW.Export(SC.Data);
|
||||
uint32 nOffs = 0;
|
||||
|
||||
bRes &= ExportSamplers(SHW, SC);
|
||||
bRes &= ExportParams(SHW, SC);
|
||||
@@ -5268,7 +5254,6 @@ CHWShader* CHWShader::Import(SShaderSerializeContext& SC, int nOffs, uint32 CRC3
|
||||
ImportParams(SC, pSHW, pData, Params);
|
||||
}
|
||||
|
||||
bool bPrecache = (SC.SSR.m_Flags & EF_PRECACHESHADER) != 0;
|
||||
|
||||
//static CHWShader *mfForName(const char *name, const char *nameSource, uint32 CRC32, const char *szEntryFunc, EHWShaderClass eClass, TArray<uint32>& SHData, FXShaderToken *pTable, uint32 dwType, CShader *pFX, uint64 nMaskGen=0, uint64 nMaskGenFX=0);
|
||||
pHWSH = CHWShader::mfForName(szName, szNameSource, CRC32, szNameEntry, pSHW->m_eSHClass, SHData, pTable, pSHW->m_dwShaderType, pSH, pSHW->m_nMaskGenShader, pSHW->m_nMaskGenFX);
|
||||
@@ -5372,7 +5357,6 @@ const char* CHWShader::GetCurrentShaderCombinations(bool bForLevel)
|
||||
|
||||
Name = CHWShader::mfGetClassName(eHWSC_Pixel);
|
||||
pRL = CBaseResource::GetResourcesForClass(Name);
|
||||
int n = 0;
|
||||
if (pRL)
|
||||
{
|
||||
ResourcesMapItor itor;
|
||||
|
||||
@@ -459,7 +459,6 @@ static bool Dilate(CTexture* pTex, CTexture* pOutput, int nPhase, std::vector<II
|
||||
const ColorF& inMissColour = pInputParams->dilateMagicColour;
|
||||
Vec4 missColour = Vec4(inMissColour.r, inMissColour.g, inMissColour.b, inMissColour.a);
|
||||
Vec4 whiteColour = Vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
uint32 extraPasses = 0;
|
||||
uint32 nPasses = 0;
|
||||
if (!pSH)
|
||||
{
|
||||
@@ -478,7 +477,7 @@ static bool Dilate(CTexture* pTex, CTexture* pOutput, int nPhase, std::vector<II
|
||||
|
||||
CTexture* pTemp = CTexture::CreateRenderTarget("MeshBaker_DilateTemp", uvMapWidth, uvMapHeight, Clr_Unknown, eTT_2D, FT_STATE_CLAMP, pTex->GetTextureDstFormat());
|
||||
int TempX, TempY, TempWidth, TempHeight;
|
||||
int nTexStateIdRepeat = CTexture::GetTexState(STexState(FILTER_TRILINEAR, false));
|
||||
CTexture::GetTexState(STexState(FILTER_TRILINEAR, false));
|
||||
rd->GetViewport(&TempX, &TempY, &TempWidth, &TempHeight);
|
||||
rd->RT_SetViewport(0, 0, uvMapWidth, uvMapHeight);
|
||||
|
||||
@@ -850,7 +849,6 @@ bool CD3D9Renderer::BakeMesh([[maybe_unused]] const SMeshBakingInputParams* pInp
|
||||
ri[numChunks].pObj = pObj;
|
||||
ri[numChunks].nOcclQuery = m; // Stash in this in something that doesn't effect sorting
|
||||
ri[numChunks].ObjSort = (pObj->m_ObjFlags & 0xffff0000) | pObj->m_nSort;
|
||||
int nThreadID2 = m_RP.m_nProcessThreadID;
|
||||
ri[numChunks].nBatchFlags = EF_BatchFlags(pSH, pObj, pRE, passInfo); // naughty
|
||||
ri[numChunks].nStencRef = pObj->m_nClipVolumeStencilRef;
|
||||
uint32 nResID = pR ? pR->m_Id : 0;
|
||||
|
||||
@@ -27,7 +27,11 @@ void COcclusionQuery::Create()
|
||||
D3D11_QUERY_DESC desc;
|
||||
desc.Query = D3D11_QUERY_OCCLUSION;
|
||||
desc.MiscFlags = 0;
|
||||
HRESULT hr(gcpRendD3D->GetDevice().CreateQuery(&desc, &pVizQuery));
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
HRESULT hr =
|
||||
#endif
|
||||
gcpRendD3D->GetDevice().CreateQuery(&desc, &pVizQuery);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
m_nOcclusionID = (UINT_PTR) pVizQuery;
|
||||
|
||||
@@ -97,7 +97,6 @@ void SD3DPostEffectsUtils::ResolveRT(CTexture*& pDst, const RECT* pSrcRect)
|
||||
pOrigRT->GetResource(&pSrcResource);
|
||||
#endif
|
||||
|
||||
HRESULT hr = 0;
|
||||
gcpRendD3D->m_RP.m_PS[gcpRendD3D->m_RP.m_nProcessThreadID].m_RTCopied++;
|
||||
gcpRendD3D->m_RP.m_PS[gcpRendD3D->m_RP.m_nProcessThreadID].m_RTCopiedSize += pDst->GetDeviceDataSize();
|
||||
|
||||
@@ -319,7 +318,6 @@ void SD3DPostEffectsUtils::StretchRect(CTexture* pSrc, CTexture*& pDst, bool bCl
|
||||
gRenDev->FX_SetState(GS_NODEPTHTEST);
|
||||
|
||||
// Get sample size ratio (based on empirical "best look" approach)
|
||||
float fSampleSize = ((float)pSrc->GetWidth() / (float)pDst->GetWidth()) * 0.5f;
|
||||
|
||||
// Set samples position
|
||||
//float s1 = fSampleSize / (float) pSrc->GetWidth(); // 2.0 better results on lower res images resizing
|
||||
@@ -1473,15 +1471,10 @@ void CPostEffectsMgr::End()
|
||||
PostProcessUtils().SetFillModeSolid(false);
|
||||
|
||||
const uint32 nThreadID = gRenDev->m_RP.m_nProcessThreadID;
|
||||
#if !defined(NDEBUG)
|
||||
int recursiveLevel = SRendItem::m_RecurseLevel[nThreadID];
|
||||
assert(recursiveLevel >= 0);
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (gRenDev->m_RP.m_TI[nThreadID].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // if AZ_RTT_ENABLE
|
||||
#endif
|
||||
|
||||
gcpRendD3D->UpdatePreviousFrameMatrices();
|
||||
|
||||
@@ -1581,7 +1574,8 @@ bool CREPostProcess:: mfDraw([[maybe_unused]] CShader* ef, [[maybe_unused]] SSha
|
||||
SPostEffectsDebugInfo* pDebugInfo = NULL;
|
||||
for (uint32 i = 0, nNumEffects = activeEffects.size(); i < nNumEffects; ++i)
|
||||
{
|
||||
if ((pDebugInfo = &activeEffects[i]) && pDebugInfo->pEffect == currentEffect)
|
||||
pDebugInfo = &activeEffects[i];
|
||||
if (pDebugInfo && pDebugInfo->pEffect == currentEffect)
|
||||
{
|
||||
pDebugInfo->fTimeOut = POSTSEFFECTS_DEBUGINFO_TIMEOUT;
|
||||
break;
|
||||
@@ -1662,7 +1656,8 @@ bool CREPostProcess:: mfDraw([[maybe_unused]] CShader* ef, [[maybe_unused]] SSha
|
||||
SPostEffectsDebugInfo* pDebugInfo = NULL;
|
||||
for (uint32 p = 0, nNumParams = activeParams.size(); p < nNumParams; ++p)
|
||||
{
|
||||
if ((pDebugInfo = &activeParams[p]) && pDebugInfo->szParamName == (pItor->first))
|
||||
pDebugInfo = &activeParams[p];
|
||||
if (pDebugInfo && pDebugInfo->szParamName == (pItor->first))
|
||||
{
|
||||
pDebugInfo->fTimeOut = POSTSEFFECTS_DEBUGINFO_TIMEOUT;
|
||||
break;
|
||||
|
||||
@@ -95,7 +95,6 @@ void CRECloud::IlluminateCloud(Vec3 vLightPos, [[maybe_unused]] Vec3 vObjPos, Co
|
||||
}
|
||||
|
||||
rd->FX_SetFPMode();
|
||||
HRESULT h = S_OK;
|
||||
|
||||
rd->EF_ClearTargetsLater(FRT_CLEAR, Clr_White, Clr_FarPlane.r, 0);
|
||||
rd->FX_Commit();
|
||||
@@ -105,7 +104,6 @@ void CRECloud::IlluminateCloud(Vec3 vLightPos, [[maybe_unused]] Vec3 vObjPos, Co
|
||||
// the solid angle over which we will sample forward-scattered light.
|
||||
float fSolidAngle = 0.09f;
|
||||
int i;
|
||||
int iNumFailed = 0;
|
||||
int nParts = m_particles.size();
|
||||
for (i = 0; i < nParts; i++)
|
||||
{
|
||||
@@ -259,7 +257,6 @@ void CRECloud::DisplayWithoutImpostor(const CameraViewParameters& camera)
|
||||
int nCurParts;
|
||||
|
||||
CRenderObject* pObj = rd->m_RP.m_pCurObject;
|
||||
SRenderObjData* pOD = pObj->GetObjData();
|
||||
CShader* pSH = rd->m_RP.m_pShader;
|
||||
SShaderTechnique* pSHT = rd->m_RP.m_pCurTechnique;
|
||||
SShaderPass* pPass = rd->m_RP.m_pCurPass;
|
||||
@@ -343,9 +340,6 @@ void CRECloud::DisplayWithoutImpostor(const CameraViewParameters& camera)
|
||||
// get various run-time parameters to determine cloud shading
|
||||
Vec3 sunDir(gEnv->p3DEngine->GetSunDir().GetNormalized());
|
||||
|
||||
float minHeight(m_boundingBox.GetMin().z);
|
||||
float totalHeight(m_boundingBox.GetMax().z - minHeight);
|
||||
|
||||
ColorF cloudSpec, cloudDiff;
|
||||
GetIllumParams(cloudSpec, cloudDiff);
|
||||
|
||||
@@ -507,7 +501,6 @@ bool CRECloud::GenerateCloudImposter(CShader* pShader, CShaderResources* pRes, C
|
||||
bool CRECloud::UpdateImposter(CRenderObject* pObj)
|
||||
{
|
||||
CD3D9Renderer* rd = gcpRendD3D;
|
||||
SRenderObjData* pOD = pObj->GetObjData();
|
||||
CREImposter* pRE = (CREImposter*)pObj->GetRE();
|
||||
|
||||
if (!pRE->PrepareForUpdate())
|
||||
@@ -627,7 +620,6 @@ bool CRECloud::UpdateImposter(CRenderObject* pObj)
|
||||
bool CRECloud::mfDisplay(bool bDisplayFrontOfSplit)
|
||||
{
|
||||
CD3D9Renderer* rd = gcpRendD3D;
|
||||
int nThreadID = rd->m_RP.m_nProcessThreadID;
|
||||
CRenderObject* pObj = rd->m_RP.m_pCurObject;
|
||||
CREImposter* pRE = (CREImposter*)pObj->GetRE();
|
||||
Vec3 vPos = pRE->m_vPos;
|
||||
@@ -801,10 +793,6 @@ bool CRECloud::mfDisplay(bool bDisplayFrontOfSplit)
|
||||
}
|
||||
if IsCVarConstAccess(constexpr) (CRenderer::CV_r_impostersdraw & 2)
|
||||
{
|
||||
CRenderObject* pObject = rd->m_RP.m_pCurObject;
|
||||
int colR = ((DWORD)((UINT_PTR)pObject) >> 4) & 0xf;
|
||||
int colG = ((DWORD)((UINT_PTR)pObject) >> 8) & 0xf;
|
||||
int colB = ((DWORD)((UINT_PTR)pObject) >> 12) & 0xf;
|
||||
Vec3 v[4];
|
||||
v[0] = vPos - y - x;
|
||||
v[1] = vPos - y + x;
|
||||
|
||||
@@ -267,7 +267,7 @@ bool CREImposter::PrepareForUpdate()
|
||||
float fRadiusY = vUp.len() / 2 + fabsf(fDerivY);
|
||||
|
||||
Vec3 vNearest;
|
||||
int nCollide = IntersectRayAABB(cam.vOrigin, vEye, m_WorldSpaceBV, vNearest);
|
||||
IntersectRayAABB(cam.vOrigin, vEye, m_WorldSpaceBV, vNearest);
|
||||
Vec4 v4Nearest = Vec4(vNearest, 1);
|
||||
Vec4 v4Far = Vec4(vNearest + vEye * fRadius * 2, 1);
|
||||
Vec4 v4ZRange = Vec4(0, 0, 0, 0);
|
||||
@@ -386,7 +386,6 @@ bool CREImposter::PrepareForUpdate()
|
||||
|
||||
Matrix44A M;
|
||||
|
||||
CRenderObject* pInstObj = rd->m_RP.m_pCurObject;
|
||||
|
||||
m_LastViewParameters = cam;
|
||||
m_vLastSunDir = gEnv->p3DEngine->GetSunDir().GetNormalized();
|
||||
@@ -652,10 +651,6 @@ bool CREImposter::Display(bool bDisplayFrontOfSplit)
|
||||
}
|
||||
if IsCVarConstAccess(constexpr) (CRenderer::CV_r_impostersdraw & 2)
|
||||
{
|
||||
CRenderObject* pObj = rd->m_RP.m_pCurObject;
|
||||
int colR = ((DWORD)((UINT_PTR)pObj) >> 4) & 0xf;
|
||||
int colG = ((DWORD)((UINT_PTR)pObj) >> 8) & 0xf;
|
||||
int colB = ((DWORD)((UINT_PTR)pObj) >> 12) & 0xf;
|
||||
ColorB col = Col_Yellow; //ColorB(colR<<4, colG<<4, colB<<4, 255);
|
||||
Vec3 v[4];
|
||||
v[0] = vPos - y - x;
|
||||
|
||||
@@ -309,7 +309,6 @@ void CD3D9Renderer::EF_Init()
|
||||
return;
|
||||
}
|
||||
|
||||
bool nv = 0;
|
||||
|
||||
if IsCVarConstAccess(constexpr) (CV_r_logTexStreaming && m_logFileStrHandle == AZ::IO::InvalidHandle)
|
||||
{
|
||||
@@ -401,10 +400,9 @@ void CD3D9Renderer::EF_Init()
|
||||
m_RP.m_ObjectsPool = (CRenderObject*)CryModuleMemalign(sizeof(CRenderObject) * (m_RP.m_nNumObjectsInPool * RT_COMMAND_BUF_COUNT), 16);
|
||||
for (int j = 0; j < (int)(m_RP.m_nNumObjectsInPool * RT_COMMAND_BUF_COUNT); j++)
|
||||
{
|
||||
CRenderObject* pRendObj = new(&m_RP.m_ObjectsPool[j])CRenderObject();
|
||||
new(&m_RP.m_ObjectsPool[j])CRenderObject();
|
||||
}
|
||||
|
||||
|
||||
CRenderObject** arrPrefill = (CRenderObject**)(alloca(m_RP.m_nNumObjectsInPool * sizeof(CRenderObject*)));
|
||||
for (int j = 0; j < RT_COMMAND_BUF_COUNT; j++)
|
||||
{
|
||||
@@ -1266,7 +1264,7 @@ void CD3D9Renderer::FX_ProcessHalfResParticlesRenderList(int nList, void(* Rende
|
||||
const int nums = m_RP.m_pRLD->m_nStartRI[1][nList];
|
||||
if (m_RP.m_pRLD->m_nEndRI[1][nList] - nums > 0)
|
||||
{
|
||||
const auto& ri = CRenderView::CurrentRenderView()->GetRenderItems(1, nList)[nums];
|
||||
CRenderView::CurrentRenderView()->GetRenderItems(1, nList);
|
||||
const bool bAlphaBased = CV_r_ParticlesHalfResBlendMode == 0;
|
||||
|
||||
#ifdef DO_RENDERLOG
|
||||
@@ -1321,7 +1319,6 @@ void CD3D9Renderer::FX_ProcessHalfResParticlesRenderList(int nList, void(* Rende
|
||||
|
||||
{
|
||||
PROFILE_LABEL_SCOPE("UPSAMPLE_PASS");
|
||||
CShader* pSH = CShaderMan::s_shPostEffects;
|
||||
CTexture* pHalfResSrc = pHalfResTarget;
|
||||
CTexture* pZTarget = CTexture::s_ptexZTarget;
|
||||
CTexture* pZTargetScaled = CV_r_ParticlesHalfResAmount > 0 ? CTexture::s_ptexZTargetScaled2 : CTexture::s_ptexZTargetScaled;
|
||||
@@ -1349,11 +1346,7 @@ void CD3D9Renderer::FX_ProcessHalfResParticlesRenderList(int nList, void(* Rende
|
||||
PostProcessUtils().SetTexture(pZTargetScaled, 3, FILTER_POINT);
|
||||
|
||||
FX_SetState(nStates);
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
PostProcessUtils().DrawFullScreenTri(GetWidth(), GetHeight());
|
||||
#else
|
||||
PostProcessUtils().DrawFullScreenTri(m_width, m_height);
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
PostProcessUtils().ShEndPass();
|
||||
}
|
||||
@@ -2861,8 +2854,6 @@ void CD3D9Renderer::FX_WaterVolumesCaustics()
|
||||
// Caustics info.
|
||||
N3DEngineCommon::SCausticInfo& causticInfo = gcpRendD3D->m_p3DEngineCommon.m_CausticInfo;
|
||||
|
||||
float fWidth = CTexture::s_ptexWaterCaustics[0]->GetWidth();
|
||||
float fHeight = CTexture::s_ptexWaterCaustics[0]->GetHeight();
|
||||
|
||||
// Preprocess (render all visible volumes to caustic gbuffer)
|
||||
FX_WaterVolumesCausticsPreprocess(causticInfo);
|
||||
@@ -2980,11 +2971,7 @@ void CD3D9Renderer::FX_WaterVolumesPreprocess()
|
||||
if ((nBatchMask & FB_WATER_REFL) && CTexture::IsTextureExist(CTexture::s_ptexWaterVolumeRefl[0]))
|
||||
{
|
||||
PROFILE_LABEL_SCOPE("WATER_PREPROCESS");
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const uint32 nCurrWaterVolID = gRenDev->GetCameraFrameID() % 2;
|
||||
#else
|
||||
const uint32 nCurrWaterVolID = gRenDev->GetFrameID(false) % 2;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
CTexture* pCurrWaterVolRefl = CTexture::s_ptexWaterVolumeRefl[nCurrWaterVolID];
|
||||
|
||||
@@ -3036,7 +3023,9 @@ void CD3D9Renderer::FX_RenderWater(void(* RenderFunc)())
|
||||
{
|
||||
PROFILE_LABEL_SCOPE("WATER");
|
||||
|
||||
#if defined(ENABLE_FRAME_PROFILER)
|
||||
SThreadInfo* const pShaderThreadInfo = &(m_RP.m_TI[m_RP.m_nProcessThreadID]);
|
||||
#endif
|
||||
|
||||
PROFILE_PS_TIME_SCOPE_COND(fTimeDIPs[EFSLIST_WATER_VOLUMES], !(pShaderThreadInfo->m_PersFlags & (RBPF_SHADOWGEN)));
|
||||
const int recursiveLevel = SRendItem::m_RecurseLevel[m_RP.m_nProcessThreadID];
|
||||
@@ -3122,7 +3111,6 @@ void CD3D9Renderer::FX_LinearizeDepth(CTexture* ptexZ)
|
||||
{
|
||||
PROFILE_LABEL_SCOPE("LINEARIZE_DEPTH");
|
||||
|
||||
bool isRenderingFur = FurPasses::GetInstance().IsRenderingFur();
|
||||
|
||||
#ifdef SUPPORTS_MSAA
|
||||
if (FX_GetMSAAMode())
|
||||
@@ -3348,7 +3336,6 @@ void CD3D9Renderer::FX_DrawWire()
|
||||
// Draw geometry normal vectors
|
||||
void CD3D9Renderer::FX_DrawNormals()
|
||||
{
|
||||
HRESULT h = S_OK;
|
||||
|
||||
float len = CRenderer::CV_r_normalslength;
|
||||
int StrVrt, StrTan, StrNorm;
|
||||
@@ -3463,7 +3450,6 @@ void CD3D9Renderer::FX_DrawNormals()
|
||||
// Draw geometry tangent vectors
|
||||
void CD3D9Renderer::FX_DrawTangents()
|
||||
{
|
||||
HRESULT h = S_OK;
|
||||
|
||||
float len = CRenderer::CV_r_normalslength;
|
||||
|
||||
@@ -4014,7 +4000,6 @@ int CD3D9Renderer::EF_Preprocess(SRendItem* ri, uint32 nums, uint32 nume, Render
|
||||
Logv(SRendItem::m_RecurseLevel[m_RP.m_nFillThreadID], "*** Start preprocess frame ***\n");
|
||||
}
|
||||
|
||||
int DLDFlags = 0;
|
||||
int nReturn = 0;
|
||||
|
||||
for (i = nums; i < nume; i++)
|
||||
@@ -4036,7 +4021,6 @@ int CD3D9Renderer::EF_Preprocess(SRendItem* ri, uint32 nums, uint32 nume, Render
|
||||
}
|
||||
if (nTech < (int)Shader->m_HWTechniques.Num())
|
||||
{
|
||||
SShaderTechnique* pTech = Shader->m_HWTechniques[nTech];
|
||||
for (j = SPRID_FIRST; j < 32; j++)
|
||||
{
|
||||
uint32 nMask = 1 << j;
|
||||
@@ -4693,7 +4677,6 @@ void CD3D9Renderer::FX_ProcessBatchesList(int nums, int nume, uint32 nBatchFilte
|
||||
assert(nums < RI.size());
|
||||
assert(nume <= RI.size());
|
||||
|
||||
SRendItem* pPrefetchPlainPtr = &RI[0];
|
||||
|
||||
rRP.m_nBatchFilter = nBatchFilter;
|
||||
|
||||
@@ -5194,7 +5177,6 @@ void CD3D9Renderer::FX_ProcessPostRenderLists(uint32 nBatchFilter)
|
||||
|
||||
if ((m_RP.m_nRendFlags & SHDF_ALLOWPOSTPROCESS) && recursiveLevel <= 0)
|
||||
{
|
||||
int nList = EFSLIST_GENERAL;
|
||||
uint32 nBatchMask = SRendItem::BatchFlags(EFSLIST_GENERAL, m_RP.m_pRLD) | SRendItem::BatchFlags(EFSLIST_TRANSP, m_RP.m_pRLD);
|
||||
nBatchMask |= SRendItem::BatchFlags(EFSLIST_DECAL, m_RP.m_pRLD);
|
||||
nBatchMask |= SRendItem::BatchFlags(EFSLIST_SKIN, m_RP.m_pRLD);
|
||||
@@ -5331,7 +5313,6 @@ int CD3D9Renderer::GetOcclusionBuffer(uint16* pOutOcclBuffer, Matrix44* pmCamBuf
|
||||
const OcclusionReadbackData& readbackData = occlusionData.m_occlusionReadbackData;
|
||||
|
||||
// Copy the data that was prepared by the render thread for use with the Coverage Buffer system
|
||||
float* outputBuffer = reinterpret_cast<float*>(pOutOcclBuffer);
|
||||
memcpy(pOutOcclBuffer, readbackData.m_occlusionReadbackBuffer, s_occlusionBufferNumElements * sizeof(float));
|
||||
|
||||
*pmCamBuffer = readbackData.m_occlusionReadbackViewProj;
|
||||
@@ -5383,15 +5364,6 @@ void CD3D9Renderer::FX_ZTargetReadBackOnCPU()
|
||||
PROFILE_LABEL_SCOPE("DEPTH READBACK CPU");
|
||||
PROFILE_FRAME(FX_ZTargetReadBackOnCPU);
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// ZTarget read back is used for occlusion culling and we don't want to pollute the main pass
|
||||
// occlusion buffer with the render to texture pass
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
if (!IsDepthReadbackOcclusionEnabled() || (SRendItem::m_RecurseLevel[m_RP.m_nProcessThreadID] > 0))
|
||||
{
|
||||
return;
|
||||
@@ -5527,14 +5499,6 @@ void CD3D9Renderer::FX_ZTargetReadBack()
|
||||
PROFILE_LABEL_SCOPE("DEPTH READBACK GPU");
|
||||
PROFILE_FRAME(FX_ZTargetReadBack);
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// do not pollute the main occlusion buffer with contents from the render to texture camera
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
//Check for gmem as this code runs after gbuffer breaking gmem path. Besides we can just use
|
||||
//downsampled linearized depth for occlusion.
|
||||
const bool isGmemEnabled = FX_GetEnabledGmemPath(nullptr) != CD3D9Renderer::eGT_REGULAR_PATH;
|
||||
@@ -5841,11 +5805,7 @@ void CD3D9Renderer::RT_RenderScene(int nFlags, SThreadInfo& TI, void(* RenderFun
|
||||
|
||||
CTimeValue Time = iTimer->GetAsyncTime();
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (!recursiveLevel && !IsRenderToTextureActive())
|
||||
#else
|
||||
if (!recursiveLevel)
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
{
|
||||
m_MainViewport.nX = 0;
|
||||
m_MainViewport.nY = 0;
|
||||
@@ -5991,9 +5951,6 @@ void CD3D9Renderer::RT_RenderScene(int nFlags, SThreadInfo& TI, void(* RenderFun
|
||||
&& (gcpRendD3D->FX_GetAntialiasingType() & eAT_JITTER_MASK)
|
||||
&& (!gEnv->IsEditing() || CRenderer::CV_r_AntialiasingModeEditor)
|
||||
&& (GetWireframeMode() == R_SOLID_MODE)
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
&& !IsRenderToTextureActive()
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
&& (CRenderer::CV_r_DeferredShadingDebugGBuffer == 0);
|
||||
|
||||
m_TemporalJitterClipSpace = Vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
@@ -6443,10 +6400,10 @@ void CD3D9Renderer::EF_RenderScene(int nFlags, SViewport& VP, const SRenderingPa
|
||||
{
|
||||
AZ_TRACE_METHOD();
|
||||
int nThreadID = passInfo.ThreadID();
|
||||
int nRecurseLevel = passInfo.GetRecursiveLevel();
|
||||
|
||||
CTimeValue time0 = iTimer->GetAsyncTime();
|
||||
#ifndef _RELEASE
|
||||
int nRecurseLevel = passInfo.GetRecursiveLevel();
|
||||
if (nRecurseLevel < 0)
|
||||
{
|
||||
__debugbreak();
|
||||
@@ -6545,7 +6502,6 @@ void CD3D9Renderer::EF_EndEf3D(const int nFlags, const int nPrecacheUpdateIdSlow
|
||||
EF_Scene3D(m_MainRTViewport, nFlags, passInfo);
|
||||
}
|
||||
|
||||
DynArray<SDeferredDecal>& deferredDecals = m_RP.m_DeferredDecals[nThreadID][nRecurseLevel];
|
||||
//deferredDecals.SetUse(0);
|
||||
bool bIsMultiThreadedRenderer = false;
|
||||
EF_Query(EFQ_RenderMultithreaded, bIsMultiThreadedRenderer);
|
||||
@@ -6580,8 +6536,6 @@ void CD3D9Renderer::EF_Scene3D(SViewport& VP, int nFlags, const SRenderingPassIn
|
||||
int nThreadID = m_RP.m_nFillThreadID;
|
||||
assert(nThreadID >= 0 && nThreadID < RT_COMMAND_BUF_COUNT);
|
||||
|
||||
bool bFullScreen = true;
|
||||
SDynTexture* pDT = NULL;
|
||||
int recursiveLevel = SRendItem::m_RecurseLevel[nThreadID];
|
||||
assert(recursiveLevel >= 0 && recursiveLevel < MAX_REND_RECURSION_LEVELS);
|
||||
|
||||
|
||||
@@ -1656,7 +1656,6 @@ void CRenderAuxGeomD3D::AdjustRenderStates(const SAuxGeomRenderFlags& renderFlag
|
||||
if (newPointSize != m_curPointSize)
|
||||
{
|
||||
assert(newPointSize > 0);
|
||||
float pointSize((float) newPointSize);
|
||||
assert(0);
|
||||
m_curPointSize = newPointSize;
|
||||
}
|
||||
|
||||
@@ -1072,7 +1072,6 @@ bool CREVolumeObject::mfDraw(CShader* ef, [[maybe_unused]] SShaderPass* sfm)
|
||||
#if !defined(EXCLUDE_DOCUMENTATION_PURPOSE)
|
||||
bool CREPrismObject::mfDraw(CShader* ef, [[maybe_unused]] SShaderPass* sfm)
|
||||
{
|
||||
CD3D9Renderer* rd(gcpRendD3D);
|
||||
|
||||
// render
|
||||
uint32 nPasses(0);
|
||||
@@ -1447,20 +1446,17 @@ void CREWaterOcean::Create(uint32 nVerticesCount, SVF_P3F_C4B_T2F* pVertices, ui
|
||||
return;
|
||||
}
|
||||
|
||||
CD3D9Renderer* rd(gcpRendD3D);
|
||||
ReleaseOcean();
|
||||
|
||||
m_nVerticesCount = nVerticesCount;
|
||||
m_nIndicesCount = nIndicesCount;
|
||||
m_nIndexSizeof = nIndexSizeof;
|
||||
HRESULT hr(S_OK);
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Create vertex buffer
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
D3DBuffer* pVertexBuffer = 0;
|
||||
D3D11_BUFFER_DESC BufDesc;
|
||||
SVF_P3F_C4B_T2F* dst = 0;
|
||||
|
||||
uint32 size = nVerticesCount * sizeof(SVF_P3F_C4B_T2F);
|
||||
BufDesc.ByteWidth = size;
|
||||
@@ -1541,7 +1537,6 @@ void CREWaterOcean::FrameUpdate()
|
||||
void* pRawPtr = NULL;
|
||||
WaterSimMgr()->Update(nFrameID, fUpdateTime, false, pRawPtr);
|
||||
|
||||
uint32 pitch = 4 * sizeof(f32) * nGridSize;
|
||||
uint32 width = nGridSize;
|
||||
uint32 height = nGridSize;
|
||||
|
||||
@@ -1619,7 +1614,6 @@ bool CREWaterOcean::mfDraw(CShader* ef, [[maybe_unused]] SShaderPass* sfm)
|
||||
|
||||
|
||||
N3DEngineCommon::SOceanInfo& OceanInfo = gRenDev->m_p3DEngineCommon.m_OceanInfo;
|
||||
Vec4& pParams = OceanInfo.m_vMeshParams;
|
||||
|
||||
uint32 nPrevStateOr = rd->m_RP.m_StateOr;
|
||||
uint32 nPrevStateAnd = rd->m_RP.m_StateAnd;
|
||||
@@ -1736,8 +1730,6 @@ bool CREOcclusionQuery::mfDraw([[maybe_unused]] CShader* ef, [[maybe_unused]] SS
|
||||
return true;
|
||||
}
|
||||
|
||||
int w = r->GetWidth();
|
||||
int h = r->GetHeight();
|
||||
|
||||
if (!m_nOcclusionID)
|
||||
{
|
||||
@@ -1753,7 +1745,6 @@ bool CREOcclusionQuery::mfDraw([[maybe_unused]] CShader* ef, [[maybe_unused]] SS
|
||||
}
|
||||
}
|
||||
|
||||
int nFrame = r->GetFrameID();
|
||||
|
||||
if (!m_nDrawFrame) // only allow queries update, if finished already with previous query
|
||||
{ // draw test box
|
||||
@@ -1969,10 +1960,6 @@ bool CREBeam::mfDraw(CShader* ef, [[maybe_unused]] SShaderPass* sl)
|
||||
|
||||
PROFILE_LABEL_SCOPE("LIGHT BEAM");
|
||||
|
||||
EShaderQuality nShaderQuality = (EShaderQuality)gcpRendD3D->EF_GetShaderQuality(eST_FX);
|
||||
ERenderQuality nRenderQuality = gRenDev->m_RP.m_eQuality;
|
||||
bool bLowSpecShafts = (nShaderQuality == eSQ_Low) || (nRenderQuality == eRQ_Low);
|
||||
|
||||
STexState pState(FILTER_BILINEAR, true);
|
||||
const int texStateID(CTexture::GetTexState(pState));
|
||||
|
||||
@@ -2025,8 +2012,6 @@ bool CREBeam::mfDraw(CShader* ef, [[maybe_unused]] SShaderPass* sl)
|
||||
float fAngleCoeff = 1.0f / tan_tpl((90.0f - fLightAngle) * gf_PI / 180.0f);
|
||||
float fNear = pDL->m_fProjectorNearPlane;
|
||||
float fFar = pDL->m_fRadius;
|
||||
float fScaleNear = fNear * fAngleCoeff;
|
||||
float fScaleFar = fFar * fAngleCoeff;
|
||||
Vec3 vLightPos = pDL->m_Origin;
|
||||
Vec3 vAxis = rInstInfo.m_Matrix.GetColumn0();
|
||||
|
||||
@@ -2059,7 +2044,6 @@ bool CREBeam::mfDraw(CShader* ef, [[maybe_unused]] SShaderPass* sl)
|
||||
|
||||
if ((e > 0.0f) && (eSq >= (dSq * fCosSq)))
|
||||
{
|
||||
float fSinSq = fSin * fSin;
|
||||
dSq = vVertToSphere.dot(vVertToSphere);
|
||||
e = vVertToSphere.dot(vAxis);
|
||||
|
||||
@@ -2301,19 +2285,7 @@ bool CREGeomCache::mfDraw(CShader* ef, SShaderPass* sfm)
|
||||
|
||||
Matrix44A prevMatrix;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// render to texture does not currently support motion blur in the render target
|
||||
if (threadInfo.m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE)
|
||||
{
|
||||
prevMatrix = rRP.m_pCurObject->m_II.m_Matrix;
|
||||
}
|
||||
else
|
||||
{
|
||||
CMotionBlur::GetPrevObjToWorldMat(rRP.m_pCurObject, prevMatrix);
|
||||
}
|
||||
#else
|
||||
CMotionBlur::GetPrevObjToWorldMat(rRP.m_pCurObject, prevMatrix);
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
const uint64 oldFlagsShader_RT = rRP.m_FlagsShader_RT;
|
||||
uint64 flagsShader_RT = rRP.m_FlagsShader_RT;
|
||||
|
||||
@@ -117,7 +117,6 @@ void CD3D9Renderer::RT_DrawDynVBUI(SVF_P2F_C4B_T2F_F4B* pBuf, uint16* pInds, uin
|
||||
|
||||
void CD3D9Renderer::RT_Draw2dImageInternal(C2dImage* images, uint32 numImages, bool stereoLeftEye)
|
||||
{
|
||||
bool bSaveZTest = ((m_RP.m_CurState & GS_NODEPTHTEST) == 0);
|
||||
SetCullMode(R_CULL_DISABLE);
|
||||
|
||||
float maxParallax = 0;
|
||||
@@ -308,7 +307,6 @@ void CD3D9Renderer::RT_DrawLines(Vec3 v[], int nump, ColorF& col, int flags, flo
|
||||
|
||||
int i;
|
||||
int st;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
EF_SetColorOp(eCO_MODULATE, eCO_MODULATE, eCA_Texture | (eCA_Diffuse << 3), eCA_Texture | (eCA_Diffuse << 3));
|
||||
EF_SetSrgbWrite(false);
|
||||
|
||||
@@ -955,7 +955,6 @@ SHWActivatedShader::~SHWActivatedShader()
|
||||
}
|
||||
bool CShaderMan::mfReleasePreactivatedShaderData()
|
||||
{
|
||||
bool bRes = true;
|
||||
FXCompressedShadersItor it;
|
||||
std::vector<CCryNameTSCRC> DelStuff;
|
||||
for (it = CHWShader::m_CompressedShaders.begin(); it != CHWShader::m_CompressedShaders.end(); ++it)
|
||||
@@ -992,7 +991,6 @@ bool CShaderMan::mfPreactivateShaders2(
|
||||
bool bLoaded = LevelLookup.LoadData((pathPerLevel + "lookupdata.bin").c_str(), CParserBin::m_bEndians, true);
|
||||
if (bLoaded)
|
||||
{
|
||||
const AZStd::string& pathGlobal = gRenDev->m_cEF.m_ShadersCache;
|
||||
|
||||
const char* cgcShaders = "cgcshaders";
|
||||
const char* cgdShaders = "cgdshaders";
|
||||
|
||||
@@ -114,7 +114,6 @@ bool CD3D9Renderer::EF_PrepareShadowGenForLight(SRenderLight* pLight, int nLight
|
||||
return false;
|
||||
}
|
||||
|
||||
ShadowMapFrustum* pCopyFrustum = NULL;
|
||||
|
||||
int32 nCurLOD = 0;
|
||||
|
||||
@@ -190,7 +189,6 @@ bool CD3D9Renderer::PrepareShadowGenForFrustum(ShadowMapFrustum* pCurFrustum, SR
|
||||
}
|
||||
}
|
||||
|
||||
SDynTexture_Shadow* pTX = NULL;
|
||||
|
||||
|
||||
bool bNotNeedUpdate = false;
|
||||
@@ -407,8 +405,10 @@ bool CD3D9Renderer::PrepareShadowGenForFrustum(ShadowMapFrustum* pCurFrustum, SR
|
||||
void CD3D9Renderer::PrepareShadowGenForFrustumNonJobs([[maybe_unused]] const int nFlags)
|
||||
{
|
||||
int nThreadID = m_RP.m_nFillThreadID;
|
||||
#if !defined(NDEBUG)
|
||||
int nCurRecLevel = SRendItem::m_RecurseLevel[nThreadID];
|
||||
assert(nCurRecLevel >= 0);
|
||||
#endif
|
||||
|
||||
CCamera tmpCamera;
|
||||
|
||||
@@ -416,7 +416,6 @@ void CD3D9Renderer::PrepareShadowGenForFrustumNonJobs([[maybe_unused]] const int
|
||||
{
|
||||
SRenderPipeline::SShadowFrustumToRender& rFrustumToRender = m_RP.SShadowFrustumToRenderList[nThreadID][i];
|
||||
ShadowMapFrustum* pCurFrustum = rFrustumToRender.pFrustum;
|
||||
SRenderLight* pLight = rFrustumToRender.pLight;
|
||||
|
||||
int nSides = pCurFrustum->bOmniDirectionalShadow ? OMNI_SIDES_NUM : 1;
|
||||
|
||||
@@ -453,14 +452,6 @@ void CD3D9Renderer::PrepareShadowGenForFrustumNonJobs([[maybe_unused]] const int
|
||||
}
|
||||
#endif
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (IsRenderToTextureActive())
|
||||
{
|
||||
// the shadow render pass needs to know if we are rendering to texture
|
||||
nRenderingFlags |= SRenderingPassInfo::RENDER_SCENE_TO_TEXTURE;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
// create a matching rendering pass info for shadows
|
||||
SRenderingPassInfo passInfo = SRenderingPassInfo::CreateShadowPassRenderingInfo(tmpCamera, pCurFrustum->m_Flags, pCurFrustum->nShadowMapLod,
|
||||
pCurFrustum->IsCached(), pCurFrustum->bIsMGPUCopy, &pCurFrustum->nShadowGenMask, nS, pCurFrustum->nShadowGenID[nThreadID][nS], nRenderingFlags);
|
||||
@@ -1173,7 +1164,6 @@ bool CD3D9Renderer::PrepareDepthMap(ShadowMapFrustum* lof, int nLightFrustumID,
|
||||
SetRasterState(&CurRS);
|
||||
}
|
||||
|
||||
int nBorder = max(4, lof->nShadowMapSize / 64);
|
||||
|
||||
if (!(lof->m_Flags & DLF_LIGHT_BEAM))
|
||||
{
|
||||
@@ -1548,7 +1538,6 @@ void CD3D9Renderer::FX_SetupShadowsForTransp()
|
||||
|
||||
m_RP.m_FlagsShader_RT &= ~(g_HWSR_MaskBit[HWSR_POINT_LIGHT] | g_HWSR_MaskBit[HWSR_SHADOW_MIXED_MAP_G16R16]);
|
||||
|
||||
CRenderObject* pObj = m_RP.m_pCurObject;
|
||||
|
||||
m_RP.m_FlagsShader_RT |= g_HWSR_MaskBit[HWSR_PARTICLE_SHADOW];
|
||||
|
||||
@@ -1902,7 +1891,6 @@ void CD3D9Renderer::FX_MergeShadowMaps(ShadowMapFrustum* pDst, const ShadowMapFr
|
||||
// do we need to merge static shadows into the dynamic shadow map?
|
||||
if (bRequireCopy)
|
||||
{
|
||||
ETEX_Format texFormat = CV_r_ShadowsCacheFormat == 0 ? eTF_D32F : eTF_D16;
|
||||
|
||||
SDynTexture_Shadow* pDynTex = SDynTexture_Shadow::GetForFrustum(pDst);
|
||||
pDst->pDepthTex = pDynTex->m_pTexture;
|
||||
|
||||
@@ -318,9 +318,8 @@ void CD3DStereoRenderer::Update()
|
||||
}
|
||||
|
||||
|
||||
CCamera CD3DStereoRenderer::PrepareCamera(EStereoEye nEye, const CCamera& currentCamera, const SRenderingPassInfo& passInfo)
|
||||
CCamera CD3DStereoRenderer::PrepareCamera(EStereoEye nEye, const CCamera& currentCamera, [[maybe_unused]] const SRenderingPassInfo& passInfo)
|
||||
{
|
||||
int nThreadID = passInfo.ThreadID();
|
||||
CCamera cam = currentCamera;
|
||||
|
||||
if (IsRenderingToHMD())
|
||||
|
||||
@@ -104,8 +104,6 @@ void CD3D9Renderer::DisplaySplash()
|
||||
GetObjectA(hImage, sizeof(bm), &bm);
|
||||
SelectObject(hDCBitmap, hImage);
|
||||
|
||||
DWORD x = rect.left + (((rect.right - rect.left) - bm.bmWidth) >> 1);
|
||||
DWORD y = rect.top + (((rect.bottom - rect.top) - bm.bmHeight) >> 1);
|
||||
|
||||
|
||||
// BitBlt(hDC, x, y, bm.bmWidth, bm.bmHeight, hDCBitmap, 0, 0, SRCCOPY);
|
||||
@@ -266,7 +264,6 @@ bool CD3D9Renderer::CreateMSAADepthBuffer()
|
||||
if (m_RP.m_MSAAData.Type > 1 && !m_RP.m_MSAAData.m_pZBuffer)
|
||||
{
|
||||
// Create depth stencil texture
|
||||
ID3D11Texture2D* pDepthStencil = NULL;
|
||||
D3D11_TEXTURE2D_DESC descDepth;
|
||||
ZeroStruct(descDepth);
|
||||
descDepth.Width = m_width;
|
||||
@@ -446,7 +443,6 @@ bool CD3D9Renderer::ChangeResolution(int nNewWidth, int nNewHeight, int nNewColD
|
||||
nNewWidth = m_deskwidth;
|
||||
nNewHeight = m_deskheight;
|
||||
}
|
||||
HRESULT hr = S_OK;
|
||||
if (bNeedReset)
|
||||
{
|
||||
#if defined(SUPPORT_DEVICE_INFO)
|
||||
@@ -551,7 +547,7 @@ bool CD3D9Renderer::ChangeResolution(int nNewWidth, int nNewHeight, int nNewColD
|
||||
ICryFont* pCryFont = gEnv->pCryFont;
|
||||
if (pCryFont)
|
||||
{
|
||||
IFFont* pFont = pCryFont->GetFont("default");
|
||||
pCryFont->GetFont("default");
|
||||
}
|
||||
|
||||
PostDeviceReset();
|
||||
@@ -1150,7 +1146,6 @@ void CD3D9Renderer::ShutDown(bool bReInit)
|
||||
LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
KBDLLHOOKSTRUCT* pkbhs = (KBDLLHOOKSTRUCT*) lParam;
|
||||
BOOL bControlKeyDown = 0;
|
||||
switch (nCode)
|
||||
{
|
||||
case HC_ACTION:
|
||||
@@ -2089,7 +2084,6 @@ bool SPixFormat::CheckSupport(D3DFormat Format, const char* szDescr, [[maybe_unu
|
||||
{
|
||||
if (nOptions & (D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURECUBE))
|
||||
{
|
||||
bool canAutoGenMips = (nOptions & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0;
|
||||
bool canReadSRGB = CTexture::IsDeviceFormatSRGBReadable(Format);
|
||||
|
||||
// TODO: check if need to allow other compressed formats to stay here formats here too?
|
||||
@@ -2391,7 +2385,8 @@ HRESULT CALLBACK CD3D9Renderer::OnD3D11CreateDevice(D3DDevice* pd3dDevice)
|
||||
rd->m_bDeviceSupportsInstancing = true;
|
||||
#endif
|
||||
|
||||
if (rd->m_bDeviceSupportsVertexTexture = (rd->m_Features & RFT_HW_SM30) != 0)
|
||||
rd->m_bDeviceSupportsVertexTexture = (rd->m_Features & RFT_HW_SM30);
|
||||
if (rd->m_bDeviceSupportsVertexTexture != 0)
|
||||
{
|
||||
rd->m_Features |= RFT_HW_VERTEXTEXTURES;
|
||||
}
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
#include <AzCore/Debug/AssetTracking.h>
|
||||
#include <Common/Memory/VRAMDrillerBus.h>
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
#include <RTTBus.h>
|
||||
#endif // AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
//===============================================================================
|
||||
@@ -436,9 +432,6 @@ D3DSurface* CTexture::GetSurface(int nCMSide, int nLevel)
|
||||
SCOPED_RENDERER_ALLOCATION_NAME_HINT(GetSourceName());
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
D3DTexture* pID3DTexture = NULL;
|
||||
D3DTexture* pID3DTexture3D = NULL;
|
||||
D3DTexture* pID3DTextureCube = NULL;
|
||||
D3DSurface* pTargSurf = m_pDeviceRTV;
|
||||
const bool bUseMultisampledRTV = ((m_nFlags & FT_USAGE_MSAA) && m_bUseMultisampledRTV) != 0;
|
||||
if (bUseMultisampledRTV)
|
||||
@@ -2188,8 +2181,10 @@ bool CTexture::CreateDeviceTexture(const byte* pData[6])
|
||||
{
|
||||
if (!m_pPixelFormat)
|
||||
{
|
||||
ETEX_Format eTF = ClosestFormatSupported(m_eTFDst);
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
ETEX_Format eTF =
|
||||
#endif
|
||||
ClosestFormatSupported(m_eTFDst);
|
||||
assert(eTF != eTF_Unknown);
|
||||
assert(eTF == m_eTFDst);
|
||||
}
|
||||
@@ -2902,7 +2897,6 @@ bool CTexture::RT_CreateDeviceTexture(const byte* pData[6])
|
||||
return true;
|
||||
}
|
||||
|
||||
int nOffset = 0;
|
||||
|
||||
if (resetSRGB)
|
||||
{
|
||||
@@ -3460,7 +3454,6 @@ void CTexture::SetSamplerState(int nTS, int nSUnit, EHWShaderClass eHWSC)
|
||||
{
|
||||
FUNCTION_PROFILER_RENDER_FLAT
|
||||
assert(gcpRendD3D->m_pRT->IsRenderThread());
|
||||
STexStageInfo* const __restrict TexStages = s_TexStages;
|
||||
|
||||
STexState* pTS = &s_TexStates[nTS];
|
||||
D3DSamplerState* pSamp = (D3DSamplerState*)pTS->m_pDeviceState;
|
||||
@@ -3507,7 +3500,6 @@ void CTexture::ApplySamplerState(int nSUnit, EHWShaderClass eHWSC, int nState)
|
||||
uint32 nTSSel = Isel32(nState, (int32)m_nDefState);
|
||||
assert(nTSSel >= 0 && nTSSel < s_TexStates.size());
|
||||
|
||||
STexStageInfo *TexStages = s_TexStages;
|
||||
CDeviceTexture* pDevTex = m_pDevTexture;
|
||||
|
||||
// avoiding L2 cache misses from usage from up ahead
|
||||
@@ -3990,7 +3982,6 @@ void CTexture::RT_UpdateTextureRegion(const byte* data, int nX, int nY, int nZ,
|
||||
return;
|
||||
}
|
||||
|
||||
DXGI_FORMAT frmtSrc = (DXGI_FORMAT)CTexture::DeviceFormatFromTexFormat(eTFSrc);
|
||||
bool bDone = false;
|
||||
D3D11_BOX rc = {aznumeric_caster(nX), aznumeric_caster(nY), 0, aznumeric_caster(nX + USize), aznumeric_caster(nY + VSize), 1};
|
||||
if (m_eTT == eTT_2D)
|
||||
@@ -4015,7 +4006,6 @@ void CTexture::RT_UpdateTextureRegion(const byte* data, int nX, int nY, int nZ,
|
||||
}
|
||||
else if (m_eTT == eTT_3D)
|
||||
{
|
||||
int nFrame = gRenDev->m_nFrameSwapID;
|
||||
rc.front = nZ;
|
||||
rc.back = nZ + ZSize;
|
||||
|
||||
@@ -4160,174 +4150,6 @@ void SEnvTexture::ReleaseDeviceObjects()
|
||||
// m_pTex->ReleaseDynamicRT(true);
|
||||
}
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
bool CTexture::RenderToTexture(int handle, const CCamera& camera, AzRTT::RenderContextId contextId)
|
||||
{
|
||||
if (!CRenderer::CV_r_RTT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CTexture* pTex = CTexture::GetByID(handle);
|
||||
if (!pTex || !pTex->GetDevTexture())
|
||||
{
|
||||
iLog->Log("Failed to render texture. Invalid texture handle ID.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// a context may be invalid because it requires hardware resources that are not available
|
||||
bool contextIsValid = false;
|
||||
AzRTT::RTTRequestBus::BroadcastResult(contextIsValid, &AzRTT::RTTRequestBus::Events::ContextIsValid, contextId);
|
||||
if (!contextIsValid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const int width = pTex->GetWidth();
|
||||
const int height = pTex->GetHeight();
|
||||
|
||||
// NOTE: the renderer's camera comes from the thread info double buffer, so it is possible
|
||||
// GetCamera() will just return the camera using in the last render to texture pass.
|
||||
// System::GetViewCamera() will have the camera used for the main rendering view
|
||||
CCamera prevSysCamera = gEnv->pSystem->GetViewCamera();
|
||||
|
||||
// get the current viewport and renderer settings to restore after rendering to texture
|
||||
int vX, vY, vWidth, vHeight;
|
||||
gRenDev->GetViewport(&vX, &vY, &vWidth, &vHeight);
|
||||
|
||||
// this flag is used by the engine to denote we are rendering the whole scene to texture
|
||||
gcpRendD3D->m_RP.m_TI[gcpRendD3D->m_RP.m_nFillThreadID].m_PersFlags |= RBPF_RENDER_SCENE_TO_TEXTURE;
|
||||
|
||||
// this resets the view and frame view/proj matrices in the thread info
|
||||
gcpRendD3D->BeginFrame();
|
||||
|
||||
// this frees up previous frame render cameras and waits for jobs. It will trigger MainThreadRenderRequestBus::ExecuteQueuedEvents();
|
||||
// The main pass also calls this after BeginFrame and before RenderWorld
|
||||
gEnv->p3DEngine->Tick();
|
||||
|
||||
// set the active camera
|
||||
gRenDev->SetCamera(camera);
|
||||
|
||||
// set the system view camera
|
||||
CCamera newSystemCamera = camera;
|
||||
gEnv->pSystem->SetViewCamera(newSystemCamera);
|
||||
|
||||
// we do not call PreWorldStreamUpdate here because it will compare the distance of the rtt
|
||||
// camera to the main camera and negatively affect stream settings
|
||||
|
||||
gRenDev->m_pRT->EnqueueRenderCommand([=]()
|
||||
{
|
||||
// disable back buffer swap so the renderer doesn't call present
|
||||
gRenDev->EnableSwapBuffers(false);
|
||||
|
||||
CTexture* pTex = CTexture::GetByID(handle);
|
||||
|
||||
// when you set the render target SetViewport is also called with the size of the target
|
||||
gRenDev->RT_PushRenderTarget(0, pTex, nullptr, -1);
|
||||
|
||||
// TODO manually set the viewport with our own viewport ID if we enabled TAA. Currently
|
||||
// doesn't work in multi-threaded mode. Causes flickering vegetation/transparent shadows
|
||||
|
||||
// disabling temporal effects turns off auto exposure and reduces flicker.
|
||||
gRenDev->m_nDisableTemporalEffects = 1;
|
||||
});
|
||||
|
||||
bool contextIsActive = false;
|
||||
AzRTT::RTTRequestBus::BroadcastResult(contextIsActive, &AzRTT::RTTRequestBus::Events::SetActiveContext, contextId);
|
||||
AZ_Warning("RenderToTexture", contextIsActive, "Failed to activate render to texture context, the render target will not be updated");
|
||||
|
||||
if (contextIsActive)
|
||||
{
|
||||
// don't draw UI or console to this RTT
|
||||
gEnv->pSystem->SetConsoleDrawEnabled(false);
|
||||
gEnv->pSystem->SetUIDrawEnabled(false);
|
||||
|
||||
AzRTT::RenderContextConfig config;
|
||||
AzRTT::RTTRequestBus::BroadcastResult(config, &AzRTT::RTTRequestBus::Events::GetContextConfig, contextId);
|
||||
|
||||
uint32_t renderPassFlags = SRenderingPassInfo::DEFAULT_FLAGS | SRenderingPassInfo::RENDER_SCENE_TO_TEXTURE;
|
||||
|
||||
// render to texture does not support merged meshes yet
|
||||
renderPassFlags &= ~SRenderingPassInfo::MERGED_MESHES;
|
||||
|
||||
// do not allow SVO (SHDF_ALLOW_AO) for now
|
||||
int renderFlags = SHDF_ZPASS | SHDF_ALLOWHDR | SHDF_ALLOWPOSTPROCESS | SHDF_ALLOW_WATER;
|
||||
|
||||
if (!config.m_shadowsEnabled)
|
||||
{
|
||||
renderFlags |= SHDF_NO_SHADOWGEN;
|
||||
renderPassFlags &= ~SRenderingPassInfo::SHADOWS;
|
||||
}
|
||||
|
||||
if (!config.m_oceanEnabled)
|
||||
{
|
||||
renderPassFlags &= ~SRenderingPassInfo::WATEROCEAN;
|
||||
}
|
||||
|
||||
SRenderingPassInfo renderPassInfo = SRenderingPassInfo::CreateGeneralPassRenderingInfo(camera, renderPassFlags);
|
||||
gEnv->p3DEngine->RenderWorld(renderFlags, renderPassInfo, __FUNCTION__);
|
||||
|
||||
gEnv->pSystem->SetConsoleDrawEnabled(true);
|
||||
gEnv->pSystem->SetUIDrawEnabled(true);
|
||||
|
||||
gEnv->p3DEngine->EndOcclusion();
|
||||
|
||||
gEnv->p3DEngine->WorldStreamUpdate();
|
||||
|
||||
// NOTE: This is how you could copy from the hdr target to the render target if you wanted no post processing (should probably remove SHDF_ALLOWPOSTPROCESS above)
|
||||
//gRenDev->m_pRT->EnqueueRenderCommand([=]()
|
||||
//{
|
||||
//PostProcessUtils().StretchRect(CTexture::s_ptexHDRTarget, pTex, false, false, false, false, SPostEffectsUtils::eDepthDownsample_None, false, &gcpRendD3D->m_FullResRect);
|
||||
//});
|
||||
|
||||
// this ends up calling FX_FinalComposite which will use our render target for post effects
|
||||
gcpRendD3D->SwitchToNativeResolutionBackbuffer();
|
||||
}
|
||||
|
||||
// Pop our render target
|
||||
gcpRendD3D->SetRenderTarget(0);
|
||||
|
||||
gRenDev->m_pRT->EnqueueRenderCommand([=]()
|
||||
{
|
||||
gcpRendD3D->m_RP.m_TI[gcpRendD3D->m_RP.m_nProcessThreadID].m_PersFlags &= ~RBPF_RENDER_SCENE_TO_TEXTURE;
|
||||
|
||||
gcpRendD3D->SetViewport(vX, vY, vWidth, vHeight);
|
||||
|
||||
// Reset the camera on the render thread or the main thread can get our
|
||||
// camera info after syncing with main.
|
||||
gcpRendD3D->SetCamera(prevSysCamera);
|
||||
});
|
||||
|
||||
AzRTT::RTTRequestBus::Broadcast(&AzRTT::RTTRequestBus::Events::SetActiveContext, AzRTT::RenderContextId::CreateNull());
|
||||
|
||||
// Free all unused render meshes. Without this you can get lots of fun memory leaks.
|
||||
gRenDev->ForceGC();
|
||||
|
||||
// call endframe on the renderer instead of via d3d to bypass drawing messages
|
||||
// set wait to true otherwise EndFrame won't be sent if there is no pending flush condition
|
||||
bool wait = true;
|
||||
gRenDev->m_pRT->RC_EndFrame(wait);
|
||||
|
||||
// re-enable swap buffers after calling end frame so the main pass will call present()
|
||||
gRenDev->m_pRT->EnqueueRenderCommand([=]()
|
||||
{
|
||||
gRenDev->EnableSwapBuffers(true);
|
||||
});
|
||||
|
||||
// normally we would need to remove the cull job producer using RemoveCullJobProducer
|
||||
// we don't need to because we use e_statobjbufferrendertask = 0
|
||||
|
||||
// restore previous settings
|
||||
gEnv->pSystem->SetViewCamera(prevSysCamera);
|
||||
gRenDev->SetCamera(prevSysCamera);
|
||||
|
||||
// this fixes streaming update sync errors when rendering pre frame
|
||||
gEnv->p3DEngine->SyncProcessStreamingUpdate();
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
bool CTexture::RenderEnvironmentCMHDR([[maybe_unused]] int size, [[maybe_unused]] Vec3& Pos, [[maybe_unused]] TArray<unsigned short>& vecData)
|
||||
{
|
||||
#if !defined(CONSOLE)
|
||||
@@ -4341,7 +4163,6 @@ bool CTexture::RenderEnvironmentCMHDR([[maybe_unused]] int size, [[maybe_unused]
|
||||
|
||||
const int nOldWidth = gRenDev->GetCurrentContextViewportWidth();
|
||||
const int nOldHeight = gRenDev->GetCurrentContextViewportHeight();
|
||||
bool bFullScreen = (iConsole->GetCVar("r_Fullscreen")->GetIVal() != 0) && (!gEnv->IsEditor());
|
||||
gRenDev->ChangeViewport(0, 0, size, size);
|
||||
|
||||
int nPFlags = gcpRendD3D->m_RP.m_TI[gcpRendD3D->m_RP.m_nProcessThreadID].m_PersFlags;
|
||||
|
||||
@@ -34,7 +34,6 @@ bool STexPoolItem::IsStillUsedByGPU(uint32 nTick)
|
||||
if (pDeviceTexture)
|
||||
{
|
||||
CHK_MAINORRENDTH;
|
||||
D3DBaseTexture* pD3DTex = pDeviceTexture->GetBaseTexture();
|
||||
}
|
||||
return (nTick - m_nFreeTick) < 4;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ bool CTexture::IsStillUsedByGPU()
|
||||
if (pDeviceTexture)
|
||||
{
|
||||
D3D_CHK_RENDTH;
|
||||
D3DBaseTexture* pD3DTex = pDeviceTexture->GetBaseTexture();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -97,7 +96,6 @@ void CTexture::StreamExpandMip(const void* vpRawData, int nMip, int nBaseMipOffs
|
||||
const int nSrcSurfaceSize = CTexture::TextureDataSize(nCurMipWidth, nCurMipHeight, 1, 1, 1, m_eTFSrc, m_eSrcTileMode);
|
||||
const int nSrcSidePitch = nSrcSurfaceSize + nSideDelta;
|
||||
|
||||
SRenderThread* pRT = gRenDev->m_pRT;
|
||||
if (mh.m_Mips && mh.m_SideSize > 0)
|
||||
{
|
||||
for (int iSide = 0; iSide < nSides; ++iSide)
|
||||
@@ -470,9 +468,6 @@ ID3D11CommandList* CTexture::StreamCreateDeferred(int nStartMip, int nEndMip, ST
|
||||
|
||||
if (CTexture::s_pStreamDeferredCtx)
|
||||
{
|
||||
CD3D9Renderer* r = gcpRendD3D;
|
||||
CDeviceManager* pDevMan = &r->m_DevMan;
|
||||
HRESULT h = S_OK;
|
||||
nEndMip = min(nEndMip + 1, (int)m_nMips) - 1;//+1 -1 needed as the compare is <=
|
||||
STexMipHeader* mh = m_pFileTexMips->m_pMipHeader;
|
||||
|
||||
@@ -648,7 +643,6 @@ void CTexture::StreamAssignPoolItem(STexPoolItem* pItem, int nMinMip)
|
||||
SRVDesc.Format = CTexture::ConvertToSRGBFmt(SRVDesc.Format);
|
||||
}
|
||||
|
||||
int nDevMip = m_nMips - pItemOwner->m_nMips;
|
||||
|
||||
// Recreate shader resource view
|
||||
if (m_eTT == eTT_2D)
|
||||
@@ -680,7 +674,10 @@ void CTexture::StreamAssignPoolItem(STexPoolItem* pItem, int nMinMip)
|
||||
}
|
||||
|
||||
D3DShaderResourceView* pNewResourceView = NULL;
|
||||
HRESULT hr = gcpRendD3D->GetDevice().CreateShaderResourceView(pItem->m_pDevTexture->GetBaseTexture(), &SRVDesc, &pNewResourceView);
|
||||
#if !defined(NDEBUG)
|
||||
HRESULT hr =
|
||||
#endif
|
||||
gcpRendD3D->GetDevice().CreateShaderResourceView(pItem->m_pDevTexture->GetBaseTexture(), &SRVDesc, &pNewResourceView);
|
||||
assert(hr == S_OK);
|
||||
|
||||
SetShaderResourceView(pNewResourceView, false);
|
||||
|
||||
@@ -288,13 +288,6 @@ void CVolumetricFog::CreateResources()
|
||||
&& ((CRenderer::CV_r_VolumetricFogDownscaledSunShadow == 1 && !m_downscaledShadow[2])
|
||||
|| (CRenderer::CV_r_VolumetricFogDownscaledSunShadow != 1 && m_downscaledShadow[2])));
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if(gcpRendD3D->IsRenderToTextureActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
if (validVolumeTexture && validDownscaledShadowMaps)
|
||||
{
|
||||
return;
|
||||
@@ -1387,13 +1380,6 @@ void CVolumetricFog::PushFogVolume(CREFogVolume* pFogVolume, const SRenderingPas
|
||||
|
||||
void CVolumetricFog::ClearFogVolumes()
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if(gcpRendD3D->IsRenderToTextureActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
const uint32 nThreadID = gcpRendD3D->m_RP.m_nFillThreadID;
|
||||
int32 nRecurseLevel = SRendItem::m_RecurseLevel[nThreadID];
|
||||
|
||||
@@ -1408,13 +1394,6 @@ void CVolumetricFog::ClearFogVolumes()
|
||||
|
||||
void CVolumetricFog::ClearAllFogVolumes()
|
||||
{
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if(gcpRendD3D->IsRenderToTextureActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
for (int32 i = 0; i < RT_COMMAND_BUF_COUNT; ++i)
|
||||
{
|
||||
for (int32 j = 0; j < MAX_REND_RECURSION_LEVELS; ++j)
|
||||
@@ -1446,12 +1425,6 @@ bool CVolumetricFog::IsViable() const
|
||||
{
|
||||
int nThreadID = gcpRendD3D->m_RP.m_nProcessThreadID;
|
||||
int nRecurseLevel = SRendItem::m_RecurseLevel[nThreadID];
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if ((gcpRendD3D->m_RP.m_TI[nThreadID].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
bool v = CD3D9Renderer::CV_r_VolumetricFog != 0 // IsEnableInFrame() and e_VolumetricFog are accumulated.
|
||||
&& gcpRendD3D->m_RP.m_TI[nThreadID].m_FS.m_bEnable
|
||||
@@ -2372,7 +2345,6 @@ void CVolumetricFog::RenderDownscaledDepth()
|
||||
int nScreenWidth = m_MaxDepthTemp->GetWidth();
|
||||
int nScreenHeight = m_MaxDepthTemp->GetHeight();
|
||||
int nSrcTexWidth = CTexture::s_ptexZTargetScaled->GetWidth();
|
||||
int nSrcTexHeight = CTexture::s_ptexZTargetScaled->GetHeight();
|
||||
|
||||
static CCryNameR paramDispatchParams("maxDepthDispatchParams");
|
||||
float destW = (float)nScreenWidth;
|
||||
@@ -2430,7 +2402,6 @@ void CVolumetricFog::RenderDownscaledDepth()
|
||||
int nScreenWidth = m_MaxDepth->GetWidth();
|
||||
int nScreenHeight = m_MaxDepth->GetHeight();
|
||||
int nSrcTexWidth = m_MaxDepthTemp->GetWidth();
|
||||
int nSrcTexHeight = m_MaxDepthTemp->GetHeight();
|
||||
|
||||
static CCryNameR paramDispatchParams("maxDepthDispatchParams");
|
||||
float destW = (float)nScreenWidth;
|
||||
@@ -2521,7 +2492,6 @@ void CVolumetricFog::RenderClipVolumeToVolumeStencil(int nClipAreaReservedStenci
|
||||
{
|
||||
float fFar = rd->GetViewParameters().fFar;
|
||||
float fNear = rd->GetViewParameters().fNear;
|
||||
float invMaxIndexMinusOne = 1.0f / (static_cast<f32>(maxDepthCount) - 1.0f);
|
||||
a = fFar / (fFar - fNear);
|
||||
b = fNear * -a;
|
||||
|
||||
|
||||
@@ -124,7 +124,6 @@ void CSvoRenderer::UpdateCompute()
|
||||
return;
|
||||
}
|
||||
|
||||
CD3D9Renderer* rd = gcpRendD3D;
|
||||
|
||||
if (!m_pShader)
|
||||
{
|
||||
@@ -670,7 +669,7 @@ void CSvoRenderer::ConeTracePass(SSvoTargetsSet* pTS)
|
||||
STexState pTexStateLinearClamp;
|
||||
pTexStateLinearClamp.SetFilterMode(FILTER_LINEAR);
|
||||
pTexStateLinearClamp.SetClampMode(false, false, false);
|
||||
int nTexStateLinearClampID = CTexture::GetTexState(pTexStateLinearClamp);
|
||||
CTexture::GetTexState(pTexStateLinearClamp);
|
||||
|
||||
pCloudShadowTex->Apply(15, m_nTexStateLinearWrap);
|
||||
}
|
||||
@@ -948,11 +947,6 @@ void CSvoRenderer::SetupNodesForUpdate(int& nNodesForUpdateStartIndex, PodArray<
|
||||
{
|
||||
int nId = nNodesForUpdateStartIndex + g * 16 + x * 4 + y;
|
||||
matVal[x][y] = 0.1f + ((nId < arrNodesForUpdate.Count()) ? arrNodesForUpdate[nId].nAtlasOffset : -2);
|
||||
|
||||
if (nId < arrNodesForUpdate.Count())
|
||||
{
|
||||
float fNodeSize = arrNodesForUpdate[nId].wsBox.GetSize().x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1073,7 +1067,6 @@ void CSvoRenderer::CheckAllocateRT(bool bSpecPass)
|
||||
bool CSvoRenderer::IsShaderItemUsedForVoxelization(SShaderItem& rShaderItem, [[maybe_unused]] IRenderNode* pRN)
|
||||
{
|
||||
CShader* pS = (CShader*)rShaderItem.m_pShader;
|
||||
CShaderResources* pR = (CShaderResources*)rShaderItem.m_pShaderResources;
|
||||
|
||||
// skip some objects marked by level designer
|
||||
// if(pRN && pRN->IsRenderNode() && pRN->GetIntegrationType())
|
||||
@@ -1505,7 +1498,6 @@ void CSvoRenderer::SetupRsmSun(const EHWShaderClass eShClass)
|
||||
threadID m_nThreadID = gcpRendD3D->m_RP.m_nProcessThreadID;
|
||||
int m_nRecurseLevel = SRendItem::m_RecurseLevel[m_nThreadID];
|
||||
|
||||
int nDLights = rd->m_RP.m_DLights[m_nThreadID][m_nRecurseLevel].Num();
|
||||
int nFrustumIdx = nLightID;// + nDLights;
|
||||
|
||||
int nStartIdx = SRendItem::m_StartFrust[m_nThreadID][nFrustumIdx];
|
||||
|
||||
@@ -231,7 +231,10 @@ namespace DX12
|
||||
m_Timers.End(*this);
|
||||
#endif
|
||||
|
||||
HRESULT res = m_CommandList->Close();
|
||||
#ifndef NDEBUG
|
||||
HRESULT res =
|
||||
#endif
|
||||
m_CommandList->Close();
|
||||
DX12_ASSERT(res == S_OK, "Could not close command list!");
|
||||
}
|
||||
|
||||
@@ -791,8 +794,6 @@ namespace DX12
|
||||
MaxResourceFenceValue(dstResource, CMDTYPE_ANY);
|
||||
MaxResourceFenceValue(srcResource, CMDTYPE_WRITE);
|
||||
|
||||
D3D12_RESOURCE_STATES prevDstState = dstResource.GetCurrentState();
|
||||
D3D12_RESOURCE_STATES prevSrcState = srcResource.GetCurrentState();
|
||||
QueueTransitionBarrier(dstResource, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
QueueTransitionBarrier(srcResource, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
FlushBarriers();
|
||||
@@ -817,8 +818,6 @@ namespace DX12
|
||||
MaxResourceFenceValue(srcResource, CMDTYPE_WRITE);
|
||||
|
||||
// TODO: if we know early that the resource(s) will be DEST and SOURCE we can begin the barrier early and end it here
|
||||
D3D12_RESOURCE_STATES prevDstState = dstResource.GetCurrentState();
|
||||
D3D12_RESOURCE_STATES prevSrcState = srcResource.GetCurrentState();
|
||||
QueueTransitionBarrier(dstResource, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
QueueTransitionBarrier(srcResource, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
FlushBarriers();
|
||||
|
||||
@@ -441,7 +441,6 @@ namespace DX12
|
||||
while (it != m_ReleaseHeap.end())
|
||||
{
|
||||
AZ::u32 resourceFrameNumber = it->second.frameNumber;
|
||||
ID3D12Resource* resource = it->second.resource;
|
||||
if (m_FrameCounter > (resourceFrameNumber + RESOURCE_RECYCLE_LATENCY) || releasePolicy == ResourceReleasePolicy::Immediate)
|
||||
{
|
||||
m_RecycleHeap.insert(*it);
|
||||
|
||||
@@ -159,7 +159,6 @@ namespace DX12
|
||||
UINT64 SetFenceValue(UINT64 fenceValue, const int id, const int type)
|
||||
{
|
||||
// Check submitted completed fence
|
||||
UINT64 utilizedValue = fenceValue;
|
||||
UINT64 previousValue = m_FenceValues[type][id];
|
||||
|
||||
#define DX12_FREETHREADED_RESOURCES
|
||||
|
||||
@@ -103,8 +103,8 @@ public:
|
||||
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
ULONG RefCount;
|
||||
if (!(RefCount = CryInterlockedDecrement(&m_RefCount)))
|
||||
ULONG RefCount = CryInterlockedDecrement(&m_RefCount);
|
||||
if (!RefCount)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
@@ -146,8 +146,8 @@ public:
|
||||
|
||||
virtual ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
ULONG RefCount;
|
||||
if (!(RefCount = CryInterlockedDecrement(&m_RefCount)))
|
||||
ULONG RefCount = CryInterlockedDecrement(&m_RefCount);
|
||||
if (!RefCount)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
|
||||
@@ -525,9 +525,10 @@ void CCryDX12DeviceContext::DebugPrintResources(DX12::CommandMode commandMode)
|
||||
DX12_LOG("Resource Heap Descriptor Tables:");
|
||||
|
||||
auto& state = m_PipelineState[commandMode];
|
||||
UINT stateFlags = state.m_StateFlags;
|
||||
#ifdef GFX_DEBUG
|
||||
UINT resourceDescriptorOffset = 0;
|
||||
UINT samplerDescriptorOffset = 0;
|
||||
#endif
|
||||
|
||||
// Bind constant buffers
|
||||
for (const DX12::ResourceLayoutBinding& resourceBinding : layout.m_TableResources)
|
||||
@@ -535,9 +536,9 @@ void CCryDX12DeviceContext::DebugPrintResources(DX12::CommandMode commandMode)
|
||||
const DX12::EShaderStage i = resourceBinding.ShaderStage;
|
||||
if (resourceBinding.ViewType == D3D12_DESCRIPTOR_RANGE_TYPE_CBV)
|
||||
{
|
||||
CCryDX12Buffer* buffer = state.Stages[i].ConstantBufferViews.Get(resourceBinding.ShaderSlot);
|
||||
auto bindRange = state.Stages[i].ConstBufferBindRange.Get(resourceBinding.ShaderSlot);
|
||||
#ifdef GFX_DEBUG
|
||||
CCryDX12Buffer* buffer = state.Stages[i].ConstantBufferViews.Get(resourceBinding.ShaderSlot);
|
||||
AZ_Assert(buffer, "ConstantBuffer is required by the PSO but has not been set!");
|
||||
AZ_Assert(resourceDescriptorOffset == resourceBinding.DescriptorOffset, "ConstantBuffer offset has shifted: resource mapping invalid!");
|
||||
#endif
|
||||
@@ -555,8 +556,8 @@ void CCryDX12DeviceContext::DebugPrintResources(DX12::CommandMode commandMode)
|
||||
}
|
||||
else if (resourceBinding.ViewType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV)
|
||||
{
|
||||
CCryDX12ShaderResourceView* resource = state.Stages[i].ShaderResourceViews.Get(resourceBinding.ShaderSlot);
|
||||
#ifdef GFX_DEBUG
|
||||
CCryDX12ShaderResourceView* resource = state.Stages[i].ShaderResourceViews.Get(resourceBinding.ShaderSlot);
|
||||
AZ_Assert(resource, "ShaderResourceView is required by the PSO but has not been set!");
|
||||
AZ_Assert(resourceDescriptorOffset == resourceBinding.DescriptorOffset, "ShaderResourceView offset has shifted: resource mapping invalid!");
|
||||
#endif
|
||||
@@ -574,8 +575,8 @@ void CCryDX12DeviceContext::DebugPrintResources(DX12::CommandMode commandMode)
|
||||
}
|
||||
else if (resourceBinding.ViewType == D3D12_DESCRIPTOR_RANGE_TYPE_UAV)
|
||||
{
|
||||
CCryDX12UnorderedAccessView* resource = state.Stages[i].UnorderedAccessViews.Get(resourceBinding.ShaderSlot);
|
||||
#ifdef GFX_DEBUG
|
||||
CCryDX12UnorderedAccessView* resource = state.Stages[i].UnorderedAccessViews.Get(resourceBinding.ShaderSlot);
|
||||
AZ_Assert(resource, "UnorderedAccessView is required by the PSO but has not been set!");
|
||||
AZ_Assert(resourceDescriptorOffset == resourceBinding.DescriptorOffset, "UnorderedAccessView offset has shifted: resource mapping invalid!");
|
||||
#endif
|
||||
@@ -599,8 +600,8 @@ void CCryDX12DeviceContext::DebugPrintResources(DX12::CommandMode commandMode)
|
||||
const DX12::EShaderStage i = samplerBinding.ShaderStage;
|
||||
AZ_Assert(samplerBinding.ViewType == D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, "");
|
||||
{
|
||||
CCryDX12SamplerState* sampler = state.Stages[i].SamplerState.Get(samplerBinding.ShaderSlot);
|
||||
#ifdef GFX_DEBUG
|
||||
CCryDX12SamplerState* sampler = state.Stages[i].SamplerState.Get(samplerBinding.ShaderSlot);
|
||||
AZ_Assert(sampler, "Sampler is required by the PSO but has not been set!");
|
||||
AZ_Assert(samplerDescriptorOffset == samplerBinding.DescriptorOffset, "Sampler offset has shifted: resource mapping invalid!");
|
||||
#endif
|
||||
@@ -1135,11 +1136,10 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::Unmap(
|
||||
|
||||
DX12_LOG("Unmapping resource: %p (%d)", pResource, Subresource);
|
||||
ICryDX12Resource* dx12Resource = DX12_EXTRACT_ICRYDX12RESOURCE(pResource);
|
||||
DX12::Resource& resource = dx12Resource->GetDX12Resource();
|
||||
|
||||
// NOTE: Don't know MapType, can't optimize writeRange!
|
||||
|
||||
AZ_Assert(!D3D12IsLayoutOpaque(resource.GetDesc().Layout), "Opaque layouts are unmappable until 12.2!");
|
||||
AZ_Assert(!D3D12IsLayoutOpaque(dx12Resource->GetDX12Resource().GetDesc().Layout), "Opaque layouts are unmappable until 12.2!");
|
||||
dx12Resource->GetD3D12Resource()->Unmap(Subresource, NULL);
|
||||
}
|
||||
|
||||
@@ -1418,7 +1418,8 @@ HRESULT STDMETHODCALLTYPE CCryDX12DeviceContext::GetData(
|
||||
FlushToFence(pEventQuery->GetFenceValue());
|
||||
}
|
||||
|
||||
return (*reinterpret_cast<BOOL*>(pData) = bComplete) ? S_OK : S_FALSE;
|
||||
*reinterpret_cast<BOOL*>(pData) = bComplete;
|
||||
return bComplete ? S_OK : S_FALSE;
|
||||
}
|
||||
else if (desc.Query == D3D11_QUERY_TIMESTAMP_DISJOINT)
|
||||
{
|
||||
@@ -1786,7 +1787,6 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::UploadResource(
|
||||
DX12_FUNC_LOG
|
||||
AZ_TRACE_METHOD();
|
||||
|
||||
ID3D12Resource* pDstResource12 = pDstResource->GetD3D12Resource();
|
||||
DX12::Resource& dstResource = pDstResource->GetDX12Resource();
|
||||
DX12::Resource::InitialData* id = dstResource.GetOrCreateInitialData();
|
||||
|
||||
@@ -1907,8 +1907,10 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearUnorderedAccessViewUint(
|
||||
DX12_FUNC_LOG
|
||||
|
||||
DX12::ResourceView* view = DX12_EXTRACT_DX12VIEW(pUnorderedAccessView);
|
||||
#ifndef NDEBUG
|
||||
CCryDX12UnorderedAccessView* uav = reinterpret_cast<CCryDX12UnorderedAccessView*>(pUnorderedAccessView);
|
||||
DX12_LOG("Clearing unordered access view [int]: %p %s", pUnorderedAccessView, uav->GetResourceName().c_str());
|
||||
#endif
|
||||
|
||||
m_DirectCommandList->ClearUnorderedAccessView(*view, Values);
|
||||
}
|
||||
@@ -1920,8 +1922,10 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearUnorderedAccessViewFloat(
|
||||
DX12_FUNC_LOG
|
||||
|
||||
DX12::ResourceView* view = DX12_EXTRACT_DX12VIEW(pUnorderedAccessView);
|
||||
#ifndef NDEBUG
|
||||
CCryDX12UnorderedAccessView* uav = reinterpret_cast<CCryDX12UnorderedAccessView*>(pUnorderedAccessView);
|
||||
DX12_LOG("Clearing unordered access view [float]: %p %s", pUnorderedAccessView, uav->GetResourceName().c_str());
|
||||
#endif
|
||||
|
||||
m_DirectCommandList->ClearUnorderedAccessView(*view, Values);
|
||||
}
|
||||
@@ -1935,8 +1939,10 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearDepthStencilView(
|
||||
DX12_FUNC_LOG
|
||||
|
||||
DX12::ResourceView* view = DX12_EXTRACT_DX12VIEW(pDepthStencilView);
|
||||
#ifndef NDEBUG
|
||||
CCryDX12DepthStencilView* dsv = reinterpret_cast<CCryDX12DepthStencilView*>(pDepthStencilView);
|
||||
DX12_LOG("Clearing depth stencil view: %p %s", pDepthStencilView, dsv->GetResourceName().c_str());
|
||||
#endif
|
||||
|
||||
m_DirectCommandList->ClearDepthStencilView(*view, D3D12_CLEAR_FLAGS(ClearFlags), Depth, Stencil);
|
||||
}
|
||||
@@ -2885,8 +2891,10 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearRectsRenderTargetView(
|
||||
DX12_FUNC_LOG
|
||||
|
||||
DX12::ResourceView* view = DX12_EXTRACT_DX12VIEW(pRenderTargetView);
|
||||
#ifndef NDEBUG
|
||||
CCryDX12RenderTargetView* rtv = reinterpret_cast<CCryDX12RenderTargetView*>(pRenderTargetView);
|
||||
DX12_LOG("Clearing render target view: %p %s", pRenderTargetView, rtv->GetResourceName().c_str());
|
||||
#endif
|
||||
|
||||
m_DirectCommandList->ClearRenderTargetView(*view, ColorRGBA, NumRects, pRects);
|
||||
}
|
||||
@@ -2900,8 +2908,10 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearRectsUnorderedAccessViewUint(
|
||||
DX12_FUNC_LOG
|
||||
|
||||
DX12::ResourceView* view = DX12_EXTRACT_DX12VIEW(pUnorderedAccessView);
|
||||
#ifndef NDEBUG
|
||||
CCryDX12UnorderedAccessView* uav = reinterpret_cast<CCryDX12UnorderedAccessView*>(pUnorderedAccessView);
|
||||
DX12_LOG("Clearing unordered access view [int]: %p %s", pUnorderedAccessView, uav->GetResourceName().c_str());
|
||||
#endif
|
||||
|
||||
m_DirectCommandList->ClearUnorderedAccessView(*view, Values, NumRects, pRects);
|
||||
}
|
||||
@@ -2915,8 +2925,10 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearRectsUnorderedAccessViewFloat
|
||||
DX12_FUNC_LOG
|
||||
|
||||
DX12::ResourceView* view = DX12_EXTRACT_DX12VIEW(pUnorderedAccessView);
|
||||
#ifndef NDEBUG
|
||||
CCryDX12UnorderedAccessView* uav = reinterpret_cast<CCryDX12UnorderedAccessView*>(pUnorderedAccessView);
|
||||
DX12_LOG("Clearing unordered access view [float]: %p %s", pUnorderedAccessView, uav->GetResourceName().c_str());
|
||||
#endif
|
||||
|
||||
m_DirectCommandList->ClearUnorderedAccessView(*view, Values, NumRects, pRects);
|
||||
}
|
||||
@@ -2932,8 +2944,10 @@ void STDMETHODCALLTYPE CCryDX12DeviceContext::ClearRectsDepthStencilView(
|
||||
DX12_FUNC_LOG
|
||||
|
||||
DX12::ResourceView* view = DX12_EXTRACT_DX12VIEW(pDepthStencilView);
|
||||
#ifndef NDEBUG
|
||||
CCryDX12DepthStencilView* dsv = reinterpret_cast<CCryDX12DepthStencilView*>(pDepthStencilView);
|
||||
DX12_LOG("Clearing depth stencil view: %p %s", pDepthStencilView, dsv->GetResourceName().c_str());
|
||||
#endif
|
||||
|
||||
m_DirectCommandList->ClearDepthStencilView(*view, D3D12_CLEAR_FLAGS(ClearFlags), Depth, Stencil, NumRects, pRects);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
#include "RenderDll_precompiled.h"
|
||||
#include "CCryDX12InputLayout.hpp"
|
||||
|
||||
CCryDX12InputLayout* CCryDX12InputLayout::Create(CCryDX12Device* pDevice, const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs11, UINT NumElements, [[maybe_unused]] const void* pShaderBytecodeWithInputSignature, [[maybe_unused]] SIZE_T BytecodeLength)
|
||||
CCryDX12InputLayout* CCryDX12InputLayout::Create([[maybe_unused]] CCryDX12Device* pDevice, const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs11, UINT NumElements, [[maybe_unused]] const void* pShaderBytecodeWithInputSignature, [[maybe_unused]] SIZE_T BytecodeLength)
|
||||
{
|
||||
ID3D12Device* pDevice12 = pDevice->GetD3D12Device();
|
||||
CCryDX12InputLayout* pResult = DX12::PassAddRef(new CCryDX12InputLayout());
|
||||
pResult->m_Descriptors.resize(NumElements);
|
||||
|
||||
|
||||
@@ -151,9 +151,6 @@ set(FILES
|
||||
../PostProcessSunShafts.cpp
|
||||
../PostProcessWater.cpp
|
||||
../PostProcessSnow.cpp
|
||||
../RTT/RTTContext.cpp
|
||||
../RTT/RTTContextManager.cpp
|
||||
../RTT/RTTSwappableRenderTarget.cpp
|
||||
../D3D_SVO.h
|
||||
../D3DVolumetricFog.h
|
||||
../D3DTiledShading.h
|
||||
@@ -182,10 +179,6 @@ set(FILES
|
||||
../../RenderDll_precompiled.h
|
||||
../DeviceInfo.inl
|
||||
../MultiLayerAlphaBlendPass.h
|
||||
../RTT/RTTContext.h
|
||||
../RTT/RTTContextManager.h
|
||||
../RTT/RTTSwappableRenderTarget.h
|
||||
../RTT/RTTSwappableCVar.h
|
||||
../../Common/Renderer_Jobs.cpp
|
||||
../../Common/CommonRender.cpp
|
||||
../../Common/DeferredRenderUtils.cpp
|
||||
|
||||
@@ -894,7 +894,8 @@ error:
|
||||
|
||||
bool Initialize(IDefragAllocatorPolicy* policy, bool bestFit)
|
||||
{
|
||||
if (m_defrag_allocator = CryGetIMemoryManager()->CreateDefragAllocator())
|
||||
m_defrag_allocator = CryGetIMemoryManager()->CreateDefragAllocator();
|
||||
if (m_defrag_allocator)
|
||||
{
|
||||
IDefragAllocator::Policy pol;
|
||||
pol.pDefragPolicy = m_defrag_policy = policy;
|
||||
@@ -1583,7 +1584,6 @@ namespace
|
||||
AZRHI_ASSERT(move.m_relocating == false);
|
||||
BufferPoolItem& item = m_item_table[move.m_item_handle];
|
||||
BufferPoolBank* bank = &m_bank_table[m_banks[item.m_bank]];
|
||||
uint8* old_offset = bank->m_base_ptr + item.m_offset;
|
||||
item.m_bank = move.m_dst_offset / s_PoolConfig.m_pool_bank_size;
|
||||
item.m_offset = move.m_dst_offset & s_PoolConfig.m_pool_bank_mask;
|
||||
bank = &m_bank_table[m_banks[item.m_bank]];
|
||||
@@ -1635,7 +1635,7 @@ namespace
|
||||
D3DBuffer* buffer = NULL;
|
||||
BufferPoolItem* item = NULL;
|
||||
BufferPoolBank* bank = NULL;
|
||||
size_t offset = 0u, bank_index = 0u;
|
||||
size_t bank_index = 0u;
|
||||
item_handle_t handle;
|
||||
bool failed = false;
|
||||
|
||||
@@ -1889,7 +1889,6 @@ retry:
|
||||
// synced already we allocate a new item and swap it with the existing one
|
||||
// to make sure that we do not contend with the gpu on an already
|
||||
// used item's buffer update.
|
||||
size_t item_handle = item->m_handle;
|
||||
IF (item->m_bank != ~0u, 1)
|
||||
{
|
||||
m_allocator.PinItem(item);
|
||||
@@ -2197,7 +2196,6 @@ retry:
|
||||
void* BeginWrite(BufferPoolItem* item)
|
||||
{
|
||||
D3DBuffer* buffer = m_backing_buffer.m_buffer;
|
||||
size_t size = item->m_size;
|
||||
D3D11_MAPPED_SUBRESOURCE mapped_resource;
|
||||
D3D11_MAP map = m_map_type;
|
||||
#if defined(OPENGL) && !DXGL_FULL_EMULATION
|
||||
@@ -3216,9 +3214,9 @@ namespace AzRHI
|
||||
|
||||
void* ConstantBuffer::BeginWrite()
|
||||
{
|
||||
PoolManager& poolManager = PoolManager::GetInstance();
|
||||
|
||||
# if CONSTANT_BUFFER_ENABLE_DIRECT_ACCESS
|
||||
PoolManager& poolManager = PoolManager::GetInstance();
|
||||
if (m_used)
|
||||
{
|
||||
poolManager.m_constant_allocator.Free(this);
|
||||
@@ -3253,7 +3251,7 @@ namespace AzRHI
|
||||
{
|
||||
AZ_Assert(m_base_ptr == nullptr, "Already mapped when mapping");
|
||||
D3D11_MAPPED_SUBRESOURCE mappedResource;
|
||||
HRESULT hr = gcpRendD3D->GetDeviceContext().Map(m_buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
|
||||
[[maybe_unused]] HRESULT hr = gcpRendD3D->GetDeviceContext().Map(m_buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
|
||||
AZ_Assert(hr == S_OK, "Map buffer failed");
|
||||
m_base_ptr = mappedResource.pData;
|
||||
return mappedResource.pData;
|
||||
|
||||
@@ -659,7 +659,7 @@ void DeviceInfo::ResizeDXGIBuffers()
|
||||
flags |= DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
|
||||
#endif
|
||||
|
||||
HRESULT hr = m_pSwapChain->ResizeBuffers(0, m_swapChainDesc.BufferDesc.Width, m_swapChainDesc.BufferDesc.Height, m_swapChainDesc.BufferDesc.Format, flags);
|
||||
m_pSwapChain->ResizeBuffers(0, m_swapChainDesc.BufferDesc.Width, m_swapChainDesc.BufferDesc.Height, m_swapChainDesc.BufferDesc.Format, flags);
|
||||
|
||||
CreateViews();
|
||||
}
|
||||
@@ -735,7 +735,6 @@ void DeviceInfo::ProcessSystemEvent(ESystemEvent event, UINT_PTR wParam, [[maybe
|
||||
const bool activate = LOWORD(wParam) != 0;
|
||||
if (m_activated != activate)
|
||||
{
|
||||
HWND hWnd = (HWND) gcpRendD3D->GetHWND();
|
||||
|
||||
const bool isFullscreen = gcpRendD3D->IsFullscreen();
|
||||
if (isFullscreen && !activate)
|
||||
|
||||
@@ -1169,10 +1169,6 @@ uint32 CDeviceTexture::TextureDataSize(D3DBaseView* pView)
|
||||
eTF = CTexture::TexFormatFromDeviceFormat(sDesc.Format);
|
||||
}
|
||||
|
||||
D3DUnorderedAccessView* pUAV = nullptr;
|
||||
D3DShaderResourceView* pSRV = nullptr;
|
||||
D3DDepthSurface* pDSV = nullptr;
|
||||
D3DSurface* pRTV = nullptr;
|
||||
|
||||
return CTexture::TextureDataSize(nWidth, nHeight, nDepth, nMips, nSlices, eTF);
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ void CDeviceTexture::Unbind()
|
||||
void CDeviceTexture::DownloadToStagingResource(uint32 nSubRes, StagingHook cbTransfer)
|
||||
{
|
||||
AZ_Assert(nSubRes < m_numSubResources, "Invalid SubResource ID %d, (should be < %d)", nSubRes, m_numSubResources);
|
||||
D3DResource* pStagingResource;
|
||||
if (!(pStagingResource = GetCurrDownloadStagingResource()))
|
||||
D3DResource* pStagingResource = GetCurrDownloadStagingResource();
|
||||
if (!pStagingResource)
|
||||
{
|
||||
pStagingResource = gcpRendD3D->m_DevMan.AllocateStagingResource(m_pD3DTexture, FALSE);
|
||||
}
|
||||
@@ -189,8 +189,8 @@ void CDeviceTexture::DownloadToStagingResource()
|
||||
void CDeviceTexture::UploadFromStagingResource(const uint32 nSubRes, StagingHook cbTransfer)
|
||||
{
|
||||
AZ_Assert(nSubRes < m_numSubResources, "Invalid SubResource ID %d, (should be < %d)", nSubRes, m_numSubResources);
|
||||
D3DResource* pStagingResource;
|
||||
if (!(pStagingResource = GetCurrUploadStagingResource()))
|
||||
D3DResource* pStagingResource = GetCurrUploadStagingResource();
|
||||
if (!pStagingResource)
|
||||
{
|
||||
pStagingResource = gcpRendD3D->m_DevMan.AllocateStagingResource(m_pD3DTexture, TRUE);
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ void CDeviceTexture::DownloadToStagingResource(uint32 nSubRes, StagingHook cbTra
|
||||
D3D11_RESOURCE_DIMENSION eResourceDimension;
|
||||
m_pD3DTexture->GetType(&eResourceDimension);
|
||||
|
||||
D3DResource* pStagingResource;
|
||||
D3DResource* pStagingResource = GetCurrDownloadStagingResource();
|
||||
void* pStagingMemory = nullptr;
|
||||
if (!(pStagingResource = GetCurrDownloadStagingResource()))
|
||||
if (!pStagingResource)
|
||||
{
|
||||
pStagingResource = gcpRendD3D->m_DevMan.AllocateStagingResource(m_pD3DTexture, FALSE);
|
||||
}
|
||||
@@ -135,9 +135,9 @@ void CDeviceTexture::UploadFromStagingResource(uint32 nSubRes, StagingHook cbTra
|
||||
D3D11_RESOURCE_DIMENSION eResourceDimension;
|
||||
m_pD3DTexture->GetType(&eResourceDimension);
|
||||
|
||||
D3DResource* pStagingResource;
|
||||
D3DResource* pStagingResource = GetCurrUploadStagingResource();
|
||||
void* pStagingMemory = nullptr;
|
||||
if (!(pStagingResource = GetCurrUploadStagingResource()))
|
||||
if (!pStagingResource)
|
||||
{
|
||||
pStagingResource = gcpRendD3D->m_DevMan.AllocateStagingResource(m_pD3DTexture, TRUE);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,6 @@ bool SDeviceObjectHelpers::GetConstantBuffersFromShader(std::vector<SDeviceObjec
|
||||
{
|
||||
VectorSet<EConstantBufferShaderSlot> usedBuffersSlots;
|
||||
auto* pInstance = reinterpret_cast<CHWShader_D3D::SHWSInstance*>(hwShaders[shaderClass].pHwShaderInstance);
|
||||
auto* pHwShader = reinterpret_cast<CHWShader_D3D*>(hwShaders[shaderClass].pHwShader);
|
||||
|
||||
const int vectorCount[] =
|
||||
{
|
||||
|
||||
@@ -855,8 +855,6 @@ void CDeviceGraphicsCommandList::SetInlineConstants([[maybe_unused]] uint32 bind
|
||||
|
||||
void CDeviceGraphicsCommandList::SetStencilRefImpl(uint8_t stencilRefValue)
|
||||
{
|
||||
auto pCmdList = GET_DX11_COMMANDLIST(this);
|
||||
|
||||
ID3D11DepthStencilState* pDS = NULL;
|
||||
|
||||
if (m_pCurrentPipelineState)
|
||||
|
||||
@@ -159,9 +159,6 @@ void CDeviceResourceSet_DX12::Build()
|
||||
gcpRendD3D->m_DevBufMan.ReleaseDescriptorBlock(m_DescriptorBlockHandle);
|
||||
}
|
||||
|
||||
auto pContext = reinterpret_cast<CCryDX12DeviceContext*>(&gcpRendD3D->GetDeviceContext());
|
||||
auto pCoreCommandList = pContext->GetCoreGraphicsCommandList();
|
||||
|
||||
// CBV_SRV_UAV heap, SMP heap not yet supported
|
||||
uint32 numberResources = m_ConstantBuffers.size() + m_Textures.size() + m_Buffers.size();
|
||||
uint32 blockSize = std::max(numberResources, 1u);
|
||||
|
||||
@@ -1599,11 +1599,7 @@ void CD3D9Renderer::RT_BeginFrame()
|
||||
|
||||
#if defined(SUPPORT_DEVICE_INFO)
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (m_bEditor && !IsRenderToTextureActive())
|
||||
#else
|
||||
if (m_bEditor)
|
||||
#endif //if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
{
|
||||
const int width = GetWidth();
|
||||
const int height = GetHeight();
|
||||
@@ -2495,10 +2491,6 @@ void CD3D9Renderer::DebugDrawStats1()
|
||||
size_t nMemApp = 0;
|
||||
size_t nMemDevVB = 0;
|
||||
size_t nMemDevIB = 0;
|
||||
size_t nMemDevVBPool = 0;
|
||||
size_t nMemDevIBPool = 0;
|
||||
size_t nMemDevVBPoolUsed = 0;
|
||||
size_t nMemDevIBPoolUsed = 0;
|
||||
{
|
||||
AUTO_LOCK(CRenderMesh::m_sLinkLock);
|
||||
for (util::list<CRenderMesh>* iter = CRenderMesh::m_MeshList.prev; iter != &CRenderMesh::m_MeshList; iter = iter->prev)
|
||||
@@ -3024,7 +3016,6 @@ void CD3D9Renderer::DebugVidResourcesBars([[maybe_unused]] int nX, [[maybe_unuse
|
||||
{
|
||||
if (!tp->IsStreamed())
|
||||
{
|
||||
int nnn = 0;
|
||||
}
|
||||
if (tp->GetName()[0] != '$' && tp->GetNumMips() <= 1)
|
||||
{
|
||||
@@ -3551,7 +3542,6 @@ void CD3D9Renderer::DebugDrawStats2()
|
||||
Draw2dLabel(nX, nY, 2.0f, &col.r, false, "FX Shader: %s, Technique: %s (%d out of %d), Pass: %d", pTech->pShader->GetName(), pTech->pTech->m_NameStr.c_str(), snTech, Techs.Num(), 0);
|
||||
nY += 25;
|
||||
|
||||
CHWShader_D3D* pVS = pTech->pVS;
|
||||
CHWShader_D3D* pPS = pTech->pPS;
|
||||
DebugPrintShader(pTech->pVS, pTech->pVSInst, nX - 10, nY, Col_White);
|
||||
DebugPrintShader(pPS, pTech->pPSInst, nX + 450, nY, Col_Cyan);
|
||||
@@ -3614,7 +3604,6 @@ void CD3D9Renderer::DebugDrawStats()
|
||||
IRenderer::RNDrawcallsMapNodeItor pItor = m_RP.m_pRNDrawCallsInfoPerNode[m_RP.m_nProcessThreadID].begin();
|
||||
for (; pItor != pEnd; ++pItor)
|
||||
{
|
||||
IRenderNode* pRenderNode = pItor->first;
|
||||
SDrawCallCountInfo& pInfo = pItor->second;
|
||||
|
||||
uint32 nDrawcalls = pInfo.nShadows + pInfo.nZpass + pInfo.nGeneral + pInfo.nTransparent + pInfo.nMisc;
|
||||
@@ -3699,11 +3688,6 @@ void CD3D9Renderer::RT_RenderDebug([[maybe_unused]] bool bRenderStats)
|
||||
return;
|
||||
}
|
||||
#if !defined(_RELEASE)
|
||||
if (CV_r_showbufferusage)
|
||||
{
|
||||
const uint32 xStartCoord = 695;
|
||||
int YStep = 12;
|
||||
}
|
||||
|
||||
#if REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS
|
||||
if (CV_r_RefractionPartialResolvesDebug)
|
||||
@@ -4332,7 +4316,6 @@ void CD3D9Renderer::RT_RenderDebug([[maybe_unused]] bool bRenderStats)
|
||||
s.Trim();
|
||||
if (s.length() > 0)
|
||||
{
|
||||
const char* curName = s.c_str();
|
||||
nameList.push_back(s);
|
||||
}
|
||||
p = azstrtok(NULL, 0, " ", &nextToken);
|
||||
@@ -4468,7 +4451,6 @@ void CD3D9Renderer::RT_EndFrame(bool isLoading)
|
||||
return;
|
||||
}
|
||||
|
||||
float fTime = 0; //iTimer->GetAsyncCurTimePrec();
|
||||
HRESULT hReturn = E_FAIL;
|
||||
|
||||
CTimeValue TimeEndF = iTimer->GetAsyncTime();
|
||||
@@ -6033,12 +6015,7 @@ void CD3D9Renderer::RT_DrawImageWithUVInternal(float xpos, float ypos, float z,
|
||||
|
||||
PROFILE_FRAME(Draw_2DImage);
|
||||
|
||||
HRESULT hReturn = S_OK;
|
||||
|
||||
float fx = xpos;
|
||||
float fy = ypos;
|
||||
float fw = w;
|
||||
float fh = h;
|
||||
|
||||
SetCullMode(R_CULL_DISABLE);
|
||||
EF_SetColorOp(eCO_MODULATE, eCO_MODULATE, DEF_TEXARG0, DEF_TEXARG0);
|
||||
@@ -6193,7 +6170,6 @@ void CD3D9Renderer::PopMatrix()
|
||||
//-----------------------------------------------------------------------------
|
||||
Matrix44A OffCenterProjection(const CCamera& cam, const Vec3& nv, unsigned short max, unsigned short win_width, unsigned short win_height)
|
||||
{
|
||||
int nThreadID = gRenDev->m_pRT->GetThreadList();
|
||||
|
||||
//get the size of near plane
|
||||
float l = +nv.x;
|
||||
@@ -6288,7 +6264,6 @@ void CD3D9Renderer::SetCamera(const CCamera& cam)
|
||||
mViewFinal.m31 = mView.m32;
|
||||
mViewFinal.m32 = -mView.m31;
|
||||
|
||||
Matrix44A* m = &m_RP.m_TI[nThreadID].m_matView;
|
||||
m_RP.m_TI[nThreadID].m_matView = mViewFinal;
|
||||
|
||||
mViewFinal.m30 = 0;
|
||||
|
||||
@@ -1722,7 +1722,6 @@ public:
|
||||
|
||||
_inline void FX_DrawRE(CShader* sh, SShaderPass* sl)
|
||||
{
|
||||
int bFogOverrided = 0;
|
||||
// Unlock all VB (if needed) and set current streams
|
||||
FX_CommitStreams(sl);
|
||||
|
||||
|
||||
+2
-1
@@ -40,8 +40,9 @@ SGraphicsPipelineStateDescription::SGraphicsPipelineStateDescription(
|
||||
{
|
||||
SSkinningData* pSkinningData = NULL;
|
||||
SRenderObjData* pOD = pObj->GetObjData();
|
||||
if (pOD && (pSkinningData = pOD->m_pSkinningData))
|
||||
if (pOD && pOD->m_pSkinningData)
|
||||
{
|
||||
pSkinningData = pOD->m_pSkinningData;
|
||||
if (pSkinningData->nHWSkinningFlags & eHWS_Skinning_Matrix)
|
||||
{
|
||||
objectRuntimeMask |= (g_HWSR_MaskBit[HWSR_SKINNING_MATRIX]);
|
||||
|
||||
@@ -30,8 +30,6 @@ namespace
|
||||
// Shirleys concentric mapping
|
||||
static Vec2 ToUnitDisk(Vec2 O, float blades, [[maybe_unused]] float fstop)
|
||||
{
|
||||
float max_fstops = 8;
|
||||
float min_fstops = 1;
|
||||
float normalizedStops = 1.0f;
|
||||
|
||||
float phi, r;
|
||||
|
||||
@@ -25,26 +25,13 @@ CThreadSafeRendererContainer<CMotionBlur::ObjectMap::value_type> CMotionBlur::m_
|
||||
void CMotionBlur::GetPrevObjToWorldMat(CRenderObject* renderObject, Matrix44A& worldMatrix)
|
||||
{
|
||||
assert(renderObject);
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const int threadId = gRenDev->m_RP.m_nProcessThreadID;
|
||||
// RTT does not support motion blur yet
|
||||
if (gRenDev->m_RP.m_TI[threadId].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE)
|
||||
{
|
||||
worldMatrix = renderObject->m_II.m_Matrix;
|
||||
return;
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
if (renderObject->m_ObjFlags & FOB_HAS_PREVMATRIX)
|
||||
{
|
||||
const SRenderObjData* renderObjectData = renderObject->GetObjData();
|
||||
const uintptr_t objectId = renderObjectData ? renderObjectData->m_uniqueObjectId : 0;
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const AZ::u32 objectIndex = GetPrevBufferIndex();
|
||||
#else
|
||||
const AZ::u32 frameId = gRenDev->GetFrameID(false);
|
||||
const AZ::u32 objectIndex = (frameId - 1) % CMotionBlur::s_maxObjectBuffers;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
auto it = m_Objects[objectIndex]->find(objectId);
|
||||
if (it != m_Objects[objectIndex]->end())
|
||||
@@ -60,20 +47,8 @@ void CMotionBlur::GetPrevObjToWorldMat(CRenderObject* renderObject, Matrix44A& w
|
||||
void CMotionBlur::OnBeginFrame()
|
||||
{
|
||||
assert(!gRenDev->m_pRT || gRenDev->m_pRT->IsMainThread());
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const AZ::u32 threadId = gRenDev->m_RP.m_nFillThreadID;
|
||||
if (gRenDev->m_RP.m_TI[threadId].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE)
|
||||
{
|
||||
// RTT does not support motion blur yet in render targets yet
|
||||
return;
|
||||
}
|
||||
|
||||
const AZ::u32 frameId = gRenDev->GetCameraFrameID();
|
||||
const AZ::u32 objectIndex = GetCurrentBufferIndex();
|
||||
#else
|
||||
const AZ::u32 frameId = gRenDev->GetFrameID(false);
|
||||
const AZ::u32 objectIndex = frameId % CMotionBlur::s_maxObjectBuffers;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
m_Objects[objectIndex]->erase_if([frameId](const VectorMap<uintptr_t, MotionBlurObjectParameters >::value_type& object)
|
||||
{
|
||||
@@ -89,12 +64,8 @@ void CMotionBlur::InsertNewElements()
|
||||
return;
|
||||
}
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const AZ::u32 nObjFrameWriteID = GetCurrentBufferIndex();
|
||||
#else
|
||||
const AZ::u32 nFrameID = gRenDev->GetFrameID(false);
|
||||
const AZ::u32 nObjFrameWriteID = (nFrameID - 1) % CMotionBlur::s_maxObjectBuffers;
|
||||
#endif //if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
m_FillData[nThreadID].CoalesceMemory();
|
||||
m_Objects[nObjFrameWriteID]->insert(&m_FillData[nThreadID][0], &m_FillData[nThreadID][0] + m_FillData[nThreadID].size());
|
||||
|
||||
@@ -774,12 +774,7 @@ void PostAAPass::RenderFinalComposite(CTexture* sourceTexture)
|
||||
|
||||
PROFILE_LABEL_SCOPE("NATIVE_UPSCALE");
|
||||
gRenDev->m_RP.m_FlagsShader_RT &= ~(g_HWSR_MaskBit[HWSR_SAMPLE0] | g_HWSR_MaskBit[HWSR_SAMPLE5]);
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const bool renderSceneToTexture = (gcpRendD3D->m_RP.m_TI[gcpRendD3D->m_RP.m_nProcessThreadID].m_PersFlags & RBPF_RENDER_SCENE_TO_TEXTURE) != 0;
|
||||
if ((sourceTexture->GetWidth() != gRenDev->GetOverlayWidth() || sourceTexture->GetHeight() != gRenDev->GetOverlayHeight()) && !renderSceneToTexture)
|
||||
#else
|
||||
if (sourceTexture->GetWidth() != gRenDev->GetOverlayWidth() || sourceTexture->GetHeight() != gRenDev->GetOverlayHeight())
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
{
|
||||
gRenDev->m_RP.m_FlagsShader_RT |= g_HWSR_MaskBit[HWSR_SAMPLE0];
|
||||
}
|
||||
@@ -789,13 +784,6 @@ void PostAAPass::RenderFinalComposite(CTexture* sourceTexture)
|
||||
gRenDev->m_RP.m_FlagsShader_RT |= g_HWSR_MaskBit[HWSR_SAMPLE5];
|
||||
}
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (CRenderer::CV_r_FinalOutputAlpha == static_cast<int>(AzRTT::AlphaMode::ALPHA_DEPTH_BASED))
|
||||
{
|
||||
// enable sampling of depth target for alpha value
|
||||
gRenDev->m_RP.m_FlagsShader_RT |= g_HWSR_MaskBit[HWSR_SAMPLE1];
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
PostProcessUtils().SetSRGBShaderFlags();
|
||||
|
||||
@@ -809,13 +797,6 @@ void PostAAPass::RenderFinalComposite(CTexture* sourceTexture)
|
||||
texStateLinerSRGB.m_bSRGBLookup = true;
|
||||
sourceTexture->Apply(0, CTexture::GetTexState(texStateLinerSRGB));
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
if (CRenderer::CV_r_FinalOutputAlpha == static_cast<int>(AzRTT::AlphaMode::ALPHA_DEPTH_BASED))
|
||||
{
|
||||
CTexture::s_ptexZTarget->Apply(1, CTexture::GetTexState(STexState(FILTER_POINT, true)));
|
||||
}
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
SPostEffectsUtils::DrawFullScreenTri(gcpRendD3D->GetOverlayWidth(), gcpRendD3D->GetOverlayHeight());
|
||||
SPostEffectsUtils::ShEndPass();
|
||||
|
||||
|
||||
@@ -73,22 +73,8 @@ void CScreenSpaceReflectionsPass::Execute()
|
||||
0.5f, 0.5f, 0, 1.0f);
|
||||
const uint32 numGPUs = rd->GetActiveGPUCount();
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
const CCamera& camera = rd->m_RP.m_TI[rd->m_RP.m_nProcessThreadID].m_cam;
|
||||
const AZ::EntityId cameraID = camera.GetEntityId();
|
||||
const int frameID = camera.GetFrameUpdateId();
|
||||
const uint32 prevViewProjID = max((frameID - (int)numGPUs) % MAX_GPU_NUM, 0);
|
||||
auto iter = m_prevViewProj[prevViewProjID].find(cameraID);
|
||||
if (iter == m_prevViewProj[prevViewProjID].end())
|
||||
{
|
||||
// initialize with the current view projection in case this is a one-off render.
|
||||
m_prevViewProj[prevViewProjID].insert({cameraID, mViewProj});
|
||||
}
|
||||
Matrix44 mViewProjPrev = m_prevViewProj[prevViewProjID][cameraID] * mViewport;
|
||||
#else
|
||||
const int frameID = SPostEffectsUtils::m_iFrameCounter;
|
||||
Matrix44 mViewProjPrev = m_prevViewProj[max((frameID - (int)numGPUs) % MAX_GPU_NUM, 0)] * mViewport;
|
||||
#endif //if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
int texStateLinear = CTexture::GetTexState(STexState(FILTER_LINEAR, true));
|
||||
int texStatePoint = CTexture::GetTexState(STexState(FILTER_POINT, true));
|
||||
@@ -176,12 +162,8 @@ void CScreenSpaceReflectionsPass::Execute()
|
||||
m_passComposition.Execute();
|
||||
}
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
m_prevViewProj[frameID % MAX_GPU_NUM][cameraID] = mViewProj;
|
||||
#else
|
||||
// Update array used for MGPU support
|
||||
m_prevViewProj[frameID % MAX_GPU_NUM] = mViewProj;
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
|
||||
// Restore original state
|
||||
rd->m_RP.m_TI[rd->m_RP.m_nProcessThreadID].m_PersFlags = prevPersFlags;
|
||||
|
||||
@@ -39,10 +39,5 @@ private:
|
||||
CGaussianBlurPass m_passBlur1;
|
||||
CGaussianBlurPass m_passBlur2;
|
||||
|
||||
#if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
// render to texture supports multiple cameras
|
||||
AZStd::unordered_map<AZ::EntityId, Matrix44> m_prevViewProj[MAX_GPU_NUM];
|
||||
#else
|
||||
Matrix44 m_prevViewProj[MAX_GPU_NUM];
|
||||
#endif // if AZ_RENDER_TO_TEXTURE_GEM_ENABLED
|
||||
};
|
||||
|
||||
@@ -142,8 +142,6 @@ static const SRenderLight* FindSunLight(SRenderPipeline& renderPipeline)
|
||||
void CStandardGraphicsPipeline::UpdatePerFrameConstantBuffer(const PerFrameParameters& perFrameParams)
|
||||
{
|
||||
CD3D9Renderer* renderer = gcpRendD3D;
|
||||
const PerFrameParameters& perFrameConstants = renderer->m_cEF.m_PF;
|
||||
SRenderPipeline& RESTRICT_REFERENCE rp = gRenDev->m_RP;
|
||||
|
||||
CTypedConstantBuffer<HLSL_PerFrameConstantBuffer> cb(m_PerFrameConstantBuffer);
|
||||
|
||||
@@ -409,8 +407,6 @@ void CStandardGraphicsPipeline::BindPerViewConstantBuffer()
|
||||
|
||||
void CStandardGraphicsPipeline::UpdatePerShadowConstantBuffer(const ShadowParameters& params)
|
||||
{
|
||||
CD3D9Renderer* renderer = gcpRendD3D;
|
||||
const SRenderPipeline& renderPipeline = renderer->m_RP;
|
||||
const auto& shadowFrustum = *params.m_ShadowFrustum;
|
||||
|
||||
CTypedConstantBuffer<HLSL_PerSubPassConstantBuffer_ShadowGen> cb(m_PerShadowConstantBuffer);
|
||||
|
||||
@@ -66,8 +66,10 @@ bool MultiLayerAlphaBlendPass::IsSupported()
|
||||
if (gpuVendor == RFT_HW_NVIDIA && driverVersion < NVIDIA_DRIVER_VERSION_THAT_FIXES_OIT_CRASH)
|
||||
{
|
||||
m_supported = SupportLevel::NOT_SUPPORTED;
|
||||
#if defined(AZ_ENABLE_TRACING)
|
||||
unsigned long majorDriverVersion = (driverVersion - driverVersion % 100) / 100;
|
||||
unsigned long minorDriverVersion = driverVersion % 100;
|
||||
#endif
|
||||
AZ_Warning("Rendering", false, "Multi-layer alpha blend is currently disabled on NVIDIA hardware with driver version < 398.82 due to a bug in the NVIDIA driver that leads to a device timeout. The currently installed driver version is %lu.%lu. Update your driver version to 398.82 or later to use this feature.", majorDriverVersion, minorDriverVersion);
|
||||
return false;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user