Skip to content

Commit 5edb983

Browse files
authored
Optimize memory allocation for SFT resource (#51)
1 parent 1a0b11c commit 5edb983

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Source/GmmLib/Resource/GmmResourceInfoCommon.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont
366366
AuxSurf.Size += GMM_KBYTE(64);
367367
}
368368
}
369+
370+
if(Surf.Flags.Gpu.ProceduralTexture)
371+
{
372+
//Do not require main surface access either in GPUVA/physical space.
373+
Surf.Size = 0;
374+
}
369375

370376
TotalSize = Surf.Size + AuxSurf.Size; //Not including AuxSecSurf size, multi-Aux surface isn't supported for displayables
371377
Alignment = GFX_ULONG_CAST(Surf.Pitch * pPlatform->TileInfo[Surf.TileMode].LogicalTileHeight);

Source/GmmLib/ULT/GmmGen12ResourceULT.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,7 +2539,8 @@ TEST_F(CTestGen12Resource, Test2DTileYfAMFSResource)
25392539
VerifyResourceVAlign<true>(ResourceInfo, VAlign[i]);
25402540
VerifyResourcePitch<true>(ResourceInfo, TileSize[i][0]); // As wide as 1 Tile
25412541
VerifyResourcePitchInTiles<true>(ResourceInfo, 1); // 1 Tile wide
2542-
VerifyResourceSize<true>(ResourceInfo, GMM_KBYTE(4)); // 1 Tile Big
2542+
//VerifyResourceSize<true>(ResourceInfo, GMM_KBYTE(4)); // 1 Tile Big, old behaviour consuming bytes for main-surface (paired Texture dimensions) only used to obtain GPUVA for indirect (Auxtable mapped) CCS access by sampler.
2543+
VerifyResourceSize<true>(ResourceInfo, 0); // New behaviour, optimized SFT size, sampler doesn't access CCS via main.. kernels refer the CCS-via its GPUVA (w/o main).
25432544
VerifyResourceQPitch<false>(ResourceInfo, 0); // Not Tested
25442545

25452546
//test main surface base alignment is 4KB, since AMFS PT isn't compressed
@@ -2586,7 +2587,8 @@ TEST_F(CTestGen12Resource, Test2DTileYfAMFSResource)
25862587
VerifyResourceVAlign<true>(ResourceInfo, VAlign[i]);
25872588
VerifyResourcePitch<true>(ResourceInfo, TileSize[i][0] * 2); // As wide as 2 tile
25882589
VerifyResourcePitchInTiles<true>(ResourceInfo, 2); // 2 tile wide
2589-
VerifyResourceSize<true>(ResourceInfo, GMM_KBYTE(4) * 2); // 2 tile big
2590+
//VerifyResourceSize<true>(ResourceInfo, GMM_KBYTE(4) * 2); // 2 tile big, old behaviour consuming bytes for main-surface (paired Texture dimensions) only used to obtain GPUVA for indirect (Auxtable mapped) CCS access by sampler.
2591+
VerifyResourceSize<true>(ResourceInfo, 0); // New behaviour, optimized SFT size, sampler doesn't access CCS via main.. kernels refer the CCS-via its GPUVA (w/o main).
25902592

25912593
VerifyResourceQPitch<false>(ResourceInfo, 0); // Not tested
25922594

@@ -2632,7 +2634,8 @@ TEST_F(CTestGen12Resource, Test2DTileYfAMFSResource)
26322634
VerifyResourceVAlign<true>(ResourceInfo, VAlign[i]);
26332635
VerifyResourcePitch<true>(ResourceInfo, TileSize[i][0] * 2); // As wide as 2 tile
26342636
VerifyResourcePitchInTiles<true>(ResourceInfo, 2); // 2 tile wide
2635-
VerifyResourceSize<true>(ResourceInfo, GMM_KBYTE(4) * 2 * 2); // 2 tile wide; and 2-tile high
2637+
//VerifyResourceSize<true>(ResourceInfo, GMM_KBYTE(4) * 2 * 2); // 2 tile wide; and 2-tile high, old behaviour consuming bytes for main-surface (paired Texture dimensions) only used to obtain GPUVA for indirect (Auxtable mapped) CCS access by sampler.
2638+
VerifyResourceSize<true>(ResourceInfo, 0); // New behaviour, optimized SFT size, sampler doesn't access CCS via main.. kernels refer the CCS-via its GPUVA (w/o main).
26362639

26372640
VerifyResourceQPitch<false>(ResourceInfo, 0); // Not tested
26382641
//test main surface base alignment is 4KB

0 commit comments

Comments
 (0)