diff --git a/src/xenia/gpu/d3d11/d3d11_graphics_driver.cc b/src/xenia/gpu/d3d11/d3d11_graphics_driver.cc index 6617cd774..98d92c9ff 100644 --- a/src/xenia/gpu/d3d11/d3d11_graphics_driver.cc +++ b/src/xenia/gpu/d3d11/d3d11_graphics_driver.cc @@ -1170,9 +1170,9 @@ int D3D11GraphicsDriver::FetchTexture2D( uint32_t width = fetch.size_2d.width; uint32_t height = fetch.size_2d.height; - uint32_t data_pitch = XEROUNDUP(width, 256); + uint32_t data_pitch = MAX(256, XENEXTPOW2(width)); // TODO(benvanik): block height rounding? - uint32_t data_height = XEROUNDUP(height, 256); + uint32_t data_height = height; size_t data_size = data_pitch * data_height * info.bpp; D3D11_TEXTURE2D_DESC texture_desc; diff --git a/src/xenia/types.h b/src/xenia/types.h index 21c54dba2..f4356e94a 100644 --- a/src/xenia/types.h +++ b/src/xenia/types.h @@ -142,6 +142,9 @@ typedef XECACHEALIGN volatile void xe_aligned_void_t; #define XESELECTBITS(value, a, b) ((value & XEBITMASK(a, b)) >> a) #define XEROUNDUP(v, multiple) ((v) + (multiple) - 1 - ((v) - 1) % (multiple)) +static inline uint32_t XENEXTPOW2(uint32_t v) { + v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; +} #define XESUCCEED() goto XECLEANUP #define XEFAIL() goto XECLEANUP