Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix ARM build.
  • Loading branch information
Sonicadvance1 committed Mar 3, 2013
1 parent ed90feb commit a01f793
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions Source/Core/VideoCommon/Src/GenericTextureDecoder.cpp
Expand Up @@ -1442,6 +1442,40 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
}
}

void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth)
{
u16 sBlk = s >> 2;
u16 tBlk = t >> 2;
u16 widthBlks = (imageWidth >> 2) + 1; // TODO: Looks wrong. Shouldn't this be ((imageWidth-1)>>2)+1 ?
u32 base_ar = (tBlk * widthBlks + sBlk) << 4;
u32 base_gb = (tBlk * widthBlks + sBlk) << 4;
u16 blkS = s & 3;
u16 blkT = t & 3;
u32 blk_off = (blkT << 2) + blkS;

u32 offset_ar = (base_ar + blk_off) << 1;
u32 offset_gb = (base_gb + blk_off) << 1;
const u8* val_addr_ar = src_ar + offset_ar;
const u8* val_addr_gb = src_gb + offset_gb;

dst[3] = val_addr_ar[0]; // A
dst[0] = val_addr_ar[1]; // R
dst[1] = val_addr_gb[0]; // G
dst[2] = val_addr_gb[1]; // B
}

PC_TexFormat TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8 *src_gb, int width, int height)
{
// TODO for someone who cares: Make this less slow!
for (int y = 0; y < height; ++y)
for (int x = 0; x < width; ++x)
{
TexDecoder_DecodeTexelRGBA8FromTmem(dst, src_ar, src_gb, x, y, width-1);
dst += 4;
}

return PC_TEX_FMT_RGBA32;
}

const char* texfmt[] = {
// pixel
Expand Down
2 changes: 1 addition & 1 deletion Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
Expand Up @@ -69,7 +69,7 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
#define GL_REPORT_PROGRAM_ERROR() (void)0
#endif

#if defined __APPLE__ || defined __linux__ || defined _WIN32
#if (defined __APPLE__ || defined __linux__ || defined _WIN32) && !(defined _M_ARM)
#include <Cg/cg.h>
#include <Cg/cgGL.h>
#define HAVE_CG 1
Expand Down

0 comments on commit a01f793

Please sign in to comment.