sometimes to advance you have to make a step back.

use plain vertex arrays instead of VBOs to render in Opengl plugin as the nature of the data make VBOs slower. This must bring, depending on the implementation, a good speedup in opengl.
in my system now opengl and d3d9 have a difference of 1 to 5 fps depending of the game.
some cleanup and a little work pointing to future improvements in the way of rendering.
please test and check for any errors.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6139 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado
2010-08-28 15:09:42 +00:00
parent eb40f765c2
commit 9b0357b5e2
18 changed files with 414 additions and 424 deletions

View File

@ -119,3 +119,119 @@ u32 HashEctor(const u8* ptr, int length)
return(crc);
}
#ifdef _M_X64
u64 GetHash64(const u8 *src, int len, u32 samples)
{
const u64 m = 0xc6a4a7935bd1e995;
const int r = 47;
u64 h = len * m;
u32 Step = (len/8);
const u64 * data = (const u64 *)src;
const u64 * end = data + Step;
if(samples == 0) samples = Step;
Step = Step / samples;
if(Step < 1) Step = 1;
while(data < end)
{
u64 k = data[0];
data+=Step;
k *= m;
k ^= k >> r;
k *= m;
h ^= k;
h *= m;
}
const u8 * data2 = (const u8*)end;
switch(len & 7)
{
case 7: h ^= u64(data2[6]) << 48;
case 6: h ^= u64(data2[5]) << 40;
case 5: h ^= u64(data2[4]) << 32;
case 4: h ^= u64(data2[3]) << 24;
case 3: h ^= u64(data2[2]) << 16;
case 2: h ^= u64(data2[1]) << 8;
case 1: h ^= u64(data2[0]);
h *= m;
};
h ^= h >> r;
h *= m;
h ^= h >> r;
return h;
}
#else
u64 GetHash64(const u8 *src, int len, u32 samples)
{
const u32 m = 0x5bd1e995;
const int r = 24;
u32 h1 = len;
u32 h2 = 0;
u32 Step = (len / 4);
const u32 * data = (const u32 *)src;
const u32 * end = data + Step;
const u8 * uEnd = (const u8 *)end;
if(samples == 0) samples = Step;
Step = Step / samples;
if(Step < 2) Step = 2;
while(data < end)
{
u32 k1 = data[0];
k1 *= m;
k1 ^= k1 >> r;
k1 *= m;
h1 *= m;
h1 ^= k1;
u32 k2 = data[1];
k2 *= m;
k2 ^= k2 >> r;
k2 *= m;
h2 *= m;
h2 ^= k2;
data+=Step;
}
if((len & 7) > 3)
{
u32 k1 = *(end - 1);
k1 *= m;
k1 ^= k1 >> r;
k1 *= m;
h1 *= m;
h1 ^= k1;
len -= 4;
}
switch(len & 3)
{
case 3: h2 ^= uEnd[2] << 16;
case 2: h2 ^= uEnd[1] << 8;
case 1: h2 ^= uEnd[0];
h2 *= m;
};
h1 ^= h2 >> 18; h1 *= m;
h2 ^= h1 >> 22; h2 *= m;
h1 ^= h2 >> 17; h1 *= m;
h2 ^= h1 >> 19; h2 *= m;
u64 h = h1;
h = (h << 32) | h2;
return h;
}
#endif

View File

@ -24,5 +24,5 @@ u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower
u32 HashFNV(const u8* ptr, int length); // Another fast and decent hash
u32 HashEctor(const u8* ptr, int length); // JUNK. DO NOT USE FOR NEW THINGS
u64 GetHash64(const u8 *src, int len, u32 samples);
#endif // _HASH_H_

View File

@ -22,7 +22,7 @@ static const char ID[4] = {'D', 'C', 'A', 'C'};
// Update this to the current SVN revision every time you change shader generation code.
// We don't automatically get this from SVN_REV because that would mean regenerating the
// shader cache for every revision, graphics-related or not, which is simply annoying.
const int version = 6124;
const int version = 6139;
LinearDiskCache::LinearDiskCache()
: file_(NULL), num_entries_(0) {

View File

@ -22,6 +22,7 @@ namespace VertexManager
{
u8* s_pCurBufferPointer = NULL;
u8* s_pBaseBufferPointer = NULL;
}

View File

@ -29,6 +29,7 @@ int GetRemainingVertices(int primitive); // remaining number of vertices that ca
// TODO: move, rename.
extern u8* s_pCurBufferPointer;
extern u8* s_pBaseBufferPointer;
}

View File

@ -233,12 +233,12 @@ static void Decode()
{
u32 Cmd2 = DataReadU32();
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
u32 address = Cmd2 & 0xFFFF;
u32 xf_address = Cmd2 & 0xFFFF;
// TODO - speed this up. pshufb?
u32 data_buffer[16];
for (int i = 0; i < transfer_size; i++)
data_buffer[i] = DataReadU32();
LoadXFReg(transfer_size, address, data_buffer);
LoadXFReg(transfer_size, xf_address, data_buffer);
INCSTAT(stats.thisFrame.numXFLoads);
}
break;

View File

@ -48,5 +48,5 @@
void OpcodeDecoder_Init();
void OpcodeDecoder_Shutdown();
void OpcodeDecoder_Run(bool skipped_frame);
void ExecuteDisplayList(u32 address, u32 size);
#endif // _OPCODE_DECODING_H

View File

@ -20,7 +20,6 @@
#include "CPUDetect.h"
#include "TextureDecoder.h"
#include "OpenCL.h"
#if defined(HAVE_OPENCL) && HAVE_OPENCL
#include "OpenCL/OCLTextureDecoder.h"
@ -96,122 +95,6 @@ int TexDecoder_GetTextureSizeInBytes(int width, int height, int format)
return (width * height * TexDecoder_GetTexelSizeInNibbles(format)) / 2;
}
#ifdef _M_X64
u64 TexDecoder_GetHash64(const u8 *src, int len, u32 samples)
{
const u64 m = 0xc6a4a7935bd1e995;
const int r = 47;
u64 h = len * m;
u32 Step = (len/8);
const u64 * data = (const u64 *)src;
const u64 * end = data + Step;
if(samples == 0) samples = Step;
Step = Step / samples;
if(Step < 1) Step = 1;
while(data < end)
{
u64 k = data[0];
data+=Step;
k *= m;
k ^= k >> r;
k *= m;
h ^= k;
h *= m;
}
const u8 * data2 = (const u8*)end;
switch(len & 7)
{
case 7: h ^= u64(data2[6]) << 48;
case 6: h ^= u64(data2[5]) << 40;
case 5: h ^= u64(data2[4]) << 32;
case 4: h ^= u64(data2[3]) << 24;
case 3: h ^= u64(data2[2]) << 16;
case 2: h ^= u64(data2[1]) << 8;
case 1: h ^= u64(data2[0]);
h *= m;
};
h ^= h >> r;
h *= m;
h ^= h >> r;
return h;
}
#else
u64 TexDecoder_GetHash64(const u8 *src, int len, u32 samples)
{
const u32 m = 0x5bd1e995;
const int r = 24;
u32 h1 = len;
u32 h2 = 0;
u32 Step = (len / 4);
const u32 * data = (const u32 *)src;
const u32 * end = data + Step;
const u8 * uEnd = (const u8 *)end;
if(samples == 0) samples = Step;
Step = Step / samples;
if(Step < 2) Step = 2;
while(data < end)
{
u32 k1 = data[0];
k1 *= m;
k1 ^= k1 >> r;
k1 *= m;
h1 *= m;
h1 ^= k1;
u32 k2 = data[1];
k2 *= m;
k2 ^= k2 >> r;
k2 *= m;
h2 *= m;
h2 ^= k2;
data+=Step;
}
if((len & 7) > 3)
{
u32 k1 = *(end - 1);
k1 *= m;
k1 ^= k1 >> r;
k1 *= m;
h1 *= m;
h1 ^= k1;
len -= 4;
}
switch(len & 3)
{
case 3: h2 ^= uEnd[2] << 16;
case 2: h2 ^= uEnd[1] << 8;
case 1: h2 ^= uEnd[0];
h2 *= m;
};
h1 ^= h2 >> 18; h1 *= m;
h2 ^= h1 >> 22; h2 *= m;
h1 ^= h2 >> 17; h1 *= m;
h2 ^= h1 >> 19; h2 *= m;
u64 h = h1;
h = (h << 32) | h2;
return h;
}
#endif
int TexDecoder_GetBlockWidthInTexels(u32 format)
{
switch (format)

View File

@ -17,7 +17,7 @@
#ifndef _TEXTUREDECODER_H
#define _TEXTUREDECODER_H
#include "hash.h"
enum
{
TMEM_SIZE = 1024*1024,
@ -86,9 +86,6 @@ enum PC_TexFormat
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt,bool rgbaOnly = false);
PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt);
void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, int tlutaddr, int tlutfmt);
u64 TexDecoder_GetHash64(const u8 *src, int len, u32 samples = 0);
void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center);
#endif

View File

@ -45,10 +45,6 @@ void GetVertexShaderId(VERTEXSHADERUID *uid, u32 components)
(u32)xfregs.colChans[i].alpha.matsource) << 15;
}
// fog
uid->values[1] |= (((u32)bpmem.fog.c_proj_fsel.fsel & 3) << 30);
uid->values[2] |= (((u32)bpmem.fog.c_proj_fsel.fsel >> 2) << 30);
u32 *pcurvalue = &uid->values[3];
for (int i = 0; i < xfregs.numTexGens; ++i) {
TexMtxInfo tinfo = xfregs.texcoords[i].texmtxinfo;