Skip to content

Commit e2a8b80

Browse files
authored
Fail if pTextureCalc is NULL (#196)
1 parent dcc4b85 commit e2a8b80

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Source/GmmLib/Resource/GmmResourceInfoCommon.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,13 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont
447447
pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf, GetGmmLibContext());
448448
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf, GetGmmLibContext());
449449

450+
if (!pTextureCalc)
451+
{
452+
Status = GMM_ERROR;
453+
GMM_ASSERTDPF(0, "Texture Calculation pointer is NULL.");
454+
goto ERROR_CASE;
455+
}
456+
450457
#if defined(__GMM_KMD__) || !defined(_WIN32)
451458
if(!CreateParams.Flags.Info.ExistingSysMem)
452459
#else

Source/GmmLib/Resource/GmmResourceInfoCommonEx.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,12 @@ uint8_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::ValidateParams()
443443
pPlatformResource = GMM_OVERRIDE_PLATFORM_INFO(&Surf, GetGmmLibContext());
444444
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf, GetGmmLibContext());
445445

446+
if (!pTextureCalc)
447+
{
448+
GMM_ASSERTDPF(0, "Texture Calculation pointer is NULL.");
449+
goto ERROR_CASE;
450+
}
451+
446452
__GMM_ASSERT(!(
447453
Surf.Flags.Gpu.Query &&
448454
!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)?

Source/GmmLib/Resource/GmmRestrictions.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ void GmmLib::GmmResourceInfoCommon::GetRestrictions(__GMM_BUFFER_TYPE &Restricti
7676

7777
GMM_TEXTURE_CALC *pTextureCalc = NULL;
7878
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(&Surf, GetGmmLibContext());
79-
pTextureCalc->GetResRestrictions(&Surf, Restrictions);
79+
if (pTextureCalc)
80+
{
81+
pTextureCalc->GetResRestrictions(&Surf, Restrictions);
82+
}
8083

8184
GMM_DPF_EXIT;
8285
}

0 commit comments

Comments
 (0)