Merge branch 'master' into FIFO-BP

# By Jordan Woyak (24) and others
# Via Jordan Woyak (3) and others
* master: (66 commits)
  Reduce some DI command delays. Fix DKCR hanging with DSP HLE. My other games continue to work.
  Video_Software: Fix ZComploc option breaking stuff.
  Video_Software: Fix the ZFreeze option doing nothing.
  Video_Software: Toggable zfreeze and early_z support for testing.
  Fix header guard and definitions not being set to 1
  Add the option to turn on only the EGL interface to use desktop OpenGL with it.
  Change the ugly "no banner" banner to the sexy "X" from the website.
  Fix a crash in the FifoPlayer dialog.
  Use different reply delays for various DI commands. Fixes issue 5983.
  Revert "[bugfix] DX9::TextureCache: Use max_lod instead of min_lod where necessary."
  Fix some potential issues when blending on EFB formats without alpha. Clean up state transition tables.
  Disable play and record buttons if an iso was selected, but is later deselected.
  Disable start/play recording buttons when no iso is selected.
  Only delay DI and fs IPC replies. Fixes issue 5982.
  Fix compilation with SDL2. (based on a patch from matthewharveys) Fixes issue 5971.
  "Fix" using SDL from externals.
  Clean up SDL includes a bit. Maybe fix an SDL2 problem.
  Number "unknown" axes in OSX rather than call them all "unk".
  Revert "Only delay DI command replies." Fix "Wii Party" again.
  Hopefully make wiimote speaker less crappy.
  ...
This commit is contained in:
skidau
2013-02-16 11:10:03 +11:00
169 changed files with 7352 additions and 6303 deletions

View File

@ -456,6 +456,7 @@ void BPWritten(const BPCmd& bp)
case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
g_renderer->SetColorMask(); // alpha writing needs to be disabled if the new pixel format doesn't have an alpha channel
g_renderer->SetBlendMode(true);
OnPixelFormatChange();
break;
@ -519,9 +520,8 @@ void BPWritten(const BPCmd& bp)
for (u32 i = 0; i < tmem_cfg.preload_tile_info.count; ++i)
{
// FIXME: Duplicate conditions.
if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE ||
tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE)
tmem_addr_odd + TMEM_LINE_SIZE > TMEM_SIZE)
break;
memcpy(texMem + tmem_addr_even, src_ptr, TMEM_LINE_SIZE);

View File

@ -218,6 +218,9 @@ void TextureCache::ClearRenderTargets()
bool TextureCache::CheckForCustomTextureLODs(u64 tex_hash, int texformat, unsigned int levels)
{
if (levels == 1)
return false;
// Just checking if the necessary files exist, if they can't be loaded or have incorrect dimensions LODs will be black
char texBasePathTemp[MAX_PATH];
char texPathTemp[MAX_PATH];
@ -300,7 +303,7 @@ void TextureCache::DumpTexture(TCacheEntryBase* entry, unsigned int level)
TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
u32 address, unsigned int width, unsigned int height, int texformat,
unsigned int tlutaddr, int tlutfmt, bool UseNativeMips, unsigned int maxlevel, bool from_tmem)
unsigned int tlutaddr, int tlutfmt, bool use_mipmaps, unsigned int maxlevel, bool from_tmem)
{
if (0 == address)
return NULL;
@ -372,7 +375,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
// 2. b) For normal textures, all texture parameters need to match
if (address == entry->addr && tex_hash == entry->hash && full_format == entry->format &&
entry->num_mipmaps == maxlevel && entry->native_width == nativeW && entry->native_height == nativeH)
entry->num_mipmaps > maxlevel && entry->native_width == nativeW && entry->native_height == nativeH)
{
goto return_entry;
}
@ -382,7 +385,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
//
// TODO: Don't we need to force texture decoding to RGBA8 for dynamic EFB copies?
// TODO: Actually, it should be enough if the internal texture format matches...
if ((entry->type == TCET_NORMAL && width == entry->virtual_width && height == entry->virtual_height && full_format == entry->format && entry->num_mipmaps == maxlevel)
if ((entry->type == TCET_NORMAL && width == entry->virtual_width && height == entry->virtual_height && full_format == entry->format && entry->num_mipmaps > maxlevel)
|| (entry->type == TCET_EC_DYNAMIC && entry->native_width == width && entry->native_height == height))
{
// reuse the texture
@ -428,15 +431,12 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
}
}
// TODO: Cleanup. Plus, we still autogenerate mipmaps in certain cases (we shouldn't do that)
bool isPow2;
unsigned int texLevels;
isPow2 = !((width & (width - 1)) || (height & (height - 1)));
texLevels = (isPow2 && maxlevel) ? GetPow2(std::max(width, height)) : !isPow2;
texLevels = maxlevel ? std::min(texLevels, maxlevel + 1) : texLevels;
bool use_native_mips;
texLevels = use_mipmaps ? (maxlevel + 1) : 1;
using_custom_lods = using_custom_texture && CheckForCustomTextureLODs(tex_hash, texformat, texLevels);
UseNativeMips = UseNativeMips && !using_custom_lods && (width == nativeW && height == nativeH); // Only load native mips if their dimensions fit to our virtual texture dimensions
texLevels = (UseNativeMips || using_custom_lods) ? texLevels : !isPow2;
use_native_mips = use_mipmaps && !using_custom_lods && (width == nativeW && height == nativeH); // Only load native mips if their dimensions fit to our virtual texture dimensions
texLevels = (use_native_mips || using_custom_lods) ? texLevels : 1;
// create the entry/texture
if (NULL == entry) {
@ -445,9 +445,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
// Sometimes, we can get around recreating a texture if only the number of mip levels changes
// e.g. if our texture cache entry got too many mipmap levels we can limit the number of used levels by setting the appropriate render states
// Thus, we don't update this member for every Load, but just whenever the texture gets recreated
//
// TODO: Won't we end up recreating textures all the time because maxlevel doesn't necessarily equal texLevels?
entry->num_mipmaps = maxlevel; // TODO: Does this actually work? We can't really adjust mipmap settings per-stage...
// TODO: D3D9 doesn't support min_lod. We should add a workaround for that here!
entry->num_mipmaps = maxlevel + 1;
entry->type = TCET_NORMAL;
GFX_DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE, true);
@ -460,13 +459,13 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
else entry->type = TCET_NORMAL;
// load texture
entry->Load(width, height, expandedWidth, 0, (texLevels == 0));
entry->Load(width, height, expandedWidth, 0);
if (g_ActiveConfig.bDumpTextures && !using_custom_texture)
DumpTexture(entry, 0);
// load mips - TODO: Loading mipmaps from tmem is untested!
if (texLevels > 1 && pcfmt != PC_TEX_FMT_NONE && UseNativeMips)
if (texLevels > 1 && pcfmt != PC_TEX_FMT_NONE && use_native_mips)
{
const unsigned int bsdepth = TexDecoder_GetTexelSizeInNibbles(texformat);
@ -495,7 +494,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
expandedHeight = (currentHeight + bsh) & (~bsh);
TexDecoder_Decode(temp, *ptr, expandedWidth, expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
entry->Load(currentWidth, currentHeight, expandedWidth, level, false);
entry->Load(currentWidth, currentHeight, expandedWidth, level);
if (g_ActiveConfig.bDumpTextures)
DumpTexture(entry, level);
@ -518,7 +517,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
unsigned int currentHeight = (mipHeight > 0) ? mipHeight : 1;
LoadCustomTexture(tex_hash, texformat, level, currentWidth, currentHeight);
entry->Load(currentWidth, currentHeight, currentWidth, level, false);
entry->Load(currentWidth, currentHeight, currentWidth, level);
mipWidth >>= 1;
mipHeight >>= 1;

View File

@ -60,26 +60,26 @@ public:
int frameCount;
void SetGeneralParameters(u32 addr, u32 size, u32 format, unsigned int num_mipmaps)
void SetGeneralParameters(u32 _addr, u32 _size, u32 _format, unsigned int _num_mipmaps)
{
this->addr = addr;
this->size_in_bytes = size;
this->format = format;
this->num_mipmaps = num_mipmaps;
addr = _addr;
size_in_bytes = _size;
format = _format;
num_mipmaps = _num_mipmaps;
}
void SetDimensions(unsigned int native_width, unsigned int native_height, unsigned int virtual_width, unsigned int virtual_height)
void SetDimensions(unsigned int _native_width, unsigned int _native_height, unsigned int _virtual_width, unsigned int _virtual_height)
{
this->native_width = native_width;
this->native_height = native_height;
this->virtual_width = virtual_width;
this->virtual_height = virtual_height;
native_width = _native_width;
native_height = _native_height;
virtual_width = _virtual_width;
virtual_height = _virtual_height;
}
void SetHashes(u64 hash/*, u32 pal_hash*/)
void SetHashes(u64 _hash/*, u32 _pal_hash*/)
{
this->hash = hash;
//this->pal_hash = pal_hash;
hash = _hash;
//pal_hash = _pal_hash;
}
@ -89,7 +89,7 @@ public:
virtual bool Save(const char filename[], unsigned int level) = 0;
virtual void Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level, bool autogen_mips) = 0;
unsigned int expanded_width, unsigned int level) = 0;
virtual void FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid,
@ -116,7 +116,7 @@ public:
virtual TCacheEntryBase* CreateRenderTargetTexture(unsigned int scaled_tex_w, unsigned int scaled_tex_h) = 0;
static TCacheEntryBase* Load(unsigned int stage, u32 address, unsigned int width, unsigned int height,
int format, unsigned int tlutaddr, int tlutfmt, bool UseNativeMips, unsigned int maxlevel, bool from_tmem);
int format, unsigned int tlutaddr, int tlutfmt, bool use_mipmaps, unsigned int maxlevel, bool from_tmem);
static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf);