DXGL r882 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r881‎ | r882 | r883 >
Date:23:59, 8 December 2018
Author:admin
Status:new
Tags:
Comment:
Fix RGBA8332 texture upload and download.
Modified paths:
  • /ddraw/glTexture.cpp (modified) (history)

Diff [purge]

Index: ddraw/glTexture.cpp
@@ -453,8 +453,7 @@
454454 }
455455 else return; // Non-primary surfaces should not have scaling
456456 inpitch = NextMultipleOf4(This->levels[level].ddsd.dwWidth * This->internalsize);
457 - outpitch = NextMultipleOf4(This->levels[level].ddsd.dwHeight
458 - * (NextMultipleOf8(This->levels[level].ddsd.ddpfPixelFormat.dwRGBBitCount)/8));
 457+ outpitch = This->levels[level].ddsd.lPitch;
459458 if (This->pboPack->size < inpitch * This->levels[level].ddsd.dwHeight)
460459 BufferObject_SetData(This->pboPack, GL_PIXEL_PACK_BUFFER,
461460 inpitch * This->levels[level].ddsd.dwHeight, NULL, GL_DYNAMIC_READ);
@@ -474,7 +473,7 @@
475474 {
476475 for (i = 0; i < This->levels[level].ddsd.dwHeight; i++)
477476 colorconvproc[This->convfunctiondownload](This->levels[level].ddsd.dwWidth,
478 - This->levels[level].buffer + (i*outpitch), readbuffer + (i + inpitch));
 477+ This->levels[level].buffer + (i*outpitch), readbuffer + (i * inpitch));
479478 }
480479 BufferObject_Unmap(This->pboPack, GL_PIXEL_PACK_BUFFER);
481480 }
@@ -557,8 +556,7 @@
558557 if (!This->pboUnpack)
559558 BufferObject_Create(&This->pboUnpack, This->renderer->ext, This->renderer->util);
560559 outpitch = NextMultipleOf4(This->levels[level].ddsd.dwWidth * This->internalsize);
561 - inpitch = NextMultipleOf4(This->levels[level].ddsd.dwHeight
562 - * (NextMultipleOf8(This->levels[level].ddsd.ddpfPixelFormat.dwRGBBitCount) / 8));
 560+ inpitch = This->levels[level].ddsd.lPitch;
563561 if (This->pboUnpack->size < outpitch * This->levels[level].ddsd.dwHeight)
564562 BufferObject_SetData(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER,
565563 outpitch * This->levels[level].ddsd.dwHeight, NULL, GL_DYNAMIC_DRAW);
@@ -565,7 +563,7 @@
566564 writebuffer = (char*)BufferObject_Map(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
567565 for (i = 0; i < This->levels[level].ddsd.dwHeight; i++)
568566 colorconvproc[This->convfunctionupload](This->levels[level].ddsd.dwWidth,
569 - writebuffer + (i*outpitch), This->levels[level].buffer + (i + inpitch));
 567+ writebuffer + (i*outpitch), This->levels[level].buffer + (i * inpitch));
570568 BufferObject_Unmap(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER);
571569 BufferObject_Bind(This->pboUnpack, GL_PIXEL_UNPACK_BUFFER);
572570 if (This->renderer->ext->GLEXT_EXT_direct_state_access)