Clean up more space/tab mismatches in AudioCommon, Common, and VideoCommon.
Not planning to touch Core since it's the most actively changed part of the project.
This commit is contained in:
parent
0e3d8e2e9f
commit
edd9d0e0ef
|
@ -34,7 +34,7 @@ void AOSound::SoundLoop()
|
|||
format.channels = 2;
|
||||
format.rate = m_mixer->GetSampleRate();
|
||||
format.byte_format = AO_FMT_LITTLE;
|
||||
|
||||
|
||||
device = ao_open_live(default_driver, &format, NULL /* no options */);
|
||||
if (!device)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ void AOSound::SoundLoop()
|
|||
while (!threadData)
|
||||
{
|
||||
m_mixer->Mix(realtimeBuffer, numBytesToRender >> 2);
|
||||
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(soundCriticalSection);
|
||||
ao_play(device, (char*)realtimeBuffer, numBytesToRender);
|
||||
|
@ -62,7 +62,7 @@ void AOSound::SoundLoop()
|
|||
bool AOSound::Start()
|
||||
{
|
||||
memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
|
||||
|
||||
|
||||
thread = std::thread(std::mem_fun(&AOSound::SoundLoop), this);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -45,21 +45,21 @@ public:
|
|||
AOSound(CMixer *mixer) : SoundStream(mixer) {}
|
||||
|
||||
virtual ~AOSound();
|
||||
|
||||
|
||||
virtual bool Start();
|
||||
|
||||
|
||||
virtual void SoundLoop();
|
||||
|
||||
|
||||
virtual void Stop();
|
||||
|
||||
|
||||
static bool isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool usesMixer() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void Update();
|
||||
|
||||
#else
|
||||
|
|
|
@ -88,7 +88,7 @@ bool AlsaSound::AlsaInit()
|
|||
snd_pcm_hw_params_t *hwparams;
|
||||
snd_pcm_uframes_t buffer_size,buffer_size_max;
|
||||
unsigned int periods;
|
||||
|
||||
|
||||
err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
|
||||
if (err < 0)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ bool AlsaSound::AlsaInit()
|
|||
}
|
||||
|
||||
snd_pcm_hw_params_alloca(&hwparams);
|
||||
|
||||
|
||||
err = snd_pcm_hw_params_any(handle, hwparams);
|
||||
if (err < 0)
|
||||
{
|
||||
|
@ -111,8 +111,8 @@ bool AlsaSound::AlsaInit()
|
|||
ERROR_LOG(AUDIO, "Access type not available: %s\n", snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
err = snd_pcm_hw_params_set_format(handle, hwparams, SND_PCM_FORMAT_S16_LE);
|
||||
|
||||
err = snd_pcm_hw_params_set_format(handle, hwparams, SND_PCM_FORMAT_S16_LE);
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG(AUDIO, "Sample format not available: %s\n", snd_strerror(err));
|
||||
|
@ -126,14 +126,14 @@ bool AlsaSound::AlsaInit()
|
|||
ERROR_LOG(AUDIO, "Rate not available: %s\n", snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
err = snd_pcm_hw_params_set_channels(handle, hwparams, 2);
|
||||
|
||||
err = snd_pcm_hw_params_set_channels(handle, hwparams, 2);
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG(AUDIO, "Channels count not available: %s\n", snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
periods = BUFFER_SIZE_MAX / FRAME_COUNT_MIN;
|
||||
err = snd_pcm_hw_params_set_periods_max(handle, hwparams, &periods, &dir);
|
||||
if (err < 0)
|
||||
|
@ -153,10 +153,10 @@ bool AlsaSound::AlsaInit()
|
|||
err = snd_pcm_hw_params(handle, hwparams);
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG(AUDIO, "Unable to install hw params: %s\n", snd_strerror(err));
|
||||
ERROR_LOG(AUDIO, "Unable to install hw params: %s\n", snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
err = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size);
|
||||
if (err < 0)
|
||||
{
|
||||
|
@ -176,10 +176,10 @@ bool AlsaSound::AlsaInit()
|
|||
frames_to_deliver = buffer_size / periods;
|
||||
//limit the minimum size. pulseaudio advertises a minimum of 32 samples.
|
||||
if (frames_to_deliver < FRAME_COUNT_MIN)
|
||||
frames_to_deliver = FRAME_COUNT_MIN;
|
||||
frames_to_deliver = FRAME_COUNT_MIN;
|
||||
//it is probably a bad idea to try to send more than one buffer of data
|
||||
if ((unsigned int)frames_to_deliver > buffer_size)
|
||||
frames_to_deliver = buffer_size;
|
||||
frames_to_deliver = buffer_size;
|
||||
NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver);
|
||||
|
||||
snd_pcm_sw_params_alloca(&swparams);
|
||||
|
@ -187,21 +187,21 @@ bool AlsaSound::AlsaInit()
|
|||
err = snd_pcm_sw_params_current(handle, swparams);
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG(AUDIO, "cannot init sw params: %s\n", snd_strerror(err));
|
||||
ERROR_LOG(AUDIO, "cannot init sw params: %s\n", snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
err = snd_pcm_sw_params_set_start_threshold(handle, swparams, 0U);
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG(AUDIO, "cannot set start thresh: %s\n", snd_strerror(err));
|
||||
ERROR_LOG(AUDIO, "cannot set start thresh: %s\n", snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
err = snd_pcm_sw_params(handle, swparams);
|
||||
if (err < 0)
|
||||
{
|
||||
ERROR_LOG(AUDIO, "cannot set sw params: %s\n", snd_strerror(err));
|
||||
ERROR_LOG(AUDIO, "cannot set sw params: %s\n", snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,19 +30,19 @@ class CoreAudioSound : public SoundStream
|
|||
public:
|
||||
CoreAudioSound(CMixer *mixer);
|
||||
virtual ~CoreAudioSound();
|
||||
|
||||
|
||||
virtual bool Start();
|
||||
virtual void SetVolume(int volume);
|
||||
virtual void SoundLoop();
|
||||
virtual void Stop();
|
||||
|
||||
|
||||
static bool isValid() {
|
||||
return true;
|
||||
}
|
||||
virtual bool usesMixer() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void Update();
|
||||
|
||||
private:
|
||||
|
|
|
@ -130,15 +130,15 @@ returns 0 if OK, -1 if fail
|
|||
*/
|
||||
float* design_fir(unsigned int *n, float* fc, float opt)
|
||||
{
|
||||
unsigned int o = *n & 1; // Indicator for odd filter length
|
||||
unsigned int end = ((*n + 1) >> 1) - o; // Loop end
|
||||
unsigned int i; // Loop index
|
||||
unsigned int o = *n & 1; // Indicator for odd filter length
|
||||
unsigned int end = ((*n + 1) >> 1) - o; // Loop end
|
||||
unsigned int i; // Loop index
|
||||
|
||||
float k1 = 2 * float(M_PI); // 2*pi*fc1
|
||||
float k2 = 0.5f * (float)(1 - o);// Constant used if the filter has even length
|
||||
float g = 0.0f; // Gain
|
||||
float t1; // Temporary variables
|
||||
float fc1; // Cutoff frequencies
|
||||
float k1 = 2 * float(M_PI); // 2*pi*fc1
|
||||
float k2 = 0.5f * (float)(1 - o); // Constant used if the filter has even length
|
||||
float g = 0.0f; // Gain
|
||||
float t1; // Temporary variables
|
||||
float fc1; // Cutoff frequencies
|
||||
|
||||
// Sanity check
|
||||
if(*n==0) return NULL;
|
||||
|
@ -241,18 +241,18 @@ void matrix_decode(const float *in, const int k, const int il,
|
|||
float *_rr, float *_cf)
|
||||
{
|
||||
static const float M9_03DB = 0.3535533906f;
|
||||
static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */
|
||||
static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */
|
||||
static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */
|
||||
static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */
|
||||
static const float MATCOMPGAIN = 0.37f; /* Cross talk compensation gain, 0.50 - 0.55 is full cancellation. */
|
||||
|
||||
const int kr = (k + olddelay) % _dlbuflen;
|
||||
float l_gain = (_l_fwr + _r_fwr) / (1 + _l_fwr + _l_fwr);
|
||||
float r_gain = (_l_fwr + _r_fwr) / (1 + _r_fwr + _r_fwr);
|
||||
/* The 2nd axis has strong gain fluctuations, and therefore require
|
||||
limits. The factor corresponds to the 1 / amplification of (Lt
|
||||
- Rt) when (Lt, Rt) is strongly correlated. (e.g. during
|
||||
dialogues). It should be bigger than -12 dB to prevent
|
||||
distortion. */
|
||||
// The 2nd axis has strong gain fluctuations, and therefore require
|
||||
// limits. The factor corresponds to the 1 / amplification of (Lt
|
||||
// - Rt) when (Lt, Rt) is strongly correlated. (e.g. during
|
||||
// dialogues). It should be bigger than -12 dB to prevent
|
||||
// distortion.
|
||||
float lmr_lim_fwr = _lmr_fwr > M9_03DB * _lpr_fwr ? _lmr_fwr : M9_03DB * _lpr_fwr;
|
||||
float lpr_gain = (_lpr_fwr + lmr_lim_fwr) / (1 + _lpr_fwr + _lpr_fwr);
|
||||
float lmr_gain = (_lpr_fwr + lmr_lim_fwr) / (1 + lmr_lim_fwr + lmr_lim_fwr);
|
||||
|
@ -275,9 +275,9 @@ void matrix_decode(const float *in, const int k, const int il,
|
|||
if (decode_rear)
|
||||
{
|
||||
_lr[kr] = _rr[kr] = (l_agc - r_agc) * (float)M_SQRT1_2;
|
||||
/* Stereo rear channel is steered with the same AGC steering as
|
||||
the decoding matrix. Note this requires a fast updating AGC
|
||||
at the order of 20 ms (which is the case here). */
|
||||
// Stereo rear channel is steered with the same AGC steering as
|
||||
// the decoding matrix. Note this requires a fast updating AGC
|
||||
// at the order of 20 ms (which is the case here).
|
||||
_lr[kr] *= (_l_fwr + _l_fwr) / (1 + _l_fwr + _r_fwr);
|
||||
_rr[kr] *= (_r_fwr + _r_fwr) / (1 + _l_fwr + _r_fwr);
|
||||
}
|
||||
|
@ -298,16 +298,16 @@ void matrix_decode(const float *in, const int k, const int il,
|
|||
_rf[k] = (lpr_agc - lmr_agc) * (float)M_SQRT1_2;
|
||||
|
||||
/*** CENTER FRONT CANCELLATION ***/
|
||||
/* A heuristic approach exploits that Lt + Rt gain contains the
|
||||
information about Lt, Rt correlation. This effectively reshapes
|
||||
the front and rear "cones" to concentrate Lt + Rt to C and
|
||||
introduce Lt - Rt in L, R. */
|
||||
// A heuristic approach exploits that Lt + Rt gain contains the
|
||||
// information about Lt, Rt correlation. This effectively reshapes
|
||||
// the front and rear "cones" to concentrate Lt + Rt to C and
|
||||
// introduce Lt - Rt in L, R.
|
||||
/* 0.67677 is the empirical lower bound for lpr_gain. */
|
||||
c_gain = 8 * (*_adapt_lpr_gain - 0.67677f);
|
||||
c_gain = c_gain > 0 ? c_gain : 0;
|
||||
/* c_gain should not be too high, not even reaching full
|
||||
cancellation (~ 0.50 - 0.55 at current AGC implementation), or
|
||||
the center will sound too narrow. */
|
||||
// c_gain should not be too high, not even reaching full
|
||||
// cancellation (~ 0.50 - 0.55 at current AGC implementation), or
|
||||
// the center will sound too narrow. */
|
||||
c_gain = MATCOMPGAIN / (1 + c_gain * c_gain);
|
||||
c_agc_cfk = c_gain * _cf[k];
|
||||
_lf[k] -= c_agc_cfk;
|
||||
|
@ -317,7 +317,7 @@ void matrix_decode(const float *in, const int k, const int il,
|
|||
|
||||
void dpl2decode(float *samples, int numsamples, float *out)
|
||||
{
|
||||
static const unsigned int FWRDURATION = 240; /* FWR average duration (samples) */
|
||||
static const unsigned int FWRDURATION = 240; // FWR average duration (samples)
|
||||
static const int cfg_delay = 0;
|
||||
static const unsigned int fmt_freq = 48000;
|
||||
static const unsigned int fmt_nchannels = 2; // input channels
|
||||
|
|
|
@ -122,7 +122,7 @@ void DSound::SoundLoop()
|
|||
bool DSound::Start()
|
||||
{
|
||||
if (FAILED(DirectSoundCreate8(0, &ds, 0)))
|
||||
return false;
|
||||
return false;
|
||||
if (hWnd)
|
||||
{
|
||||
HRESULT hr = ds->SetCooperativeLevel((HWND)hWnd, DSSCL_PRIORITY);
|
||||
|
|
|
@ -31,33 +31,33 @@
|
|||
class DSound : public SoundStream
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::thread thread;
|
||||
Common::Event soundSyncEvent;
|
||||
void *hWnd;
|
||||
std::thread thread;
|
||||
Common::Event soundSyncEvent;
|
||||
void *hWnd;
|
||||
|
||||
IDirectSound8* ds;
|
||||
IDirectSoundBuffer* dsBuffer;
|
||||
|
||||
int bufferSize; //i bytes
|
||||
IDirectSound8* ds;
|
||||
IDirectSoundBuffer* dsBuffer;
|
||||
|
||||
int bufferSize; //i bytes
|
||||
int m_volume;
|
||||
|
||||
// playback position
|
||||
int currentPos;
|
||||
int lastPos;
|
||||
short realtimeBuffer[BUFSIZE / sizeof(short)];
|
||||
|
||||
inline int FIX128(int x)
|
||||
|
||||
// playback position
|
||||
int currentPos;
|
||||
int lastPos;
|
||||
short realtimeBuffer[BUFSIZE / sizeof(short)];
|
||||
|
||||
inline int FIX128(int x)
|
||||
{
|
||||
return x & (~127);
|
||||
}
|
||||
}
|
||||
|
||||
inline int ModBufferSize(int x)
|
||||
inline int ModBufferSize(int x)
|
||||
{
|
||||
return (x + bufferSize) % bufferSize;
|
||||
}
|
||||
}
|
||||
|
||||
bool CreateBuffer();
|
||||
bool WriteDataToBuffer(DWORD dwOffset, char* soundData, DWORD dwSoundBytes);
|
||||
bool CreateBuffer();
|
||||
bool WriteDataToBuffer(DWORD dwOffset, char* soundData, DWORD dwSoundBytes);
|
||||
|
||||
public:
|
||||
DSound(CMixer *mixer, void *_hWnd = NULL)
|
||||
|
@ -70,16 +70,16 @@ public:
|
|||
, hWnd(_hWnd)
|
||||
{}
|
||||
|
||||
virtual ~DSound() {}
|
||||
virtual ~DSound() {}
|
||||
|
||||
virtual bool Start();
|
||||
virtual void SoundLoop();
|
||||
virtual void SoundLoop();
|
||||
virtual void SetVolume(int volume);
|
||||
virtual void Stop();
|
||||
virtual void Stop();
|
||||
virtual void Clear(bool mute);
|
||||
static bool isValid() { return true; }
|
||||
virtual bool usesMixer() const { return true; }
|
||||
virtual void Update();
|
||||
static bool isValid() { return true; }
|
||||
virtual bool usesMixer() const { return true; }
|
||||
virtual void Update();
|
||||
|
||||
#else
|
||||
public:
|
||||
|
|
|
@ -67,7 +67,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
|
|||
{
|
||||
static const __m128i sr_mask =
|
||||
_mm_set_epi32(0x0C0D0E0FL, 0x08090A0BL,
|
||||
0x04050607L, 0x00010203L);
|
||||
0x04050607L, 0x00010203L);
|
||||
|
||||
for (unsigned int i = 0; i < numLeft * 2; i += 8)
|
||||
{
|
||||
|
@ -99,12 +99,11 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
|
|||
if ((m_indexR2 & INDEX_MASK) == (m_indexW & INDEX_MASK)) //..if it exists
|
||||
m_indexR2 = m_indexR;
|
||||
|
||||
|
||||
s16 l1 = Common::swap16(m_buffer[m_indexR & INDEX_MASK]); //current
|
||||
s16 l2 = Common::swap16(m_buffer[m_indexR2 & INDEX_MASK]); //next
|
||||
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16;
|
||||
samples[i+1] = sampleL;
|
||||
|
||||
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16;
|
||||
samples[i+1] = sampleL;
|
||||
|
||||
s16 r1 = Common::swap16(m_buffer[(m_indexR + 1) & INDEX_MASK]); //current
|
||||
s16 r2 = Common::swap16(m_buffer[(m_indexR2 + 1) & INDEX_MASK]); //next
|
||||
int sampleR = ((r1 << 16) + (r2 - r1) * (u16)frac) >> 16;
|
||||
|
@ -116,8 +115,6 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
numLeft = 0;
|
||||
}
|
||||
|
|
|
@ -25,24 +25,24 @@
|
|||
|
||||
class NullSound : public SoundStream
|
||||
{
|
||||
// playback position
|
||||
short realtimeBuffer[BUF_SIZE / sizeof(short)];
|
||||
// playback position
|
||||
short realtimeBuffer[BUF_SIZE / sizeof(short)];
|
||||
|
||||
public:
|
||||
NullSound(CMixer *mixer, void *hWnd = NULL)
|
||||
: SoundStream(mixer)
|
||||
{}
|
||||
|
||||
virtual ~NullSound() {}
|
||||
|
||||
virtual ~NullSound() {}
|
||||
|
||||
virtual bool Start();
|
||||
virtual void SoundLoop();
|
||||
virtual void SoundLoop();
|
||||
virtual void SetVolume(int volume);
|
||||
virtual void Stop();
|
||||
virtual void Stop();
|
||||
virtual void Clear(bool mute);
|
||||
static bool isValid() { return true; }
|
||||
virtual bool usesMixer() const { return true; }
|
||||
virtual void Update();
|
||||
static bool isValid() { return true; }
|
||||
virtual bool usesMixer() const { return true; }
|
||||
virtual void Update();
|
||||
};
|
||||
|
||||
#endif //_NULLSOUNDSTREAM_H_
|
||||
|
|
|
@ -295,7 +295,6 @@ void OpenALStream::SoundLoop()
|
|||
{
|
||||
ERROR_LOG(AUDIO, "Error occurred while buffering float32 data: %08x", err);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
if (!float32_capable)
|
||||
|
@ -308,7 +307,6 @@ void OpenALStream::SoundLoop()
|
|||
stereo[i * 2 + 1] = (short)((float)sampleBuffer[i * 2 + 1] * (1 << 16));
|
||||
}
|
||||
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO16, stereo, nSamples * 2 * 2, ulFrequency);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,17 +27,17 @@ class SoundStream
|
|||
protected:
|
||||
|
||||
CMixer *m_mixer;
|
||||
// We set this to shut down the sound thread.
|
||||
// 0=keep playing, 1=stop playing NOW.
|
||||
volatile int threadData;
|
||||
bool m_logAudio;
|
||||
// We set this to shut down the sound thread.
|
||||
// 0=keep playing, 1=stop playing NOW.
|
||||
volatile int threadData;
|
||||
bool m_logAudio;
|
||||
WaveFileWriter g_wave_writer;
|
||||
bool m_muted;
|
||||
|
||||
public:
|
||||
SoundStream(CMixer *mixer) : m_mixer(mixer), threadData(0), m_logAudio(false), m_muted(false) {}
|
||||
virtual ~SoundStream() { delete m_mixer;}
|
||||
|
||||
|
||||
static bool isValid() { return false; }
|
||||
virtual CMixer *GetMixer() const { return m_mixer; }
|
||||
virtual bool Start() { return false; }
|
||||
|
|
|
@ -104,21 +104,21 @@ void WaveFileWriter::AddStereoSamples(const short *sample_data, u32 count)
|
|||
{
|
||||
if (!file)
|
||||
PanicAlertT("WaveFileWriter - file not open.");
|
||||
|
||||
|
||||
if (skip_silence)
|
||||
{
|
||||
bool all_zero = true;
|
||||
|
||||
|
||||
for (u32 i = 0; i < count * 2; i++)
|
||||
{
|
||||
if (sample_data[i])
|
||||
all_zero = false;
|
||||
}
|
||||
|
||||
|
||||
if (all_zero)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
file.WriteBytes(sample_data, count * 4);
|
||||
audio_size += count * 4;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ void WaveFileWriter::AddStereoSamplesBE(const short *sample_data, u32 count)
|
|||
if (skip_silence)
|
||||
{
|
||||
bool all_zero = true;
|
||||
|
||||
|
||||
for (u32 i = 0; i < count * 2; i++)
|
||||
{
|
||||
if (sample_data[i])
|
||||
|
|
|
@ -95,10 +95,10 @@ void StreamingVoiceContext::OnBufferEnd(void* context)
|
|||
|
||||
if (!m_source_voice || !context)
|
||||
return;
|
||||
|
||||
|
||||
//m_sound_sync_event->Wait(); // sync
|
||||
//m_sound_sync_event->Spin(); // or tight sync
|
||||
|
||||
|
||||
m_mixer->Mix(static_cast<short*>(context), SAMPLES_PER_BUFFER);
|
||||
SubmitBuffer(static_cast<BYTE*>(context));
|
||||
}
|
||||
|
@ -183,6 +183,6 @@ void XAudio2::Stop()
|
|||
m_mastering_voice->DestroyVoice();
|
||||
m_mastering_voice = nullptr;
|
||||
}
|
||||
|
||||
|
||||
m_xaudio2.reset(); // release interface
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ char *GetCPUString()
|
|||
auto const fp = file.GetHandle();
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp))
|
||||
{
|
||||
if (strncmp(buf, marker, sizeof(marker) - 1))
|
||||
|
@ -74,12 +74,12 @@ int GetCoreCount()
|
|||
const char marker[] = "processor\t: ";
|
||||
int cores = 0;
|
||||
char buf[1024];
|
||||
|
||||
|
||||
File::IOFile file(procfile, "r");
|
||||
auto const fp = file.GetHandle();
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp))
|
||||
{
|
||||
if (strncmp(buf, marker, sizeof(marker) - 1))
|
||||
|
@ -103,12 +103,12 @@ void CPUInfo::Detect()
|
|||
HTT = false;
|
||||
OS64bit = false;
|
||||
CPU64bit = false;
|
||||
Mode64bit = false;
|
||||
Mode64bit = false;
|
||||
vendor = VENDOR_ARM;
|
||||
|
||||
|
||||
// Get the information about the CPU
|
||||
strncpy(cpu_string, GetCPUString(), sizeof(cpu_string));
|
||||
num_cores = GetCoreCount();
|
||||
num_cores = GetCoreCount();
|
||||
bSwp = CheckCPUFeature("swp");
|
||||
bHalf = CheckCPUFeature("half");
|
||||
bThumb = CheckCPUFeature("thumb");
|
||||
|
@ -122,7 +122,7 @@ void CPUInfo::Detect()
|
|||
bVFPv4 = CheckCPUFeature("vfpv4");
|
||||
bIDIVa = CheckCPUFeature("idiva");
|
||||
bIDIVt = CheckCPUFeature("idivt");
|
||||
|
||||
|
||||
// On some buggy kernels(Qualcomm) they show that they support VFPv4 but not IDIVa
|
||||
// All VFPv4 CPUs will support IDIVa
|
||||
if (bVFPv4)
|
||||
|
|
|
@ -157,7 +157,7 @@ void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
|
|||
{
|
||||
Operand2 op2;
|
||||
bool inverse;
|
||||
|
||||
|
||||
if (cpu_info.bArmV7 && !optimize)
|
||||
{
|
||||
// For backpatching on ARMv7
|
||||
|
|
|
@ -136,7 +136,7 @@ protected:
|
|||
u32 Value;
|
||||
|
||||
private:
|
||||
OpType Type;
|
||||
OpType Type;
|
||||
|
||||
// IMM types
|
||||
u8 Rotation; // Only for u8 values
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
{
|
||||
Type = type;
|
||||
Value = imm;
|
||||
Rotation = 0;
|
||||
Rotation = 0;
|
||||
}
|
||||
|
||||
Operand2(ARMReg Reg)
|
||||
|
@ -297,7 +297,7 @@ public:
|
|||
u32 Imm24()
|
||||
{
|
||||
_assert_msg_(DYNA_REC, (Type == TYPE_IMM), "Imm16 not IMM");
|
||||
return (Value & 0x0FFFFFFF);
|
||||
return (Value & 0x0FFFFFFF);
|
||||
}
|
||||
// NEON and ASIMD specific
|
||||
u32 Imm8ASIMD()
|
||||
|
@ -336,9 +336,9 @@ struct FixupBranch
|
|||
|
||||
struct LiteralPool
|
||||
{
|
||||
s32 loc;
|
||||
u8* ldr_address;
|
||||
u32 val;
|
||||
s32 loc;
|
||||
u8* ldr_address;
|
||||
u32 val;
|
||||
};
|
||||
|
||||
typedef const u8* JumpTarget;
|
||||
|
@ -357,7 +357,7 @@ private:
|
|||
void WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg src, ARMReg op2);
|
||||
void WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg src, Operand2 op2);
|
||||
void WriteSignedMultiply(u32 Op, u32 Op2, u32 Op3, ARMReg dest, ARMReg r1, ARMReg r2);
|
||||
|
||||
|
||||
u32 EncodeVd(ARMReg Vd);
|
||||
u32 EncodeVn(ARMReg Vn);
|
||||
u32 EncodeVm(ARMReg Vm);
|
||||
|
@ -407,10 +407,10 @@ public:
|
|||
|
||||
// Hint instruction
|
||||
void YIELD();
|
||||
|
||||
|
||||
// Do nothing
|
||||
void NOP(int count = 1); //nop padding - TODO: fast nop slides, for amd and intel (check their manuals)
|
||||
|
||||
|
||||
#ifdef CALL
|
||||
#undef CALL
|
||||
#endif
|
||||
|
@ -422,7 +422,7 @@ public:
|
|||
FixupBranch BL();
|
||||
FixupBranch BL_CC(CCFlags Cond);
|
||||
void SetJumpTarget(FixupBranch const &branch);
|
||||
|
||||
|
||||
void B (const void *fnptr);
|
||||
void B (ARMReg src);
|
||||
void BL(const void *fnptr);
|
||||
|
@ -468,7 +468,7 @@ public:
|
|||
void BICS(ARMReg dest, ARMReg src, Operand2 op2);
|
||||
void MVN (ARMReg dest, Operand2 op2);
|
||||
void MVNS(ARMReg dest, Operand2 op2);
|
||||
void MOVW(ARMReg dest, Operand2 op2);
|
||||
void MOVW(ARMReg dest, Operand2 op2);
|
||||
void MOVT(ARMReg dest, Operand2 op2, bool TopBits = false);
|
||||
|
||||
// UDIV and SDIV are only available on CPUs that have
|
||||
|
@ -510,7 +510,7 @@ public:
|
|||
|
||||
void STMFD(ARMReg dest, bool WriteBack, const int Regnum, ...);
|
||||
void LDMFD(ARMReg dest, bool WriteBack, const int Regnum, ...);
|
||||
|
||||
|
||||
// Exclusive Access operations
|
||||
void LDREX(ARMReg dest, ARMReg base);
|
||||
// result contains the result if the instruction managed to store the value
|
||||
|
@ -528,7 +528,7 @@ public:
|
|||
// NEON Only
|
||||
void VADD(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
void VSUB(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
|
||||
|
||||
// VFP Only
|
||||
void VLDR(ARMReg Dest, ARMReg Base, s16 offset);
|
||||
void VSTR(ARMReg Src, ARMReg Base, s16 offset);
|
||||
|
@ -539,7 +539,7 @@ public:
|
|||
void VCMPE(ARMReg Vd);
|
||||
void VDIV(ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
void VSQRT(ARMReg Vd, ARMReg Vm);
|
||||
|
||||
|
||||
// NEON and VFP
|
||||
void VADD(ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
void VSUB(ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
|
|
|
@ -27,9 +27,9 @@ class DebugInterface;
|
|||
|
||||
struct TBreakPoint
|
||||
{
|
||||
u32 iAddress;
|
||||
u32 iAddress;
|
||||
bool bOn;
|
||||
bool bTemporary;
|
||||
bool bTemporary;
|
||||
};
|
||||
|
||||
struct TMemCheck
|
||||
|
@ -96,9 +96,9 @@ public:
|
|||
typedef std::vector<std::string> TMemChecksStr;
|
||||
|
||||
TMemChecks m_MemChecks;
|
||||
|
||||
|
||||
const TMemChecks& GetMemChecks() { return m_MemChecks; }
|
||||
|
||||
|
||||
TMemChecksStr GetStrings() const;
|
||||
void AddFromStrings(const TMemChecksStr& mcs);
|
||||
|
||||
|
|
|
@ -32,13 +32,13 @@ enum CPUVendor
|
|||
struct CPUInfo
|
||||
{
|
||||
CPUVendor vendor;
|
||||
|
||||
|
||||
char cpu_string[0x21];
|
||||
char brand_string[0x41];
|
||||
bool OS64bit;
|
||||
bool CPU64bit;
|
||||
bool Mode64bit;
|
||||
|
||||
|
||||
bool HTT;
|
||||
int num_cores;
|
||||
int logical_cpu_count;
|
||||
|
@ -56,7 +56,7 @@ struct CPUInfo
|
|||
bool bAES;
|
||||
bool bLAHFSAHF64;
|
||||
bool bLongMode;
|
||||
|
||||
|
||||
// ARM specific CPUInfo
|
||||
bool bSwp;
|
||||
bool bHalf;
|
||||
|
@ -72,14 +72,14 @@ struct CPUInfo
|
|||
bool bIDIVa;
|
||||
bool bIDIVt;
|
||||
bool bArmV7; // enable MOVT, MOVW etc
|
||||
|
||||
|
||||
// ARMv8 specific
|
||||
bool bFP;
|
||||
bool bASIMD;
|
||||
|
||||
// Call Detect()
|
||||
explicit CPUInfo();
|
||||
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string Summarize();
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
{
|
||||
u32 count = (u32)x.size();
|
||||
Do(count);
|
||||
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case MODE_READ:
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
x.insert(pair);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MODE_WRITE:
|
||||
case MODE_MEASURE:
|
||||
case MODE_VERIFY:
|
||||
|
@ -93,14 +93,14 @@ public:
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void DoContainer(T& x)
|
||||
{
|
||||
u32 size = (u32)x.size();
|
||||
Do(size);
|
||||
x.resize(size);
|
||||
|
||||
|
||||
for (auto itr = x.begin(); itr != x.end(); ++itr)
|
||||
Do(*itr);
|
||||
}
|
||||
|
@ -110,32 +110,32 @@ public:
|
|||
{
|
||||
DoContainer(x);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void Do(std::list<T>& x)
|
||||
{
|
||||
DoContainer(x);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void Do(std::deque<T>& x)
|
||||
{
|
||||
DoContainer(x);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void Do(std::basic_string<T>& x)
|
||||
{
|
||||
DoContainer(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T>
|
||||
void DoArray(T* x, u32 count)
|
||||
{
|
||||
for (u32 i = 0; i != count; ++i)
|
||||
Do(x[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Do(T& x)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ public:
|
|||
{
|
||||
u32 cookie = arbitraryNumber;
|
||||
Do(cookie);
|
||||
|
||||
|
||||
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber)
|
||||
{
|
||||
PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...",
|
||||
|
@ -228,7 +228,7 @@ public:
|
|||
mode = PointerWrap::MODE_MEASURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
__forceinline void DoByte(u8& x)
|
||||
{
|
||||
|
@ -237,27 +237,27 @@ private:
|
|||
case MODE_READ:
|
||||
x = **ptr;
|
||||
break;
|
||||
|
||||
|
||||
case MODE_WRITE:
|
||||
**ptr = x;
|
||||
break;
|
||||
|
||||
|
||||
case MODE_MEASURE:
|
||||
break;
|
||||
|
||||
|
||||
case MODE_VERIFY:
|
||||
_dbg_assert_msg_(COMMON, (x == **ptr),
|
||||
"Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n",
|
||||
x, x, &x, **ptr, **ptr, *ptr);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
++(*ptr);
|
||||
}
|
||||
|
||||
|
||||
void DoVoid(void *data, u32 size)
|
||||
{
|
||||
for(u32 i = 0; i != size; ++i)
|
||||
|
@ -300,7 +300,7 @@ public:
|
|||
ERROR_LOG(COMMON,"ChunkReader: Bad header size");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check revision
|
||||
if (header.Revision != _Revision)
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ public:
|
|||
header.Revision, _Revision);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// get size
|
||||
const u32 sz = (u32)(fileSize - headerSize);
|
||||
if (header.ExpectedSize != sz)
|
||||
|
@ -317,7 +317,7 @@ public:
|
|||
sz, header.ExpectedSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// read the state
|
||||
std::vector<u8> buffer(sz);
|
||||
if (!pFile.ReadArray(&buffer[0], sz))
|
||||
|
@ -333,7 +333,7 @@ public:
|
|||
INFO_LOG(COMMON, "ChunkReader: Done loading %s" , _rFilename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Save file template
|
||||
template<class T>
|
||||
static bool Save(const std::string& _rFilename, u32 _Revision, T& _class)
|
||||
|
@ -355,12 +355,12 @@ public:
|
|||
ptr = &buffer[0];
|
||||
p.SetMode(PointerWrap::MODE_WRITE);
|
||||
_class.DoState(p);
|
||||
|
||||
|
||||
// Create header
|
||||
SChunkHeader header;
|
||||
header.Revision = _Revision;
|
||||
header.ExpectedSize = (u32)sz;
|
||||
|
||||
|
||||
// Write to file
|
||||
if (!pFile.WriteArray(&header, 1))
|
||||
{
|
||||
|
@ -373,11 +373,11 @@ public:
|
|||
ERROR_LOG(COMMON,"ChunkReader: Failed writing data");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
INFO_LOG(COMMON,"ChunkReader: Done writing %s", _rFilename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
struct SChunkHeader
|
||||
{
|
||||
|
|
|
@ -68,9 +68,9 @@ _mm_shuffle_epi8(__m128i a, __m128i mask)
|
|||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
|
||||
inline u32 _rotl(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
}
|
||||
|
||||
inline u64 _rotl64(u64 x, unsigned int shift){
|
||||
|
@ -79,9 +79,9 @@ inline u64 _rotl64(u64 x, unsigned int shift){
|
|||
}
|
||||
|
||||
inline u32 _rotr(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x >> shift) | (x << (32 - shift));
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x >> shift) | (x << (32 - shift));
|
||||
}
|
||||
|
||||
inline u64 _rotr64(u64 x, unsigned int shift){
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#define SHARED_USER_DIR File::GetBundleDirectory() + \
|
||||
DIR_SEP USERDATA_DIR DIR_SEP
|
||||
#elif defined ANDROID
|
||||
#define SYSDATA_DIR "/sdcard/dolphin-emu"
|
||||
#define SYSDATA_DIR "/sdcard/dolphin-emu"
|
||||
#else
|
||||
#ifdef DATA_DIR
|
||||
#define SYSDATA_DIR DATA_DIR "sys"
|
||||
|
@ -127,9 +127,9 @@
|
|||
#define GC_MEMCARDA "MemoryCardA"
|
||||
#define GC_MEMCARDB "MemoryCardB"
|
||||
|
||||
#define WII_STATE "state.dat"
|
||||
#define WII_STATE "state.dat"
|
||||
|
||||
#define WII_SETTING "setting.txt"
|
||||
#define WII_SETTING "setting.txt"
|
||||
#define WII_EUR_SETTING "setting-eur.txt"
|
||||
#define WII_USA_SETTING "setting-usa.txt"
|
||||
#define WII_JAP_SETTING "setting-jpn.txt"
|
||||
|
|
|
@ -227,7 +227,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
|
|||
LetterSpace(LBufWidth, LBufHeight);
|
||||
|
||||
|
||||
ClearScreen(true);
|
||||
ClearScreen(true);
|
||||
coordScreen.Y = 0;
|
||||
coordScreen.X = 0;
|
||||
DWORD cCharsWritten = 0;
|
||||
|
@ -270,7 +270,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
|||
*/
|
||||
DWORD cCharsWritten;
|
||||
WORD Color;
|
||||
|
||||
|
||||
switch (Level)
|
||||
{
|
||||
case NOTICE_LEVEL: // light green
|
||||
|
@ -334,9 +334,9 @@ void ConsoleListener::ClearScreen(bool Cursor)
|
|||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
DWORD dwConSize;
|
||||
|
||||
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
|
||||
// Write space to the entire console
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#pragma comment( lib, "imagehlp.lib" )
|
||||
|
||||
#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath )
|
||||
#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
|
||||
#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
|
||||
#define STACKTRACE(file) StackTrace( GetCurrentThread(), "", file)
|
||||
#define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), "", file, eip, esp, ebp)
|
||||
// class File;
|
||||
|
@ -43,10 +43,10 @@ extern char g_uefbuf[UEFBUFSIZE];
|
|||
|
||||
#else // not WIN32
|
||||
|
||||
#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0)
|
||||
#define EXTENDEDTRACEUNINITIALIZE() ((void)0)
|
||||
#define STACKTRACE(file) ((void)0)
|
||||
#define STACKTRACE2(file, eip, esp, ebp) ((void)0)
|
||||
#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0)
|
||||
#define EXTENDEDTRACEUNINITIALIZE() ((void)0)
|
||||
#define STACKTRACE(file) ((void)0)
|
||||
#define STACKTRACE2(file, eip, esp, ebp) ((void)0)
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
|
|
|
@ -38,11 +38,12 @@ namespace FPURoundMode
|
|||
|
||||
void SetSIMDMode(u32 mode);
|
||||
|
||||
/*
|
||||
There are two different flavors of float to int conversion:
|
||||
_mm_cvtps_epi32() and _mm_cvttps_epi32(). The first rounds
|
||||
according to the MXCSR rounding bits. The second one always
|
||||
uses round towards zero.
|
||||
/*
|
||||
* There are two different flavors of float to int conversion:
|
||||
* _mm_cvtps_epi32() and _mm_cvttps_epi32().
|
||||
*
|
||||
* The first rounds according to the MXCSR rounding bits.
|
||||
* The second one always uses round towards zero.
|
||||
*/
|
||||
void SaveSIMDState();
|
||||
void LoadSIMDState();
|
||||
|
|
|
@ -190,7 +190,7 @@ bool CreateFullPath(const std::string &fullPath)
|
|||
{
|
||||
int panicCounter = 100;
|
||||
INFO_LOG(COMMON, "CreateFullPath: path %s", fullPath.c_str());
|
||||
|
||||
|
||||
if (File::Exists(fullPath))
|
||||
{
|
||||
INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath.c_str());
|
||||
|
@ -206,7 +206,7 @@ bool CreateFullPath(const std::string &fullPath)
|
|||
// we're done, yay!
|
||||
if (position == fullPath.npos)
|
||||
return true;
|
||||
|
||||
|
||||
// Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
|
||||
std::string const subPath(fullPath.substr(0, position + 1));
|
||||
if (!File::IsDirectory(subPath))
|
||||
|
@ -486,7 +486,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
|
|||
return foundEntries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Deletes the given directory and anything under it. Returns true on success.
|
||||
bool DeleteDirRecursively(const std::string &directory)
|
||||
{
|
||||
|
@ -501,7 +501,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
|||
FindClose(hFind);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// windows loop
|
||||
do
|
||||
{
|
||||
|
@ -532,7 +532,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
|||
#ifndef _WIN32
|
||||
closedir(dirp);
|
||||
#endif
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
|||
#ifndef _WIN32
|
||||
closedir(dirp);
|
||||
#endif
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ std::string GetCurrentDir()
|
|||
if (!(dir = __getcwd(NULL, 0))) {
|
||||
|
||||
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s",
|
||||
GetLastErrorMsg());
|
||||
GetLastErrorMsg());
|
||||
return NULL;
|
||||
}
|
||||
std::string strDir = dir;
|
||||
|
@ -849,7 +849,7 @@ bool IOFile::Seek(s64 off, int origin)
|
|||
}
|
||||
|
||||
u64 IOFile::Tell()
|
||||
{
|
||||
{
|
||||
if (IsOpen())
|
||||
return ftello(m_file);
|
||||
else
|
||||
|
|
|
@ -119,7 +119,7 @@ u32 HashEctor(const u8* ptr, int length)
|
|||
|
||||
inline u64 getblock(const u64 * p, int i)
|
||||
{
|
||||
return p[i];
|
||||
return p[i];
|
||||
}
|
||||
|
||||
//----------
|
||||
|
@ -127,25 +127,25 @@ inline u64 getblock(const u64 * p, int i)
|
|||
|
||||
inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2)
|
||||
{
|
||||
k1 *= c1;
|
||||
k1 = _rotl64(k1,23);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
h1 += h2;
|
||||
k1 *= c1;
|
||||
k1 = _rotl64(k1,23);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
h1 += h2;
|
||||
|
||||
h2 = _rotl64(h2,41);
|
||||
h2 = _rotl64(h2,41);
|
||||
|
||||
k2 *= c2;
|
||||
k2 = _rotl64(k2,23);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
h2 += h1;
|
||||
k2 *= c2;
|
||||
k2 = _rotl64(k2,23);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = h1*3+0x52dce729;
|
||||
h2 = h2*3+0x38495ab5;
|
||||
h1 = h1*3+0x52dce729;
|
||||
h2 = h2*3+0x38495ab5;
|
||||
|
||||
c1 = c1*5+0x7b7d159c;
|
||||
c2 = c2*5+0x6bce6396;
|
||||
c1 = c1*5+0x7b7d159c;
|
||||
c2 = c2*5+0x6bce6396;
|
||||
}
|
||||
|
||||
//----------
|
||||
|
@ -153,87 +153,87 @@ inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2)
|
|||
|
||||
inline u64 fmix64(u64 k)
|
||||
{
|
||||
k ^= k >> 33;
|
||||
k *= 0xff51afd7ed558ccd;
|
||||
k ^= k >> 33;
|
||||
k *= 0xc4ceb9fe1a85ec53;
|
||||
k ^= k >> 33;
|
||||
k ^= k >> 33;
|
||||
k *= 0xff51afd7ed558ccd;
|
||||
k ^= k >> 33;
|
||||
k *= 0xc4ceb9fe1a85ec53;
|
||||
k ^= k >> 33;
|
||||
|
||||
return k;
|
||||
return k;
|
||||
}
|
||||
|
||||
u64 GetMurmurHash3(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
const u8 * data = (const u8*)src;
|
||||
const int nblocks = len / 16;
|
||||
const u8 * data = (const u8*)src;
|
||||
const int nblocks = len / 16;
|
||||
u32 Step = (len / 8);
|
||||
if(samples == 0) samples = max(Step, 1u);
|
||||
Step = Step / samples;
|
||||
if(Step < 1) Step = 1;
|
||||
|
||||
u64 h1 = 0x9368e53c2f6af274;
|
||||
u64 h2 = 0x586dcd208f7cd3fd;
|
||||
u64 h1 = 0x9368e53c2f6af274;
|
||||
u64 h2 = 0x586dcd208f7cd3fd;
|
||||
|
||||
u64 c1 = 0x87c37b91114253d5;
|
||||
u64 c2 = 0x4cf5ad432745937f;
|
||||
u64 c1 = 0x87c37b91114253d5;
|
||||
u64 c2 = 0x4cf5ad432745937f;
|
||||
|
||||
|
||||
//----------
|
||||
// body
|
||||
//----------
|
||||
// body
|
||||
|
||||
const u64 * blocks = (const u64 *)(data);
|
||||
const u64 * blocks = (const u64 *)(data);
|
||||
|
||||
for(int i = 0; i < nblocks; i+=Step)
|
||||
{
|
||||
u64 k1 = getblock(blocks,i*2+0);
|
||||
u64 k2 = getblock(blocks,i*2+1);
|
||||
for(int i = 0; i < nblocks; i+=Step)
|
||||
{
|
||||
u64 k1 = getblock(blocks,i*2+0);
|
||||
u64 k2 = getblock(blocks,i*2+1);
|
||||
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
}
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const u8 * tail = (const u8*)(data + nblocks*16);
|
||||
const u8 * tail = (const u8*)(data + nblocks*16);
|
||||
|
||||
u64 k1 = 0;
|
||||
u64 k2 = 0;
|
||||
u64 k1 = 0;
|
||||
u64 k2 = 0;
|
||||
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15: k2 ^= u64(tail[14]) << 48;
|
||||
case 14: k2 ^= u64(tail[13]) << 40;
|
||||
case 13: k2 ^= u64(tail[12]) << 32;
|
||||
case 12: k2 ^= u64(tail[11]) << 24;
|
||||
case 11: k2 ^= u64(tail[10]) << 16;
|
||||
case 10: k2 ^= u64(tail[ 9]) << 8;
|
||||
case 9: k2 ^= u64(tail[ 8]) << 0;
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15: k2 ^= u64(tail[14]) << 48;
|
||||
case 14: k2 ^= u64(tail[13]) << 40;
|
||||
case 13: k2 ^= u64(tail[12]) << 32;
|
||||
case 12: k2 ^= u64(tail[11]) << 24;
|
||||
case 11: k2 ^= u64(tail[10]) << 16;
|
||||
case 10: k2 ^= u64(tail[ 9]) << 8;
|
||||
case 9: k2 ^= u64(tail[ 8]) << 0;
|
||||
|
||||
case 8: k1 ^= u64(tail[ 7]) << 56;
|
||||
case 7: k1 ^= u64(tail[ 6]) << 48;
|
||||
case 6: k1 ^= u64(tail[ 5]) << 40;
|
||||
case 5: k1 ^= u64(tail[ 4]) << 32;
|
||||
case 4: k1 ^= u64(tail[ 3]) << 24;
|
||||
case 3: k1 ^= u64(tail[ 2]) << 16;
|
||||
case 2: k1 ^= u64(tail[ 1]) << 8;
|
||||
case 1: k1 ^= u64(tail[ 0]) << 0;
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
};
|
||||
case 8: k1 ^= u64(tail[ 7]) << 56;
|
||||
case 7: k1 ^= u64(tail[ 6]) << 48;
|
||||
case 6: k1 ^= u64(tail[ 5]) << 40;
|
||||
case 5: k1 ^= u64(tail[ 4]) << 32;
|
||||
case 4: k1 ^= u64(tail[ 3]) << 24;
|
||||
case 3: k1 ^= u64(tail[ 2]) << 16;
|
||||
case 2: k1 ^= u64(tail[ 1]) << 8;
|
||||
case 1: k1 ^= u64(tail[ 0]) << 0;
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h2 ^= len;
|
||||
h2 ^= len;
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = fmix64(h1);
|
||||
h2 = fmix64(h2);
|
||||
h1 = fmix64(h1);
|
||||
h2 = fmix64(h2);
|
||||
|
||||
h1 += h2;
|
||||
h1 += h2;
|
||||
|
||||
return h1;
|
||||
return h1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -262,11 +262,13 @@ u64 GetCRC32(const u8 *src, int len, u32 samples)
|
|||
}
|
||||
|
||||
|
||||
/* NOTE: This hash function is used for custom texture loading/dumping, so
|
||||
it should not be changed, which would require all custom textures to be
|
||||
recalculated for their new hash values. If the hashing function is
|
||||
changed, make sure this one is still used when the legacy parameter is
|
||||
true. */
|
||||
/*
|
||||
* NOTE: This hash function is used for custom texture loading/dumping, so
|
||||
* it should not be changed, which would require all custom textures to be
|
||||
* recalculated for their new hash values. If the hashing function is
|
||||
* changed, make sure this one is still used when the legacy parameter is
|
||||
* true.
|
||||
*/
|
||||
u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
const u64 m = 0xc6a4a7935bd1e995;
|
||||
|
@ -282,11 +284,11 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
|||
{
|
||||
u64 k = data[0];
|
||||
data+=Step;
|
||||
k *= m;
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
k *= m;
|
||||
h ^= k;
|
||||
h *= m;
|
||||
h *= m;
|
||||
}
|
||||
|
||||
const u8 * data2 = (const u8*)end;
|
||||
|
@ -453,9 +455,11 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
|
|||
return *((u64 *)&out);
|
||||
}
|
||||
|
||||
/* FIXME: The old 32-bit version of this hash made different hashes than the
|
||||
64-bit version. Until someone can make a new version of the 32-bit one that
|
||||
makes identical hashes, this is just a c/p of the 64-bit one. */
|
||||
/*
|
||||
* FIXME: The old 32-bit version of this hash made different hashes than the
|
||||
* 64-bit version. Until someone can make a new version of the 32-bit one that
|
||||
* makes identical hashes, this is just a c/p of the 64-bit one.
|
||||
*/
|
||||
u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
const u64 m = 0xc6a4a7935bd1e995ULL;
|
||||
|
@ -473,7 +477,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
|||
data+=Step;
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
k *= m;
|
||||
h ^= k;
|
||||
h *= m;
|
||||
}
|
||||
|
@ -502,7 +506,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
|||
|
||||
u64 GetHash64(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
return ptrHashFunction(src, len, samples);
|
||||
return ptrHashFunction(src, len, samples);
|
||||
}
|
||||
|
||||
// sets the hash function used for the texture cache
|
||||
|
|
|
@ -45,9 +45,9 @@ LogManager::LogManager()
|
|||
m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
|
||||
m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot");
|
||||
m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common");
|
||||
m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
|
||||
m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
|
||||
m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor");
|
||||
m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
|
||||
m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
|
||||
m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine");
|
||||
m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc");
|
||||
m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt");
|
||||
|
@ -63,15 +63,15 @@ LogManager::LogManager()
|
|||
m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
|
||||
m_Log[LogTypes::POWERPC] = new LogContainer("PowerPC", "IBM CPU");
|
||||
m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE");
|
||||
m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
|
||||
m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
|
||||
m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
|
||||
m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend");
|
||||
m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator");
|
||||
m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
|
||||
m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
|
||||
m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
|
||||
m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend");
|
||||
m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator");
|
||||
m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
|
||||
m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
|
||||
m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
|
||||
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
|
||||
m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
|
||||
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
|
||||
m_Log[LogTypes::WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
|
||||
m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
|
||||
m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
|
||||
|
@ -82,7 +82,7 @@ LogManager::LogManager()
|
|||
m_Log[LogTypes::WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
|
||||
m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
|
||||
m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE");
|
||||
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
|
||||
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
|
||||
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
|
||||
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <set>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_MESSAGES 8000
|
||||
#define MAX_MESSAGES 8000
|
||||
#define MAX_MSGLEN 1024
|
||||
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ u32 ClassifyFloat(float fvalue)
|
|||
else
|
||||
{
|
||||
// Denormalized number.
|
||||
return sign ? PPC_FPCLASS_ND : PPC_FPCLASS_PD;
|
||||
return sign ? PPC_FPCLASS_ND : PPC_FPCLASS_PD;
|
||||
}
|
||||
}
|
||||
else if (exp)
|
||||
|
@ -101,26 +101,26 @@ u32 ClassifyFloat(float fvalue)
|
|||
//Zero
|
||||
return sign ? PPC_FPCLASS_NZ : PPC_FPCLASS_PZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
inline void MatrixMul(int n, const float *a, const float *b, float *result)
|
||||
{
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for (int j = 0; j < n; ++j)
|
||||
for (int j = 0; j < n; ++j)
|
||||
{
|
||||
float temp = 0;
|
||||
for (int k = 0; k < n; ++k)
|
||||
float temp = 0;
|
||||
for (int k = 0; k < n; ++k)
|
||||
{
|
||||
temp += a[i * n + k] * b[k * n + j];
|
||||
}
|
||||
result[i * n + j] = temp;
|
||||
}
|
||||
}
|
||||
temp += a[i * n + k] * b[k * n + j];
|
||||
}
|
||||
result[i * n + j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate sum of a float list
|
||||
|
@ -131,94 +131,94 @@ float MathFloatVectorSum(const std::vector<float>& Vec)
|
|||
|
||||
void Matrix33::LoadIdentity(Matrix33 &mtx)
|
||||
{
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1.0f;
|
||||
mtx.data[4] = 1.0f;
|
||||
mtx.data[8] = 1.0f;
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1.0f;
|
||||
mtx.data[4] = 1.0f;
|
||||
mtx.data[8] = 1.0f;
|
||||
}
|
||||
|
||||
void Matrix33::RotateX(Matrix33 &mtx, float rad)
|
||||
{
|
||||
float s = sin(rad);
|
||||
float c = cos(rad);
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1;
|
||||
mtx.data[4] = c;
|
||||
mtx.data[5] = -s;
|
||||
mtx.data[7] = s;
|
||||
mtx.data[8] = c;
|
||||
float s = sin(rad);
|
||||
float c = cos(rad);
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1;
|
||||
mtx.data[4] = c;
|
||||
mtx.data[5] = -s;
|
||||
mtx.data[7] = s;
|
||||
mtx.data[8] = c;
|
||||
}
|
||||
void Matrix33::RotateY(Matrix33 &mtx, float rad)
|
||||
{
|
||||
float s = sin(rad);
|
||||
float c = cos(rad);
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = c;
|
||||
mtx.data[2] = s;
|
||||
mtx.data[4] = 1;
|
||||
mtx.data[6] = -s;
|
||||
mtx.data[8] = c;
|
||||
float s = sin(rad);
|
||||
float c = cos(rad);
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = c;
|
||||
mtx.data[2] = s;
|
||||
mtx.data[4] = 1;
|
||||
mtx.data[6] = -s;
|
||||
mtx.data[8] = c;
|
||||
}
|
||||
|
||||
void Matrix33::Multiply(const Matrix33 &a, const Matrix33 &b, Matrix33 &result)
|
||||
{
|
||||
MatrixMul(3, a.data, b.data, result.data);
|
||||
MatrixMul(3, a.data, b.data, result.data);
|
||||
}
|
||||
|
||||
void Matrix33::Multiply(const Matrix33 &a, const float vec[3], float result[3])
|
||||
{
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
result[i] = 0;
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
result[i] += a.data[i * 3 + k] * vec[k];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
result[i] = 0;
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
result[i] += a.data[i * 3 + k] * vec[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix44::LoadIdentity(Matrix44 &mtx)
|
||||
{
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1.0f;
|
||||
mtx.data[5] = 1.0f;
|
||||
mtx.data[10] = 1.0f;
|
||||
mtx.data[15] = 1.0f;
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1.0f;
|
||||
mtx.data[5] = 1.0f;
|
||||
mtx.data[10] = 1.0f;
|
||||
mtx.data[15] = 1.0f;
|
||||
}
|
||||
|
||||
void Matrix44::LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 3; ++j)
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
mtx.data[i * 4 + j] = m33.data[i * 3 + j];
|
||||
}
|
||||
}
|
||||
mtx.data[i * 4 + j] = m33.data[i * 3 + j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
mtx.data[i * 4 + 3] = 0;
|
||||
mtx.data[i + 12] = 0;
|
||||
}
|
||||
mtx.data[15] = 1.0f;
|
||||
mtx.data[i * 4 + 3] = 0;
|
||||
mtx.data[i + 12] = 0;
|
||||
}
|
||||
mtx.data[15] = 1.0f;
|
||||
}
|
||||
|
||||
void Matrix44::Set(Matrix44 &mtx, const float mtxArray[16])
|
||||
{
|
||||
for(int i = 0; i < 16; ++i) {
|
||||
mtx.data[i] = mtxArray[i];
|
||||
}
|
||||
for(int i = 0; i < 16; ++i) {
|
||||
mtx.data[i] = mtxArray[i];
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix44::Translate(Matrix44 &mtx, const float vec[3])
|
||||
{
|
||||
LoadIdentity(mtx);
|
||||
mtx.data[3] = vec[0];
|
||||
mtx.data[7] = vec[1];
|
||||
mtx.data[11] = vec[2];
|
||||
LoadIdentity(mtx);
|
||||
mtx.data[3] = vec[0];
|
||||
mtx.data[7] = vec[1];
|
||||
mtx.data[11] = vec[2];
|
||||
}
|
||||
|
||||
void Matrix44::Multiply(const Matrix44 &a, const Matrix44 &b, Matrix44 &result)
|
||||
{
|
||||
MatrixMul(4, a.data, b.data, result.data);
|
||||
MatrixMul(4, a.data, b.data, result.data);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,12 +159,12 @@ inline u64 Log2(u64 val)
|
|||
{
|
||||
#if defined(__GNUC__)
|
||||
return 63 - __builtin_clzll(val);
|
||||
|
||||
|
||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
||||
unsigned long result = -1;
|
||||
_BitScanReverse64(&result, val);
|
||||
return result;
|
||||
|
||||
|
||||
#else
|
||||
u64 result = -1;
|
||||
while (val != 0)
|
||||
|
@ -182,32 +182,32 @@ inline u64 Log2(u64 val)
|
|||
class Matrix33
|
||||
{
|
||||
public:
|
||||
static void LoadIdentity(Matrix33 &mtx);
|
||||
static void LoadIdentity(Matrix33 &mtx);
|
||||
|
||||
// set mtx to be a rotation matrix around the x axis
|
||||
static void RotateX(Matrix33 &mtx, float rad);
|
||||
// set mtx to be a rotation matrix around the y axis
|
||||
static void RotateY(Matrix33 &mtx, float rad);
|
||||
// set mtx to be a rotation matrix around the x axis
|
||||
static void RotateX(Matrix33 &mtx, float rad);
|
||||
// set mtx to be a rotation matrix around the y axis
|
||||
static void RotateY(Matrix33 &mtx, float rad);
|
||||
|
||||
// set result = a x b
|
||||
static void Multiply(const Matrix33 &a, const Matrix33 &b, Matrix33 &result);
|
||||
static void Multiply(const Matrix33 &a, const float vec[3], float result[3]);
|
||||
// set result = a x b
|
||||
static void Multiply(const Matrix33 &a, const Matrix33 &b, Matrix33 &result);
|
||||
static void Multiply(const Matrix33 &a, const float vec[3], float result[3]);
|
||||
|
||||
float data[9];
|
||||
float data[9];
|
||||
};
|
||||
|
||||
class Matrix44
|
||||
{
|
||||
public:
|
||||
static void LoadIdentity(Matrix44 &mtx);
|
||||
static void LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33);
|
||||
static void Set(Matrix44 &mtx, const float mtxArray[16]);
|
||||
static void LoadIdentity(Matrix44 &mtx);
|
||||
static void LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33);
|
||||
static void Set(Matrix44 &mtx, const float mtxArray[16]);
|
||||
|
||||
static void Translate(Matrix44 &mtx, const float vec[3]);
|
||||
static void Translate(Matrix44 &mtx, const float vec[3]);
|
||||
|
||||
static void Multiply(const Matrix44 &a, const Matrix44 &b, Matrix44 &result);
|
||||
static void Multiply(const Matrix44 &a, const Matrix44 &b, Matrix44 &result);
|
||||
|
||||
float data[16];
|
||||
float data[16];
|
||||
};
|
||||
|
||||
#endif // _MATH_UTIL_H_
|
||||
|
|
|
@ -47,10 +47,10 @@ int AshmemCreateFileMapping(const char *name, size_t size)
|
|||
fd = open(ASHMEM_DEVICE, O_RDWR);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
|
||||
// We don't really care if we can't set the name, it is optional
|
||||
ret = ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
|
||||
|
||||
ret = ioctl(fd, ASHMEM_SET_SIZE, size);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
|
@ -155,9 +155,7 @@ void FreeAlignedMemory(void* ptr)
|
|||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
_aligned_free(ptr);
|
||||
|
||||
_aligned_free(ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
#endif
|
||||
|
|
|
@ -102,15 +102,14 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
|||
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int STYLE = MB_ICONINFORMATION;
|
||||
if (Style == QUESTION) STYLE = MB_ICONQUESTION;
|
||||
if (Style == WARNING) STYLE = MB_ICONWARNING;
|
||||
|
||||
return IDYES == MessageBox(0, UTF8ToTStr(text).c_str(), UTF8ToTStr(caption).c_str(), STYLE | (yes_no ? MB_YESNO : MB_OK));
|
||||
|
||||
int STYLE = MB_ICONINFORMATION;
|
||||
if (Style == QUESTION) STYLE = MB_ICONQUESTION;
|
||||
if (Style == WARNING) STYLE = MB_ICONWARNING;
|
||||
|
||||
return IDYES == MessageBox(0, UTF8ToTStr(text).c_str(), UTF8ToTStr(caption).c_str(), STYLE | (yes_no ? MB_YESNO : MB_OK));
|
||||
#else
|
||||
printf("%s\n", text);
|
||||
return true;
|
||||
printf("%s\n", text);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public:
|
|||
// bool wait_for(unique_lock<mutex>& lock,
|
||||
// const chrono::duration<Rep, Period>& rel_time,
|
||||
// Predicate pred);
|
||||
|
||||
|
||||
native_handle_type native_handle()
|
||||
{
|
||||
#ifdef USE_EVENTS
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
bool operator<(const id& rhs) const
|
||||
{
|
||||
return m_thread < rhs.m_thread;
|
||||
|
|
|
@ -435,10 +435,10 @@ template <typename T>
|
|||
std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& input)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
|
||||
#if defined(ANDROID)
|
||||
result = "Not implemented on Android!";
|
||||
|
||||
|
||||
#else
|
||||
iconv_t const conv_desc = iconv_open("UTF-8", fromcode);
|
||||
if ((iconv_t)-1 == conv_desc)
|
||||
|
@ -449,7 +449,7 @@ std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& input)
|
|||
{
|
||||
size_t const in_bytes = sizeof(T) * input.size();
|
||||
size_t const out_buffer_size = 4 * in_bytes;
|
||||
|
||||
|
||||
std::string out_buffer;
|
||||
out_buffer.resize(out_buffer_size);
|
||||
|
||||
|
@ -457,12 +457,12 @@ std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& input)
|
|||
size_t src_bytes = in_bytes;
|
||||
auto dst_buffer = &out_buffer[0];
|
||||
size_t dst_bytes = out_buffer.size();
|
||||
|
||||
|
||||
while (src_bytes != 0)
|
||||
{
|
||||
size_t const iconv_result = iconv(conv_desc, (char**)(&src_buffer), &src_bytes,
|
||||
&dst_buffer, &dst_bytes);
|
||||
|
||||
|
||||
if ((size_t)-1 == iconv_result)
|
||||
{
|
||||
if (EILSEQ == errno || EINVAL == errno)
|
||||
|
@ -512,7 +512,7 @@ std::string UTF16ToUTF8(const std::wstring& input)
|
|||
// CodeToUTF8("UCS-2LE", input);
|
||||
// CodeToUTF8("UTF-16", input);
|
||||
CodeToUTF8("UTF-16LE", input);
|
||||
|
||||
|
||||
// TODO: why is this needed?
|
||||
result.erase(std::remove(result.begin(), result.end(), 0x00), result.end());
|
||||
return result;
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
m_condvar.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Wait()
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(m_mutex);
|
||||
|
|
|
@ -226,11 +226,11 @@ void XEmitter::ABI_CallFunction(void *func) {
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,11 +239,11 @@ void XEmitter::ABI_CallFunctionC16(void *func, u16 param1) {
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,11 +266,11 @@ void XEmitter::ABI_CallFunctionC(void *func, u32 param1) {
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,11 +280,11 @@ void XEmitter::ABI_CallFunctionCC(void *func, u32 param1, u32 param2) {
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,11 +295,11 @@ void XEmitter::ABI_CallFunctionCCC(void *func, u32 param1, u32 param2, u32 param
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,11 +310,11 @@ void XEmitter::ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *par
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,11 +326,11 @@ void XEmitter::ABI_CallFunctionCCCP(void *func, u32 param1, u32 param2, u32 para
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,11 +341,11 @@ void XEmitter::ABI_CallFunctionPPC(void *func, void *param1, void *param2, u32 p
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,11 +356,11 @@ void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) {
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,11 +380,11 @@ void XEmitter::ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2) {
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,11 +396,11 @@ void XEmitter::ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -411,11 +411,11 @@ void XEmitter::ABI_CallFunctionA(void *func, const Gen::OpArg &arg1)
|
|||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,18 +60,18 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
|
|||
|
||||
codeByte = *codePtr++;
|
||||
|
||||
// Skip two-byte opcode byte
|
||||
bool twoByte = false;
|
||||
if(codeByte == 0x0F)
|
||||
{
|
||||
twoByte = true;
|
||||
// Skip two-byte opcode byte
|
||||
bool twoByte = false;
|
||||
if(codeByte == 0x0F)
|
||||
{
|
||||
twoByte = true;
|
||||
codeByte2 = *codePtr++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!twoByte)
|
||||
{
|
||||
if ((codeByte & 0xF0) == 0x80 ||
|
||||
((codeByte & 0xF8) == 0xC0 && (codeByte & 0x0E) != 0x02))
|
||||
if ((codeByte & 0xF0) == 0x80 ||
|
||||
((codeByte & 0xF8) == 0xC0 && (codeByte & 0x0E) != 0x02))
|
||||
{
|
||||
modRMbyte = *codePtr++;
|
||||
hasModRM = true;
|
||||
|
@ -79,20 +79,20 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
|
|||
}
|
||||
else
|
||||
{
|
||||
if (((codeByte2 & 0xF0) == 0x00 && (codeByte2 & 0x0F) >= 0x04 && (codeByte2 & 0x0D) != 0x0D) ||
|
||||
(codeByte2 & 0xF0) == 0x30 ||
|
||||
codeByte2 == 0x77 ||
|
||||
(codeByte2 & 0xF0) == 0x80 ||
|
||||
((codeByte2 & 0xF0) == 0xA0 && (codeByte2 & 0x07) <= 0x02) ||
|
||||
(codeByte2 & 0xF8) == 0xC8)
|
||||
{
|
||||
// No mod R/M byte
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((codeByte2 & 0xF0) == 0x00 && (codeByte2 & 0x0F) >= 0x04 && (codeByte2 & 0x0D) != 0x0D) ||
|
||||
(codeByte2 & 0xF0) == 0x30 ||
|
||||
codeByte2 == 0x77 ||
|
||||
(codeByte2 & 0xF0) == 0x80 ||
|
||||
((codeByte2 & 0xF0) == 0xA0 && (codeByte2 & 0x07) <= 0x02) ||
|
||||
(codeByte2 & 0xF8) == 0xC8)
|
||||
{
|
||||
// No mod R/M byte
|
||||
}
|
||||
else
|
||||
{
|
||||
modRMbyte = *codePtr++;
|
||||
hasModRM = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasModRM)
|
||||
|
@ -130,7 +130,7 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
|
|||
info.displacement = *((s32 *)codePtr);
|
||||
codePtr += displacementSize;
|
||||
|
||||
|
||||
|
||||
if (accessType == 1)
|
||||
{
|
||||
info.isMemoryWrite = true;
|
||||
|
|
|
@ -51,7 +51,7 @@ enum{
|
|||
MOVZX_SHORT = 0xB7, //movzx on short
|
||||
MOVSX_BYTE = 0xBE, //movsx on byte
|
||||
MOVSX_SHORT = 0xBF, //movsx on short
|
||||
MOVE_8BIT = 0xC6, //move 8-bit immediate
|
||||
MOVE_8BIT = 0xC6, //move 8-bit immediate
|
||||
MOVE_16_32BIT = 0xC7, //move 16 or 32-bit immediate
|
||||
MOVE_REG_TO_MEM = 0x89, //move reg to memory
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <machine/cpufunc.h>
|
||||
#else
|
||||
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
unsigned int *ecx, unsigned int *edx)
|
||||
unsigned int *ecx, unsigned int *edx)
|
||||
{
|
||||
#if defined _M_GENERIC
|
||||
(*eax) = (*ebx) = (*ecx) = (*edx) = 0;
|
||||
|
|
|
@ -51,13 +51,13 @@ static const NormalOpDef nops[11] =
|
|||
|
||||
enum NormalSSEOps
|
||||
{
|
||||
sseCMP = 0xC2,
|
||||
sseADD = 0x58, //ADD
|
||||
sseCMP = 0xC2,
|
||||
sseADD = 0x58, //ADD
|
||||
sseSUB = 0x5C, //SUB
|
||||
sseAND = 0x54, //AND
|
||||
sseANDN = 0x55, //ANDN
|
||||
sseOR = 0x56,
|
||||
sseXOR = 0x57,
|
||||
sseOR = 0x56,
|
||||
sseXOR = 0x57,
|
||||
sseMUL = 0x59, //MUL,
|
||||
sseDIV = 0x5E, //DIV
|
||||
sseMIN = 0x5D, //MIN
|
||||
|
@ -143,18 +143,18 @@ void OpArg::WriteRex(XEmitter *emit, int opBits, int bits, int customOp) const
|
|||
if (indexReg & 8) op |= 2;
|
||||
if (offsetOrBaseReg & 8) op |= 1; //TODO investigate if this is dangerous
|
||||
if (op != 0x40 ||
|
||||
(bits == 8 && (offsetOrBaseReg & 0x10c) == 4) ||
|
||||
(opBits == 8 && (customOp & 0x10c) == 4)) {
|
||||
(bits == 8 && (offsetOrBaseReg & 0x10c) == 4) ||
|
||||
(opBits == 8 && (customOp & 0x10c) == 4)) {
|
||||
emit->Write8(op);
|
||||
_dbg_assert_(DYNA_REC, (offsetOrBaseReg & 0x100) == 0 || bits != 8);
|
||||
_dbg_assert_(DYNA_REC, (customOp & 0x100) == 0 || opBits != 8);
|
||||
} else {
|
||||
_dbg_assert_(DYNA_REC, (offsetOrBaseReg & 0x10c) == 0 ||
|
||||
(offsetOrBaseReg & 0x10c) == 0x104 ||
|
||||
bits != 8);
|
||||
(offsetOrBaseReg & 0x10c) == 0x104 ||
|
||||
bits != 8);
|
||||
_dbg_assert_(DYNA_REC, (customOp & 0x10c) == 0 ||
|
||||
(customOp & 0x10c) == 0x104 ||
|
||||
opBits != 8);
|
||||
(customOp & 0x10c) == 0x104 ||
|
||||
opBits != 8);
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -969,15 +969,15 @@ void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg &o
|
|||
immToWrite = 8;
|
||||
}
|
||||
else if ((operand.scale == SCALE_IMM16 && bits == 16) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 64))
|
||||
(operand.scale == SCALE_IMM32 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 64))
|
||||
{
|
||||
emit->Write8(nops[op].imm32);
|
||||
immToWrite = bits == 16 ? 16 : 32;
|
||||
}
|
||||
else if ((operand.scale == SCALE_IMM8 && bits == 16) ||
|
||||
(operand.scale == SCALE_IMM8 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM8 && bits == 64))
|
||||
(operand.scale == SCALE_IMM8 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM8 && bits == 64))
|
||||
{
|
||||
emit->Write8(nops[op].simm8);
|
||||
immToWrite = 8;
|
||||
|
@ -1471,142 +1471,142 @@ void XEmitter::RTDSC() { Write8(0x0F); Write8(0x31); }
|
|||
// helper routines for setting pointers
|
||||
void XEmitter::CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2)
|
||||
{
|
||||
using namespace Gen;
|
||||
using namespace Gen;
|
||||
#ifdef _M_X64
|
||||
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
CALL(fnptr);
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
CALL(fnptr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
ABI_AlignStack(3 * 4);
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
ABI_AlignStack(3 * 4);
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
#ifdef _WIN32
|
||||
// don't inc stack
|
||||
// don't inc stack
|
||||
#else
|
||||
ABI_RestoreStack(3 * 4);
|
||||
ABI_RestoreStack(3 * 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void XEmitter::CallCdeclFunction4(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3)
|
||||
{
|
||||
using namespace Gen;
|
||||
using namespace Gen;
|
||||
#ifdef _M_X64
|
||||
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
CALL(fnptr);
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
CALL(fnptr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
ABI_AlignStack(4 * 4);
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
ABI_AlignStack(4 * 4);
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
#ifdef _WIN32
|
||||
// don't inc stack
|
||||
// don't inc stack
|
||||
#else
|
||||
ABI_RestoreStack(4 * 4);
|
||||
ABI_RestoreStack(4 * 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void XEmitter::CallCdeclFunction5(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
||||
{
|
||||
using namespace Gen;
|
||||
using namespace Gen;
|
||||
#ifdef _M_X64
|
||||
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
||||
CALL(fnptr);
|
||||
CALL(fnptr);
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
MOV(32, R(R8), Imm32(arg4));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
MOV(32, R(R8), Imm32(arg4));
|
||||
CALL(fnptr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
ABI_AlignStack(5 * 4);
|
||||
PUSH(32, Imm32(arg4));
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
ABI_AlignStack(5 * 4);
|
||||
PUSH(32, Imm32(arg4));
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
#ifdef _WIN32
|
||||
// don't inc stack
|
||||
// don't inc stack
|
||||
#else
|
||||
ABI_RestoreStack(5 * 4);
|
||||
ABI_RestoreStack(5 * 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void XEmitter::CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
|
||||
{
|
||||
using namespace Gen;
|
||||
using namespace Gen;
|
||||
#ifdef _M_X64
|
||||
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
||||
MOV(32, MDisp(RSP, 0x28), Imm32(arg5));
|
||||
CALL(fnptr);
|
||||
CALL(fnptr);
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
MOV(32, R(R8), Imm32(arg4));
|
||||
MOV(32, R(R9), Imm32(arg5));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
MOV(32, R(R8), Imm32(arg4));
|
||||
MOV(32, R(R9), Imm32(arg5));
|
||||
CALL(fnptr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
ABI_AlignStack(6 * 4);
|
||||
PUSH(32, Imm32(arg5));
|
||||
PUSH(32, Imm32(arg4));
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
ABI_AlignStack(6 * 4);
|
||||
PUSH(32, Imm32(arg5));
|
||||
PUSH(32, Imm32(arg4));
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
#ifdef _WIN32
|
||||
// don't inc stack
|
||||
// don't inc stack
|
||||
#else
|
||||
ABI_RestoreStack(6 * 4);
|
||||
ABI_RestoreStack(6 * 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -1615,31 +1615,31 @@ void XEmitter::CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32
|
|||
|
||||
// See header
|
||||
void XEmitter::___CallCdeclImport3(void* impptr, u32 arg0, u32 arg1, u32 arg2) {
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
CALLptr(M(impptr));
|
||||
}
|
||||
void XEmitter::___CallCdeclImport4(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3) {
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
CALLptr(M(impptr));
|
||||
}
|
||||
void XEmitter::___CallCdeclImport5(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4) {
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
||||
CALLptr(M(impptr));
|
||||
}
|
||||
void XEmitter::___CallCdeclImport6(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5) {
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
||||
MOV(32, MDisp(RSP, 0x28), Imm32(arg5));
|
||||
CALLptr(M(impptr));
|
||||
|
|
|
@ -766,7 +766,7 @@ public:
|
|||
// Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()).
|
||||
void WriteProtect()
|
||||
{
|
||||
WriteProtectMemory(region, region_size, true);
|
||||
WriteProtectMemory(region, region_size, true);
|
||||
}
|
||||
|
||||
void ResetCodePtr()
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace FPURoundMode
|
|||
}
|
||||
|
||||
void SetPrecisionMode(u32 mode)
|
||||
{
|
||||
{
|
||||
#ifdef _M_IX86
|
||||
// sets the floating-point lib to 53-bit
|
||||
// PowerPC has a 53bit floating pipeline only
|
||||
|
@ -104,7 +104,7 @@ namespace FPURoundMode
|
|||
u32 csr = ssetable[mode];
|
||||
_mm_setcsr(csr);
|
||||
}
|
||||
|
||||
|
||||
void SaveSIMDState()
|
||||
{
|
||||
saved_sse_state = _mm_getcsr();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,18 +25,18 @@ enum
|
|||
{
|
||||
ARRAY_POSITION = 0,
|
||||
ARRAY_NORMAL = 1,
|
||||
ARRAY_COLOR = 2,
|
||||
ARRAY_COLOR2 = 3,
|
||||
ARRAY_TEXCOORD0 = 4,
|
||||
ARRAY_COLOR = 2,
|
||||
ARRAY_COLOR2 = 3,
|
||||
ARRAY_TEXCOORD0 = 4,
|
||||
};
|
||||
|
||||
// Vertex components
|
||||
enum
|
||||
{
|
||||
NOT_PRESENT = 0,
|
||||
DIRECT = 1,
|
||||
INDEX8 = 2,
|
||||
INDEX16 = 3,
|
||||
DIRECT = 1,
|
||||
INDEX8 = 2,
|
||||
INDEX16 = 3,
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -74,14 +74,14 @@ union TVtxDesc
|
|||
// 0: not present
|
||||
// 1: present
|
||||
u32 PosMatIdx : 1;
|
||||
u32 Tex0MatIdx : 1;
|
||||
u32 Tex1MatIdx : 1;
|
||||
u32 Tex2MatIdx : 1;
|
||||
u32 Tex3MatIdx : 1;
|
||||
u32 Tex4MatIdx : 1;
|
||||
u32 Tex5MatIdx : 1;
|
||||
u32 Tex6MatIdx : 1;
|
||||
u32 Tex7MatIdx : 1;
|
||||
u32 Tex0MatIdx : 1;
|
||||
u32 Tex1MatIdx : 1;
|
||||
u32 Tex2MatIdx : 1;
|
||||
u32 Tex3MatIdx : 1;
|
||||
u32 Tex4MatIdx : 1;
|
||||
u32 Tex5MatIdx : 1;
|
||||
u32 Tex6MatIdx : 1;
|
||||
u32 Tex7MatIdx : 1;
|
||||
|
||||
// 00: not present
|
||||
// 01: direct
|
||||
|
@ -89,156 +89,156 @@ union TVtxDesc
|
|||
// 11: 16 bit index
|
||||
u32 Position : 2;
|
||||
u32 Normal : 2;
|
||||
u32 Color0 : 2;
|
||||
u32 Color1 : 2;
|
||||
u32 Tex0Coord : 2;
|
||||
u32 Tex1Coord : 2;
|
||||
u32 Tex2Coord : 2;
|
||||
u32 Tex3Coord : 2;
|
||||
u32 Tex4Coord : 2;
|
||||
u32 Tex5Coord : 2;
|
||||
u32 Tex6Coord : 2;
|
||||
u32 Tex7Coord : 2;
|
||||
u32 Color0 : 2;
|
||||
u32 Color1 : 2;
|
||||
u32 Tex0Coord : 2;
|
||||
u32 Tex1Coord : 2;
|
||||
u32 Tex2Coord : 2;
|
||||
u32 Tex3Coord : 2;
|
||||
u32 Tex4Coord : 2;
|
||||
u32 Tex5Coord : 2;
|
||||
u32 Tex6Coord : 2;
|
||||
u32 Tex7Coord : 2;
|
||||
u32 :31;
|
||||
};
|
||||
struct {
|
||||
u32 Hex0, Hex1;
|
||||
};
|
||||
struct {
|
||||
u32 Hex0, Hex1;
|
||||
};
|
||||
};
|
||||
|
||||
union UVAT_group0
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:8
|
||||
u32 PosElements : 1;
|
||||
u32 PosFormat : 3;
|
||||
u32 PosFrac : 5;
|
||||
// 9:12
|
||||
u32 NormalElements : 1;
|
||||
u32 NormalFormat : 3;
|
||||
// 13:16
|
||||
u32 Color0Elements : 1;
|
||||
u32 Color0Comp : 3;
|
||||
// 17:20
|
||||
u32 Color1Elements : 1;
|
||||
u32 Color1Comp : 3;
|
||||
// 21:29
|
||||
u32 Tex0CoordElements : 1;
|
||||
u32 Tex0CoordFormat : 3;
|
||||
u32 Tex0Frac : 5;
|
||||
// 30:31
|
||||
u32 ByteDequant : 1;
|
||||
u32 NormalIndex3 : 1;
|
||||
};
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:8
|
||||
u32 PosElements : 1;
|
||||
u32 PosFormat : 3;
|
||||
u32 PosFrac : 5;
|
||||
// 9:12
|
||||
u32 NormalElements : 1;
|
||||
u32 NormalFormat : 3;
|
||||
// 13:16
|
||||
u32 Color0Elements : 1;
|
||||
u32 Color0Comp : 3;
|
||||
// 17:20
|
||||
u32 Color1Elements : 1;
|
||||
u32 Color1Comp : 3;
|
||||
// 21:29
|
||||
u32 Tex0CoordElements : 1;
|
||||
u32 Tex0CoordFormat : 3;
|
||||
u32 Tex0Frac : 5;
|
||||
// 30:31
|
||||
u32 ByteDequant : 1;
|
||||
u32 NormalIndex3 : 1;
|
||||
};
|
||||
};
|
||||
|
||||
union UVAT_group1
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:8
|
||||
u32 Tex1CoordElements : 1;
|
||||
u32 Tex1CoordFormat : 3;
|
||||
u32 Tex1Frac : 5;
|
||||
// 9:17
|
||||
u32 Tex2CoordElements : 1;
|
||||
u32 Tex2CoordFormat : 3;
|
||||
u32 Tex2Frac : 5;
|
||||
// 18:26
|
||||
u32 Tex3CoordElements : 1;
|
||||
u32 Tex3CoordFormat : 3;
|
||||
u32 Tex3Frac : 5;
|
||||
// 27:30
|
||||
u32 Tex4CoordElements : 1;
|
||||
u32 Tex4CoordFormat : 3;
|
||||
//
|
||||
u32 : 1;
|
||||
};
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:8
|
||||
u32 Tex1CoordElements : 1;
|
||||
u32 Tex1CoordFormat : 3;
|
||||
u32 Tex1Frac : 5;
|
||||
// 9:17
|
||||
u32 Tex2CoordElements : 1;
|
||||
u32 Tex2CoordFormat : 3;
|
||||
u32 Tex2Frac : 5;
|
||||
// 18:26
|
||||
u32 Tex3CoordElements : 1;
|
||||
u32 Tex3CoordFormat : 3;
|
||||
u32 Tex3Frac : 5;
|
||||
// 27:30
|
||||
u32 Tex4CoordElements : 1;
|
||||
u32 Tex4CoordFormat : 3;
|
||||
//
|
||||
u32 : 1;
|
||||
};
|
||||
};
|
||||
|
||||
union UVAT_group2
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:4
|
||||
u32 Tex4Frac : 5;
|
||||
// 5:13
|
||||
u32 Tex5CoordElements : 1;
|
||||
u32 Tex5CoordFormat : 3;
|
||||
u32 Tex5Frac : 5;
|
||||
// 14:22
|
||||
u32 Tex6CoordElements : 1;
|
||||
u32 Tex6CoordFormat : 3;
|
||||
u32 Tex6Frac : 5;
|
||||
// 23:31
|
||||
u32 Tex7CoordElements : 1;
|
||||
u32 Tex7CoordFormat : 3;
|
||||
u32 Tex7Frac : 5;
|
||||
};
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:4
|
||||
u32 Tex4Frac : 5;
|
||||
// 5:13
|
||||
u32 Tex5CoordElements : 1;
|
||||
u32 Tex5CoordFormat : 3;
|
||||
u32 Tex5Frac : 5;
|
||||
// 14:22
|
||||
u32 Tex6CoordElements : 1;
|
||||
u32 Tex6CoordFormat : 3;
|
||||
u32 Tex6Frac : 5;
|
||||
// 23:31
|
||||
u32 Tex7CoordElements : 1;
|
||||
u32 Tex7CoordFormat : 3;
|
||||
u32 Tex7Frac : 5;
|
||||
};
|
||||
};
|
||||
|
||||
struct ColorAttr
|
||||
{
|
||||
u8 Elements;
|
||||
u8 Comp;
|
||||
u8 Elements;
|
||||
u8 Comp;
|
||||
};
|
||||
|
||||
struct TexAttr
|
||||
{
|
||||
u8 Elements;
|
||||
u8 Format;
|
||||
u8 Frac;
|
||||
u8 Elements;
|
||||
u8 Format;
|
||||
u8 Frac;
|
||||
};
|
||||
|
||||
struct TVtxAttr
|
||||
{
|
||||
u8 PosElements;
|
||||
u8 PosFormat;
|
||||
u8 PosFrac;
|
||||
u8 NormalElements;
|
||||
u8 NormalFormat;
|
||||
ColorAttr color[2];
|
||||
TexAttr texCoord[8];
|
||||
u8 ByteDequant;
|
||||
u8 NormalIndex3;
|
||||
{
|
||||
u8 PosElements;
|
||||
u8 PosFormat;
|
||||
u8 PosFrac;
|
||||
u8 NormalElements;
|
||||
u8 NormalFormat;
|
||||
ColorAttr color[2];
|
||||
TexAttr texCoord[8];
|
||||
u8 ByteDequant;
|
||||
u8 NormalIndex3;
|
||||
};
|
||||
|
||||
// Matrix indices
|
||||
union TMatrixIndexA
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 PosNormalMtxIdx : 6;
|
||||
u32 Tex0MtxIdx : 6;
|
||||
u32 Tex1MtxIdx : 6;
|
||||
u32 Tex2MtxIdx : 6;
|
||||
u32 Tex3MtxIdx : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Hex : 30;
|
||||
u32 unused : 2;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 PosNormalMtxIdx : 6;
|
||||
u32 Tex0MtxIdx : 6;
|
||||
u32 Tex1MtxIdx : 6;
|
||||
u32 Tex2MtxIdx : 6;
|
||||
u32 Tex3MtxIdx : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Hex : 30;
|
||||
u32 unused : 2;
|
||||
};
|
||||
};
|
||||
|
||||
union TMatrixIndexB
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 Tex4MtxIdx : 6;
|
||||
u32 Tex5MtxIdx : 6;
|
||||
u32 Tex6MtxIdx : 6;
|
||||
u32 Tex7MtxIdx : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Hex : 24;
|
||||
u32 unused : 8;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Tex4MtxIdx : 6;
|
||||
u32 Tex5MtxIdx : 6;
|
||||
u32 Tex6MtxIdx : 6;
|
||||
u32 Tex7MtxIdx : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Hex : 24;
|
||||
u32 unused : 8;
|
||||
};
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
|
|
@ -325,7 +325,7 @@ void Write16(const u16 _Value, const u32 _Address)
|
|||
case CLEAR_REGISTER:
|
||||
{
|
||||
UCPClearReg tmpCtrl(_Value);
|
||||
m_CPClearReg.Hex = tmpCtrl.Hex;
|
||||
m_CPClearReg.Hex = tmpCtrl.Hex;
|
||||
DEBUG_LOG(COMMANDPROCESSOR,"\t write to CLEAR_REGISTER : %04x", _Value);
|
||||
SetCpClearRegister();
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ void Write16(const u16 _Value, const u32 _Address)
|
|||
}
|
||||
else
|
||||
{
|
||||
ResetVideoBuffer();
|
||||
ResetVideoBuffer();
|
||||
}
|
||||
IncrementCheckContextId();
|
||||
DEBUG_LOG(COMMANDPROCESSOR,"try to write to FIFO_RW_DISTANCE_HI : %04x", _Value);
|
||||
|
@ -462,7 +462,6 @@ void STACKALIGN GatherPipeBursted()
|
|||
ProcessFifoAllDistance();
|
||||
waitingForPEInterruptDisable = false;
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -492,11 +491,11 @@ void STACKALIGN GatherPipeBursted()
|
|||
|
||||
void UpdateInterrupts(u64 userdata)
|
||||
{
|
||||
if (userdata)
|
||||
if (userdata)
|
||||
{
|
||||
interruptSet = true;
|
||||
INFO_LOG(COMMANDPROCESSOR,"Interrupt set");
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true);
|
||||
INFO_LOG(COMMANDPROCESSOR,"Interrupt set");
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -504,7 +503,7 @@ void UpdateInterrupts(u64 userdata)
|
|||
INFO_LOG(COMMANDPROCESSOR,"Interrupt cleared");
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, false);
|
||||
}
|
||||
interruptWaiting = false;
|
||||
interruptWaiting = false;
|
||||
}
|
||||
|
||||
void UpdateInterruptsFromVideoBackend(u64 userdata)
|
||||
|
@ -520,11 +519,11 @@ void AbortFrame()
|
|||
|
||||
void SetCpStatus(bool isCPUThread)
|
||||
{
|
||||
// overflow & underflow check
|
||||
// overflow & underflow check
|
||||
fifo.bFF_HiWatermark = (fifo.CPReadWriteDistance > fifo.CPHiWatermark);
|
||||
fifo.bFF_LoWatermark = (fifo.CPReadWriteDistance < fifo.CPLoWatermark);
|
||||
fifo.bFF_LoWatermark = (fifo.CPReadWriteDistance < fifo.CPLoWatermark);
|
||||
|
||||
// breakpoint
|
||||
// breakpoint
|
||||
if (!isCPUThread)
|
||||
{
|
||||
if (fifo.bFF_BPEnable)
|
||||
|
@ -562,12 +561,12 @@ void SetCpStatus(bool isCPUThread)
|
|||
isHiWatermarkActive = ovfInt && m_CPCtrlReg.GPReadEnable;
|
||||
isLoWatermarkActive = undfInt && m_CPCtrlReg.GPReadEnable;
|
||||
|
||||
if (interrupt != interruptSet && !interruptWaiting)
|
||||
{
|
||||
u64 userdata = interrupt?1:0;
|
||||
if (IsOnThread())
|
||||
{
|
||||
if (!interrupt || bpInt || undfInt || ovfInt)
|
||||
if (interrupt != interruptSet && !interruptWaiting)
|
||||
{
|
||||
u64 userdata = interrupt?1:0;
|
||||
if (IsOnThread())
|
||||
{
|
||||
if (!interrupt || bpInt || undfInt || ovfInt)
|
||||
{
|
||||
if (!isCPUThread)
|
||||
{
|
||||
|
@ -579,14 +578,14 @@ void SetCpStatus(bool isCPUThread)
|
|||
{
|
||||
// CPU thread:
|
||||
interruptSet = interrupt;
|
||||
INFO_LOG(COMMANDPROCESSOR,"Interrupt set");
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, interrupt);
|
||||
INFO_LOG(COMMANDPROCESSOR,"Interrupt set");
|
||||
ProcessorInterface::SetInterrupt(INT_CAUSE_CP, interrupt);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
CommandProcessor::UpdateInterrupts(userdata);
|
||||
}
|
||||
}
|
||||
else
|
||||
CommandProcessor::UpdateInterrupts(userdata);
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessFifoToLoWatermark()
|
||||
|
|
|
@ -80,7 +80,7 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
|||
static bool mouseLookEnabled = false;
|
||||
static bool mouseMoveEnabled = false;
|
||||
static float lastMouse[2];
|
||||
POINT point;
|
||||
POINT point;
|
||||
switch(iMsg)
|
||||
{
|
||||
case WM_USER_KEYDOWN:
|
||||
|
@ -133,7 +133,7 @@ void FreeLookInput( UINT iMsg, WPARAM wParam )
|
|||
lastMouse[1] = (float)point.y;
|
||||
mouseLookEnabled= true;
|
||||
break;
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_MBUTTONDOWN:
|
||||
GetCursorPos(&point);
|
||||
lastMouse[0] = (float)point.x;
|
||||
lastMouse[1] = (float)point.y;
|
||||
|
|
|
@ -43,10 +43,10 @@ static int size = 0;
|
|||
|
||||
void Fifo_DoState(PointerWrap &p)
|
||||
{
|
||||
p.DoArray(videoBuffer, FIFO_SIZE);
|
||||
p.Do(size);
|
||||
p.DoPointer(g_pVideoData, videoBuffer);
|
||||
p.Do(g_bSkipCurrentFrame);
|
||||
p.DoArray(videoBuffer, FIFO_SIZE);
|
||||
p.Do(size);
|
||||
p.DoPointer(g_pVideoData, videoBuffer);
|
||||
p.Do(g_bSkipCurrentFrame);
|
||||
}
|
||||
|
||||
void Fifo_PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
|
@ -69,8 +69,8 @@ void Fifo_PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
|||
|
||||
|
||||
void Fifo_Init()
|
||||
{
|
||||
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
|
||||
{
|
||||
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
|
||||
size = 0;
|
||||
GpuRunningState = false;
|
||||
Common::AtomicStore(CommandProcessor::VITicks, CommandProcessor::m_cpClockOrigin);
|
||||
|
@ -79,12 +79,12 @@ void Fifo_Init()
|
|||
void Fifo_Shutdown()
|
||||
{
|
||||
if (GpuRunningState) PanicAlert("Fifo shutting down while active");
|
||||
FreeMemoryPages(videoBuffer, FIFO_SIZE);
|
||||
FreeMemoryPages(videoBuffer, FIFO_SIZE);
|
||||
}
|
||||
|
||||
u8* GetVideoBufferStartPtr()
|
||||
{
|
||||
return videoBuffer;
|
||||
return videoBuffer;
|
||||
}
|
||||
|
||||
u8* GetVideoBufferEndPtr()
|
||||
|
@ -119,20 +119,20 @@ void EmulatorState(bool running)
|
|||
// Description: RunGpuLoop() sends data through this function.
|
||||
void ReadDataFromFifo(u8* _uData, u32 len)
|
||||
{
|
||||
if (size + len >= FIFO_SIZE)
|
||||
{
|
||||
if (size + len >= FIFO_SIZE)
|
||||
{
|
||||
int pos = (int)(g_pVideoData - videoBuffer);
|
||||
size -= pos;
|
||||
if (size + len > FIFO_SIZE)
|
||||
{
|
||||
PanicAlert("FIFO out of bounds (sz = %i, len = %i at %08x)", size, len, pos);
|
||||
}
|
||||
memmove(&videoBuffer[0], &videoBuffer[pos], size);
|
||||
if (size + len > FIFO_SIZE)
|
||||
{
|
||||
PanicAlert("FIFO out of bounds (sz = %i, len = %i at %08x)", size, len, pos);
|
||||
}
|
||||
memmove(&videoBuffer[0], &videoBuffer[pos], size);
|
||||
g_pVideoData = videoBuffer;
|
||||
}
|
||||
}
|
||||
// Copy new video instructions to videoBuffer for future use in rendering the new picture
|
||||
memcpy(videoBuffer + size, _uData, len);
|
||||
size += len;
|
||||
memcpy(videoBuffer + size, _uData, len);
|
||||
size += len;
|
||||
}
|
||||
|
||||
void ResetVideoBuffer()
|
||||
|
@ -153,7 +153,7 @@ void RunGpuLoop()
|
|||
|
||||
while (GpuRunningState)
|
||||
{
|
||||
g_video_backend->PeekMessages();
|
||||
g_video_backend->PeekMessages();
|
||||
|
||||
VideoFifo_CheckAsyncRequest();
|
||||
|
||||
|
@ -240,7 +240,7 @@ void RunGpu()
|
|||
while (fifo.bFF_GPReadEnable && fifo.CPReadWriteDistance && !AtBreakpoint() )
|
||||
{
|
||||
u8 *uData = Memory::GetPointer(fifo.CPReadPointer);
|
||||
|
||||
|
||||
FPURoundMode::SaveSIMDState();
|
||||
FPURoundMode::LoadDefaultSIMDState();
|
||||
ReadDataFromFifo(uData, 32);
|
||||
|
|
|
@ -60,12 +60,12 @@ const XFBSourceBase* const* FramebufferManagerBase::GetRealXFBSource(u32 xfbAddr
|
|||
m_realXFBSource->texHeight = fbHeight;
|
||||
|
||||
// TODO: stuff only used by OGL... :/
|
||||
// OpenGL texture coordinates originate at the lower left, which is why
|
||||
// sourceRc.top = fbHeight and sourceRc.bottom = 0.
|
||||
m_realXFBSource->sourceRc.left = 0;
|
||||
m_realXFBSource->sourceRc.top = fbHeight;
|
||||
m_realXFBSource->sourceRc.right = fbWidth;
|
||||
m_realXFBSource->sourceRc.bottom = 0;
|
||||
// OpenGL texture coordinates originate at the lower left, which is why
|
||||
// sourceRc.top = fbHeight and sourceRc.bottom = 0.
|
||||
m_realXFBSource->sourceRc.left = 0;
|
||||
m_realXFBSource->sourceRc.top = fbHeight;
|
||||
m_realXFBSource->sourceRc.right = fbWidth;
|
||||
m_realXFBSource->sourceRc.bottom = 0;
|
||||
|
||||
// Decode YUYV data from GameCube RAM
|
||||
m_realXFBSource->DecodeToTexture(xfbAddr, fbWidth, fbHeight);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace DLCache
|
||||
{
|
||||
|
||||
|
||||
void Init()
|
||||
{
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ void Shutdown()
|
|||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
void ProgressiveCleanup()
|
||||
|
|
|
@ -480,7 +480,7 @@ inline void decodebytesARGB8_4ToRgba(u32 *dst, const u16 *src, const u16 * src2)
|
|||
{
|
||||
#if 0
|
||||
for (int x = 0; x < 4; x++) {
|
||||
dst[x] = ((src[x] & 0xFF) << 24) | ((src[x] & 0xFF00)>>8) | (src2[x] << 8);
|
||||
dst[x] = ((src[x] & 0xFF) << 24) | ((src[x] & 0xFF00)>>8) | (src2[x] << 8);
|
||||
}
|
||||
#else
|
||||
dst[0] = ((src[0] & 0xFF) << 24) | ((src[0] & 0xFF00)>>8) | (src2[0] << 8);
|
||||
|
@ -519,7 +519,7 @@ void decodeDXTBlock(u32 *dst, const DXTBlock *src, int pitch)
|
|||
{
|
||||
int blue3 = ((blue2 - blue1) >> 1) - ((blue2 - blue1) >> 3);
|
||||
int green3 = ((green2 - green1) >> 1) - ((green2 - green1) >> 3);
|
||||
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
|
||||
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
|
||||
colors[2] = makecol(red1 + red3, green1 + green3, blue1 + blue3, 255);
|
||||
colors[3] = makecol(red2 - red3, green2 - green3, blue2 - blue3, 255);
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ void decodeDXTBlockRGBA(u32 *dst, const DXTBlock *src, int pitch)
|
|||
{
|
||||
int blue3 = ((blue2 - blue1) >> 1) - ((blue2 - blue1) >> 3);
|
||||
int green3 = ((green2 - green1) >> 1) - ((green2 - green1) >> 3);
|
||||
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
|
||||
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
|
||||
colors[2] = makeRGBA(red1 + red3, green1 + green3, blue1 + blue3, 255);
|
||||
colors[3] = makeRGBA(red2 - red3, green2 - green3, blue2 - blue3, 255);
|
||||
}
|
||||
|
@ -664,22 +664,22 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
if (tlutfmt == 2)
|
||||
{
|
||||
// Special decoding is required for TLUT format 5A3
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = yStep * 8; iy < 8; iy++, xStep++)
|
||||
decodebytesC4_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr);
|
||||
decodebytesC4_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = yStep * 8; iy < 8; iy++, xStep++)
|
||||
decodebytesC4_To_Raw16((u16*)dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr);
|
||||
decodebytesC4_To_Raw16((u16*)dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr);
|
||||
}
|
||||
return GetPCFormatFromTLUTFormat(tlutfmt);
|
||||
case GX_TF_I4:
|
||||
{
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = yStep * 8 ; iy < 8; iy++,xStep++)
|
||||
for (int ix = 0; ix < 4; ix++)
|
||||
|
@ -692,19 +692,17 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
return PC_TEX_FMT_I4_AS_I8;
|
||||
case GX_TF_I8: // speed critical
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
{
|
||||
((u64*)(dst + (y + iy) * width + x))[0] = ((u64*)(src + 8 * xStep))[0];
|
||||
}
|
||||
}
|
||||
return PC_TEX_FMT_I8;
|
||||
case GX_TF_C8:
|
||||
if (tlutfmt == 2)
|
||||
{
|
||||
// Special decoding is required for TLUT format 5A3
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC8_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr);
|
||||
|
@ -713,7 +711,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
{
|
||||
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC8_To_Raw16((u16*)dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr);
|
||||
|
@ -722,7 +720,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
return GetPCFormatFromTLUTFormat(tlutfmt);
|
||||
case GX_TF_IA4:
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesIA4((u16*)dst + (y + iy) * width + x, src + 8 * xStep);
|
||||
|
@ -730,7 +728,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
return PC_TEX_FMT_IA4_AS_IA8;
|
||||
case GX_TF_IA8:
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
for (int iy = 0, xStep = yStep * 4; iy < 4; iy++, xStep++)
|
||||
{
|
||||
|
@ -739,21 +737,20 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
for(int j = 0; j < 4; j++)
|
||||
*ptr++ = Common::swap16(*s++);
|
||||
}
|
||||
|
||||
}
|
||||
return PC_TEX_FMT_IA8;
|
||||
case GX_TF_C14X2:
|
||||
if (tlutfmt == 2)
|
||||
{
|
||||
// Special decoding is required for TLUT format 5A3
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC14X2_5A3_To_BGRA32((u32*)dst + (y + iy) * width + x, (u16*)(src + 8 * xStep), tlutaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC14X2_To_Raw16((u16*)dst + (y + iy) * width + x,(u16*)(src + 8 * xStep), tlutaddr);
|
||||
|
@ -761,7 +758,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
return GetPCFormatFromTLUTFormat(tlutfmt);
|
||||
case GX_TF_RGB565:
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
{
|
||||
|
@ -774,7 +771,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
return PC_TEX_FMT_RGB565;
|
||||
case GX_TF_RGB5A3:
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
//decodebytesRGB5A3((u32*)dst+(y+iy)*width+x, (u16*)src, 4);
|
||||
|
@ -783,15 +780,14 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
return PC_TEX_FMT_BGRA32;
|
||||
case GX_TF_RGBA8: // speed critical
|
||||
{
|
||||
|
||||
for (int y = 0; y < height; y += 4)
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
{
|
||||
const u8* src2 = src + 64 * yStep;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
decodebytesARGB8_4((u32*)dst + (y+iy)*width + x, (u16*)src2 + 4 * iy, (u16*)src2 + 4 * iy + 16);
|
||||
}
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
{
|
||||
const u8* src2 = src + 64 * yStep;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
decodebytesARGB8_4((u32*)dst + (y+iy)*width + x, (u16*)src2 + 4 * iy, (u16*)src2 + 4 * iy + 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
return PC_TEX_FMT_BGRA32;
|
||||
|
@ -817,7 +813,7 @@ PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int heigh
|
|||
}
|
||||
return PC_TEX_FMT_DXT1;
|
||||
#else
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int y = 0; y < height; y += 8)
|
||||
{
|
||||
for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8, yStep++)
|
||||
{
|
||||
|
@ -862,22 +858,21 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
|
|||
if (tlutfmt == 2)
|
||||
{
|
||||
// Special decoding is required for TLUT format 5A3
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8,yStep++)
|
||||
for (int iy = 0, xStep = 8 * yStep; iy < 8; iy++,xStep++)
|
||||
decodebytesC4_5A3_To_rgba32(dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr);
|
||||
}
|
||||
else if(tlutfmt == 0)
|
||||
{
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8,yStep++)
|
||||
for (int iy = 0, xStep = 8 * yStep; iy < 8; iy++,xStep++)
|
||||
decodebytesC4IA8_To_RGBA(dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0, yStep = (y / 8) * Wsteps8; x < width; x += 8,yStep++)
|
||||
for (int iy = 0, xStep = 8 * yStep; iy < 8; iy++,xStep++)
|
||||
decodebytesC4RGB565_To_RGBA(dst + (y + iy) * width + x, src + 4 * xStep, tlutaddr);
|
||||
|
@ -925,34 +920,33 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
|
|||
if (tlutfmt == 2)
|
||||
{
|
||||
// Special decoding is required for TLUT format 5A3
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC8_5A3_To_RGBA32((u32*)dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr);
|
||||
}
|
||||
else if(tlutfmt == 0)
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC8IA8_To_RGBA(dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr);
|
||||
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC8IA8_To_RGBA(dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC8RGB565_To_RGBA(dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr);
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC8RGB565_To_RGBA(dst + (y + iy) * width + x, src + 8 * xStep, tlutaddr);
|
||||
|
||||
}
|
||||
break;
|
||||
case GX_TF_IA4:
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesIA4RGBA(dst + (y + iy) * width + x, src + 8 * xStep);
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps8; x < width; x += 8, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesIA4RGBA(dst + (y + iy) * width + x, src + 8 * xStep);
|
||||
}
|
||||
break;
|
||||
case GX_TF_IA8:
|
||||
|
@ -975,21 +969,21 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
|
|||
if (tlutfmt == 2)
|
||||
{
|
||||
// Special decoding is required for TLUT format 5A3
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC14X2_5A3_To_BGRA32(dst + (y + iy) * width + x, (u16*)(src + 8 * xStep), tlutaddr);
|
||||
}
|
||||
else if (tlutfmt == 0)
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC14X2IA8_To_RGBA(dst + (y + iy) * width + x, (u16*)(src + 8 * xStep), tlutaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int y = 0; y < height; y += 4)
|
||||
for (int x = 0, yStep = (y / 4) * Wsteps4; x < width; x += 4, yStep++)
|
||||
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
|
||||
decodebytesC14X2rgb565_To_RGBA(dst + (y + iy) * width + x, (u16*)(src + 8 * xStep), tlutaddr);
|
||||
|
@ -1130,7 +1124,7 @@ PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, in
|
|||
dtp[(y + yoff)*width + x + xoff] = ptr[x] ? 0xFFFF : 0x0000;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
default:
|
||||
case PC_TEX_FMT_BGRA32:
|
||||
{
|
||||
int *dtp = (int*)dst;
|
||||
|
@ -1160,7 +1154,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u32 base = (tBlk * widthBlks + sBlk) * blockWidth * blockHeight;
|
||||
u16 blkS = s & (blockWidth - 1);
|
||||
u16 blkT = t & (blockHeight - 1);
|
||||
u32 blkOff = blkT * blockWidth + blkS;
|
||||
u32 blkOff = blkT * blockWidth + blkS;
|
||||
*/
|
||||
|
||||
switch (texformat)
|
||||
|
@ -1174,9 +1168,9 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 7;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
int rs = (blkOff & 1)?0:4;
|
||||
u32 offset = base + (blkOff >> 1);
|
||||
u32 offset = base + (blkOff >> 1);
|
||||
|
||||
u8 val = (*(src + offset) >> rs) & 0xF;
|
||||
u16 *tlut = (u16*)(texMem + tlutaddr);
|
||||
|
@ -1186,7 +1180,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
case 0:
|
||||
*((u32*)dst) = decodeIA8Swapped(tlut[val]);
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
*((u32*)dst) = decode565RGBA(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 2:
|
||||
|
@ -1204,9 +1198,9 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 7;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
int rs = (blkOff & 1)?0:4;
|
||||
u32 offset = base + (blkOff >> 1);
|
||||
u32 offset = base + (blkOff >> 1);
|
||||
|
||||
u8 val = (*(src + offset) >> rs) & 0xF;
|
||||
val = Convert4To8(val);
|
||||
|
@ -1225,7 +1219,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
u8 val = *(src + base + blkOff);
|
||||
dst[0] = val;
|
||||
dst[1] = val;
|
||||
|
@ -1242,7 +1236,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
u8 val = *(src + base + blkOff);
|
||||
u16 *tlut = (u16*)(texMem + tlutaddr);
|
||||
|
||||
|
@ -1251,7 +1245,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
case 0:
|
||||
*((u32*)dst) = decodeIA8Swapped(tlut[val]);
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
*((u32*)dst) = decode565RGBA(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 2:
|
||||
|
@ -1269,7 +1263,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
u8 val = *(src + base + blkOff);
|
||||
const u8 a = Convert4To8(val>>4);
|
||||
const u8 l = Convert4To8(val&0xF);
|
||||
|
@ -1288,7 +1282,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 2) + blkS;
|
||||
|
||||
|
||||
u32 offset = (base + blkOff) << 1;
|
||||
const u16* valAddr = (u16*)(src + offset);
|
||||
|
||||
|
@ -1304,7 +1298,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 2) + blkS;
|
||||
|
||||
|
||||
u32 offset = (base + blkOff) << 1;
|
||||
const u16* valAddr = (u16*)(src + offset);
|
||||
|
||||
|
@ -1316,7 +1310,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
case 0:
|
||||
*((u32*)dst) = decodeIA8Swapped(tlut[val]);
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
*((u32*)dst) = decode565RGBA(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 2:
|
||||
|
@ -1334,7 +1328,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 2) + blkS;
|
||||
|
||||
|
||||
u32 offset = (base + blkOff) << 1;
|
||||
const u16* valAddr = (u16*)(src + offset);
|
||||
|
||||
|
@ -1392,7 +1386,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u32 offset = (base + blkOff) << 3;
|
||||
|
||||
const DXTBlock* dxtBlock = (const DXTBlock*)(src + offset);
|
||||
|
||||
|
||||
u16 c1 = Common::swap16(dxtBlock->color1);
|
||||
u16 c2 = Common::swap16(dxtBlock->color2);
|
||||
int blue1 = Convert5To8(c1 & 0x1F);
|
||||
|
@ -1411,7 +1405,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
colorSel |= c1 > c2?0:4;
|
||||
|
||||
u32 color = 0;
|
||||
|
||||
|
||||
switch (colorSel)
|
||||
{
|
||||
case 0:
|
||||
|
|
|
@ -25,22 +25,22 @@
|
|||
|
||||
struct TGA_HEADER
|
||||
{
|
||||
u8 identsize; // size of ID field that follows 18 u8 header (0 usually)
|
||||
u8 colourmaptype; // type of colour map 0=none, 1=has palette
|
||||
u8 imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
|
||||
u8 identsize; // size of ID field that follows 18 u8 header (0 usually)
|
||||
u8 colourmaptype; // type of colour map 0=none, 1=has palette
|
||||
u8 imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
|
||||
|
||||
s16 colourmapstart; // first colour map entry in palette
|
||||
s16 colourmaplength; // number of colours in palette
|
||||
u8 colourmapbits; // number of bits per palette entry 15,16,24,32
|
||||
s16 colourmapstart; // first colour map entry in palette
|
||||
s16 colourmaplength; // number of colours in palette
|
||||
u8 colourmapbits; // number of bits per palette entry 15,16,24,32
|
||||
|
||||
s16 xstart; // image x origin
|
||||
s16 ystart; // image y origin
|
||||
s16 width; // image width in pixels
|
||||
s16 height; // image height in pixels
|
||||
u8 bits; // image bits per pixel 8,16,24,32
|
||||
u8 descriptor; // image descriptor bits (vh flip bits)
|
||||
|
||||
// pixel data follows header
|
||||
s16 xstart; // image x origin
|
||||
s16 ystart; // image y origin
|
||||
s16 width; // image width in pixels
|
||||
s16 height; // image height in pixels
|
||||
u8 bits; // image bits per pixel 8,16,24,32
|
||||
u8 descriptor; // image descriptor bits (vh flip bits)
|
||||
|
||||
// pixel data follows header
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
@ -53,7 +53,7 @@ bool SaveTGA(const char* filename, int width, int height, void* pdata)
|
|||
return false;
|
||||
|
||||
_assert_(sizeof(TGA_HEADER) == 18 && sizeof(hdr) == 18);
|
||||
|
||||
|
||||
memset(&hdr, 0, sizeof(hdr));
|
||||
hdr.imagetype = 2;
|
||||
hdr.bits = 32;
|
||||
|
|
|
@ -63,7 +63,7 @@ void IndexGenerator::AddIndices(int primitive, u32 numVerts)
|
|||
//case GX_DRAW_TRIANGLES: IndexGenerator::AddList(numVerts); break;
|
||||
//case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(numVerts); break;
|
||||
//case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(numVerts); break;
|
||||
//case GX_DRAW_LINES: IndexGenerator::AddLineList(numVerts); break;
|
||||
//case GX_DRAW_LINES: IndexGenerator::AddLineList(numVerts); break;
|
||||
//case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(numVerts); break;
|
||||
//case GX_DRAW_POINTS: IndexGenerator::AddPoints(numVerts); break;
|
||||
//}
|
||||
|
|
|
@ -27,17 +27,17 @@ class IndexGenerator
|
|||
public:
|
||||
// Init
|
||||
static void Start(u16 *Triangleptr,u16 *Lineptr,u16 *Pointptr);
|
||||
|
||||
|
||||
static void AddIndices(int primitive, u32 numVertices);
|
||||
|
||||
|
||||
// Interface
|
||||
static u32 GetNumTriangles() {return numT;}
|
||||
static u32 GetNumLines() {return numL;}
|
||||
static u32 GetNumPoints() {return numP;}
|
||||
|
||||
|
||||
// returns numprimitives
|
||||
static u32 GetNumVerts() {return index;}
|
||||
|
||||
|
||||
static u32 GetTriangleindexLen() {return (u32)(Tptr - BASETptr);}
|
||||
static u32 GetLineindexLen() {return (u32)(Lptr - BASELptr);}
|
||||
static u32 GetPointindexLen() {return (u32)(Pptr - BASEPptr);}
|
||||
|
@ -56,16 +56,16 @@ private:
|
|||
static void AddStrip(u32 numVerts);
|
||||
static void AddFan(u32 numVerts);
|
||||
static void AddQuads(u32 numVerts);
|
||||
|
||||
|
||||
// Lines
|
||||
static void AddLineList(u32 numVerts);
|
||||
static void AddLineStrip(u32 numVerts);
|
||||
|
||||
|
||||
// Points
|
||||
static void AddPoints(u32 numVerts);
|
||||
|
||||
|
||||
static void WriteTriangle(u32 index1, u32 index2, u32 index3);
|
||||
|
||||
|
||||
static u16 *Tptr;
|
||||
static u16 *BASETptr;
|
||||
static u16 *Lptr;
|
||||
|
|
|
@ -123,7 +123,7 @@ void InterpretDisplayList(u32 address, u32 size)
|
|||
Statistics::SwapDL();
|
||||
}
|
||||
|
||||
// reset to the old pointer
|
||||
// reset to the old pointer
|
||||
g_pVideoData = old_pVideoData;
|
||||
}
|
||||
|
||||
|
@ -140,14 +140,14 @@ u32 FifoCommandRunnable(u32 &command_size)
|
|||
{
|
||||
u32 cycleTime = 0;
|
||||
u32 buffer_size = (u32)(GetVideoBufferEndPtr() - g_pVideoData);
|
||||
if (buffer_size == 0)
|
||||
if (buffer_size == 0)
|
||||
return 0; // can't peek
|
||||
|
||||
u8 cmd_byte = DataPeek8(0);
|
||||
|
||||
switch (cmd_byte)
|
||||
{
|
||||
case GX_NOP: // Hm, this means that we scan over nop streams pretty slowly...
|
||||
switch (cmd_byte)
|
||||
{
|
||||
case GX_NOP: // Hm, this means that we scan over nop streams pretty slowly...
|
||||
command_size = 1;
|
||||
cycleTime = 6;
|
||||
break;
|
||||
|
@ -155,30 +155,30 @@ u32 FifoCommandRunnable(u32 &command_size)
|
|||
command_size = 1;
|
||||
cycleTime = 6;
|
||||
break;
|
||||
case GX_CMD_UNKNOWN_METRICS: // zelda 4 swords calls it and checks the metrics registers after that
|
||||
command_size = 1;
|
||||
case GX_CMD_UNKNOWN_METRICS: // zelda 4 swords calls it and checks the metrics registers after that
|
||||
command_size = 1;
|
||||
cycleTime = 6;
|
||||
break;
|
||||
break;
|
||||
|
||||
case GX_LOAD_BP_REG:
|
||||
command_size = 5;
|
||||
case GX_LOAD_BP_REG:
|
||||
command_size = 5;
|
||||
cycleTime = 12;
|
||||
break;
|
||||
break;
|
||||
|
||||
case GX_LOAD_CP_REG:
|
||||
command_size = 6;
|
||||
case GX_LOAD_CP_REG:
|
||||
command_size = 6;
|
||||
cycleTime = 12;
|
||||
break;
|
||||
break;
|
||||
|
||||
case GX_LOAD_INDX_A:
|
||||
case GX_LOAD_INDX_B:
|
||||
case GX_LOAD_INDX_C:
|
||||
case GX_LOAD_INDX_D:
|
||||
command_size = 5;
|
||||
case GX_LOAD_INDX_A:
|
||||
case GX_LOAD_INDX_B:
|
||||
case GX_LOAD_INDX_C:
|
||||
case GX_LOAD_INDX_D:
|
||||
command_size = 5;
|
||||
cycleTime = 6; // TODO
|
||||
break;
|
||||
break;
|
||||
|
||||
case GX_CMD_CALL_DL:
|
||||
case GX_CMD_CALL_DL:
|
||||
{
|
||||
// FIXME: Calculate the cycle time of the display list.
|
||||
//u32 address = DataPeek32(1);
|
||||
|
@ -208,42 +208,42 @@ u32 FifoCommandRunnable(u32 &command_size)
|
|||
command_size = 9;
|
||||
cycleTime = 45; // This is unverified
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case GX_LOAD_XF_REG:
|
||||
{
|
||||
// check if we can read the header
|
||||
if (buffer_size >= 5)
|
||||
{
|
||||
command_size = 1 + 4;
|
||||
u32 Cmd2 = DataPeek32(1);
|
||||
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
|
||||
command_size += transfer_size * 4;
|
||||
case GX_LOAD_XF_REG:
|
||||
{
|
||||
// check if we can read the header
|
||||
if (buffer_size >= 5)
|
||||
{
|
||||
command_size = 1 + 4;
|
||||
u32 Cmd2 = DataPeek32(1);
|
||||
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
|
||||
command_size += transfer_size * 4;
|
||||
cycleTime = 18 + 6 * transfer_size;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (cmd_byte & 0x80)
|
||||
{
|
||||
// check if we can read the header
|
||||
if (buffer_size >= 3)
|
||||
default:
|
||||
if (cmd_byte & 0x80)
|
||||
{
|
||||
// check if we can read the header
|
||||
if (buffer_size >= 3)
|
||||
{
|
||||
command_size = 1 + 2;
|
||||
u16 numVertices = DataPeek16(1);
|
||||
command_size = 1 + 2;
|
||||
u16 numVertices = DataPeek16(1);
|
||||
command_size += numVertices * VertexLoaderManager::GetVertexSize(cmd_byte & GX_VAT_MASK);
|
||||
cycleTime = 1600; // This depends on the number of pixels rendered
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO(Omega): Maybe dump FIFO to file on this error
|
||||
|
@ -258,7 +258,7 @@ u32 FifoCommandRunnable(u32 &command_size)
|
|||
Host_SysMessage(szTemp);
|
||||
INFO_LOG(VIDEO, "%s", szTemp);
|
||||
{
|
||||
SCPFifoStruct &fifo = CommandProcessor::fifo;
|
||||
SCPFifoStruct &fifo = CommandProcessor::fifo;
|
||||
|
||||
char szTmp[512];
|
||||
// sprintf(szTmp, "Illegal command %02x (at %08x)",cmd_byte,g_pDataReader->GetPtr());
|
||||
|
@ -283,18 +283,18 @@ u32 FifoCommandRunnable(u32 &command_size)
|
|||
Host_SysMessage(szTmp);
|
||||
INFO_LOG(VIDEO, "%s", szTmp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (command_size > buffer_size)
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// INFO_LOG("OP detected: cmd_byte 0x%x size %i buffer %i",cmd_byte, command_size, buffer_size);
|
||||
if (command_size > buffer_size)
|
||||
return 0;
|
||||
|
||||
// INFO_LOG("OP detected: cmd_byte 0x%x size %i buffer %i",cmd_byte, command_size, buffer_size);
|
||||
if (cycleTime == 0)
|
||||
cycleTime = 6;
|
||||
|
||||
return cycleTime;
|
||||
return cycleTime;
|
||||
}
|
||||
|
||||
u32 FifoCommandRunnable()
|
||||
|
@ -305,92 +305,92 @@ u32 FifoCommandRunnable()
|
|||
|
||||
static void Decode()
|
||||
{
|
||||
u8 *opcodeStart = g_pVideoData;
|
||||
u8 *opcodeStart = g_pVideoData;
|
||||
|
||||
int cmd_byte = DataReadU8();
|
||||
switch (cmd_byte)
|
||||
{
|
||||
case GX_NOP:
|
||||
break;
|
||||
int cmd_byte = DataReadU8();
|
||||
switch (cmd_byte)
|
||||
{
|
||||
case GX_NOP:
|
||||
break;
|
||||
|
||||
case GX_LOAD_CP_REG: //0x08
|
||||
{
|
||||
u8 sub_cmd = DataReadU8();
|
||||
u32 value = DataReadU32();
|
||||
LoadCPReg(sub_cmd, value);
|
||||
case GX_LOAD_CP_REG: //0x08
|
||||
{
|
||||
u8 sub_cmd = DataReadU8();
|
||||
u32 value = DataReadU32();
|
||||
LoadCPReg(sub_cmd, value);
|
||||
INCSTAT(stats.thisFrame.numCPLoads);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_LOAD_XF_REG:
|
||||
{
|
||||
u32 Cmd2 = DataReadU32();
|
||||
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
|
||||
case GX_LOAD_XF_REG:
|
||||
{
|
||||
u32 Cmd2 = DataReadU32();
|
||||
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
|
||||
u32 xf_address = Cmd2 & 0xFFFF;
|
||||
GC_ALIGNED128(u32 data_buffer[16]);
|
||||
DataReadU32xFuncs[transfer_size-1](data_buffer);
|
||||
LoadXFReg(transfer_size, xf_address, data_buffer);
|
||||
LoadXFReg(transfer_size, xf_address, data_buffer);
|
||||
|
||||
INCSTAT(stats.thisFrame.numXFLoads);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_LOAD_INDX_A: //used for position matrices
|
||||
LoadIndexedXF(DataReadU32(), 0xC);
|
||||
break;
|
||||
case GX_LOAD_INDX_B: //used for normal matrices
|
||||
LoadIndexedXF(DataReadU32(), 0xD);
|
||||
break;
|
||||
case GX_LOAD_INDX_C: //used for postmatrices
|
||||
LoadIndexedXF(DataReadU32(), 0xE);
|
||||
break;
|
||||
case GX_LOAD_INDX_D: //used for lights
|
||||
LoadIndexedXF(DataReadU32(), 0xF);
|
||||
break;
|
||||
case GX_LOAD_INDX_A: //used for position matrices
|
||||
LoadIndexedXF(DataReadU32(), 0xC);
|
||||
break;
|
||||
case GX_LOAD_INDX_B: //used for normal matrices
|
||||
LoadIndexedXF(DataReadU32(), 0xD);
|
||||
break;
|
||||
case GX_LOAD_INDX_C: //used for postmatrices
|
||||
LoadIndexedXF(DataReadU32(), 0xE);
|
||||
break;
|
||||
case GX_LOAD_INDX_D: //used for lights
|
||||
LoadIndexedXF(DataReadU32(), 0xF);
|
||||
break;
|
||||
|
||||
case GX_CMD_CALL_DL:
|
||||
{
|
||||
u32 address = DataReadU32();
|
||||
u32 count = DataReadU32();
|
||||
ExecuteDisplayList(address, count);
|
||||
}
|
||||
break;
|
||||
case GX_CMD_CALL_DL:
|
||||
{
|
||||
u32 address = DataReadU32();
|
||||
u32 count = DataReadU32();
|
||||
ExecuteDisplayList(address, count);
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_CMD_UNKNOWN_METRICS: // zelda 4 swords calls it and checks the metrics registers after that
|
||||
case GX_CMD_UNKNOWN_METRICS: // zelda 4 swords calls it and checks the metrics registers after that
|
||||
DEBUG_LOG(VIDEO, "GX 0x44: %08x", cmd_byte);
|
||||
break;
|
||||
break;
|
||||
|
||||
case GX_CMD_INVL_VC: // Invalidate Vertex Cache
|
||||
DEBUG_LOG(VIDEO, "Invalidate (vertex cache?)");
|
||||
break;
|
||||
case GX_CMD_INVL_VC: // Invalidate Vertex Cache
|
||||
DEBUG_LOG(VIDEO, "Invalidate (vertex cache?)");
|
||||
break;
|
||||
|
||||
case GX_LOAD_BP_REG: //0x61
|
||||
{
|
||||
case GX_LOAD_BP_REG: //0x61
|
||||
{
|
||||
u32 bp_cmd = DataReadU32();
|
||||
LoadBPReg(bp_cmd);
|
||||
LoadBPReg(bp_cmd);
|
||||
INCSTAT(stats.thisFrame.numBPLoads);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
// draw primitives
|
||||
default:
|
||||
if (cmd_byte & 0x80)
|
||||
{
|
||||
// load vertices (use computed vertex size from FifoCommandRunnable above)
|
||||
// draw primitives
|
||||
default:
|
||||
if (cmd_byte & 0x80)
|
||||
{
|
||||
// load vertices (use computed vertex size from FifoCommandRunnable above)
|
||||
u16 numVertices = DataReadU16();
|
||||
|
||||
VertexLoaderManager::RunVertices(
|
||||
cmd_byte & GX_VAT_MASK, // Vertex loader index (0 - 7)
|
||||
(cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
|
||||
numVertices);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(VIDEO, "OpcodeDecoding::Decode: Illegal command %02x", cmd_byte);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Display lists get added directly into the FIFO stream
|
||||
if (g_bRecordFifoData && cmd_byte != GX_CMD_CALL_DL)
|
||||
|
@ -399,89 +399,89 @@ static void Decode()
|
|||
|
||||
static void DecodeSemiNop()
|
||||
{
|
||||
u8 *opcodeStart = g_pVideoData;
|
||||
u8 *opcodeStart = g_pVideoData;
|
||||
|
||||
int cmd_byte = DataReadU8();
|
||||
switch (cmd_byte)
|
||||
{
|
||||
case GX_CMD_UNKNOWN_METRICS: // zelda 4 swords calls it and checks the metrics registers after that
|
||||
case GX_CMD_INVL_VC: // Invalidate Vertex Cache
|
||||
case GX_NOP:
|
||||
int cmd_byte = DataReadU8();
|
||||
switch (cmd_byte)
|
||||
{
|
||||
case GX_CMD_UNKNOWN_METRICS: // zelda 4 swords calls it and checks the metrics registers after that
|
||||
case GX_CMD_INVL_VC: // Invalidate Vertex Cache
|
||||
case GX_NOP:
|
||||
break;
|
||||
|
||||
case GX_LOAD_CP_REG: //0x08
|
||||
// We have to let CP writes through because they determine the size of vertices.
|
||||
{
|
||||
u8 sub_cmd = DataReadU8();
|
||||
u32 value = DataReadU32();
|
||||
LoadCPReg(sub_cmd, value);
|
||||
INCSTAT(stats.thisFrame.numCPLoads);
|
||||
}
|
||||
break;
|
||||
{
|
||||
u8 sub_cmd = DataReadU8();
|
||||
u32 value = DataReadU32();
|
||||
LoadCPReg(sub_cmd, value);
|
||||
INCSTAT(stats.thisFrame.numCPLoads);
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_LOAD_XF_REG:
|
||||
{
|
||||
u32 Cmd2 = DataReadU32();
|
||||
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
|
||||
u32 address = Cmd2 & 0xFFFF;
|
||||
GC_ALIGNED128(u32 data_buffer[16]);
|
||||
DataReadU32xFuncs[transfer_size-1](data_buffer);
|
||||
LoadXFReg(transfer_size, address, data_buffer);
|
||||
INCSTAT(stats.thisFrame.numXFLoads);
|
||||
}
|
||||
break;
|
||||
case GX_LOAD_XF_REG:
|
||||
{
|
||||
u32 Cmd2 = DataReadU32();
|
||||
int transfer_size = ((Cmd2 >> 16) & 15) + 1;
|
||||
u32 address = Cmd2 & 0xFFFF;
|
||||
GC_ALIGNED128(u32 data_buffer[16]);
|
||||
DataReadU32xFuncs[transfer_size-1](data_buffer);
|
||||
LoadXFReg(transfer_size, address, data_buffer);
|
||||
INCSTAT(stats.thisFrame.numXFLoads);
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_LOAD_INDX_A: //used for position matrices
|
||||
LoadIndexedXF(DataReadU32(), 0xC);
|
||||
break;
|
||||
case GX_LOAD_INDX_B: //used for normal matrices
|
||||
LoadIndexedXF(DataReadU32(), 0xD);
|
||||
break;
|
||||
case GX_LOAD_INDX_C: //used for postmatrices
|
||||
LoadIndexedXF(DataReadU32(), 0xE);
|
||||
break;
|
||||
case GX_LOAD_INDX_D: //used for lights
|
||||
LoadIndexedXF(DataReadU32(), 0xF);
|
||||
break;
|
||||
case GX_LOAD_INDX_A: //used for position matrices
|
||||
LoadIndexedXF(DataReadU32(), 0xC);
|
||||
break;
|
||||
case GX_LOAD_INDX_B: //used for normal matrices
|
||||
LoadIndexedXF(DataReadU32(), 0xD);
|
||||
break;
|
||||
case GX_LOAD_INDX_C: //used for postmatrices
|
||||
LoadIndexedXF(DataReadU32(), 0xE);
|
||||
break;
|
||||
case GX_LOAD_INDX_D: //used for lights
|
||||
LoadIndexedXF(DataReadU32(), 0xF);
|
||||
break;
|
||||
|
||||
case GX_CMD_CALL_DL:
|
||||
case GX_CMD_CALL_DL:
|
||||
// Hm, wonder if any games put tokens in display lists - in that case,
|
||||
// we'll have to parse them too.
|
||||
DataSkip(8);
|
||||
break;
|
||||
DataSkip(8);
|
||||
break;
|
||||
|
||||
case GX_LOAD_BP_REG: //0x61
|
||||
case GX_LOAD_BP_REG: //0x61
|
||||
// We have to let BP writes through because they set tokens and stuff.
|
||||
// TODO: Call a much simplified LoadBPReg instead.
|
||||
{
|
||||
{
|
||||
u32 bp_cmd = DataReadU32();
|
||||
LoadBPReg(bp_cmd);
|
||||
LoadBPReg(bp_cmd);
|
||||
INCSTAT(stats.thisFrame.numBPLoads);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
// draw primitives
|
||||
default:
|
||||
if (cmd_byte & 0x80)
|
||||
{
|
||||
// load vertices (use computed vertex size from FifoCommandRunnable above)
|
||||
// draw primitives
|
||||
default:
|
||||
if (cmd_byte & 0x80)
|
||||
{
|
||||
// load vertices (use computed vertex size from FifoCommandRunnable above)
|
||||
u16 numVertices = DataReadU16();
|
||||
DataSkip(numVertices * VertexLoaderManager::GetVertexSize(cmd_byte & GX_VAT_MASK));
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(VIDEO, "OpcodeDecoding::Decode: Illegal command %02x", cmd_byte);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_bRecordFifoData && cmd_byte != GX_CMD_CALL_DL)
|
||||
FifoRecorder::GetInstance().WriteGPCommand(opcodeStart, u32(g_pVideoData - opcodeStart));
|
||||
}
|
||||
|
||||
void OpcodeDecoder_Init()
|
||||
{
|
||||
{
|
||||
g_pVideoData = GetVideoBufferStartPtr();
|
||||
|
||||
#if _M_SSE >= 0x301
|
||||
|
@ -494,8 +494,8 @@ void OpcodeDecoder_Init()
|
|||
|
||||
if (g_Config.bEnableOpenCL)
|
||||
{
|
||||
OpenCL::Initialize();
|
||||
TexDecoder_OpenCL_Initialize();
|
||||
OpenCL::Initialize();
|
||||
TexDecoder_OpenCL_Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,8 +504,8 @@ void OpcodeDecoder_Shutdown()
|
|||
{
|
||||
if (g_Config.bEnableOpenCL)
|
||||
{
|
||||
TexDecoder_OpenCL_Shutdown();
|
||||
OpenCL::Destroy();
|
||||
TexDecoder_OpenCL_Shutdown();
|
||||
OpenCL::Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#define GX_DRAW_LINES 0x5 // 0xA8
|
||||
#define GX_DRAW_LINE_STRIP 0x6 // 0xB0
|
||||
#define GX_DRAW_POINTS 0x7 // 0xB8
|
||||
#define GX_DRAW_NONE 0x1; //Tis is a fake value to used in the backends
|
||||
#define GX_DRAW_NONE 0x1; //Tis is a fake value to used in the backends
|
||||
|
||||
extern bool g_bRecordFifoData;
|
||||
|
||||
|
|
|
@ -148,25 +148,25 @@ cl_program CompileProgram(const char *Kernel)
|
|||
// Build the program executable
|
||||
err = clBuildProgram(program , 0, NULL, NULL, NULL, NULL);
|
||||
if(err != CL_SUCCESS) {
|
||||
HandleCLError(err, "Error: failed to build program");
|
||||
HandleCLError(err, "Error: failed to build program");
|
||||
|
||||
char *buildlog = NULL;
|
||||
size_t buildlog_size = 0;
|
||||
size_t buildlog_size = 0;
|
||||
|
||||
clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &buildlog_size);
|
||||
buildlog = new char[buildlog_size + 1];
|
||||
err = clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, buildlog_size, buildlog, NULL);
|
||||
buildlog[buildlog_size] = 0;
|
||||
|
||||
if(err != CL_SUCCESS)
|
||||
{
|
||||
HandleCLError(err, "Error: can't get build log");
|
||||
} else
|
||||
{
|
||||
ERROR_LOG(COMMON, "Error log:\n%s\n", buildlog);
|
||||
}
|
||||
buildlog = new char[buildlog_size + 1];
|
||||
err = clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, buildlog_size, buildlog, NULL);
|
||||
buildlog[buildlog_size] = 0;
|
||||
|
||||
if(err != CL_SUCCESS)
|
||||
{
|
||||
HandleCLError(err, "Error: can't get build log");
|
||||
} else
|
||||
{
|
||||
ERROR_LOG(COMMON, "Error log:\n%s\n", buildlog);
|
||||
}
|
||||
|
||||
delete[] buildlog;
|
||||
delete[] buildlog;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void TexDecoder_OpenCL_Initialize()
|
|||
size_t nDevices = 0;
|
||||
cl_device_id *devices = NULL;
|
||||
size_t *binary_sizes = NULL;
|
||||
char **binaries = NULL;
|
||||
char **binaries = NULL;
|
||||
std::string filename;
|
||||
char dolphin_rev[HEADER_SIZE];
|
||||
|
||||
|
@ -132,7 +132,7 @@ void TexDecoder_OpenCL_Initialize()
|
|||
{
|
||||
OpenCL::HandleCLError(err, "clCreateProgramWithBinary");
|
||||
}
|
||||
|
||||
|
||||
if (!err)
|
||||
{
|
||||
err = clBuildProgram(g_program, 1, &OpenCL::device_id, NULL, NULL, NULL);
|
||||
|
|
|
@ -126,8 +126,8 @@ bool bbox_active;
|
|||
|
||||
enum
|
||||
{
|
||||
INT_CAUSE_PE_TOKEN = 0x200, // GP Token
|
||||
INT_CAUSE_PE_FINISH = 0x400, // GP Finished
|
||||
INT_CAUSE_PE_TOKEN = 0x200, // GP Token
|
||||
INT_CAUSE_PE_FINISH = 0x400, // GP Finished
|
||||
};
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
|
|
|
@ -24,13 +24,13 @@ class PointerWrap;
|
|||
// internal hardware addresses
|
||||
enum
|
||||
{
|
||||
PE_ZCONF = 0x00, // Z Config
|
||||
PE_ALPHACONF = 0x02, // Alpha Config
|
||||
PE_DSTALPHACONF = 0x04, // Destination Alpha Config
|
||||
PE_ALPHAMODE = 0x06, // Alpha Mode Config
|
||||
PE_ALPHAREAD = 0x08, // Alpha Read
|
||||
PE_ZCONF = 0x00, // Z Config
|
||||
PE_ALPHACONF = 0x02, // Alpha Config
|
||||
PE_DSTALPHACONF = 0x04, // Destination Alpha Config
|
||||
PE_ALPHAMODE = 0x06, // Alpha Mode Config
|
||||
PE_ALPHAREAD = 0x08, // Alpha Read
|
||||
PE_CTRL_REGISTER = 0x0a, // Control
|
||||
PE_TOKEN_REG = 0x0e, // Token
|
||||
PE_TOKEN_REG = 0x0e, // Token
|
||||
PE_BBOX_LEFT = 0x10, // Flip Left
|
||||
PE_BBOX_RIGHT = 0x12, // Flip Right
|
||||
PE_BBOX_TOP = 0x14, // Flip Top
|
||||
|
|
|
@ -374,38 +374,38 @@ static const char *tevOpTable[] = { // TEV
|
|||
|
||||
static const char *tevCInputTable[] = // CC
|
||||
{
|
||||
"(prev.rgb)", // CPREV,
|
||||
"(prev.rgb)", // CPREV,
|
||||
"(prev.aaa)", // APREV,
|
||||
"(c0.rgb)", // C0,
|
||||
"(c0.rgb)", // C0,
|
||||
"(c0.aaa)", // A0,
|
||||
"(c1.rgb)", // C1,
|
||||
"(c1.rgb)", // C1,
|
||||
"(c1.aaa)", // A1,
|
||||
"(c2.rgb)", // C2,
|
||||
"(c2.rgb)", // C2,
|
||||
"(c2.aaa)", // A2,
|
||||
"(textemp.rgb)", // TEXC,
|
||||
"(textemp.rgb)", // TEXC,
|
||||
"(textemp.aaa)", // TEXA,
|
||||
"(rastemp.rgb)", // RASC,
|
||||
"(rastemp.rgb)", // RASC,
|
||||
"(rastemp.aaa)", // RASA,
|
||||
"float3(1.0f, 1.0f, 1.0f)", // ONE
|
||||
"float3(0.5f, 0.5f, 0.5f)", // HALF
|
||||
"(konsttemp.rgb)", //"konsttemp.rgb", // KONST
|
||||
"float3(0.5f, 0.5f, 0.5f)", // HALF
|
||||
"(konsttemp.rgb)", //"konsttemp.rgb", // KONST
|
||||
"float3(0.0f, 0.0f, 0.0f)", // ZERO
|
||||
///aded extra values to map clamped values
|
||||
"(cprev.rgb)", // CPREV,
|
||||
"(cprev.aaa)", // APREV,
|
||||
"(cc0.rgb)", // C0,
|
||||
"(cc0.aaa)", // A0,
|
||||
"(cc1.rgb)", // C1,
|
||||
"(cc1.aaa)", // A1,
|
||||
"(cc2.rgb)", // C2,
|
||||
"(cc2.aaa)", // A2,
|
||||
"(textemp.rgb)", // TEXC,
|
||||
"(cprev.rgb)", // CPREV,
|
||||
"(cprev.aaa)", // APREV,
|
||||
"(cc0.rgb)", // C0,
|
||||
"(cc0.aaa)", // A0,
|
||||
"(cc1.rgb)", // C1,
|
||||
"(cc1.aaa)", // A1,
|
||||
"(cc2.rgb)", // C2,
|
||||
"(cc2.aaa)", // A2,
|
||||
"(textemp.rgb)", // TEXC,
|
||||
"(textemp.aaa)", // TEXA,
|
||||
"(crastemp.rgb)", // RASC,
|
||||
"(crastemp.aaa)", // RASA,
|
||||
"(crastemp.rgb)", // RASC,
|
||||
"(crastemp.aaa)", // RASA,
|
||||
"float3(1.0f, 1.0f, 1.0f)", // ONE
|
||||
"float3(0.5f, 0.5f, 0.5f)", // HALF
|
||||
"(ckonsttemp.rgb)", //"konsttemp.rgb", // KONST
|
||||
"float3(0.5f, 0.5f, 0.5f)", // HALF
|
||||
"(ckonsttemp.rgb)", //"konsttemp.rgb", // KONST
|
||||
"float3(0.0f, 0.0f, 0.0f)", // ZERO
|
||||
"PADERROR1", "PADERROR2", "PADERROR3", "PADERROR4"
|
||||
};
|
||||
|
@ -425,7 +425,7 @@ static const char *tevAInputTable[] = // CA
|
|||
"cc0", // A0,
|
||||
"cc1", // A1,
|
||||
"cc2", // A2,
|
||||
"textemp", // TEXA,
|
||||
"textemp", // TEXA,
|
||||
"crastemp", // RASA,
|
||||
"ckonsttemp", // KONST, (hw1 had quarter)
|
||||
"float4(0.0f, 0.0f, 0.0f, 0.0f)", // ZERO
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
#define I_INDTEXSCALE "cindscale"
|
||||
#define I_INDTEXMTX "cindmtx"
|
||||
#define I_FOG "cfog"
|
||||
#define I_PLIGHTS "cPLights"
|
||||
#define I_PMATERIALS "cPmtrl"
|
||||
#define I_PLIGHTS "cPLights"
|
||||
#define I_PMATERIALS "cPmtrl"
|
||||
|
||||
#define C_COLORMATRIX 0 // 0
|
||||
#define C_COLORS 0 // 0
|
||||
|
|
|
@ -87,61 +87,61 @@ void PixelShaderManager::SetConstants()
|
|||
{
|
||||
if (g_ActiveConfig.backend_info.APIType == API_OPENGL && !g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
Dirty();
|
||||
for (int i = 0; i < 2; ++i)
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (s_nColorsChanged[i])
|
||||
if (s_nColorsChanged[i])
|
||||
{
|
||||
int baseind = i ? C_KCOLORS : C_COLORS;
|
||||
for (int j = 0; j < 4; ++j)
|
||||
int baseind = i ? C_KCOLORS : C_COLORS;
|
||||
for (int j = 0; j < 4; ++j)
|
||||
{
|
||||
if (s_nColorsChanged[i] & (1 << j))
|
||||
SetPSConstant4fv(baseind+j, &lastRGBAfull[i][j][0]);
|
||||
}
|
||||
s_nColorsChanged[i] = 0;
|
||||
}
|
||||
}
|
||||
if (s_nColorsChanged[i] & (1 << j))
|
||||
SetPSConstant4fv(baseind+j, &lastRGBAfull[i][j][0]);
|
||||
}
|
||||
s_nColorsChanged[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_nTexDimsChanged)
|
||||
if (s_nTexDimsChanged)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if (s_nTexDimsChanged & (1<<i))
|
||||
if (s_nTexDimsChanged & (1<<i))
|
||||
SetPSTextureDims(i);
|
||||
}
|
||||
s_nTexDimsChanged = 0;
|
||||
}
|
||||
}
|
||||
s_nTexDimsChanged = 0;
|
||||
}
|
||||
|
||||
if (s_bAlphaChanged)
|
||||
if (s_bAlphaChanged)
|
||||
{
|
||||
SetPSConstant4f(C_ALPHA, (lastAlpha&0xff)/255.0f, ((lastAlpha>>8)&0xff)/255.0f, 0, ((lastAlpha>>16)&0xff)/255.0f);
|
||||
s_bAlphaChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_bZTextureTypeChanged)
|
||||
{
|
||||
float ftemp[4];
|
||||
switch (bpmem.ztex2.type)
|
||||
float ftemp[4];
|
||||
switch (bpmem.ztex2.type)
|
||||
{
|
||||
case 0:
|
||||
// 8 bits
|
||||
ftemp[0] = 0; ftemp[1] = 0; ftemp[2] = 0; ftemp[3] = 255.0f/16777215.0f;
|
||||
break;
|
||||
case 1:
|
||||
// 16 bits
|
||||
ftemp[0] = 255.0f/16777215.0f; ftemp[1] = 0; ftemp[2] = 0; ftemp[3] = 65280.0f/16777215.0f;
|
||||
break;
|
||||
case 2:
|
||||
// 24 bits
|
||||
case 0:
|
||||
// 8 bits
|
||||
ftemp[0] = 0; ftemp[1] = 0; ftemp[2] = 0; ftemp[3] = 255.0f/16777215.0f;
|
||||
break;
|
||||
case 1:
|
||||
// 16 bits
|
||||
ftemp[0] = 255.0f/16777215.0f; ftemp[1] = 0; ftemp[2] = 0; ftemp[3] = 65280.0f/16777215.0f;
|
||||
break;
|
||||
case 2:
|
||||
// 24 bits
|
||||
ftemp[0] = 16711680.0f/16777215.0f; ftemp[1] = 65280.0f/16777215.0f; ftemp[2] = 255.0f/16777215.0f; ftemp[3] = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
SetPSConstant4fv(C_ZBIAS, ftemp);
|
||||
s_bZTextureTypeChanged = false;
|
||||
}
|
||||
|
||||
if (s_bZBiasChanged || s_bDepthRangeChanged)
|
||||
{
|
||||
// reversed gxsetviewport(xorig, yorig, width, height, nearz, farz)
|
||||
// reversed gxsetviewport(xorig, yorig, width, height, nearz, farz)
|
||||
// [0] = width/2
|
||||
// [1] = height/2
|
||||
// [2] = 16777215 * (farz - nearz)
|
||||
|
@ -152,78 +152,78 @@ void PixelShaderManager::SetConstants()
|
|||
//ERROR_LOG("pixel=%x,%x, bias=%x\n", bpmem.zcontrol.pixel_format, bpmem.ztex2.type, lastZBias);
|
||||
SetPSConstant4f(C_ZBIAS+1, xfregs.viewport.farZ / 16777216.0f, xfregs.viewport.zRange / 16777216.0f, 0, (float)(lastZBias)/16777215.0f);
|
||||
s_bZBiasChanged = s_bDepthRangeChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
// indirect incoming texture scales
|
||||
if (s_nIndTexScaleChanged)
|
||||
// indirect incoming texture scales
|
||||
if (s_nIndTexScaleChanged)
|
||||
{
|
||||
// set as two sets of vec4s, each containing S and T of two ind stages.
|
||||
float f[8];
|
||||
float f[8];
|
||||
|
||||
if (s_nIndTexScaleChanged & 0x03)
|
||||
if (s_nIndTexScaleChanged & 0x03)
|
||||
{
|
||||
for (u32 i = 0; i < 2; ++i)
|
||||
for (u32 i = 0; i < 2; ++i)
|
||||
{
|
||||
f[2 * i] = bpmem.texscale[0].getScaleS(i & 1);
|
||||
f[2 * i + 1] = bpmem.texscale[0].getScaleT(i & 1);
|
||||
PRIM_LOG("tex indscale%d: %f %f\n", i, f[2 * i], f[2 * i + 1]);
|
||||
}
|
||||
f[2 * i] = bpmem.texscale[0].getScaleS(i & 1);
|
||||
f[2 * i + 1] = bpmem.texscale[0].getScaleT(i & 1);
|
||||
PRIM_LOG("tex indscale%d: %f %f\n", i, f[2 * i], f[2 * i + 1]);
|
||||
}
|
||||
SetPSConstant4fv(C_INDTEXSCALE, f);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_nIndTexScaleChanged & 0x0c) {
|
||||
for (u32 i = 2; i < 4; ++i) {
|
||||
f[2 * i] = bpmem.texscale[1].getScaleS(i & 1);
|
||||
f[2 * i + 1] = bpmem.texscale[1].getScaleT(i & 1);
|
||||
PRIM_LOG("tex indscale%d: %f %f\n", i, f[2 * i], f[2 * i + 1]);
|
||||
}
|
||||
if (s_nIndTexScaleChanged & 0x0c) {
|
||||
for (u32 i = 2; i < 4; ++i) {
|
||||
f[2 * i] = bpmem.texscale[1].getScaleS(i & 1);
|
||||
f[2 * i + 1] = bpmem.texscale[1].getScaleT(i & 1);
|
||||
PRIM_LOG("tex indscale%d: %f %f\n", i, f[2 * i], f[2 * i + 1]);
|
||||
}
|
||||
SetPSConstant4fv(C_INDTEXSCALE+1, &f[4]);
|
||||
}
|
||||
}
|
||||
|
||||
s_nIndTexScaleChanged = 0;
|
||||
}
|
||||
s_nIndTexScaleChanged = 0;
|
||||
}
|
||||
|
||||
if (s_nIndTexMtxChanged)
|
||||
if (s_nIndTexMtxChanged)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
if (s_nIndTexMtxChanged & (1 << i))
|
||||
if (s_nIndTexMtxChanged & (1 << i))
|
||||
{
|
||||
int scale = ((u32)bpmem.indmtx[i].col0.s0 << 0) |
|
||||
((u32)bpmem.indmtx[i].col1.s1 << 2) |
|
||||
((u32)bpmem.indmtx[i].col2.s2 << 4);
|
||||
float fscale = powf(2.0f, (float)(scale - 17)) / 1024.0f;
|
||||
int scale = ((u32)bpmem.indmtx[i].col0.s0 << 0) |
|
||||
((u32)bpmem.indmtx[i].col1.s1 << 2) |
|
||||
((u32)bpmem.indmtx[i].col2.s2 << 4);
|
||||
float fscale = powf(2.0f, (float)(scale - 17)) / 1024.0f;
|
||||
|
||||
// xyz - static matrix
|
||||
// TODO w - dynamic matrix scale / 256...... somehow / 4 works better
|
||||
// rev 2972 - now using / 256.... verify that this works
|
||||
// xyz - static matrix
|
||||
// TODO w - dynamic matrix scale / 256...... somehow / 4 works better
|
||||
// rev 2972 - now using / 256.... verify that this works
|
||||
SetPSConstant4f(C_INDTEXMTX + 2 * i,
|
||||
bpmem.indmtx[i].col0.ma * fscale,
|
||||
bpmem.indmtx[i].col0.ma * fscale,
|
||||
bpmem.indmtx[i].col1.mc * fscale,
|
||||
bpmem.indmtx[i].col2.me * fscale,
|
||||
fscale * 4.0f);
|
||||
SetPSConstant4f(C_INDTEXMTX + 2 * i + 1,
|
||||
bpmem.indmtx[i].col0.mb * fscale,
|
||||
SetPSConstant4f(C_INDTEXMTX + 2 * i + 1,
|
||||
bpmem.indmtx[i].col0.mb * fscale,
|
||||
bpmem.indmtx[i].col1.md * fscale,
|
||||
bpmem.indmtx[i].col2.mf * fscale,
|
||||
fscale * 4.0f);
|
||||
|
||||
PRIM_LOG("indmtx%d: scale=%f, mat=(%f %f %f; %f %f %f)\n",
|
||||
i, 1024.0f*fscale,
|
||||
bpmem.indmtx[i].col0.ma * fscale, bpmem.indmtx[i].col1.mc * fscale, bpmem.indmtx[i].col2.me * fscale,
|
||||
bpmem.indmtx[i].col0.mb * fscale, bpmem.indmtx[i].col1.md * fscale, bpmem.indmtx[i].col2.mf * fscale);
|
||||
}
|
||||
}
|
||||
s_nIndTexMtxChanged = 0;
|
||||
}
|
||||
PRIM_LOG("indmtx%d: scale=%f, mat=(%f %f %f; %f %f %f)\n",
|
||||
i, 1024.0f*fscale,
|
||||
bpmem.indmtx[i].col0.ma * fscale, bpmem.indmtx[i].col1.mc * fscale, bpmem.indmtx[i].col2.me * fscale,
|
||||
bpmem.indmtx[i].col0.mb * fscale, bpmem.indmtx[i].col1.md * fscale, bpmem.indmtx[i].col2.mf * fscale);
|
||||
}
|
||||
}
|
||||
s_nIndTexMtxChanged = 0;
|
||||
}
|
||||
|
||||
if (s_bFogColorChanged)
|
||||
if (s_bFogColorChanged)
|
||||
{
|
||||
SetPSConstant4f(C_FOG, bpmem.fog.color.r / 255.0f, bpmem.fog.color.g / 255.0f, bpmem.fog.color.b / 255.0f, 0);
|
||||
s_bFogColorChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_bFogParamChanged)
|
||||
if (s_bFogParamChanged)
|
||||
{
|
||||
if(!g_ActiveConfig.bDisableFog)
|
||||
{
|
||||
|
@ -236,8 +236,8 @@ void PixelShaderManager::SetConstants()
|
|||
else
|
||||
SetPSConstant4f(C_FOG + 1, 0.0, 1.0, 0.0, 1.0);
|
||||
|
||||
s_bFogParamChanged = false;
|
||||
}
|
||||
s_bFogParamChanged = false;
|
||||
}
|
||||
|
||||
if (s_bFogRangeAdjustChanged)
|
||||
{
|
||||
|
@ -341,11 +341,11 @@ void PixelShaderManager::SetConstants()
|
|||
|
||||
void PixelShaderManager::SetPSTextureDims(int texid)
|
||||
{
|
||||
// texdims.xy are reciprocals of the real texture dimensions
|
||||
// texdims.zw are the scaled dimensions
|
||||
float fdims[4];
|
||||
// texdims.xy are reciprocals of the real texture dimensions
|
||||
// texdims.zw are the scaled dimensions
|
||||
float fdims[4];
|
||||
|
||||
TCoordInfo& tc = bpmem.texcoords[texid];
|
||||
TCoordInfo& tc = bpmem.texcoords[texid];
|
||||
fdims[0] = 1.0f / (float)(lastTexDims[texid] & 0xffff);
|
||||
fdims[1] = 1.0f / (float)((lastTexDims[texid] >> 16) & 0xfff);
|
||||
fdims[2] = (float)(tc.s.scale_minus_1 + 1);
|
||||
|
@ -359,7 +359,7 @@ void PixelShaderManager::SetPSTextureDims(int texid)
|
|||
// and update it when the shader constant is set, only.
|
||||
void PixelShaderManager::SetColorChanged(int type, int num, bool high)
|
||||
{
|
||||
float *pf = &lastRGBAfull[type][num][0];
|
||||
float *pf = &lastRGBAfull[type][num][0];
|
||||
if (!high) {
|
||||
int r = bpmem.tevregs[num].low.a;
|
||||
int a = bpmem.tevregs[num].low.b;
|
||||
|
@ -371,45 +371,45 @@ void PixelShaderManager::SetColorChanged(int type, int num, bool high)
|
|||
pf[1] = (float)g * (1.0f / 255.0f);
|
||||
pf[2] = (float)b * (1.0f / 255.0f);
|
||||
}
|
||||
s_nColorsChanged[type] |= 1 << num;
|
||||
PRIM_LOG("pixel %scolor%d: %f %f %f %f\n", type?"k":"", num, pf[0], pf[1], pf[2], pf[3]);
|
||||
s_nColorsChanged[type] |= 1 << num;
|
||||
PRIM_LOG("pixel %scolor%d: %f %f %f %f\n", type?"k":"", num, pf[0], pf[1], pf[2], pf[3]);
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetAlpha(const AlphaTest& alpha)
|
||||
{
|
||||
if ((alpha.hex & 0xffff) != lastAlpha)
|
||||
if ((alpha.hex & 0xffff) != lastAlpha)
|
||||
{
|
||||
lastAlpha = (lastAlpha & ~0xffff) | (alpha.hex & 0xffff);
|
||||
s_bAlphaChanged = true;
|
||||
}
|
||||
lastAlpha = (lastAlpha & ~0xffff) | (alpha.hex & 0xffff);
|
||||
s_bAlphaChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetDestAlpha(const ConstantAlpha& alpha)
|
||||
{
|
||||
if (alpha.alpha != (lastAlpha >> 16))
|
||||
if (alpha.alpha != (lastAlpha >> 16))
|
||||
{
|
||||
lastAlpha = (lastAlpha & ~0xff0000) | ((alpha.hex & 0xff) << 16);
|
||||
s_bAlphaChanged = true;
|
||||
}
|
||||
lastAlpha = (lastAlpha & ~0xff0000) | ((alpha.hex & 0xff) << 16);
|
||||
s_bAlphaChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetTexDims(int texmapid, u32 width, u32 height, u32 wraps, u32 wrapt)
|
||||
{
|
||||
u32 wh = width | (height << 16) | (wraps << 28) | (wrapt << 30);
|
||||
if (lastTexDims[texmapid] != wh)
|
||||
u32 wh = width | (height << 16) | (wraps << 28) | (wrapt << 30);
|
||||
if (lastTexDims[texmapid] != wh)
|
||||
{
|
||||
lastTexDims[texmapid] = wh;
|
||||
lastTexDims[texmapid] = wh;
|
||||
s_nTexDimsChanged |= 1 << texmapid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetZTextureBias(u32 bias)
|
||||
{
|
||||
if (lastZBias != bias)
|
||||
if (lastZBias != bias)
|
||||
{
|
||||
s_bZBiasChanged = true;
|
||||
lastZBias = bias;
|
||||
}
|
||||
s_bZBiasChanged = true;
|
||||
lastZBias = bias;
|
||||
}
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetViewportChanged()
|
||||
|
@ -420,12 +420,12 @@ void PixelShaderManager::SetViewportChanged()
|
|||
|
||||
void PixelShaderManager::SetIndTexScaleChanged(u8 stagemask)
|
||||
{
|
||||
s_nIndTexScaleChanged |= stagemask;
|
||||
s_nIndTexScaleChanged |= stagemask;
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetIndMatrixChanged(int matrixidx)
|
||||
{
|
||||
s_nIndTexMtxChanged |= 1 << matrixidx;
|
||||
s_nIndTexMtxChanged |= 1 << matrixidx;
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetZTextureTypeChanged()
|
||||
|
@ -435,22 +435,22 @@ void PixelShaderManager::SetZTextureTypeChanged()
|
|||
|
||||
void PixelShaderManager::SetTexCoordChanged(u8 texmapid)
|
||||
{
|
||||
s_nTexDimsChanged |= 1 << texmapid;
|
||||
s_nTexDimsChanged |= 1 << texmapid;
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetFogColorChanged()
|
||||
{
|
||||
s_bFogColorChanged = true;
|
||||
s_bFogColorChanged = true;
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetFogParamChanged()
|
||||
{
|
||||
s_bFogParamChanged = true;
|
||||
s_bFogParamChanged = true;
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetFogRangeAdjustChanged()
|
||||
{
|
||||
s_bFogRangeAdjustChanged = true;
|
||||
s_bFogRangeAdjustChanged = true;
|
||||
}
|
||||
|
||||
void PixelShaderManager::SetColorMatrix(const float* pmatrix)
|
||||
|
|
|
@ -54,7 +54,6 @@ public:
|
|||
static void SetColorMatrix(const float* pmatrix);
|
||||
static void InvalidateXFRange(int start, int end);
|
||||
static void SetMaterialColorChanged(int index);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ char *Statistics::ToString(char *ptr)
|
|||
ptr+=sprintf(ptr,"pshaders (unique, delete cache first): %i\n",stats.numUniquePixelShaders);
|
||||
ptr+=sprintf(ptr,"vshaders created: %i\n",stats.numVertexShadersCreated);
|
||||
ptr+=sprintf(ptr,"vshaders alive: %i\n",stats.numVertexShadersAlive);
|
||||
ptr+=sprintf(ptr,"dlists called: %i\n",stats.numDListsCalled);
|
||||
ptr+=sprintf(ptr,"dlists called(f): %i\n",stats.thisFrame.numDListsCalled);
|
||||
ptr+=sprintf(ptr,"dlists called: %i\n",stats.numDListsCalled);
|
||||
ptr+=sprintf(ptr,"dlists called(f): %i\n",stats.thisFrame.numDListsCalled);
|
||||
ptr+=sprintf(ptr,"dlists alive: %i\n",stats.numDListsAlive);
|
||||
ptr+=sprintf(ptr,"primitive joins: %i\n",stats.thisFrame.numPrimitiveJoins);
|
||||
ptr+=sprintf(ptr,"draw calls: %i\n",stats.thisFrame.numDrawCalls);
|
||||
|
|
|
@ -24,20 +24,20 @@
|
|||
|
||||
struct Statistics
|
||||
{
|
||||
int numPixelShadersCreated;
|
||||
int numPixelShadersAlive;
|
||||
int numVertexShadersCreated;
|
||||
int numVertexShadersAlive;
|
||||
int numPixelShadersCreated;
|
||||
int numPixelShadersAlive;
|
||||
int numVertexShadersCreated;
|
||||
int numVertexShadersAlive;
|
||||
|
||||
int numTexturesCreated;
|
||||
int numTexturesAlive;
|
||||
int numTexturesCreated;
|
||||
int numTexturesAlive;
|
||||
|
||||
int numRenderTargetsCreated;
|
||||
int numRenderTargetsAlive;
|
||||
|
||||
int numDListsCalled;
|
||||
int numDListsCreated;
|
||||
int numDListsAlive;
|
||||
int numRenderTargetsCreated;
|
||||
int numRenderTargetsAlive;
|
||||
|
||||
int numDListsCalled;
|
||||
int numDListsCreated;
|
||||
int numDListsAlive;
|
||||
|
||||
int numVertexLoaders;
|
||||
|
||||
|
@ -52,30 +52,30 @@ struct Statistics
|
|||
|
||||
std::vector<EFBRectangle> efb_regions;
|
||||
|
||||
struct ThisFrame
|
||||
{
|
||||
int numBPLoads;
|
||||
int numCPLoads;
|
||||
int numXFLoads;
|
||||
|
||||
int numBPLoadsInDL;
|
||||
int numCPLoadsInDL;
|
||||
int numXFLoadsInDL;
|
||||
|
||||
int numDLs;
|
||||
int numPrims;
|
||||
int numDLPrims;
|
||||
int numShaderChanges;
|
||||
struct ThisFrame
|
||||
{
|
||||
int numBPLoads;
|
||||
int numCPLoads;
|
||||
int numXFLoads;
|
||||
|
||||
int numBPLoadsInDL;
|
||||
int numCPLoadsInDL;
|
||||
int numXFLoadsInDL;
|
||||
|
||||
int numDLs;
|
||||
int numPrims;
|
||||
int numDLPrims;
|
||||
int numShaderChanges;
|
||||
|
||||
int numPrimitiveJoins;
|
||||
int numDrawCalls;
|
||||
int numIndexedDrawCalls;
|
||||
int numBufferSplits;
|
||||
int numPrimitiveJoins;
|
||||
int numDrawCalls;
|
||||
int numIndexedDrawCalls;
|
||||
int numBufferSplits;
|
||||
|
||||
int numDListsCalled;
|
||||
};
|
||||
ThisFrame thisFrame;
|
||||
void ResetFrame();
|
||||
};
|
||||
ThisFrame thisFrame;
|
||||
void ResetFrame();
|
||||
static void SwapDL();
|
||||
|
||||
// Yeah, this is unsafe, but we really don't wanna faff around allocating
|
||||
|
|
|
@ -56,7 +56,7 @@ TextureCache::TextureCache()
|
|||
if (!temp)
|
||||
temp = (u8*)AllocateAlignedMemory(temp_size, 16);
|
||||
TexDecoder_SetTexFmtOverlayOptions(g_ActiveConfig.bTexFmtOverlayEnable, g_ActiveConfig.bTexFmtOverlayCenter);
|
||||
if(g_ActiveConfig.bHiresTextures && !g_ActiveConfig.bDumpTextures)
|
||||
if(g_ActiveConfig.bHiresTextures && !g_ActiveConfig.bDumpTextures)
|
||||
HiresTextures::Init(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
|
||||
SetHash64Function(g_ActiveConfig.bHiresTextures || g_ActiveConfig.bDumpTextures);
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
|
|||
case 1: // R8
|
||||
case 8: // R8
|
||||
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1;
|
||||
cbufid = 13;
|
||||
cbufid = 13;
|
||||
break;
|
||||
|
||||
case 2: // RA4
|
||||
|
@ -746,11 +746,11 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
|
|||
|
||||
case 9: // G8
|
||||
colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1.0f;
|
||||
cbufid = 17;
|
||||
cbufid = 17;
|
||||
break;
|
||||
case 10: // B8
|
||||
colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1.0f;
|
||||
cbufid = 18;
|
||||
cbufid = 18;
|
||||
break;
|
||||
|
||||
case 11: // RG8
|
||||
|
@ -759,7 +759,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
|
|||
break;
|
||||
|
||||
case 12: // GB8
|
||||
colmat[1] = colmat[5] = colmat[9] = colmat[14] = 1.0f;
|
||||
colmat[1] = colmat[5] = colmat[9] = colmat[14] = 1.0f;
|
||||
cbufid = 20;
|
||||
break;
|
||||
|
||||
|
|
|
@ -39,23 +39,23 @@ namespace TextureConversionShader
|
|||
|
||||
u16 GetEncodedSampleCount(u32 format)
|
||||
{
|
||||
switch (format) {
|
||||
case GX_TF_I4: return 8;
|
||||
switch (format) {
|
||||
case GX_TF_I4: return 8;
|
||||
case GX_TF_I8: return 4;
|
||||
case GX_TF_IA4: return 4;
|
||||
case GX_TF_IA8: return 2;
|
||||
case GX_TF_IA8: return 2;
|
||||
case GX_TF_RGB565: return 2;
|
||||
case GX_TF_RGB5A3: return 2;
|
||||
case GX_TF_RGBA8: return 1;
|
||||
case GX_CTF_R4: return 8;
|
||||
case GX_CTF_RA4: return 4;
|
||||
case GX_CTF_RA8: return 2;
|
||||
case GX_CTF_A8: return 4;
|
||||
case GX_CTF_R8: return 4;
|
||||
case GX_CTF_G8: return 4;
|
||||
case GX_CTF_B8: return 4;
|
||||
case GX_CTF_RG8: return 2;
|
||||
case GX_CTF_GB8: return 2;
|
||||
case GX_CTF_RA4: return 4;
|
||||
case GX_CTF_RA8: return 2;
|
||||
case GX_CTF_A8: return 4;
|
||||
case GX_CTF_R8: return 4;
|
||||
case GX_CTF_G8: return 4;
|
||||
case GX_CTF_B8: return 4;
|
||||
case GX_CTF_RG8: return 2;
|
||||
case GX_CTF_GB8: return 2;
|
||||
case GX_TF_Z8: return 4;
|
||||
case GX_TF_Z16: return 2;
|
||||
case GX_TF_Z24X8: return 1;
|
||||
|
@ -63,8 +63,8 @@ u16 GetEncodedSampleCount(u32 format)
|
|||
case GX_CTF_Z8M: return 4;
|
||||
case GX_CTF_Z8L: return 4;
|
||||
case GX_CTF_Z16L: return 2;
|
||||
default: return 1;
|
||||
}
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
|
||||
const char* WriteRegister(API_TYPE ApiType, const char *prefix, const u32 num)
|
||||
|
@ -100,10 +100,9 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||
else
|
||||
{
|
||||
WRITE(p,"sampler samp0 : register(s0);\n");
|
||||
WRITE(p, "Texture2D Tex0 : register(t0);\n");
|
||||
WRITE(p, "Texture2D Tex0 : register(t0);\n");
|
||||
}
|
||||
|
||||
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
WRITE(p, " out float4 ocol0;\n");
|
||||
|
@ -123,9 +122,9 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||
}
|
||||
WRITE(p," in float2 uv0 : TEXCOORD0)\n");
|
||||
}
|
||||
|
||||
|
||||
WRITE(p, "{\n"
|
||||
" float2 sampleUv;\n"
|
||||
" float2 sampleUv;\n"
|
||||
" float2 uv1 = floor(uv0);\n");
|
||||
|
||||
WRITE(p, " uv1.x = uv1.x * %f;\n", samples);
|
||||
|
@ -147,14 +146,14 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||
|
||||
if (ApiType == API_OPENGL)
|
||||
WRITE(p," sampleUv.y = " I_COLORS"[1].y - sampleUv.y;\n");
|
||||
|
||||
|
||||
WRITE(p, " sampleUv = sampleUv + " I_COLORS"[1].zw;\n");
|
||||
|
||||
if (ApiType != API_OPENGL)
|
||||
{
|
||||
WRITE(p, " sampleUv = sampleUv + float2(0.0f,1.0f);\n");// still to determine the reason for this
|
||||
WRITE(p, " sampleUv = sampleUv / " I_COLORS"[0].zw;\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// block dimensions : widthStride, heightStride
|
||||
|
@ -182,7 +181,7 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||
else
|
||||
{
|
||||
WRITE(p,"sampler samp0 : register(s0);\n");
|
||||
WRITE(p, "Texture2D Tex0 : register(t0);\n");
|
||||
WRITE(p, "Texture2D Tex0 : register(t0);\n");
|
||||
}
|
||||
|
||||
if (ApiType == API_OPENGL)
|
||||
|
@ -204,12 +203,12 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||
}
|
||||
WRITE(p," in float2 uv0 : TEXCOORD0)\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WRITE(p, "{\n"
|
||||
" float2 sampleUv;\n"
|
||||
" float2 sampleUv;\n"
|
||||
" float2 uv1 = floor(uv0);\n");
|
||||
|
||||
|
||||
WRITE(p, " float yl = floor(uv1.y / %f);\n", blkH);
|
||||
WRITE(p, " float yb = yl * %f;\n", blkH);
|
||||
WRITE(p, " float yoff = uv1.y - yb;\n");
|
||||
|
@ -217,26 +216,26 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
|
|||
WRITE(p, " float xel = floor(xp / 2);\n");
|
||||
WRITE(p, " float xb = floor(xel / %f);\n", blkH);
|
||||
WRITE(p, " float xoff = xel - (xb * %f);\n", blkH);
|
||||
|
||||
|
||||
WRITE(p, " float x2 = uv1.x * 2;\n");
|
||||
WRITE(p, " float xl = floor(x2 / %f);\n", blkW);
|
||||
WRITE(p, " float xib = x2 - (xl * %f);\n", blkW);
|
||||
WRITE(p, " float halfxb = floor(xb / 2);\n");
|
||||
|
||||
|
||||
WRITE(p, " sampleUv.x = xib + (halfxb * %f);\n", blkW);
|
||||
WRITE(p, " sampleUv.y = yb + xoff;\n");
|
||||
WRITE(p, " sampleUv = sampleUv * " I_COLORS"[0].xy;\n");
|
||||
|
||||
|
||||
if (ApiType == API_OPENGL)
|
||||
WRITE(p," sampleUv.y = " I_COLORS"[1].y - sampleUv.y;\n");
|
||||
|
||||
|
||||
WRITE(p, " sampleUv = sampleUv + " I_COLORS"[1].zw;\n");
|
||||
|
||||
if (ApiType != API_OPENGL)
|
||||
{
|
||||
WRITE(p, " sampleUv = sampleUv + float2(0.0f,1.0f);\n");// still to determine the reason for this
|
||||
WRITE(p, " sampleUv = sampleUv / " I_COLORS"[0].zw;\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WriteSampleColor(char*& p, const char* colorComp, const char* dest, API_TYPE ApiType)
|
||||
|
@ -465,11 +464,11 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
|
|||
|
||||
WriteSampleColor(p, "rgba", "texSample", ApiType);
|
||||
|
||||
// 0.8784 = 224 / 255 which is the maximum alpha value that can be represented in 3 bits
|
||||
WRITE(p, "if(texSample.a > 0.878f) {\n");
|
||||
// 0.8784 = 224 / 255 which is the maximum alpha value that can be represented in 3 bits
|
||||
WRITE(p, "if(texSample.a > 0.878f) {\n");
|
||||
|
||||
WriteToBitDepth(p, 5, "texSample.g", "color0");
|
||||
WRITE(p, " gUpper = floor(color0 / 8.0f);\n");
|
||||
WRITE(p, " gUpper = floor(color0 / 8.0f);\n");
|
||||
WRITE(p, " gLower = color0 - gUpper * 8.0f;\n");
|
||||
|
||||
WriteToBitDepth(p, 5, "texSample.r", "ocol0.b");
|
||||
|
@ -477,27 +476,27 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
|
|||
WriteToBitDepth(p, 5, "texSample.b", "ocol0.g");
|
||||
WRITE(p, " ocol0.g = ocol0.g + gLower * 32.0f;\n");
|
||||
|
||||
WRITE(p, "} else {\n");
|
||||
WRITE(p, "} else {\n");
|
||||
|
||||
WriteToBitDepth(p, 4, "texSample.r", "ocol0.b");
|
||||
WriteToBitDepth(p, 4, "texSample.b", "ocol0.g");
|
||||
WriteToBitDepth(p, 4, "texSample.r", "ocol0.b");
|
||||
WriteToBitDepth(p, 4, "texSample.b", "ocol0.g");
|
||||
|
||||
WriteToBitDepth(p, 3, "texSample.a", "color0");
|
||||
WRITE(p, "ocol0.b = ocol0.b + color0 * 16.0f;\n");
|
||||
WriteToBitDepth(p, 3, "texSample.a", "color0");
|
||||
WRITE(p, "ocol0.b = ocol0.b + color0 * 16.0f;\n");
|
||||
WriteToBitDepth(p, 4, "texSample.g", "color0");
|
||||
WRITE(p, "ocol0.g = ocol0.g + color0 * 16.0f;\n");
|
||||
WRITE(p, "ocol0.g = ocol0.g + color0 * 16.0f;\n");
|
||||
|
||||
WRITE(p, "}\n");
|
||||
WRITE(p, "}\n");
|
||||
|
||||
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
|
||||
WriteSampleColor(p, "rgba", "texSample", ApiType);
|
||||
|
||||
WRITE(p, "if(texSample.a > 0.878f) {\n");
|
||||
WRITE(p, "if(texSample.a > 0.878f) {\n");
|
||||
|
||||
WriteToBitDepth(p, 5, "texSample.g", "color0");
|
||||
WRITE(p, " gUpper = floor(color0 / 8.0f);\n");
|
||||
WRITE(p, " gUpper = floor(color0 / 8.0f);\n");
|
||||
WRITE(p, " gLower = color0 - gUpper * 8.0f;\n");
|
||||
|
||||
WriteToBitDepth(p, 5, "texSample.r", "ocol0.r");
|
||||
|
@ -505,17 +504,17 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType)
|
|||
WriteToBitDepth(p, 5, "texSample.b", "ocol0.a");
|
||||
WRITE(p, " ocol0.a = ocol0.a + gLower * 32.0f;\n");
|
||||
|
||||
WRITE(p, "} else {\n");
|
||||
WRITE(p, "} else {\n");
|
||||
|
||||
WriteToBitDepth(p, 4, "texSample.r", "ocol0.r");
|
||||
WriteToBitDepth(p, 4, "texSample.b", "ocol0.a");
|
||||
WriteToBitDepth(p, 4, "texSample.r", "ocol0.r");
|
||||
WriteToBitDepth(p, 4, "texSample.b", "ocol0.a");
|
||||
|
||||
WriteToBitDepth(p, 3, "texSample.a", "color0");
|
||||
WRITE(p, "ocol0.r = ocol0.r + color0 * 16.0f;\n");
|
||||
WriteToBitDepth(p, 3, "texSample.a", "color0");
|
||||
WRITE(p, "ocol0.r = ocol0.r + color0 * 16.0f;\n");
|
||||
WriteToBitDepth(p, 4, "texSample.g", "color0");
|
||||
WRITE(p, "ocol0.a = ocol0.a + color0 * 16.0f;\n");
|
||||
WRITE(p, "ocol0.a = ocol0.a + color0 * 16.0f;\n");
|
||||
|
||||
WRITE(p, "}\n");
|
||||
WRITE(p, "}\n");
|
||||
|
||||
WRITE(p, " ocol0 = ocol0 / 255.0f;\n");
|
||||
WriteEncoderEnd(p, ApiType);
|
||||
|
@ -680,96 +679,96 @@ void WriteZ8Encoder(char* p, const char* multiplier,API_TYPE ApiType)
|
|||
{
|
||||
WriteSwizzler(p, GX_CTF_Z8M, ApiType);
|
||||
|
||||
WRITE(p, " float depth;\n");
|
||||
WRITE(p, " float depth;\n");
|
||||
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WRITE(p, "ocol0.b = frac(depth * %s);\n", multiplier);
|
||||
WRITE(p, "ocol0.b = frac(depth * %s);\n", multiplier);
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WRITE(p, "ocol0.g = frac(depth * %s);\n", multiplier);
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WRITE(p, "ocol0.g = frac(depth * %s);\n", multiplier);
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WRITE(p, "ocol0.r = frac(depth * %s);\n", multiplier);
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WRITE(p, "ocol0.r = frac(depth * %s);\n", multiplier);
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WRITE(p, "ocol0.a = frac(depth * %s);\n", multiplier);
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WRITE(p, "ocol0.a = frac(depth * %s);\n", multiplier);
|
||||
|
||||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ16Encoder(char* p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_TF_Z16, ApiType);
|
||||
WriteSwizzler(p, GX_TF_Z16, ApiType);
|
||||
|
||||
WRITE(p, " float depth;\n");
|
||||
WRITE(p, " float3 expanded;\n");
|
||||
WRITE(p, " float depth;\n");
|
||||
WRITE(p, " float3 expanded;\n");
|
||||
|
||||
// byte order is reversed
|
||||
// byte order is reversed
|
||||
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
|
||||
WRITE(p, " depth *= 16777215.0f;\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256 * 256));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256 * 256;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256);\n");
|
||||
WRITE(p, " depth *= 16777215.0f;\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256 * 256));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256 * 256;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256);\n");
|
||||
|
||||
WRITE(p, " ocol0.b = expanded.g / 255;\n");
|
||||
WRITE(p, " ocol0.g = expanded.r / 255;\n");
|
||||
WRITE(p, " ocol0.b = expanded.g / 255;\n");
|
||||
WRITE(p, " ocol0.g = expanded.r / 255;\n");
|
||||
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
|
||||
WRITE(p, " depth *= 16777215.0f;\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256 * 256));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256 * 256;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256);\n");
|
||||
WRITE(p, " depth *= 16777215.0f;\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256 * 256));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256 * 256;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256);\n");
|
||||
|
||||
WRITE(p, " ocol0.r = expanded.g / 255;\n");
|
||||
WRITE(p, " ocol0.a = expanded.r / 255;\n");
|
||||
WRITE(p, " ocol0.r = expanded.g / 255;\n");
|
||||
WRITE(p, " ocol0.a = expanded.r / 255;\n");
|
||||
|
||||
WriteEncoderEnd(p, ApiType);
|
||||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ16LEncoder(char* p,API_TYPE ApiType)
|
||||
{
|
||||
WriteSwizzler(p, GX_CTF_Z16L, ApiType);
|
||||
WriteSwizzler(p, GX_CTF_Z16L, ApiType);
|
||||
|
||||
WRITE(p, " float depth;\n");
|
||||
WRITE(p, " float3 expanded;\n");
|
||||
WRITE(p, " float depth;\n");
|
||||
WRITE(p, " float3 expanded;\n");
|
||||
|
||||
// byte order is reversed
|
||||
// byte order is reversed
|
||||
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
|
||||
WRITE(p, " depth *= 16777215.0f;\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256 * 256));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256 * 256;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256);\n");
|
||||
WRITE(p, " depth -= expanded.g * 256;\n");
|
||||
WRITE(p, " expanded.b = depth;\n");
|
||||
WRITE(p, " depth *= 16777215.0f;\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256 * 256));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256 * 256;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256);\n");
|
||||
WRITE(p, " depth -= expanded.g * 256;\n");
|
||||
WRITE(p, " expanded.b = depth;\n");
|
||||
|
||||
WRITE(p, " ocol0.b = expanded.b / 255;\n");
|
||||
WRITE(p, " ocol0.g = expanded.g / 255;\n");
|
||||
WRITE(p, " ocol0.b = expanded.b / 255;\n");
|
||||
WRITE(p, " ocol0.g = expanded.g / 255;\n");
|
||||
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
WriteSampleColor(p, "b", "depth", ApiType);
|
||||
|
||||
WRITE(p, " depth *= 16777215.0f;\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256 * 256));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256 * 256;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256);\n");
|
||||
WRITE(p, " depth -= expanded.g * 256;\n");
|
||||
WRITE(p, " expanded.b = depth;\n");
|
||||
WRITE(p, " depth *= 16777215.0f;\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256 * 256));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256 * 256;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256);\n");
|
||||
WRITE(p, " depth -= expanded.g * 256;\n");
|
||||
WRITE(p, " expanded.b = depth;\n");
|
||||
|
||||
WRITE(p, " ocol0.r = expanded.b;\n");
|
||||
WRITE(p, " ocol0.a = expanded.g;\n");
|
||||
WRITE(p, " ocol0.r = expanded.b;\n");
|
||||
WRITE(p, " ocol0.a = expanded.g;\n");
|
||||
|
||||
WriteEncoderEnd(p, ApiType);
|
||||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
void WriteZ24Encoder(char* p, API_TYPE ApiType)
|
||||
|
@ -779,16 +778,16 @@ void WriteZ24Encoder(char* p, API_TYPE ApiType)
|
|||
WRITE(p, " float cl = xb - (halfxb * 2);\n");
|
||||
|
||||
WRITE(p, " float depth0;\n");
|
||||
WRITE(p, " float depth1;\n");
|
||||
WRITE(p, " float3 expanded0;\n");
|
||||
WRITE(p, " float3 expanded1;\n");
|
||||
WRITE(p, " float depth1;\n");
|
||||
WRITE(p, " float3 expanded0;\n");
|
||||
WRITE(p, " float3 expanded1;\n");
|
||||
|
||||
WriteSampleColor(p, "b", "depth0", ApiType);
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
WriteSampleColor(p, "b", "depth1", ApiType);
|
||||
WriteIncrementSampleX(p, ApiType);
|
||||
WriteSampleColor(p, "b", "depth1", ApiType);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
WRITE(p, " depth%i *= 16777215.0f;\n", i);
|
||||
|
||||
WRITE(p, " expanded%i.r = floor(depth%i / (256 * 256));\n", i, i);
|
||||
|
@ -796,23 +795,23 @@ void WriteZ24Encoder(char* p, API_TYPE ApiType)
|
|||
WRITE(p, " expanded%i.g = floor(depth%i / 256);\n", i, i);
|
||||
WRITE(p, " depth%i -= expanded%i.g * 256;\n", i, i);
|
||||
WRITE(p, " expanded%i.b = depth%i;\n", i, i);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE(p, " if(cl > 0.5f) {\n");
|
||||
// upper 16
|
||||
WRITE(p, " ocol0.b = expanded0.g / 255;\n");
|
||||
WRITE(p, " ocol0.g = expanded0.b / 255;\n");
|
||||
WRITE(p, " ocol0.r = expanded1.g / 255;\n");
|
||||
WRITE(p, " ocol0.a = expanded1.b / 255;\n");
|
||||
WRITE(p, " } else {\n");
|
||||
// lower 8
|
||||
WRITE(p, " ocol0.b = 1.0f;\n");
|
||||
WRITE(p, " ocol0.g = expanded0.r / 255;\n");
|
||||
WRITE(p, " ocol0.r = 1.0f;\n");
|
||||
WRITE(p, " ocol0.a = expanded1.r / 255;\n");
|
||||
WRITE(p, " }\n");
|
||||
WRITE(p, " if(cl > 0.5f) {\n");
|
||||
// upper 16
|
||||
WRITE(p, " ocol0.b = expanded0.g / 255;\n");
|
||||
WRITE(p, " ocol0.g = expanded0.b / 255;\n");
|
||||
WRITE(p, " ocol0.r = expanded1.g / 255;\n");
|
||||
WRITE(p, " ocol0.a = expanded1.b / 255;\n");
|
||||
WRITE(p, " } else {\n");
|
||||
// lower 8
|
||||
WRITE(p, " ocol0.b = 1.0f;\n");
|
||||
WRITE(p, " ocol0.g = expanded0.r / 255;\n");
|
||||
WRITE(p, " ocol0.r = 1.0f;\n");
|
||||
WRITE(p, " ocol0.a = expanded1.r / 255;\n");
|
||||
WRITE(p, " }\n");
|
||||
|
||||
WriteEncoderEnd(p, ApiType);
|
||||
WriteEncoderEnd(p, ApiType);
|
||||
}
|
||||
|
||||
const char *GenerateEncodingShader(u32 format,API_TYPE ApiType)
|
||||
|
@ -902,7 +901,7 @@ const char *GenerateEncodingShader(u32 format,API_TYPE ApiType)
|
|||
PanicAlert("TextureConversionShader generator - buffer too small, canary has been eaten!");
|
||||
|
||||
setlocale(LC_NUMERIC, ""); // restore locale
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
void SetShaderParameters(float width, float height, float offsetX, float offsetY, float widthStride, float heightStride,float buffW,float buffH)
|
||||
|
|
|
@ -27,41 +27,41 @@ extern GC_ALIGNED16(u8 texMem[TMEM_SIZE]);
|
|||
|
||||
enum TextureFormat
|
||||
{
|
||||
GX_TF_I4 = 0x0,
|
||||
GX_TF_I8 = 0x1,
|
||||
GX_TF_IA4 = 0x2,
|
||||
GX_TF_IA8 = 0x3,
|
||||
GX_TF_RGB565 = 0x4,
|
||||
GX_TF_RGB5A3 = 0x5,
|
||||
GX_TF_RGBA8 = 0x6,
|
||||
GX_TF_C4 = 0x8,
|
||||
GX_TF_C8 = 0x9,
|
||||
GX_TF_C14X2 = 0xA,
|
||||
GX_TF_CMPR = 0xE,
|
||||
GX_TF_I4 = 0x0,
|
||||
GX_TF_I8 = 0x1,
|
||||
GX_TF_IA4 = 0x2,
|
||||
GX_TF_IA8 = 0x3,
|
||||
GX_TF_RGB565 = 0x4,
|
||||
GX_TF_RGB5A3 = 0x5,
|
||||
GX_TF_RGBA8 = 0x6,
|
||||
GX_TF_C4 = 0x8,
|
||||
GX_TF_C8 = 0x9,
|
||||
GX_TF_C14X2 = 0xA,
|
||||
GX_TF_CMPR = 0xE,
|
||||
|
||||
_GX_TF_CTF = 0x20, // copy-texture-format only (simply means linear?)
|
||||
_GX_TF_ZTF = 0x10, // Z-texture-format
|
||||
_GX_TF_CTF = 0x20, // copy-texture-format only (simply means linear?)
|
||||
_GX_TF_ZTF = 0x10, // Z-texture-format
|
||||
|
||||
// these formats are also valid when copying targets
|
||||
GX_CTF_R4 = 0x0 | _GX_TF_CTF,
|
||||
GX_CTF_RA4 = 0x2 | _GX_TF_CTF,
|
||||
GX_CTF_RA8 = 0x3 | _GX_TF_CTF,
|
||||
GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF,
|
||||
GX_CTF_A8 = 0x7 | _GX_TF_CTF,
|
||||
GX_CTF_R8 = 0x8 | _GX_TF_CTF,
|
||||
GX_CTF_G8 = 0x9 | _GX_TF_CTF,
|
||||
GX_CTF_B8 = 0xA | _GX_TF_CTF,
|
||||
GX_CTF_RG8 = 0xB | _GX_TF_CTF,
|
||||
GX_CTF_GB8 = 0xC | _GX_TF_CTF,
|
||||
// these formats are also valid when copying targets
|
||||
GX_CTF_R4 = 0x0 | _GX_TF_CTF,
|
||||
GX_CTF_RA4 = 0x2 | _GX_TF_CTF,
|
||||
GX_CTF_RA8 = 0x3 | _GX_TF_CTF,
|
||||
GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF,
|
||||
GX_CTF_A8 = 0x7 | _GX_TF_CTF,
|
||||
GX_CTF_R8 = 0x8 | _GX_TF_CTF,
|
||||
GX_CTF_G8 = 0x9 | _GX_TF_CTF,
|
||||
GX_CTF_B8 = 0xA | _GX_TF_CTF,
|
||||
GX_CTF_RG8 = 0xB | _GX_TF_CTF,
|
||||
GX_CTF_GB8 = 0xC | _GX_TF_CTF,
|
||||
|
||||
GX_TF_Z8 = 0x1 | _GX_TF_ZTF,
|
||||
GX_TF_Z16 = 0x3 | _GX_TF_ZTF,
|
||||
GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF,
|
||||
GX_TF_Z8 = 0x1 | _GX_TF_ZTF,
|
||||
GX_TF_Z16 = 0x3 | _GX_TF_ZTF,
|
||||
GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF,
|
||||
|
||||
GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
};
|
||||
|
||||
int TexDecoder_GetTexelSizeInNibbles(int format);
|
||||
|
|
|
@ -121,10 +121,10 @@ void LOADERDECL UpdateBoundingBox()
|
|||
{
|
||||
if (!PixelEngine::bbox_active)
|
||||
return;
|
||||
|
||||
|
||||
// reset videodata pointer
|
||||
VertexManager::s_pCurBufferPointer = s_bbox_pCurBufferPointer_orig;
|
||||
|
||||
|
||||
// copy vertex pointers
|
||||
memcpy(VertexManager::s_pCurBufferPointer, s_bbox_vertex_buffer, 12);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
|
@ -335,7 +335,7 @@ void VertexLoader::CompileVertexTranslator()
|
|||
nat_offset += 12;
|
||||
vtx_decl.normal_offset[2] = nat_offset;
|
||||
nat_offset += 12;
|
||||
}
|
||||
}
|
||||
|
||||
int numNormals = (m_VtxAttr.NormalElements == 1) ? NRM_THREE : NRM_ONE;
|
||||
m_NativeFmt->m_components |= VB_HAS_NRM0;
|
||||
|
@ -367,7 +367,7 @@ void VertexLoader::CompileVertexTranslator()
|
|||
default: _assert_(0); break;
|
||||
}
|
||||
break;
|
||||
case INDEX8:
|
||||
case INDEX8:
|
||||
m_VertexSize += 1;
|
||||
switch (m_VtxAttr.color[i].Comp)
|
||||
{
|
||||
|
@ -558,7 +558,7 @@ int VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const
|
|||
m_VtxAttr.texCoord[0].Frac = g_VtxAttr[vtx_attr_group].g0.Tex0Frac;
|
||||
m_VtxAttr.texCoord[1].Frac = g_VtxAttr[vtx_attr_group].g1.Tex1Frac;
|
||||
m_VtxAttr.texCoord[2].Frac = g_VtxAttr[vtx_attr_group].g1.Tex2Frac;
|
||||
m_VtxAttr.texCoord[3].Frac = g_VtxAttr[vtx_attr_group].g1.Tex3Frac;
|
||||
m_VtxAttr.texCoord[3].Frac = g_VtxAttr[vtx_attr_group].g1.Tex3Frac;
|
||||
m_VtxAttr.texCoord[4].Frac = g_VtxAttr[vtx_attr_group].g2.Tex4Frac;
|
||||
m_VtxAttr.texCoord[5].Frac = g_VtxAttr[vtx_attr_group].g2.Tex5Frac;
|
||||
m_VtxAttr.texCoord[6].Frac = g_VtxAttr[vtx_attr_group].g2.Tex6Frac;
|
||||
|
@ -607,11 +607,11 @@ void VertexLoader::ConvertVertices ( int count )
|
|||
void VertexLoader::RunCompiledVertices(int vtx_attr_group, int primitive, int const count, u8* Data)
|
||||
{
|
||||
auto const new_count = SetupRunVertices(vtx_attr_group, primitive, count);
|
||||
|
||||
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, Data, native_stride * new_count);
|
||||
VertexManager::s_pCurBufferPointer += native_stride * new_count;
|
||||
DataSkip(new_count * m_VertexSize);
|
||||
|
||||
|
||||
VertexManager::AddVertices(primitive, new_count);
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,7 @@ void VertexLoader::SetVAT(u32 _group0, u32 _group1, u32 _group2)
|
|||
m_VtxAttr.texCoord[2].Frac = vat.g1.Tex2Frac;
|
||||
m_VtxAttr.texCoord[3].Elements = vat.g1.Tex3CoordElements;
|
||||
m_VtxAttr.texCoord[3].Format = vat.g1.Tex3CoordFormat;
|
||||
m_VtxAttr.texCoord[3].Frac = vat.g1.Tex3Frac;
|
||||
m_VtxAttr.texCoord[3].Frac = vat.g1.Tex3Frac;
|
||||
m_VtxAttr.texCoord[4].Elements = vat.g1.Tex4CoordElements;
|
||||
m_VtxAttr.texCoord[4].Format = vat.g1.Tex4CoordFormat;
|
||||
|
||||
|
|
|
@ -134,6 +134,6 @@ private:
|
|||
void WriteGetVariable(int bits, Gen::OpArg dest, void *address);
|
||||
void WriteSetVariable(int bits, void *address, Gen::OpArg dest);
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@ __forceinline float FracAdjust(T val)
|
|||
//auto const U8FRAC = 1.f / (1u << 7);
|
||||
//auto const S16FRAC = 1.f / (1u << 14);
|
||||
//auto const U16FRAC = 1.f / (1u << 15);
|
||||
|
||||
|
||||
// TODO: is this right?
|
||||
return val / float(1u << (sizeof(T) * 8 - std::numeric_limits<T>::is_signed - 1));
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ __forceinline void ReadIndirect(const T* data)
|
|||
{
|
||||
DataWrite(FracAdjust(Common::FromBigEndian(data[i])));
|
||||
}
|
||||
|
||||
|
||||
LOG_NORM();
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ struct Normal_Direct
|
|||
ReadIndirect<T, N * 3>(source);
|
||||
DataSkip<N * 3 * sizeof(T)>();
|
||||
}
|
||||
|
||||
|
||||
static const int size = sizeof(T) * N * 3;
|
||||
};
|
||||
|
||||
|
@ -99,7 +99,7 @@ struct Normal_Index
|
|||
{
|
||||
Normal_Index_Offset<I, T, N, 0>();
|
||||
}
|
||||
|
||||
|
||||
static const int size = sizeof(I);
|
||||
};
|
||||
|
||||
|
@ -112,7 +112,7 @@ struct Normal_Index_Indices3
|
|||
Normal_Index_Offset<I, T, 1, 1>();
|
||||
Normal_Index_Offset<I, T, 1, 2>();
|
||||
}
|
||||
|
||||
|
||||
static const int size = sizeof(I) * 3;
|
||||
};
|
||||
|
||||
|
|
|
@ -25,43 +25,43 @@ class VertexLoader_Normal
|
|||
{
|
||||
public:
|
||||
|
||||
// Init
|
||||
static void Init(void);
|
||||
// Init
|
||||
static void Init(void);
|
||||
|
||||
// GetSize
|
||||
static unsigned int GetSize(unsigned int _type, unsigned int _format,
|
||||
// GetSize
|
||||
static unsigned int GetSize(unsigned int _type, unsigned int _format,
|
||||
unsigned int _elements, unsigned int _index3);
|
||||
|
||||
// GetFunction
|
||||
static TPipelineFunction GetFunction(unsigned int _type,
|
||||
// GetFunction
|
||||
static TPipelineFunction GetFunction(unsigned int _type,
|
||||
unsigned int _format, unsigned int _elements, unsigned int _index3);
|
||||
|
||||
private:
|
||||
enum ENormalType
|
||||
{
|
||||
NRM_NOT_PRESENT = 0,
|
||||
NRM_DIRECT = 1,
|
||||
NRM_INDEX8 = 2,
|
||||
NRM_INDEX16 = 3,
|
||||
NUM_NRM_TYPE
|
||||
};
|
||||
enum ENormalType
|
||||
{
|
||||
NRM_NOT_PRESENT = 0,
|
||||
NRM_DIRECT = 1,
|
||||
NRM_INDEX8 = 2,
|
||||
NRM_INDEX16 = 3,
|
||||
NUM_NRM_TYPE
|
||||
};
|
||||
|
||||
enum ENormalFormat
|
||||
{
|
||||
FORMAT_UBYTE = 0,
|
||||
FORMAT_BYTE = 1,
|
||||
FORMAT_USHORT = 2,
|
||||
FORMAT_SHORT = 3,
|
||||
FORMAT_FLOAT = 4,
|
||||
NUM_NRM_FORMAT
|
||||
};
|
||||
enum ENormalFormat
|
||||
{
|
||||
FORMAT_UBYTE = 0,
|
||||
FORMAT_BYTE = 1,
|
||||
FORMAT_USHORT = 2,
|
||||
FORMAT_SHORT = 3,
|
||||
FORMAT_FLOAT = 4,
|
||||
NUM_NRM_FORMAT
|
||||
};
|
||||
|
||||
enum ENormalElements
|
||||
{
|
||||
NRM_NBT = 0,
|
||||
NRM_NBT3 = 1,
|
||||
NUM_NRM_ELEMENTS
|
||||
};
|
||||
enum ENormalElements
|
||||
{
|
||||
NRM_NBT = 0,
|
||||
NRM_NBT3 = 1,
|
||||
NUM_NRM_ELEMENTS
|
||||
};
|
||||
|
||||
enum ENormalIndices
|
||||
{
|
||||
|
|
|
@ -87,10 +87,10 @@ template <typename T, int N>
|
|||
void LOADERDECL Pos_ReadDirect()
|
||||
{
|
||||
static_assert(N <= 3, "N > 3 is not sane!");
|
||||
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
DataWrite(i<N ? PosScale(DataRead<T>()) : 0.f);
|
||||
|
||||
|
||||
LOG_VTX();
|
||||
}
|
||||
|
||||
|
@ -99,15 +99,15 @@ void LOADERDECL Pos_ReadIndex()
|
|||
{
|
||||
static_assert(!std::numeric_limits<I>::is_signed, "Only unsigned I is sane!");
|
||||
static_assert(N <= 3, "N > 3 is not sane!");
|
||||
|
||||
|
||||
auto const index = DataRead<I>();
|
||||
if (index < std::numeric_limits<I>::max())
|
||||
{
|
||||
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_POSITION] + (index * arraystrides[ARRAY_POSITION]));
|
||||
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
DataWrite(i<N ? PosScale(Common::FromBigEndian(data[i])) : 0.f);
|
||||
|
||||
|
||||
LOG_VTX();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
class VertexLoader_Position {
|
||||
public:
|
||||
|
||||
// Init
|
||||
static void Init(void);
|
||||
// Init
|
||||
static void Init(void);
|
||||
|
||||
// GetSize
|
||||
static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
// GetSize
|
||||
static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
|
||||
// GetFunction
|
||||
static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
// GetFunction
|
||||
static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -70,7 +70,7 @@ void LOADERDECL TexCoord_ReadDirect()
|
|||
DataWrite(TCScale(DataRead<T>()));
|
||||
|
||||
LOG_TEX<N>();
|
||||
|
||||
|
||||
++tcIndex;
|
||||
}
|
||||
|
||||
|
@ -82,10 +82,10 @@ void LOADERDECL TexCoord_ReadIndex()
|
|||
auto const index = DataRead<I>();
|
||||
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_TEXCOORD0 + tcIndex]
|
||||
+ (index * arraystrides[ARRAY_TEXCOORD0 + tcIndex]));
|
||||
|
||||
|
||||
for (int i = 0; i != N; ++i)
|
||||
DataWrite(TCScale(Common::FromBigEndian(data[i])));
|
||||
|
||||
|
||||
LOG_TEX<N>();
|
||||
++tcIndex;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ template <typename I>
|
|||
void LOADERDECL TexCoord_ReadIndex_Short2_SSE4()
|
||||
{
|
||||
static_assert(!std::numeric_limits<I>::is_signed, "Only unsigned I is sane!");
|
||||
|
||||
|
||||
// Heavy in ZWW
|
||||
auto const index = DataRead<I>();
|
||||
const s32 *pData = (const s32*)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
|
@ -121,7 +121,7 @@ template <typename I>
|
|||
void LOADERDECL TexCoord_ReadIndex_Float2_SSSE3()
|
||||
{
|
||||
static_assert(!std::numeric_limits<I>::is_signed, "Only unsigned I is sane!");
|
||||
|
||||
|
||||
auto const index = DataRead<I>();
|
||||
const u32 *pData = (const u32 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
GC_ALIGNED128(const __m128i a = _mm_loadl_epi64((__m128i*)pData));
|
||||
|
|
|
@ -24,18 +24,18 @@ class VertexLoader_TextCoord
|
|||
{
|
||||
public:
|
||||
|
||||
// Init
|
||||
static void Init(void);
|
||||
// Init
|
||||
static void Init(void);
|
||||
|
||||
// GetSize
|
||||
static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
// GetSize
|
||||
static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
|
||||
// GetFunction
|
||||
static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
// GetFunction
|
||||
static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
|
||||
// GetDummyFunction
|
||||
// GetDummyFunction
|
||||
// It is important to synchronize tcIndex.
|
||||
static TPipelineFunction GetDummyFunction();
|
||||
static TPipelineFunction GetDummyFunction();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -103,7 +103,7 @@ void VertexManager::AddVertices(int primitive, u32 numVertices)
|
|||
|
||||
ADDSTAT(stats.thisFrame.numPrims, numVertices);
|
||||
INCSTAT(stats.thisFrame.numPrimitiveJoins);
|
||||
|
||||
|
||||
IndexGenerator::AddIndices(primitive, numVertices);
|
||||
}
|
||||
|
||||
|
@ -111,14 +111,14 @@ void VertexManager::Flush()
|
|||
{
|
||||
if (g_vertex_manager->IsFlushed())
|
||||
return;
|
||||
|
||||
|
||||
// loading a state will invalidate BP, so check for it
|
||||
g_video_backend->CheckInvalidState();
|
||||
|
||||
|
||||
VideoFifo_CheckEFBAccess();
|
||||
|
||||
|
||||
g_vertex_manager->vFlush();
|
||||
|
||||
|
||||
g_vertex_manager->ResetBuffer();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,10 @@ public:
|
|||
virtual void DestroyDeviceObjects(){};
|
||||
|
||||
protected:
|
||||
u16* GetTriangleIndexBuffer() { return &TIBuffer[0]; }
|
||||
u16* GetLineIndexBuffer() { return &LIBuffer[0]; }
|
||||
u16* GetPointIndexBuffer() { return &PIBuffer[0]; }
|
||||
u8* GetVertexBuffer() { return &s_pBaseBufferPointer[0]; }
|
||||
u16* GetTriangleIndexBuffer() { return &TIBuffer[0]; }
|
||||
u16* GetLineIndexBuffer() { return &LIBuffer[0]; }
|
||||
u16* GetPointIndexBuffer() { return &PIBuffer[0]; }
|
||||
u8* GetVertexBuffer() { return &s_pBaseBufferPointer[0]; }
|
||||
|
||||
virtual void vDoState(PointerWrap& p) { DoStateShared(p); }
|
||||
void DoStateShared(PointerWrap& p);
|
||||
|
|
|
@ -174,7 +174,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
|
||||
_assert_(bpmem.genMode.numtexgens == xfregs.numTexGen.numTexGens);
|
||||
_assert_(bpmem.genMode.numcolchans == xfregs.numChan.numColorChans);
|
||||
|
||||
|
||||
bool is_d3d = (ApiType & API_D3D9 || ApiType == API_D3D11);
|
||||
u32 lightMask = 0;
|
||||
if (xfregs.numChan.numColorChans > 0)
|
||||
|
@ -184,11 +184,11 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
|
||||
char *p = text;
|
||||
WRITE(p, "//Vertex Shader: comp:%x, \n", components);
|
||||
|
||||
|
||||
// uniforms
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
WRITE(p, "layout(std140) uniform VSBlock {\n");
|
||||
|
||||
|
||||
WRITE(p, "%sfloat4 " I_POSNORMALMATRIX"[6] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_POSNORMALMATRIX));
|
||||
WRITE(p, "%sfloat4 " I_PROJECTION"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_PROJECTION));
|
||||
WRITE(p, "%sfloat4 " I_MATERIALS"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_MATERIALS));
|
||||
|
@ -198,10 +198,9 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
WRITE(p, "%sfloat4 " I_NORMALMATRICES"[32] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_NORMALMATRICES));
|
||||
WRITE(p, "%sfloat4 " I_POSTTRANSFORMMATRICES"[64] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_POSTTRANSFORMMATRICES));
|
||||
WRITE(p, "%sfloat4 " I_DEPTHPARAMS" %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_DEPTHPARAMS));
|
||||
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
WRITE(p, "};\n");
|
||||
|
||||
|
||||
p = GenerateVSOutputStruct(p, components, ApiType);
|
||||
|
||||
|
@ -221,7 +220,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
WRITE(p, "ATTRIN float4 color0; // ATTR%d,\n", SHADER_COLOR0_ATTRIB);
|
||||
if (components & VB_HAS_COL1)
|
||||
WRITE(p, "ATTRIN float4 color1; // ATTR%d,\n", SHADER_COLOR1_ATTRIB);
|
||||
|
||||
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
u32 hastexmtx = (components & (VB_HAS_TEXMTXIDX0<<i));
|
||||
if ((components & (VB_HAS_UV0<<i)) || hastexmtx)
|
||||
|
@ -258,8 +257,8 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
}
|
||||
else
|
||||
{
|
||||
WRITE(p, "VS_OUTPUT main(\n");
|
||||
|
||||
WRITE(p, "VS_OUTPUT main(\n");
|
||||
|
||||
// inputs
|
||||
if (components & VB_HAS_NRM0)
|
||||
WRITE(p, " float3 rawnorm0 : NORMAL0,\n");
|
||||
|
@ -335,8 +334,6 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
if (!(components & VB_HAS_NRM0))
|
||||
WRITE(p, "float3 _norm0 = float3(0.0f, 0.0f, 0.0f);\n");
|
||||
|
||||
|
||||
|
||||
WRITE(p, "o.pos = float4(dot(" I_PROJECTION"[0], pos), dot(" I_PROJECTION"[1], pos), dot(" I_PROJECTION"[2], pos), dot(" I_PROJECTION"[3], pos));\n");
|
||||
|
||||
WRITE(p, "float4 mat, lacc;\n"
|
||||
|
@ -506,9 +503,9 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
WRITE(p, "o.tex7 = pos.xyzz;\n");
|
||||
else
|
||||
WRITE(p, "o.tex7.w = pos.z;\n");
|
||||
}
|
||||
}
|
||||
if (components & VB_HAS_COL0)
|
||||
WRITE(p, "o.colors_0 = color0;\n");
|
||||
WRITE(p, "o.colors_0 = color0;\n");
|
||||
|
||||
if (components & VB_HAS_COL1)
|
||||
WRITE(p, "o.colors_1 = color1;\n");
|
||||
|
@ -522,26 +519,26 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
}
|
||||
else
|
||||
{
|
||||
// this results in a scale from -1..0 to -1..1 after perspective
|
||||
// divide
|
||||
WRITE(p, "o.pos.z = o.pos.w + o.pos.z * 2.0f;\n");
|
||||
// this results in a scale from -1..0 to -1..1 after perspective
|
||||
// divide
|
||||
WRITE(p, "o.pos.z = o.pos.w + o.pos.z * 2.0f;\n");
|
||||
|
||||
// Sonic Unleashed puts its final rendering at the near or
|
||||
// far plane of the viewing frustrum(actually box, they use
|
||||
// orthogonal projection for that), and we end up putting it
|
||||
// just beyond, and the rendering gets clipped away. (The
|
||||
// primitive gets dropped)
|
||||
WRITE(p, "o.pos.z = o.pos.z * 1048575.0f/1048576.0f;\n");
|
||||
// Sonic Unleashed puts its final rendering at the near or
|
||||
// far plane of the viewing frustrum(actually box, they use
|
||||
// orthogonal projection for that), and we end up putting it
|
||||
// just beyond, and the rendering gets clipped away. (The
|
||||
// primitive gets dropped)
|
||||
WRITE(p, "o.pos.z = o.pos.z * 1048575.0f/1048576.0f;\n");
|
||||
|
||||
// the next steps of the OGL pipeline are:
|
||||
// (x_c,y_c,z_c,w_c) = o.pos //switch to OGL spec terminology
|
||||
// clipping to -w_c <= (x_c,y_c,z_c) <= w_c
|
||||
// (x_d,y_d,z_d) = (x_c,y_c,z_c)/w_c//perspective divide
|
||||
// z_w = (f-n)/2*z_d + (n+f)/2
|
||||
// z_w now contains the value to go to the 0..1 depth buffer
|
||||
|
||||
//trying to get the correct semantic while not using glDepthRange
|
||||
//seems to get rather complicated
|
||||
// the next steps of the OGL pipeline are:
|
||||
// (x_c,y_c,z_c,w_c) = o.pos //switch to OGL spec terminology
|
||||
// clipping to -w_c <= (x_c,y_c,z_c) <= w_c
|
||||
// (x_d,y_d,z_d) = (x_c,y_c,z_c)/w_c//perspective divide
|
||||
// z_w = (f-n)/2*z_d + (n+f)/2
|
||||
// z_w now contains the value to go to the 0..1 depth buffer
|
||||
|
||||
//trying to get the correct semantic while not using glDepthRange
|
||||
//seems to get rather complicated
|
||||
}
|
||||
|
||||
if (ApiType & API_D3D9)
|
||||
|
@ -579,7 +576,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
|||
for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i)
|
||||
WRITE(p, " uv%d_2%s = o.tex%d;\n", i, i < 4 ? ".xyzw" : ".xyz" , i);
|
||||
}
|
||||
}
|
||||
}
|
||||
WRITE(p, "colors_02 = o.colors_0;\n");
|
||||
WRITE(p, "colors_12 = o.colors_1;\n");
|
||||
WRITE(p, "gl_Position = o.pos;\n");
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
#define C_NORMALMATRICES (C_TRANSFORMMATRICES + 64)
|
||||
#define C_POSTTRANSFORMMATRICES (C_NORMALMATRICES + 32)
|
||||
#define C_DEPTHPARAMS (C_POSTTRANSFORMMATRICES + 64)
|
||||
#define C_VENVCONST_END (C_DEPTHPARAMS + 1)
|
||||
#define C_VENVCONST_END (C_DEPTHPARAMS + 1)
|
||||
const s_svar VSVar_Loc[] = { {I_POSNORMALMATRIX, C_POSNORMALMATRIX, 6 },
|
||||
{I_PROJECTION , C_PROJECTION, 4 },
|
||||
{I_MATERIALS, C_MATERIALS, 4 },
|
||||
|
|
|
@ -102,7 +102,7 @@ float PHackValue(std::string sValue)
|
|||
c[i] = (cStr[i] == ',') ? '.' : *(cStr+i);
|
||||
if (c[i] == '.')
|
||||
fp = true;
|
||||
}
|
||||
}
|
||||
cStr = c;
|
||||
sTof.str(cStr);
|
||||
sTof >> f;
|
||||
|
@ -119,22 +119,22 @@ void UpdateProjectionHack(int iPhackvalue[], std::string sPhackvalue[])
|
|||
float fhacksign1 = 1.0, fhacksign2 = 1.0;
|
||||
bool bProjHack3 = false;
|
||||
const char *sTemp[2];
|
||||
|
||||
|
||||
if (iPhackvalue[0] == 1)
|
||||
{
|
||||
NOTICE_LOG(VIDEO, "\t\t--- Ortographic Projection Hack ON ---");
|
||||
|
||||
|
||||
fhacksign1 *= (iPhackvalue[1] == 1) ? -1.0f : fhacksign1;
|
||||
sTemp[0] = (iPhackvalue[1] == 1) ? " * (-1)" : "";
|
||||
fhacksign2 *= (iPhackvalue[2] == 1) ? -1.0f : fhacksign2;
|
||||
sTemp[1] = (iPhackvalue[2] == 1) ? " * (-1)" : "";
|
||||
|
||||
|
||||
fhackvalue1 = PHackValue(sPhackvalue[0]);
|
||||
NOTICE_LOG(VIDEO, "- zNear Correction = (%f + zNear)%s", fhackvalue1, sTemp[0]);
|
||||
|
||||
fhackvalue2 = PHackValue(sPhackvalue[1]);
|
||||
NOTICE_LOG(VIDEO, "- zFar Correction = (%f + zFar)%s", fhackvalue2, sTemp[1]);
|
||||
|
||||
|
||||
sTemp[0] = "DISABLED";
|
||||
bProjHack3 = (iPhackvalue[3] == 1) ? true : bProjHack3;
|
||||
if (bProjHack3)
|
||||
|
@ -171,22 +171,22 @@ void VertexShaderManager::Dirty()
|
|||
{
|
||||
nTransformMatricesChanged[0] = 0;
|
||||
nTransformMatricesChanged[1] = 256;
|
||||
|
||||
|
||||
nNormalMatricesChanged[0] = 0;
|
||||
nNormalMatricesChanged[1] = 96;
|
||||
|
||||
|
||||
nPostTransformMatricesChanged[0] = 0;
|
||||
nPostTransformMatricesChanged[1] = 256;
|
||||
|
||||
|
||||
nLightsChanged[0] = 0;
|
||||
nLightsChanged[1] = 0x80;
|
||||
|
||||
|
||||
bPosNormalMatrixChanged = true;
|
||||
bTexMatricesChanged[0] = true;
|
||||
bTexMatricesChanged[1] = true;
|
||||
|
||||
|
||||
bProjectionChanged = true;
|
||||
|
||||
|
||||
nMaterialsChanged = 15;
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ void VertexShaderManager::SetConstants()
|
|||
switch(xfregs.projection.type)
|
||||
{
|
||||
case GX_PERSPECTIVE:
|
||||
|
||||
|
||||
g_fProjectionMatrix[0] = rawProjection[0] * g_ActiveConfig.fAspectRatioHackW;
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
g_fProjectionMatrix[2] = rawProjection[1];
|
||||
|
@ -374,7 +374,7 @@ void VertexShaderManager::SetConstants()
|
|||
g_fProjectionMatrix[10] = rawProjection[4];
|
||||
|
||||
g_fProjectionMatrix[11] = rawProjection[5];
|
||||
|
||||
|
||||
g_fProjectionMatrix[12] = 0.0f;
|
||||
g_fProjectionMatrix[13] = 0.0f;
|
||||
// donkopunchstania: GC GPU rounds differently?
|
||||
|
@ -399,9 +399,9 @@ void VertexShaderManager::SetConstants()
|
|||
SETSTAT_FT(stats.gproj_14, g_fProjectionMatrix[14]);
|
||||
SETSTAT_FT(stats.gproj_15, g_fProjectionMatrix[15]);
|
||||
break;
|
||||
|
||||
|
||||
case GX_ORTHOGRAPHIC:
|
||||
|
||||
|
||||
g_fProjectionMatrix[0] = rawProjection[0];
|
||||
g_fProjectionMatrix[1] = 0.0f;
|
||||
g_fProjectionMatrix[2] = 0.0f;
|
||||
|
@ -426,10 +426,10 @@ void VertexShaderManager::SetConstants()
|
|||
this hack was added...setting g_fProjectionMatrix[14] to -1 might make the hack more stable, needs more testing.
|
||||
Only works for OGL and DX9...this is not helping DX11
|
||||
*/
|
||||
|
||||
|
||||
g_fProjectionMatrix[14] = 0.0f;
|
||||
g_fProjectionMatrix[15] = (g_ProjHack3 && rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled
|
||||
|
||||
|
||||
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
|
||||
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
|
||||
SETSTAT_FT(stats.g2proj_2, g_fProjectionMatrix[2]);
|
||||
|
@ -453,7 +453,7 @@ void VertexShaderManager::SetConstants()
|
|||
SETSTAT_FT(stats.proj_4, rawProjection[4]);
|
||||
SETSTAT_FT(stats.proj_5, rawProjection[5]);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
ERROR_LOG(VIDEO, "unknown projection type: %d", xfregs.projection.type);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
static void Dirty();
|
||||
static void Shutdown();
|
||||
static void DoState(PointerWrap &p);
|
||||
;
|
||||
|
||||
// constant management
|
||||
static void SetConstants();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ void VideoConfig::Load(const char *ini_file)
|
|||
std::string temp;
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
|
||||
|
||||
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
|
||||
iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
|
||||
iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
|
||||
|
@ -78,17 +78,17 @@ void VideoConfig::Load(const char *ini_file)
|
|||
iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0);
|
||||
iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0);
|
||||
iniFile.Get("Settings", "HackedBufferUpload", &bHackedBufferUpload, 0);
|
||||
|
||||
|
||||
iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
|
||||
iniFile.Get("Settings", "EFBScale", &iEFBScale, 2); // native
|
||||
|
||||
|
||||
iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);
|
||||
|
||||
|
||||
iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
|
||||
iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
|
||||
iniFile.Get("Settings", "WireFrame", &bWireFrame, 0);
|
||||
iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);
|
||||
|
||||
|
||||
iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false);
|
||||
iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false);
|
||||
|
||||
|
@ -98,7 +98,7 @@ void VideoConfig::Load(const char *ini_file)
|
|||
iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x)
|
||||
iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, "");
|
||||
iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false);
|
||||
|
||||
|
||||
iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
|
||||
iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false);
|
||||
iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true);
|
||||
|
@ -219,14 +219,14 @@ void VideoConfig::Save(const char *ini_file)
|
|||
|
||||
iniFile.Set("Settings", "EnableOpenCL", bEnableOpenCL);
|
||||
iniFile.Set("Settings", "OMPDecoder", bOMPDecoder);
|
||||
|
||||
|
||||
iniFile.Set("Settings", "EnableShaderDebugging", bEnableShaderDebugging);
|
||||
|
||||
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
|
||||
iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy);
|
||||
iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader);
|
||||
iniFile.Set("Enhancements", "Enable3dVision", b3DVision);
|
||||
|
||||
|
||||
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
|
||||
iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable);
|
||||
iniFile.Set("Hacks", "EFBCopyEnable", bEFBCopyEnable);
|
||||
|
@ -237,7 +237,7 @@ void VideoConfig::Save(const char *ini_file)
|
|||
iniFile.Set("Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
|
||||
|
||||
iniFile.Set("Hardware", "Adapter", iAdapter);
|
||||
|
||||
|
||||
iniFile.Save(ini_file);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,12 +99,12 @@ struct VideoConfig
|
|||
bool bTexFmtOverlayCenter;
|
||||
bool bShowEFBCopyRegions;
|
||||
bool bLogFPSToFile;
|
||||
|
||||
|
||||
// Render
|
||||
bool bWireFrame;
|
||||
bool bDstAlphaPass;
|
||||
bool bDisableFog;
|
||||
|
||||
|
||||
// Utility
|
||||
bool bDumpTextures;
|
||||
bool bHiresTextures;
|
||||
|
@ -164,7 +164,7 @@ struct VideoConfig
|
|||
bool bSupportsDualSourceBlend; // only supported by D3D11 and OpenGL
|
||||
bool bSupportsFormatReinterpretation;
|
||||
bool bSupportsPixelLighting;
|
||||
|
||||
|
||||
bool bSupportsGLSLUBO;
|
||||
bool bSupportsGLSLCache;
|
||||
bool bSupportsGLPinnedMemory;
|
||||
|
@ -172,11 +172,11 @@ struct VideoConfig
|
|||
bool bSupportsGLBaseVertex;
|
||||
} backend_info;
|
||||
|
||||
// Utility
|
||||
bool RealXFBEnabled() const { return bUseXFB && bUseRealXFB; }
|
||||
bool VirtualXFBEnabled() const { return bUseXFB && !bUseRealXFB; }
|
||||
bool EFBCopiesToTextureEnabled() const { return bEFBCopyEnable && bCopyEFBToTexture; }
|
||||
bool EFBCopiesToRamEnabled() const { return bEFBCopyEnable && !bCopyEFBToTexture; }
|
||||
// Utility
|
||||
bool RealXFBEnabled() const { return bUseXFB && bUseRealXFB; }
|
||||
bool VirtualXFBEnabled() const { return bUseXFB && !bUseRealXFB; }
|
||||
bool EFBCopiesToTextureEnabled() const { return bEFBCopyEnable && bCopyEFBToTexture; }
|
||||
bool EFBCopiesToRamEnabled() const { return bEFBCopyEnable && !bCopyEFBToTexture; }
|
||||
};
|
||||
|
||||
extern VideoConfig g_Config;
|
||||
|
|
|
@ -30,33 +30,33 @@
|
|||
|
||||
static void DoState(PointerWrap &p)
|
||||
{
|
||||
// BP Memory
|
||||
p.Do(bpmem);
|
||||
// BP Memory
|
||||
p.Do(bpmem);
|
||||
p.DoMarker("BP Memory");
|
||||
|
||||
// CP Memory
|
||||
p.DoArray(arraybases, 16);
|
||||
p.DoArray(arraystrides, 16);
|
||||
p.Do(MatrixIndexA);
|
||||
p.Do(MatrixIndexB);
|
||||
p.Do(g_VtxDesc.Hex);
|
||||
p.DoArray(arraybases, 16);
|
||||
p.DoArray(arraystrides, 16);
|
||||
p.Do(MatrixIndexA);
|
||||
p.Do(MatrixIndexB);
|
||||
p.Do(g_VtxDesc.Hex);
|
||||
p.DoArray(g_VtxAttr, 8);
|
||||
p.DoMarker("CP Memory");
|
||||
|
||||
// XF Memory
|
||||
p.Do(xfregs);
|
||||
p.DoArray(xfmem, XFMEM_SIZE);
|
||||
// XF Memory
|
||||
p.Do(xfregs);
|
||||
p.DoArray(xfmem, XFMEM_SIZE);
|
||||
p.DoMarker("XF Memory");
|
||||
|
||||
// Texture decoder
|
||||
p.DoArray(texMem, TMEM_SIZE);
|
||||
p.DoArray(texMem, TMEM_SIZE);
|
||||
p.DoMarker("texMem");
|
||||
|
||||
// FIFO
|
||||
Fifo_DoState(p);
|
||||
// FIFO
|
||||
Fifo_DoState(p);
|
||||
p.DoMarker("Fifo");
|
||||
|
||||
CommandProcessor::DoState(p);
|
||||
CommandProcessor::DoState(p);
|
||||
p.DoMarker("CommandProcessor");
|
||||
|
||||
PixelEngine::DoState(p);
|
||||
|
@ -77,7 +77,7 @@ static void DoState(PointerWrap &p)
|
|||
|
||||
void VideoCommon_DoState(PointerWrap &p)
|
||||
{
|
||||
DoState(p);
|
||||
DoState(p);
|
||||
}
|
||||
|
||||
void VideoCommon_RunLoop(bool enable)
|
||||
|
|
|
@ -110,70 +110,70 @@
|
|||
|
||||
union LitChannel
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 matsource : 1;
|
||||
u32 enablelighting : 1;
|
||||
u32 lightMask0_3 : 4;
|
||||
u32 ambsource : 1;
|
||||
u32 diffusefunc : 2; // LIGHTDIF_X
|
||||
u32 attnfunc : 2; // LIGHTATTN_X
|
||||
u32 lightMask4_7 : 4;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 hex : 15;
|
||||
u32 unused : 17;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 dummy0 : 7;
|
||||
u32 lightparams : 4;
|
||||
u32 dummy1 : 21;
|
||||
};
|
||||
unsigned int GetFullLightMask() const
|
||||
{
|
||||
return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0;
|
||||
}
|
||||
struct
|
||||
{
|
||||
u32 matsource : 1;
|
||||
u32 enablelighting : 1;
|
||||
u32 lightMask0_3 : 4;
|
||||
u32 ambsource : 1;
|
||||
u32 diffusefunc : 2; // LIGHTDIF_X
|
||||
u32 attnfunc : 2; // LIGHTATTN_X
|
||||
u32 lightMask4_7 : 4;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 hex : 15;
|
||||
u32 unused : 17;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 dummy0 : 7;
|
||||
u32 lightparams : 4;
|
||||
u32 dummy1 : 21;
|
||||
};
|
||||
unsigned int GetFullLightMask() const
|
||||
{
|
||||
return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
union INVTXSPEC
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 numcolors : 2;
|
||||
u32 numnormals : 2; // 0 - nothing, 1 - just normal, 2 - normals and binormals
|
||||
u32 numtextures : 4;
|
||||
u32 unused : 24;
|
||||
};
|
||||
u32 hex;
|
||||
struct
|
||||
{
|
||||
u32 numcolors : 2;
|
||||
u32 numnormals : 2; // 0 - nothing, 1 - just normal, 2 - normals and binormals
|
||||
u32 numtextures : 4;
|
||||
u32 unused : 24;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union TexMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 unknown : 1;
|
||||
u32 projection : 1; // XF_TEXPROJ_X
|
||||
u32 inputform : 2; // XF_TEXINPUT_X
|
||||
u32 texgentype : 3; // XF_TEXGEN_X
|
||||
u32 sourcerow : 5; // XF_SRCGEOM_X
|
||||
u32 embosssourceshift : 3; // what generated texcoord to use
|
||||
u32 embosslightshift : 3; // light index that is used
|
||||
};
|
||||
u32 hex;
|
||||
struct
|
||||
{
|
||||
u32 unknown : 1;
|
||||
u32 projection : 1; // XF_TEXPROJ_X
|
||||
u32 inputform : 2; // XF_TEXINPUT_X
|
||||
u32 texgentype : 3; // XF_TEXGEN_X
|
||||
u32 sourcerow : 5; // XF_SRCGEOM_X
|
||||
u32 embosssourceshift : 3; // what generated texcoord to use
|
||||
u32 embosslightshift : 3; // light index that is used
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union PostMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 index : 6; // base row of dual transform matrix
|
||||
u32 unused : 2;
|
||||
u32 normalize : 1; // normalize before send operation
|
||||
};
|
||||
u32 hex;
|
||||
struct
|
||||
{
|
||||
u32 index : 6; // base row of dual transform matrix
|
||||
u32 unused : 2;
|
||||
u32 normalize : 1; // normalize before send operation
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union NumColorChannel
|
||||
|
@ -207,25 +207,25 @@ union DualTexInfo
|
|||
|
||||
struct Light
|
||||
{
|
||||
u32 useless[3];
|
||||
u32 color; //rgba
|
||||
float a0; //attenuation
|
||||
float a1;
|
||||
float a2;
|
||||
float k0; //k stuff
|
||||
float k1;
|
||||
float k2;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
u32 useless[3];
|
||||
u32 color; //rgba
|
||||
float a0; //attenuation
|
||||
float a1;
|
||||
float a2;
|
||||
float k0; //k stuff
|
||||
float k1;
|
||||
float k2;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
float dpos[3];
|
||||
float ddir[3]; // specular lights only
|
||||
};
|
||||
struct {
|
||||
float sdir[3];
|
||||
float shalfangle[3]; // specular lights only
|
||||
};
|
||||
};
|
||||
float ddir[3]; // specular lights only
|
||||
};
|
||||
struct {
|
||||
float sdir[3];
|
||||
float shalfangle[3]; // specular lights only
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
struct Viewport
|
||||
|
@ -246,35 +246,35 @@ struct Projection
|
|||
|
||||
struct XFRegisters
|
||||
{
|
||||
u32 error; // 0x1000
|
||||
u32 diag; // 0x1001
|
||||
u32 state0; // 0x1002
|
||||
u32 state1; // 0x1003
|
||||
u32 xfClock; // 0x1004
|
||||
u32 clipDisable; // 0x1005
|
||||
u32 perf0; // 0x1006
|
||||
u32 perf1; // 0x1007
|
||||
INVTXSPEC hostinfo; // 0x1008 number of textures,colors,normals from vertex input
|
||||
NumColorChannel numChan; // 0x1009
|
||||
u32 ambColor[2]; // 0x100a, 0x100b
|
||||
u32 matColor[2]; // 0x100c, 0x100d
|
||||
LitChannel color[2]; // 0x100e, 0x100f
|
||||
LitChannel alpha[2]; // 0x1010, 0x1011
|
||||
DualTexInfo dualTexTrans; // 0x1012
|
||||
u32 unk3; // 0x1013
|
||||
u32 unk4; // 0x1014
|
||||
u32 unk5; // 0x1015
|
||||
u32 unk6; // 0x1016
|
||||
u32 unk7; // 0x1017
|
||||
u32 MatrixIndexA; // 0x1018
|
||||
u32 MatrixIndexB; // 0x1019
|
||||
Viewport viewport; // 0x101a - 0x101f
|
||||
Projection projection; // 0x1020 - 0x1026
|
||||
u32 unk8[24]; // 0x1027 - 0x103e
|
||||
NumTexGen numTexGen; // 0x103f
|
||||
TexMtxInfo texMtxInfo[8]; // 0x1040 - 0x1047
|
||||
u32 unk9[8]; // 0x1048 - 0x104f
|
||||
PostMtxInfo postMtxInfo[8]; // 0x1050 - 0x1057
|
||||
u32 error; // 0x1000
|
||||
u32 diag; // 0x1001
|
||||
u32 state0; // 0x1002
|
||||
u32 state1; // 0x1003
|
||||
u32 xfClock; // 0x1004
|
||||
u32 clipDisable; // 0x1005
|
||||
u32 perf0; // 0x1006
|
||||
u32 perf1; // 0x1007
|
||||
INVTXSPEC hostinfo; // 0x1008 number of textures,colors,normals from vertex input
|
||||
NumColorChannel numChan; // 0x1009
|
||||
u32 ambColor[2]; // 0x100a, 0x100b
|
||||
u32 matColor[2]; // 0x100c, 0x100d
|
||||
LitChannel color[2]; // 0x100e, 0x100f
|
||||
LitChannel alpha[2]; // 0x1010, 0x1011
|
||||
DualTexInfo dualTexTrans; // 0x1012
|
||||
u32 unk3; // 0x1013
|
||||
u32 unk4; // 0x1014
|
||||
u32 unk5; // 0x1015
|
||||
u32 unk6; // 0x1016
|
||||
u32 unk7; // 0x1017
|
||||
u32 MatrixIndexA; // 0x1018
|
||||
u32 MatrixIndexB; // 0x1019
|
||||
Viewport viewport; // 0x101a - 0x101f
|
||||
Projection projection; // 0x1020 - 0x1026
|
||||
u32 unk8[24]; // 0x1027 - 0x103e
|
||||
NumTexGen numTexGen; // 0x103f
|
||||
TexMtxInfo texMtxInfo[8]; // 0x1040 - 0x1047
|
||||
u32 unk9[8]; // 0x1048 - 0x104f
|
||||
PostMtxInfo postMtxInfo[8]; // 0x1050 - 0x1057
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -36,37 +36,37 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
|
|||
u32 address = baseAddress;
|
||||
u32 dataIndex = 0;
|
||||
|
||||
while (transferSize > 0 && address < 0x1058)
|
||||
{
|
||||
u32 newValue = pData[dataIndex];
|
||||
while (transferSize > 0 && address < 0x1058)
|
||||
{
|
||||
u32 newValue = pData[dataIndex];
|
||||
u32 nextAddress = address + 1;
|
||||
|
||||
switch (address)
|
||||
{
|
||||
case XFMEM_ERROR:
|
||||
case XFMEM_DIAG:
|
||||
case XFMEM_STATE0: // internal state 0
|
||||
case XFMEM_STATE1: // internal state 1
|
||||
case XFMEM_CLOCK:
|
||||
switch (address)
|
||||
{
|
||||
case XFMEM_ERROR:
|
||||
case XFMEM_DIAG:
|
||||
case XFMEM_STATE0: // internal state 0
|
||||
case XFMEM_STATE1: // internal state 1
|
||||
case XFMEM_CLOCK:
|
||||
case XFMEM_SETGPMETRIC:
|
||||
nextAddress = 0x1007;
|
||||
break;
|
||||
break;
|
||||
|
||||
case XFMEM_CLIPDISABLE:
|
||||
case XFMEM_CLIPDISABLE:
|
||||
//if (data & 1) {} // disable clipping detection
|
||||
//if (data & 2) {} // disable trivial rejection
|
||||
//if (data & 4) {} // disable cpoly clipping acceleration
|
||||
break;
|
||||
break;
|
||||
|
||||
case XFMEM_VTXSPECS: //__GXXfVtxSpecs, wrote 0004
|
||||
break;
|
||||
case XFMEM_VTXSPECS: //__GXXfVtxSpecs, wrote 0004
|
||||
break;
|
||||
|
||||
case XFMEM_SETNUMCHAN:
|
||||
case XFMEM_SETNUMCHAN:
|
||||
if (xfregs.numChan.numColorChans != (newValue & 3))
|
||||
VertexManager::Flush();
|
||||
break;
|
||||
VertexManager::Flush();
|
||||
break;
|
||||
|
||||
case XFMEM_SETCHAN0_AMBCOLOR: // Channel Ambient Color
|
||||
case XFMEM_SETCHAN0_AMBCOLOR: // Channel Ambient Color
|
||||
case XFMEM_SETCHAN1_AMBCOLOR:
|
||||
{
|
||||
u8 chan = address - XFMEM_SETCHAN0_AMBCOLOR;
|
||||
|
@ -75,11 +75,11 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
|
|||
VertexManager::Flush();
|
||||
VertexShaderManager::SetMaterialColorChanged(chan);
|
||||
PixelShaderManager::SetMaterialColorChanged(chan);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case XFMEM_SETCHAN0_MATCOLOR: // Channel Material Color
|
||||
case XFMEM_SETCHAN0_MATCOLOR: // Channel Material Color
|
||||
case XFMEM_SETCHAN1_MATCOLOR:
|
||||
{
|
||||
u8 chan = address - XFMEM_SETCHAN0_MATCOLOR;
|
||||
|
@ -92,28 +92,28 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
|
|||
break;
|
||||
}
|
||||
|
||||
case XFMEM_SETCHAN0_COLOR: // Channel Color
|
||||
case XFMEM_SETCHAN0_COLOR: // Channel Color
|
||||
case XFMEM_SETCHAN1_COLOR:
|
||||
case XFMEM_SETCHAN0_ALPHA: // Channel Alpha
|
||||
case XFMEM_SETCHAN1_ALPHA:
|
||||
case XFMEM_SETCHAN1_ALPHA:
|
||||
if (((u32*)&xfregs)[address - 0x1000] != (newValue & 0x7fff))
|
||||
VertexManager::Flush();
|
||||
VertexManager::Flush();
|
||||
break;
|
||||
|
||||
case XFMEM_DUALTEX:
|
||||
case XFMEM_DUALTEX:
|
||||
if (xfregs.dualTexTrans.enabled != (newValue & 1))
|
||||
VertexManager::Flush();
|
||||
break;
|
||||
VertexManager::Flush();
|
||||
break;
|
||||
|
||||
|
||||
case XFMEM_SETMATRIXINDA:
|
||||
//_assert_msg_(GX_XF, 0, "XF matrixindex0");
|
||||
case XFMEM_SETMATRIXINDA:
|
||||
//_assert_msg_(GX_XF, 0, "XF matrixindex0");
|
||||
VertexShaderManager::SetTexMatrixChangedA(newValue);
|
||||
break;
|
||||
case XFMEM_SETMATRIXINDB:
|
||||
//_assert_msg_(GX_XF, 0, "XF matrixindex1");
|
||||
VertexShaderManager::SetTexMatrixChangedB(newValue);
|
||||
break;
|
||||
break;
|
||||
case XFMEM_SETMATRIXINDB:
|
||||
//_assert_msg_(GX_XF, 0, "XF matrixindex1");
|
||||
VertexShaderManager::SetTexMatrixChangedB(newValue);
|
||||
break;
|
||||
|
||||
case XFMEM_SETVIEWPORT:
|
||||
case XFMEM_SETVIEWPORT+1:
|
||||
|
@ -135,16 +135,16 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
|
|||
case XFMEM_SETPROJECTION+4:
|
||||
case XFMEM_SETPROJECTION+5:
|
||||
case XFMEM_SETPROJECTION+6:
|
||||
VertexManager::Flush();
|
||||
VertexManager::Flush();
|
||||
VertexShaderManager::SetProjectionChanged();
|
||||
|
||||
nextAddress = XFMEM_SETPROJECTION + 7;
|
||||
break;
|
||||
|
||||
case XFMEM_SETNUMTEXGENS: // GXSetNumTexGens
|
||||
case XFMEM_SETNUMTEXGENS: // GXSetNumTexGens
|
||||
if (xfregs.numTexGen.numTexGens != (newValue & 15))
|
||||
VertexManager::Flush();
|
||||
break;
|
||||
break;
|
||||
|
||||
case XFMEM_SETTEXMTXINFO:
|
||||
case XFMEM_SETTEXMTXINFO+1:
|
||||
|
@ -178,47 +178,47 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
|
|||
|
||||
// Maybe these are for Normals?
|
||||
case 0x1048: //xfregs.texcoords[0].nrmmtxinfo.hex = data; break; ??
|
||||
case 0x1049:
|
||||
case 0x104a:
|
||||
case 0x104b:
|
||||
case 0x104c:
|
||||
case 0x104d:
|
||||
case 0x104e:
|
||||
case 0x104f:
|
||||
case 0x1049:
|
||||
case 0x104a:
|
||||
case 0x104b:
|
||||
case 0x104c:
|
||||
case 0x104d:
|
||||
case 0x104e:
|
||||
case 0x104f:
|
||||
DEBUG_LOG(VIDEO, "Possible Normal Mtx XF reg?: %x=%x\n", address, newValue);
|
||||
break;
|
||||
|
||||
case 0x1013:
|
||||
case 0x1014:
|
||||
case 0x1015:
|
||||
case 0x1016:
|
||||
case 0x1017:
|
||||
case 0x1014:
|
||||
case 0x1015:
|
||||
case 0x1016:
|
||||
case 0x1017:
|
||||
|
||||
default:
|
||||
WARN_LOG(VIDEO, "Unknown XF Reg: %x=%x\n", address, newValue);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
WARN_LOG(VIDEO, "Unknown XF Reg: %x=%x\n", address, newValue);
|
||||
break;
|
||||
}
|
||||
|
||||
int transferred = nextAddress - address;
|
||||
address = nextAddress;
|
||||
|
||||
transferSize -= transferred;
|
||||
dataIndex += transferred;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
|
||||
{
|
||||
// do not allow writes past registers
|
||||
if (baseAddress + transferSize > 0x1058)
|
||||
{
|
||||
INFO_LOG(VIDEO, "xf load exceeds address space: %x %d bytes\n", baseAddress, transferSize);
|
||||
// do not allow writes past registers
|
||||
if (baseAddress + transferSize > 0x1058)
|
||||
{
|
||||
INFO_LOG(VIDEO, "xf load exceeds address space: %x %d bytes\n", baseAddress, transferSize);
|
||||
|
||||
if (baseAddress >= 0x1058)
|
||||
transferSize = 0;
|
||||
else
|
||||
transferSize = 0x1058 - baseAddress;
|
||||
}
|
||||
if (baseAddress >= 0x1058)
|
||||
transferSize = 0;
|
||||
else
|
||||
transferSize = 0x1058 - baseAddress;
|
||||
}
|
||||
|
||||
// write to XF mem
|
||||
if (baseAddress < 0x1000 && transferSize > 0)
|
||||
|
@ -247,11 +247,11 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
|
|||
}
|
||||
|
||||
// write to XF regs
|
||||
if (transferSize > 0)
|
||||
if (transferSize > 0)
|
||||
{
|
||||
XFRegWritten(transferSize, baseAddress, pData);
|
||||
memcpy_gc((u32*)(&xfregs) + (baseAddress - 0x1000), pData, transferSize * 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - verify that it is correct. Seems to work, though.
|
||||
|
|
|
@ -111,17 +111,17 @@ struct CachedDisplayList
|
|||
u32 num_cp_reg;
|
||||
u32 num_bp_reg;
|
||||
u32 num_index_xf;
|
||||
u32 num_draw_call;
|
||||
u32 num_draw_call;
|
||||
u32 pass;
|
||||
u32 check;
|
||||
int frame_count;
|
||||
int frame_count;
|
||||
u32 BufferCount;
|
||||
|
||||
void InsertRegion(ReferencedDataRegion* NewRegion)
|
||||
{
|
||||
if(LastRegion)
|
||||
{
|
||||
LastRegion->NextRegion = NewRegion;
|
||||
LastRegion->NextRegion = NewRegion;
|
||||
}
|
||||
LastRegion = NewRegion;
|
||||
if(!Regions)
|
||||
|
@ -174,7 +174,7 @@ struct CachedDisplayList
|
|||
Current = Current->NextRegion;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ReferencedDataRegion* FindOverlapingRegion(u8* RegionStart, u32 Regionsize)
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ struct CachedDisplayList
|
|||
while(Current)
|
||||
{
|
||||
if(!Current->IntersectsMemoryRange(RegionStart, Regionsize))
|
||||
return Current;
|
||||
return Current;
|
||||
Current = Current->NextRegion;
|
||||
}
|
||||
return Current;
|
||||
|
@ -330,7 +330,7 @@ u32 AnalyzeAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
|
|||
u32 addr = DataReadU32();
|
||||
u32 count = DataReadU32();
|
||||
ExecuteDisplayList(addr, count);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GX_CMD_UNKNOWN_METRICS: // zelda 4 swords calls it and checks the metrics registers after that
|
||||
DEBUG_LOG(VIDEO, "GX 0x44: %08x", cmd_byte);
|
||||
|
@ -392,7 +392,7 @@ u32 AnalyzeAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
|
|||
dl->num_draw_call = num_draw_call;
|
||||
dl->num_index_xf = num_index_xf;
|
||||
dl->num_xf_reg = num_xf_reg;
|
||||
// reset to the old pointer
|
||||
// reset to the old pointer
|
||||
g_pVideoData = old_pVideoData;
|
||||
return result;
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
|
|||
NewRegion->MustClean = true;
|
||||
NewRegion->size = transfer_size * 4;
|
||||
NewRegion->start_address = (u8*) new u8[NewRegion->size+15+12]; // alignment and guaranteed space
|
||||
NewRegion->hash = 0;
|
||||
NewRegion->hash = 0;
|
||||
dl->InsertRegion(NewRegion);
|
||||
u32 *data_buffer = (u32*)(u8*)(((size_t)NewRegion->start_address+0xf)&~0xf);
|
||||
DataReadU32xFuncs[transfer_size-1](data_buffer);
|
||||
|
@ -539,7 +539,6 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
|
|||
if (cmd_byte & 0x80)
|
||||
{
|
||||
// load vertices (use computed vertex size from FifoCommandRunnable above)
|
||||
|
||||
u16 numVertices = DataReadU16();
|
||||
if(numVertices > 0)
|
||||
{
|
||||
|
@ -558,7 +557,7 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
|
|||
NewRegion->MustClean = true;
|
||||
NewRegion->size = Vdatasize;
|
||||
NewRegion->start_address = (u8*)new u8[Vdatasize];
|
||||
NewRegion->hash = 0;
|
||||
NewRegion->hash = 0;
|
||||
dl->InsertRegion(NewRegion);
|
||||
memcpy(NewRegion->start_address, StartAddress, Vdatasize);
|
||||
emitter.ABI_CallFunctionCCCP((void *)&VertexLoaderManager::RunCompiledVertices, cmd_byte & GX_VAT_MASK, (cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices, NewRegion->start_address);
|
||||
|
@ -577,7 +576,6 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -626,7 +624,7 @@ void Clear()
|
|||
}
|
||||
dl_map.clear();
|
||||
// Reset the cache pointers.
|
||||
emitter.SetCodePtr(dlcode_cache);
|
||||
emitter.SetCodePtr(dlcode_cache);
|
||||
}
|
||||
|
||||
void ProgressiveCleanup()
|
||||
|
@ -684,14 +682,14 @@ bool HandleDisplayList(u32 address, u32 size)
|
|||
{
|
||||
vhash = DLCache::CreateVMapId(Parentiter->second.VATUsed);
|
||||
iter = Parentiter->second.dl_map.find(vhash);
|
||||
childexist = iter != Parentiter->second.dl_map.end();
|
||||
childexist = iter != Parentiter->second.dl_map.end();
|
||||
}
|
||||
if (Parentiter != DLCache::dl_map.end() && childexist)
|
||||
{
|
||||
DLCache::CachedDisplayList &dl = iter->second;
|
||||
if (dl.uncachable)
|
||||
{
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (dl.pass)
|
||||
|
@ -700,7 +698,7 @@ bool HandleDisplayList(u32 address, u32 size)
|
|||
// First, check that the hash is the same as the last time.
|
||||
if (dl.dl_hash != GetHash64(Memory::GetPointer(address), size, 0))
|
||||
{
|
||||
dl.uncachable = true;
|
||||
dl.uncachable = true;
|
||||
return false;
|
||||
}
|
||||
DLCache::CompileAndRunDisplayList(address, size, &dl);
|
||||
|
@ -717,7 +715,7 @@ bool HandleDisplayList(u32 address, u32 size)
|
|||
if (DlistChanged)
|
||||
{
|
||||
dl.uncachable = true;
|
||||
dl.ClearRegions();
|
||||
dl.ClearRegions();
|
||||
return false;
|
||||
}
|
||||
dl.frame_count= frameCount;
|
||||
|
@ -764,10 +762,9 @@ bool HandleDisplayList(u32 address, u32 size)
|
|||
vdl.VATUsed = dlvatused;
|
||||
vdl.count = 1;
|
||||
DLCache::dl_map[dl_id] = vdl;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void IncrementCheckContextId()
|
||||
|
|
|
@ -517,7 +517,7 @@ inline void decodebytesARGB8_4ToRgba(u32 *dst, const u16 *src, const u16 * src2)
|
|||
{
|
||||
#if 0
|
||||
for (int x = 0; x < 4; x++) {
|
||||
dst[x] = ((src[x] & 0xFF) << 24) | ((src[x] & 0xFF00)>>8) | (src2[x] << 8);
|
||||
dst[x] = ((src[x] & 0xFF) << 24) | ((src[x] & 0xFF00)>>8) | (src2[x] << 8);
|
||||
}
|
||||
#else
|
||||
dst[0] = ((src[0] & 0xFF) << 24) | ((src[0] & 0xFF00)>>8) | (src2[0] << 8);
|
||||
|
@ -556,7 +556,7 @@ void decodeDXTBlock(u32 *dst, const DXTBlock *src, int pitch)
|
|||
{
|
||||
int blue3 = ((blue2 - blue1) >> 1) - ((blue2 - blue1) >> 3);
|
||||
int green3 = ((green2 - green1) >> 1) - ((green2 - green1) >> 3);
|
||||
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
|
||||
int red3 = ((red2 - red1) >> 1) - ((red2 - red1) >> 3);
|
||||
colors[2] = makecol(red1 + red3, green1 + green3, blue1 + blue3, 255);
|
||||
colors[3] = makecol(red2 - red3, green2 - green3, blue2 - blue3, 255);
|
||||
}
|
||||
|
@ -2140,7 +2140,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u32 base = (tBlk * widthBlks + sBlk) * blockWidth * blockHeight;
|
||||
u16 blkS = s & (blockWidth - 1);
|
||||
u16 blkT = t & (blockHeight - 1);
|
||||
u32 blkOff = blkT * blockWidth + blkS;
|
||||
u32 blkOff = blkT * blockWidth + blkS;
|
||||
*/
|
||||
|
||||
switch (texformat)
|
||||
|
@ -2154,9 +2154,9 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 7;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
int rs = (blkOff & 1)?0:4;
|
||||
u32 offset = base + (blkOff >> 1);
|
||||
u32 offset = base + (blkOff >> 1);
|
||||
|
||||
u8 val = (*(src + offset) >> rs) & 0xF;
|
||||
u16 *tlut = (u16*)(texMem + tlutaddr);
|
||||
|
@ -2166,7 +2166,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
case 0:
|
||||
*((u32*)dst) = decodeIA8Swapped(tlut[val]);
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
*((u32*)dst) = decode565RGBA(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 2:
|
||||
|
@ -2184,9 +2184,9 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 7;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
int rs = (blkOff & 1)?0:4;
|
||||
u32 offset = base + (blkOff >> 1);
|
||||
u32 offset = base + (blkOff >> 1);
|
||||
|
||||
u8 val = (*(src + offset) >> rs) & 0xF;
|
||||
val = Convert4To8(val);
|
||||
|
@ -2205,7 +2205,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
u8 val = *(src + base + blkOff);
|
||||
dst[0] = val;
|
||||
dst[1] = val;
|
||||
|
@ -2222,7 +2222,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
u8 val = *(src + base + blkOff);
|
||||
u16 *tlut = (u16*)(texMem + tlutaddr);
|
||||
|
||||
|
@ -2231,7 +2231,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
case 0:
|
||||
*((u32*)dst) = decodeIA8Swapped(tlut[val]);
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
*((u32*)dst) = decode565RGBA(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 2:
|
||||
|
@ -2249,7 +2249,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 7;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 3) + blkS;
|
||||
|
||||
|
||||
u8 val = *(src + base + blkOff);
|
||||
const u8 a = Convert4To8(val>>4);
|
||||
const u8 l = Convert4To8(val&0xF);
|
||||
|
@ -2268,7 +2268,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 2) + blkS;
|
||||
|
||||
|
||||
u32 offset = (base + blkOff) << 1;
|
||||
const u16* valAddr = (u16*)(src + offset);
|
||||
|
||||
|
@ -2284,7 +2284,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 2) + blkS;
|
||||
|
||||
|
||||
u32 offset = (base + blkOff) << 1;
|
||||
const u16* valAddr = (u16*)(src + offset);
|
||||
|
||||
|
@ -2296,7 +2296,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
case 0:
|
||||
*((u32*)dst) = decodeIA8Swapped(tlut[val]);
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
*((u32*)dst) = decode565RGBA(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 2:
|
||||
|
@ -2314,7 +2314,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u16 blkS = s & 3;
|
||||
u16 blkT = t & 3;
|
||||
u32 blkOff = (blkT << 2) + blkS;
|
||||
|
||||
|
||||
u32 offset = (base + blkOff) << 1;
|
||||
const u16* valAddr = (u16*)(src + offset);
|
||||
|
||||
|
@ -2372,7 +2372,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
u32 offset = (base + blkOff) << 3;
|
||||
|
||||
const DXTBlock* dxtBlock = (const DXTBlock*)(src + offset);
|
||||
|
||||
|
||||
u16 c1 = Common::swap16(dxtBlock->color1);
|
||||
u16 c2 = Common::swap16(dxtBlock->color2);
|
||||
int blue1 = Convert5To8(c1 & 0x1F);
|
||||
|
@ -2391,7 +2391,7 @@ void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth
|
|||
colorSel |= c1 > c2?0:4;
|
||||
|
||||
u32 color = 0;
|
||||
|
||||
|
||||
switch (colorSel)
|
||||
{
|
||||
case 0:
|
||||
|
|
Loading…
Reference in New Issue