Integrating latest 47acbe8

This commit is contained in:
alexpete
2021-03-25 13:57:57 -07:00
parent 448c549698
commit 75dc720198
10312 changed files with 2711566 additions and 671451 deletions
@@ -50,11 +50,6 @@
#include "DeviceManager_D3D12.inl"
#else
#include "DeviceManager_D3D11.inl"
#if defined(USE_NV_API)
#include "DeviceManager_D3D11_NVAPI.h"
#include "DeviceManager_D3D11_NVAPI.inl"
#endif
#endif
CDeviceManager::CDeviceManager()
@@ -1093,10 +1088,6 @@ int CDeviceTexture::Cleanup()
#include AZ_RESTRICTED_FILE(DeviceManager_cpp)
#endif
#if defined(USE_NV_API)
m_handleMGPU = NULL;
#endif
return nRef;
}
@@ -43,10 +43,6 @@
#define AZ_RESTRICTED_SECTION DEVICEMANAGER_H_SECTION_1
#include AZ_RESTRICTED_FILE(DeviceManager_h)
# endif
# if defined(USE_NV_API)
# include "DeviceManager_D3D11_NVAPI.h"
# endif
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
@@ -482,10 +478,6 @@ class CDeviceTexture
void* m_pStagingMemoryUpload[NUM_UPLOAD_STAGING_RES];
#endif
#if defined(USE_NV_API)
void* m_handleMGPU;
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION DEVICEMANAGER_H_SECTION_9
#include AZ_RESTRICTED_FILE(DeviceManager_h)
@@ -523,20 +515,12 @@ public:
void Unbind();
#if defined(USE_NV_API)
void DisableMgpuSync();
void MgpuResourceUpdate(bool bUpdating = true);
#endif
CDeviceTexture ()
: m_pD3DTexture(NULL)
, m_nBaseAllocatedSize(0)
, m_bNoDelete(false)
, m_bCube(false)
, m_numSubResources(0)
#if defined(USE_NV_API)
, m_handleMGPU(NULL)
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION DEVICEMANAGER_H_SECTION_10
#include AZ_RESTRICTED_FILE(DeviceManager_h)
@@ -558,9 +542,6 @@ public:
, m_bNoDelete(false)
, m_bCube(false)
, m_numSubResources(0)
#if defined(USE_NV_API)
, m_handleMGPU(NULL)
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION DEVICEMANAGER_H_SECTION_11
#include AZ_RESTRICTED_FILE(DeviceManager_h)
@@ -582,9 +563,6 @@ public:
, m_bNoDelete(false)
, m_bCube(true)
, m_numSubResources(0)
#if defined(USE_NV_API)
, m_handleMGPU(NULL)
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION DEVICEMANAGER_H_SECTION_12
#include AZ_RESTRICTED_FILE(DeviceManager_h)
@@ -1,17 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or
* a third party where indicated.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#if defined(USE_NV_API)
#include <nvapi.h>
#endif
@@ -1,65 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#if defined(USE_NV_API)
void CDeviceTexture::DisableMgpuSync()
{
if (gRenDev->m_bVendorLibInitialized && (gRenDev->GetFeatures() & RFT_HW_NVIDIA))
{
NVDX_ObjectHandle handle = (NVDX_ObjectHandle&)m_handleMGPU;
if (handle == NULL)
{
NvAPI_Status status = NvAPI_D3D_GetObjectHandleForResource(&gcpRendD3D->GetDevice(), m_pD3DTexture, &handle);
assert(status == NVAPI_OK);
m_handleMGPU = handle;
}
//if (nWidth >= 4 && nHeight >= 4)
{
NvU32 value = 1;
// disable driver watching this texture - it will never be synced unless requested by the application
NvAPI_Status status = NvAPI_D3D_SetResourceHint(&gcpRendD3D->GetDevice(), handle, NVAPI_D3D_SRH_CATEGORY_SLI, NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC, &value);
assert(status == NVAPI_OK);
}
}
}
void CDeviceTexture::MgpuResourceUpdate(bool bUpdating)
{
if (gcpRendD3D->m_bVendorLibInitialized && (gRenDev->GetFeatures() & RFT_HW_NVIDIA))
{
ID3D11Device* pDevice = &gcpRendD3D->GetDevice();
NVDX_ObjectHandle handle = (NVDX_ObjectHandle&)m_handleMGPU;
if (handle == NULL)
{
NvAPI_Status status = NvAPI_D3D_GetObjectHandleForResource(pDevice, m_pD3DTexture, &handle);
assert(status == NVAPI_OK);
m_handleMGPU = handle;
}
if (handle)
{
NvAPI_Status status = NVAPI_OK;
if (bUpdating)
{
status = NvAPI_D3D_BeginResourceRendering(pDevice, handle, NVAPI_D3D_RR_FLAG_FORCE_DISCARD_CONTENT);
}
else
{
status = NvAPI_D3D_EndResourceRendering(pDevice, handle, 0);
}
// TODO: Verify that NVAPI_WAS_STILL_DRAWING is valid here
assert(status == NVAPI_OK || status == NVAPI_WAS_STILL_DRAWING);
}
}
}
#endif