mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'recording-pack-alignment' into 'master'
Fix pack alignment handling in screen capture Closes RingRacers#41 See merge request KartKrew/Kart!2322
This commit is contained in:
commit
a160487556
2 changed files with 3 additions and 3 deletions
|
|
@ -34,7 +34,7 @@ void ScreenshotPass::capture(Rhi& rhi, Handle<GraphicsContext> ctx)
|
|||
packed_data_.clear();
|
||||
// Pixel data must be in pack alignment (4) so a stride of non-multiple 4 must align to 4
|
||||
uint32_t stride = width_ * 3;
|
||||
uint32_t read_stride = ((width_ + (kPixelRowPackAlignment - 1)) & ~(kPixelRowPackAlignment - 1)) * 3;
|
||||
uint32_t read_stride = ((stride + (kPixelRowPackAlignment - 1)) & ~(kPixelRowPackAlignment - 1));
|
||||
pixel_data_.resize(read_stride * height_); // 3 bytes per pixel for RGB8
|
||||
packed_data_.resize(stride * height_);
|
||||
|
||||
|
|
|
|||
|
|
@ -1759,9 +1759,9 @@ void Gl2Rhi::read_pixels(Handle<GraphicsContext> ctx, const Rect& rect, PixelFor
|
|||
GLint size = std::get<2>(gl_format);
|
||||
|
||||
// Pack alignment comes into play.
|
||||
uint32_t pack_aligned_w = (rect.w + (kPixelRowPackAlignment - 1)) & ~(kPixelRowPackAlignment - 1);
|
||||
uint32_t pack_stride = (rect.w * size + (kPixelRowPackAlignment - 1)) & ~(kPixelRowPackAlignment - 1);
|
||||
|
||||
SRB2_ASSERT(out.size_bytes() == pack_aligned_w * rect.h * size);
|
||||
SRB2_ASSERT(out.size_bytes() == pack_stride * rect.h);
|
||||
|
||||
bool is_back;
|
||||
Rect src_dim;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue