diff options
author | Jason Ekstrand <[email protected]> | 2016-08-29 16:34:06 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-09-12 19:42:57 -0700 |
commit | 8ac99eabb6570f0f3c5f7d7da1332a99ce636362 (patch) | |
tree | 1d900c4576f4bc588ef0f2e12143b5d8e28750f9 /src/intel/isl/isl.c | |
parent | 3cc15ba5bb2e48930c9a8f8916790006ba32e22e (diff) |
intel/isl: Add a helper for getting the size of an interleaved pixel
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/isl/isl.c')
-rw-r--r-- | src/intel/isl/isl.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c index 3dfdf201d9e..c19ef59edac 100644 --- a/src/intel/isl/isl.c +++ b/src/intel/isl/isl.c @@ -286,9 +286,8 @@ isl_choose_msaa_layout(const struct isl_device *dev, } } -static void -isl_msaa_interleaved_scale_px_to_sa(uint32_t samples, - uint32_t *width, uint32_t *height) +struct isl_extent2d +isl_get_interleaved_msaa_px_size_sa(uint32_t samples) { assert(isl_is_pow2(samples)); @@ -300,10 +299,23 @@ isl_msaa_interleaved_scale_px_to_sa(uint32_t samples, * MSFMT_DEPTH_STENCIL, W_L and H_L must be adjusted as follows before * proceeding: [...] */ + return (struct isl_extent2d) { + .width = 1 << ((ffs(samples) - 0) / 2), + .height = 1 << ((ffs(samples) - 1) / 2), + }; +} + +static void +isl_msaa_interleaved_scale_px_to_sa(uint32_t samples, + uint32_t *width, uint32_t *height) +{ + const struct isl_extent2d px_size_sa = + isl_get_interleaved_msaa_px_size_sa(samples); + if (width) - *width = isl_align(*width, 2) << ((ffs(samples) - 0) / 2); + *width = isl_align(*width, 2) * px_size_sa.width; if (height) - *height = isl_align(*height, 2) << ((ffs(samples) - 1) / 2); + *height = isl_align(*height, 2) * px_size_sa.width; } static enum isl_array_pitch_span |