Fail if pTextureCalc is NULL (#196)

This commit is contained in:
John Machado 2024-05-30 15:06:59 +05:30 committed by GitHub
parent dcc4b85ea3
commit e2a8b80fb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 1 deletions

View File

@ -447,6 +447,13 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont
pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf, GetGmmLibContext());
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf, GetGmmLibContext());
if (!pTextureCalc)
{
Status = GMM_ERROR;
GMM_ASSERTDPF(0, "Texture Calculation pointer is NULL.");
goto ERROR_CASE;
}
#if defined(__GMM_KMD__) || !defined(_WIN32)
if(!CreateParams.Flags.Info.ExistingSysMem)
#else

View File

@ -443,6 +443,12 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams()
pPlatformResource = GMM_OVERRIDE_PLATFORM_INFO(&Surf, GetGmmLibContext());
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf, GetGmmLibContext());
if (!pTextureCalc)
{
GMM_ASSERTDPF(0, "Texture Calculation pointer is NULL.");
goto ERROR_CASE;
}
__GMM_ASSERT(!(
Surf.Flags.Gpu.Query &&
!Surf.Flags.Info.Cacheable)); // Why query not set as cacheable? If not cacheable, what keeps from stolen memory (because STORE_DWORD/PIPE_CONTROL/etc. targets can't be in stolen)?

View File

@ -76,7 +76,10 @@ void GmmLib::GmmResourceInfoCommon::GetRestrictions(__GMM_BUFFER_TYPE &Restricti
GMM_TEXTURE_CALC *pTextureCalc = NULL;
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf, GetGmmLibContext());
pTextureCalc->GetResRestrictions(&Surf, Restrictions);
if (pTextureCalc)
{
pTextureCalc->GetResRestrictions(&Surf, Restrictions);
}
GMM_DPF_EXIT;
}