Commit d3206e61 by Nicolas Capens Committed by Nicolas Capens

Use the source stride for framebuffer blit.

Previously we assumed the source stride (in pixels) to be the width rounded up to the next multiple of 2. This is currently correct but may not hold in the future. Change-Id: I23a79ace66f720398a120b70081d731c2cf1b4c0 Reviewed-on: https://swiftshader-review.googlesource.com/4481Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent e5a9637d
......@@ -1831,14 +1831,15 @@ namespace D3D9
static void (__cdecl *blitFunction)(void *dst, void *src);
static sw::Routine *blitRoutine;
static sw::BlitState blitState = {0};
static sw::BlitState blitState = {};
sw::BlitState update;
update.width = sourceDescription.Width;
update.height = sourceDescription.Height;
update.sourceFormat = sw::FORMAT_A8R8G8B8;
update.sourceStride = source->getExternalPitchB();
update.destFormat = sw::FORMAT_A8R8G8B8;
update.stride = dest->getExternalPitchB();
update.destStride = dest->getExternalPitchB();
update.cursorHeight = 0;
update.cursorWidth = 0;
......
......@@ -119,8 +119,9 @@ namespace sw
updateState.width = width;
updateState.height = height;
updateState.destFormat = format;
updateState.destStride = stride;
updateState.sourceFormat = sourceFormat;
updateState.stride = topLeftOrigin ? (int)sourceStride : -(int)sourceStride;
updateState.sourceStride = topLeftOrigin ? (int)sourceStride : -(int)sourceStride;
updateState.cursorWidth = cursor.width;
updateState.cursorHeight = cursor.height;
......@@ -169,11 +170,10 @@ namespace sw
{
const int width = state.width;
const int height = state.height;
const int width2 = (state.width + 1) & ~1;
const int dBytes = Surface::bytes(state.destFormat);
const int dStride = state.stride;
const int dStride = state.destStride;
const int sBytes = Surface::bytes(state.sourceFormat);
const int sStride = topLeftOrigin ? (sBytes * width2) : -(sBytes * width2);
const int sStride = state.sourceStride;
Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)> function;
{
......
......@@ -29,7 +29,8 @@ namespace sw
int height;
Format destFormat;
Format sourceFormat;
int stride;
int destStride;
int sourceStride;
int cursorWidth;
int cursorHeight;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment