Skip to content

Commit

Permalink
Fixup merge failure (to rebase later.)
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Jul 9, 2016
1 parent c406ccd commit 6bdc2bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
23 changes: 1 addition & 22 deletions GPU/Common/TextureCacheCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,31 +521,10 @@ void *TextureCacheCommon::DecodeLevelToIndexed(GETextureFormat format, int level
ERROR_LOG_REPORT(G3D, "Unsupported indexed texture with CLUT indexes outside 0-255");
}

if (!(g_Config.iTexScalingLevel == 1 && gstate_c.Supports(GPU_SUPPORTS_UNPACK_SUBIMAGE)) && w != bufw) {
// Need to rearrange the buffer to simulate GL_UNPACK_ROW_LENGTH etc.
finalBuf = (u8 *)RearrangeBuf(finalBuf, bufw, w, h);
}

// TODO: Change to using an output and stride.
return finalBuf;
}

void *TextureCacheCommon::RearrangeBuf(void *inBuf, u32 inRowBytes, u32 outRowBytes, int h, bool allowInPlace) {
const u8 *read = (const u8 *)inBuf;
void *outBuf = inBuf;
u8 *write = (u8 *)inBuf;
if (outRowBytes > inRowBytes || !allowInPlace) {
write = (u8 *)tmpTexBufRearrange.data();
outBuf = tmpTexBufRearrange.data();
}
for (int y = 0; y < h; y++) {
memmove(write, read, outRowBytes);
read += inRowBytes;
write += outRowBytes;
}

return outBuf;
}

bool TextureCacheCommon::GetCurrentClutBuffer(GPUDebugBuffer &buffer) {
const u32 bpp = gstate.getClutPaletteFormat() == GE_CMODE_32BIT_ABGR8888 ? 4 : 2;
const u32 pixels = 1024 / bpp;
Expand Down
16 changes: 13 additions & 3 deletions GPU/Directx9/TextureCacheDX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ void TextureCacheDX9::SetTexture(bool force) {
cluthash = 0;
}
u64 cachekey = TexCacheEntry::CacheKey(texaddr, format, dim, cluthash);

int bufw = GetTextureBufw(0, texaddr, format);
u8 maxLevel = gstate.getTextureMaxLevel();

Expand All @@ -1016,7 +1016,7 @@ void TextureCacheDX9::SetTexture(bool force) {
gstate_c.bgraTexture = true;
gstate_c.skipDrawReason &= ~SKIPDRAW_BAD_FB_TEXTURE;
bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;

if (iter != cache.end()) {
entry = &iter->second;
// Validate the texture still matches the cache entry.
Expand Down Expand Up @@ -1542,7 +1542,17 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re
if (!useIndexed) {
decSuccess = DecodeTextureLevel((u8 *)pixelData, decPitch, tfmt, clutformat, texaddr, level, bufw, false);
} else {
finalBuf = DecodeLevelToIndexed(GETextureFormat(entry.format), level, &bufw);
pixelData = (u32 *)DecodeLevelToIndexed(GETextureFormat(entry.format), level, &bufw);
decSuccess = pixelData != nullptr;

if (decSuccess) {
for (int y = 0; y < h; ++y) {
memcpy((u8 *)rect.pBits + rect.Pitch * y, (u8 *)rect.pBits + bufw * y, w);
}
}
pixelData = (u32 *)rect.pBits;
bpp = 1;
decPitch = bufw;
}
if (!decSuccess) {
memset(pixelData, 0, decPitch * h);
Expand Down

0 comments on commit 6bdc2bc

Please sign in to comment.