Polish, fix and otherwise improve the video plugin configuration dialog:

- Add some info about a backend's feature set (MSAA, Real XFB, EFB to RAM, ..) to VideoConfig
- Gray out options if they aren't supported by the backend or if changing them doesn't affect anything (e.g. changing STC mode if STC is disabled)
- Allow signed bytes for D3D11. Not sure if this causes glitches, but it should work
- Call wxEvent.Skip() in the event function handlers, not sure if this fixes any bugs but the old code definitely caused bugs during development of this patch
- Fix a memory leak in the configuration dialog if D3D11 is used
- Other minor stuff that doesn't need to be mentioned or which I forgot

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6450 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2010-11-21 14:47:28 +00:00
parent 86dc8d09fe
commit ee21237d6a
13 changed files with 207 additions and 84 deletions

View File

@ -162,7 +162,7 @@ void TextureCache::ClearRenderTargets()
iter = textures.begin(),
tcend = textures.end();
for (; iter!=tcend; ++iter)
iter->second->isRenderTarget = false;
iter->second->isRenderTarget = false;
}
TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
@ -314,7 +314,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
if (pcfmt == PC_TEX_FMT_NONE)
pcfmt = TexDecoder_Decode(temp, ptr, expandedWidth,
expandedHeight, texformat, tlutaddr, tlutfmt, !g_texture_cache->isOGL());
expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
isPow2 = !((width & (width - 1)) || (height & (height - 1)));
texLevels = (isPow2 && UseNativeMips && maxlevel) ?
@ -376,7 +376,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
expandedWidth = (currentWidth + bsw) & (~bsw);
expandedHeight = (currentHeight + bsh) & (~bsh);
TexDecoder_Decode(temp, ptr, expandedWidth, expandedHeight, texformat, tlutaddr, tlutfmt, !g_texture_cache->isOGL());
TexDecoder_Decode(temp, ptr, expandedWidth, expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
entry->Load(currentWidth, currentHeight, expandedWidth, level);
ptr += ((std::max(mipWidth, bsw) * std::max(mipHeight, bsh) * bsdepth) >> 1);
@ -429,7 +429,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer,
{
// TODO: these values differ slightly from the DX9/11 values,
// do they need to? or can this be removed
if (g_texture_cache->isOGL())
if (g_ActiveConfig.backend_info.APIType == API_OPENGL)
{
switch(copyfmt)
{

View File

@ -97,8 +97,6 @@ private:
typedef std::map<u32, TCacheEntryBase*> TexCache;
static TexCache textures;
virtual bool isOGL() { return false; } // Hacks for TextureDecode_real support
};
extern TextureCache *g_texture_cache;

View File

@ -291,7 +291,7 @@ void VertexLoader::CompileVertexTranslator()
vtx_decl.num_normals = 0;
if (m_VtxDesc.Normal != NOT_PRESENT) {
m_VertexSize += VertexLoader_Normal::GetSize(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3);
TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3, g_Config.bAllowSignedBytes);
TPipelineFunction pFunc = VertexLoader_Normal::GetFunction(m_VtxDesc.Normal, m_VtxAttr.NormalFormat, m_VtxAttr.NormalElements, m_VtxAttr.NormalIndex3, g_Config.backend_info.bAllowSignedBytes);
if (pFunc == 0)
{
char temp[256];
@ -310,7 +310,7 @@ void VertexLoader::CompileVertexTranslator()
{
vtx_decl.normal_gl_type = (vtx_attr.NormalFormat == FORMAT_BYTE)? VAR_BYTE : VAR_UNSIGNED_BYTE;
int native_size = 4;
if (vtx_attr.NormalFormat == FORMAT_BYTE && !g_Config.bAllowSignedBytes)
if (vtx_attr.NormalFormat == FORMAT_BYTE && !g_Config.backend_info.bAllowSignedBytes)
{
vtx_decl.normal_gl_type = VAR_SHORT;
native_size = 8;

View File

@ -153,7 +153,8 @@ typedef enum
API_OPENGL,
API_D3D9,
API_D3D11,
API_GLSL
API_GLSL,
API_NONE
} API_TYPE;
#endif // _VIDEOCOMMON_H

View File

@ -34,11 +34,17 @@ void UpdateActiveConfig()
VideoConfig::VideoConfig()
{
bRunning = false;
bAllowSignedBytes = !IsD3D();
// Needed for the first frame, I think
fAspectRatioHackW = 1;
fAspectRatioHackH = 1;
// disable all features by default
backend_info.APIType = API_NONE;
backend_info.bAllowSignedBytes = false;
backend_info.bUseRGBATextures = false;
backend_info.bSupportsEFBToRAM = false;
backend_info.bSupportsRealXFB = false;
}
void VideoConfig::Load(const char *ini_file)

View File

@ -28,6 +28,7 @@
#include "Common.h"
#include "VideoCommon.h"
#include <vector>
#include <string>
// Log in two categories, and save three other options in the same byte
@ -143,7 +144,19 @@ struct VideoConfig
int iAdapter;
// Static config per API
bool bAllowSignedBytes;
struct
{
API_TYPE APIType;
std::vector<std::string> Adapters; // for D3D9 and D3D11
std::vector<std::string> AAModes;
std::vector<std::string> PPShaders; // post-processing shaders
bool bUseRGBATextures; // used for D3D11 in TextureCache
bool bSupportsEFBToRAM;
bool bSupportsRealXFB;
bool bAllowSignedBytes; // D3D9 doesn't support signed bytes (?)
} backend_info;
};
extern VideoConfig g_Config;