diff options
author | Frans Gu <[email protected]> | 2016-07-01 04:54:44 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-03-30 14:44:33 +0200 |
commit | 588e5bbf3d40a5d2537b4e49fbf377ccad953a41 (patch) | |
tree | 5b84bed5a058cf1995bb869018a68387686f0ddc /src/amd | |
parent | 11f1306207dc606257ff1570195360346af2d7f0 (diff) |
amd/addrlib: Apply input pitch after internal pitch aligning
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/addrlib/r800/egbaddrlib.cpp | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/src/amd/addrlib/r800/egbaddrlib.cpp b/src/amd/addrlib/r800/egbaddrlib.cpp index 7942d20d75a..fe98d2ff25d 100644 --- a/src/amd/addrlib/r800/egbaddrlib.cpp +++ b/src/amd/addrlib/r800/egbaddrlib.cpp @@ -240,18 +240,6 @@ BOOL_32 EgBasedLib::ComputeSurfaceInfoLinear( &pOut->pitchAlign, &pOut->heightAlign); - if (pIn->pitchAlign != 0) - { - ADDR_ASSERT((pIn->pitchAlign % pOut->pitchAlign) == 0); - pOut->pitchAlign = pIn->pitchAlign; - } - - if (pIn->heightAlign != 0) - { - ADDR_ASSERT((pIn->heightAlign % pOut->heightAlign) == 0); - pOut->heightAlign = pIn->heightAlign; - } - if ((pIn->tileMode == ADDR_TM_LINEAR_GENERAL) && pIn->flags.color && (pIn->height > 1)) { #if !ALT_TEST @@ -297,6 +285,39 @@ BOOL_32 EgBasedLib::ComputeSurfaceInfoLinear( &expHeight, &pOut->heightAlign); + if (pIn->pitchAlign != 0) + { + ADDR_ASSERT((pIn->pitchAlign % pOut->pitchAlign) == 0); + pOut->pitchAlign = pIn->pitchAlign; + + if (IsPow2(pOut->pitchAlign)) + { + expPitch = PowTwoAlign(expPitch, pOut->pitchAlign); + } + else + { + expPitch += pOut->pitchAlign - 1; + expPitch /= pOut->pitchAlign; + expPitch *= pOut->pitchAlign; + } + } + + if (pIn->heightAlign != 0) + { + ADDR_ASSERT((pIn->heightAlign % pOut->heightAlign) == 0); + pOut->heightAlign = pIn->heightAlign; + + if (IsPow2(pOut->heightAlign)) + { + expHeight = PowTwoAlign(expHeight, pOut->heightAlign); + } + else + { + expHeight += pOut->heightAlign - 1; + expHeight /= pOut->heightAlign; + expHeight *= pOut->heightAlign; + } + } pOut->pitch = expPitch; pOut->height = expHeight; |