mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #774 from magcius/texdecode-cleanup
Clean up the TextureDecoder and some related things
This commit is contained in:
@@ -220,22 +220,6 @@ void Interpreter::lwz(UGeckoInstruction _inst)
|
||||
{
|
||||
m_GPR[_inst.RD] = temp;
|
||||
}
|
||||
|
||||
// hack to detect SelectThread loop
|
||||
// should probably run a pass through memory instead before execution
|
||||
// but that would be dangerous
|
||||
|
||||
// Enable idle skipping?
|
||||
/*
|
||||
if ((_inst.hex & 0xFFFF0000)==0x800D0000 &&
|
||||
Memory::ReadUnchecked_U32(PC+4)==0x28000000 &&
|
||||
Memory::ReadUnchecked_U32(PC+8)==0x4182fff8)
|
||||
{
|
||||
if (CommandProcessor::AllowIdleSkipping() && PixelEngine::AllowIdleSkipping())
|
||||
{
|
||||
CoreTiming::Idle();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void Interpreter::lwzu(UGeckoInstruction _inst)
|
||||
|
||||
@@ -94,7 +94,6 @@ void Jit64::lXXx(UGeckoInstruction inst)
|
||||
// (mb2): I agree,
|
||||
// IMHO those Idles should always be skipped and replaced by a more controllable "native" Idle methode
|
||||
// ... maybe the throttle one already do that :p
|
||||
// if (CommandProcessor::AllowIdleSkipping() && PixelEngine::AllowIdleSkipping())
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle &&
|
||||
inst.OPCD == 32 &&
|
||||
(inst.hex & 0xFFFF0000) == 0x800D0000 &&
|
||||
|
||||
@@ -72,7 +72,6 @@ void InitBackendInfo()
|
||||
}
|
||||
|
||||
g_Config.backend_info.APIType = API_D3D;
|
||||
g_Config.backend_info.bUseRGBATextures = true; // the GX formats barely match any D3D11 formats
|
||||
g_Config.backend_info.bUseMinimalMipCount = true;
|
||||
g_Config.backend_info.bSupportsExclusiveFullscreen = true;
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = true;
|
||||
|
||||
@@ -132,7 +132,6 @@ static void GetShaders(std::vector<std::string> &shaders)
|
||||
static void InitBackendInfo()
|
||||
{
|
||||
g_Config.backend_info.APIType = API_OPENGL;
|
||||
g_Config.backend_info.bUseRGBATextures = true;
|
||||
g_Config.backend_info.bUseMinimalMipCount = false;
|
||||
g_Config.backend_info.bSupportsExclusiveFullscreen = false;
|
||||
//g_Config.backend_info.bSupportsDualSourceBlend = true; // is gpu dependent and must be set in renderer
|
||||
|
||||
@@ -106,6 +106,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
|
||||
TexMode0& tm0 = texUnit.texMode0[subTexmap];
|
||||
TexImage0& ti0 = texUnit.texImage0[subTexmap];
|
||||
TexTLUT& texTlut = texUnit.texTlut[subTexmap];
|
||||
TlutFormat tlutfmt = (TlutFormat) texTlut.tlut_format;
|
||||
|
||||
u8 *imageSrc, *imageSrcOdd = nullptr;
|
||||
if (texUnit.texImage1[subTexmap].image_type)
|
||||
@@ -124,6 +125,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
|
||||
int imageHeight = ti0.height;
|
||||
|
||||
int tlutAddress = texTlut.tmem_offset << 9;
|
||||
const u8* tlut = &texMem[tlutAddress];
|
||||
|
||||
// reduce sample location and texture size to mip level
|
||||
// move texture pointer to mip location
|
||||
@@ -181,16 +183,16 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
|
||||
|
||||
if (!(ti0.format == GX_TF_RGBA8 && texUnit.texImage1[subTexmap].image_type))
|
||||
{
|
||||
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
|
||||
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageT, imageWidth, ti0.format, tlut, tlutfmt);
|
||||
SetTexel(sampledTex, texel, (128 - fractS) * (128 - fractT));
|
||||
|
||||
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
|
||||
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageT, imageWidth, ti0.format, tlut, tlutfmt);
|
||||
AddTexel(sampledTex, texel, (fractS) * (128 - fractT));
|
||||
|
||||
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageTPlus1, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
|
||||
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageS, imageTPlus1, imageWidth, ti0.format, tlut, tlutfmt);
|
||||
AddTexel(sampledTex, texel, (128 - fractS) * (fractT));
|
||||
|
||||
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageTPlus1, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
|
||||
TexDecoder_DecodeTexel(sampledTex, imageSrc, imageSPlus1, imageTPlus1, imageWidth, ti0.format, tlut, tlutfmt);
|
||||
AddTexel(sampledTex, texel, (fractS) * (fractT));
|
||||
}
|
||||
else
|
||||
@@ -224,7 +226,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
|
||||
WrapCoord(imageT, tm0.wrap_t, imageHeight);
|
||||
|
||||
if (!(ti0.format == GX_TF_RGBA8 && texUnit.texImage1[subTexmap].image_type))
|
||||
TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
|
||||
TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, ti0.format, tlut, tlutfmt);
|
||||
else
|
||||
TexDecoder_DecodeTexelRGBA8FromTmem(sample, imageSrc, imageSrcOdd, imageS, imageT, imageWidth);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ set(SRCS BPFunctions.cpp
|
||||
Statistics.cpp
|
||||
TextureCacheBase.cpp
|
||||
TextureConversionShader.cpp
|
||||
TextureDecoder_Common.cpp
|
||||
VertexLoader.cpp
|
||||
VertexLoaderManager.cpp
|
||||
VertexLoader_Color.cpp
|
||||
|
||||
@@ -141,8 +141,6 @@ void GatherPipeBursted();
|
||||
void UpdateInterrupts(u64 userdata);
|
||||
void UpdateInterruptsFromVideoBackend(u64 userdata);
|
||||
|
||||
bool AllowIdleSkipping();
|
||||
|
||||
void SetCpClearRegister();
|
||||
void SetCpControlRegister();
|
||||
void SetCpStatusRegister();
|
||||
|
||||
@@ -490,8 +490,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
|
||||
{
|
||||
if (!(texformat == GX_TF_RGBA8 && from_tmem))
|
||||
{
|
||||
pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth,
|
||||
expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
|
||||
const u8* tlut = &texMem[tlutaddr];
|
||||
pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth, expandedHeight, texformat, tlut, (TlutFormat) tlutfmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -567,7 +567,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
|
||||
const u8*& mip_src_data = from_tmem
|
||||
? ((level % 2) ? ptr_odd : ptr_even)
|
||||
: src_data;
|
||||
TexDecoder_Decode(temp, mip_src_data, expanded_mip_width, expanded_mip_height, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
|
||||
const u8* tlut = &texMem[tlutaddr];
|
||||
TexDecoder_Decode(temp, mip_src_data, expanded_mip_width, expanded_mip_height, texformat, tlut, (TlutFormat) tlutfmt);
|
||||
mip_src_data += TexDecoder_GetTextureSizeInBytes(expanded_mip_width, expanded_mip_height, texformat);
|
||||
|
||||
entry->Load(mip_width, mip_height, expanded_mip_width, level);
|
||||
|
||||
@@ -52,9 +52,12 @@ enum TextureFormat
|
||||
GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
};
|
||||
|
||||
extern const char* texfmt[];
|
||||
extern const unsigned char sfont_map[];
|
||||
extern const unsigned char sfont_raw[][9*10];
|
||||
enum TlutFormat
|
||||
{
|
||||
GX_TL_IA8 = 0x0,
|
||||
GX_TL_RGB565 = 0x1,
|
||||
GX_TL_RGB5A3 = 0x2,
|
||||
};
|
||||
|
||||
int TexDecoder_GetTexelSizeInNibbles(int format);
|
||||
int TexDecoder_GetTextureSizeInBytes(int width, int height, int format);
|
||||
@@ -75,9 +78,12 @@ enum PC_TexFormat
|
||||
PC_TEX_FMT_DXT1,
|
||||
};
|
||||
|
||||
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt,bool rgbaOnly = false);
|
||||
PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt);
|
||||
void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, int tlutaddr, int tlutfmt);
|
||||
void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth);
|
||||
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, const u8* tlut, TlutFormat tlutfmt);
|
||||
PC_TexFormat TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8 *src_gb, int width, int height);
|
||||
void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, const u8* tlut, TlutFormat tlutfmt);
|
||||
void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth);
|
||||
|
||||
void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center);
|
||||
|
||||
/* Internal method, implemented by TextureDecoder_Generic and TextureDecoder_x64. */
|
||||
PC_TexFormat _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int height, int texformat, const u8* tlut, TlutFormat tlutfmt);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
@@ -73,6 +73,7 @@
|
||||
<ClCompile Include="VideoBackendBase.cpp" />
|
||||
<ClCompile Include="VideoConfig.cpp" />
|
||||
<ClCompile Include="VideoState.cpp" />
|
||||
<ClCompile Include="TextureDecoder_Common.cpp" />
|
||||
<ClCompile Include="TextureDecoder_x64.cpp" />
|
||||
<ClCompile Include="XFMemory.cpp" />
|
||||
<ClCompile Include="XFStructs.cpp" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Base">
|
||||
@@ -134,6 +134,9 @@
|
||||
<ClCompile Include="VertexLoaderManager.cpp">
|
||||
<Filter>Vertex Loading</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TextureDecoder_Common.cpp">
|
||||
<Filter>Decoding</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TextureDecoder_x64.cpp">
|
||||
<Filter>Decoding</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -36,7 +36,6 @@ VideoConfig::VideoConfig()
|
||||
|
||||
// disable all features by default
|
||||
backend_info.APIType = API_NONE;
|
||||
backend_info.bUseRGBATextures = false;
|
||||
backend_info.bUseMinimalMipCount = false;
|
||||
backend_info.bSupportsExclusiveFullscreen = false;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,6 @@ struct VideoConfig final
|
||||
std::vector<std::string> AAModes;
|
||||
std::vector<std::string> PPShaders; // post-processing shaders
|
||||
|
||||
bool bUseRGBATextures; // used for D3D in TextureCache
|
||||
bool bUseMinimalMipCount;
|
||||
bool bSupportsExclusiveFullscreen;
|
||||
bool bSupportsDualSourceBlend;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user