mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-11 09:05:38 +00:00
Remove the ReplacedTextureFormat enum
This commit is contained in:
parent
ef4a6cf873
commit
c41b780c8c
@ -410,7 +410,7 @@ void TextureReplacer::PopulateReplacement(ReplacedTexture *result, u64 cachekey,
|
||||
}
|
||||
|
||||
ReplacedTextureLevel level;
|
||||
level.fmt = ReplacedTextureFormat::F_8888;
|
||||
level.fmt = Draw::DataFormat::R8G8B8A8_UNORM;
|
||||
level.file = filename;
|
||||
bool good = PopulateLevel(level);
|
||||
|
||||
@ -657,7 +657,7 @@ void TextureReplacer::NotifyTextureDecoded(const ReplacedTextureDecodeInfo &repl
|
||||
// Remember that we've saved this for next time.
|
||||
// Should be OK that the actual disk write may not be finished yet.
|
||||
ReplacedTextureLevel saved;
|
||||
saved.fmt = ReplacedTextureFormat::F_8888;
|
||||
saved.fmt = Draw::DataFormat::R8G8B8A8_UNORM;
|
||||
saved.file = filename;
|
||||
saved.w = w;
|
||||
saved.h = h;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/MemoryUtil.h"
|
||||
#include "Common/File/Path.h"
|
||||
#include "Common/GPU/DataFormat.h"
|
||||
|
||||
#include "GPU/Common/TextureDecoder.h"
|
||||
#include "GPU/ge_constants.h"
|
||||
@ -35,12 +36,6 @@ class TextureReplacer;
|
||||
class ReplacedTextureTask;
|
||||
class LimitedWaitable;
|
||||
|
||||
enum class ReplacedTextureFormat {
|
||||
F_8888,
|
||||
// Might add compressed formats here later, maybe universal ones like Basis.
|
||||
// We don't bother with the 16-bit formats for replacement storage, they're not commonly used these days.
|
||||
};
|
||||
|
||||
// These must match the constants in TextureCacheCommon.
|
||||
enum class ReplacedTextureAlpha {
|
||||
UNKNOWN = 0x04,
|
||||
@ -57,7 +52,7 @@ enum class ReplacedTextureHash {
|
||||
struct ReplacedTextureLevel {
|
||||
int w;
|
||||
int h;
|
||||
ReplacedTextureFormat fmt;
|
||||
Draw::DataFormat fmt; // NOTE: Right now, the only supported format is Draw::DataFormat::R8G8B8A8_UNORM.
|
||||
Path file;
|
||||
};
|
||||
|
||||
@ -141,11 +136,11 @@ struct ReplacedTexture {
|
||||
return (int)levels_.size() - 1;
|
||||
}
|
||||
|
||||
ReplacedTextureFormat Format(int level) {
|
||||
Draw::DataFormat Format(int level) {
|
||||
if ((size_t)level < levels_.size()) {
|
||||
return levels_[level].fmt;
|
||||
}
|
||||
return ReplacedTextureFormat::F_8888;
|
||||
return Draw::DataFormat::R8G8B8A8_UNORM;
|
||||
}
|
||||
|
||||
u8 AlphaStatus() {
|
||||
@ -180,7 +175,7 @@ struct ReplacedTextureDecodeInfo {
|
||||
bool isVideo;
|
||||
bool isFinal;
|
||||
int scaleFactor;
|
||||
ReplacedTextureFormat fmt;
|
||||
Draw::DataFormat fmt;
|
||||
};
|
||||
|
||||
enum class ReplacerDecimateMode {
|
||||
|
@ -605,15 +605,15 @@ CheckAlphaResult TextureCacheD3D11::CheckAlpha(const u32 *pixelData, u32 dstFmt,
|
||||
}
|
||||
}
|
||||
|
||||
ReplacedTextureFormat FromD3D11Format(u32 fmt) {
|
||||
Draw::DataFormat FromD3D11Format(u32 fmt) {
|
||||
switch (fmt) {
|
||||
case DXGI_FORMAT_B8G8R8A8_UNORM: default: return ReplacedTextureFormat::F_8888;
|
||||
case DXGI_FORMAT_B8G8R8A8_UNORM: default: return Draw::DataFormat::R8G8B8A8_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
DXGI_FORMAT ToDXGIFormat(ReplacedTextureFormat fmt) {
|
||||
DXGI_FORMAT ToDXGIFormat(Draw::DataFormat fmt) {
|
||||
switch (fmt) {
|
||||
case ReplacedTextureFormat::F_8888: default: return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
case Draw::DataFormat::R8G8B8A8_UNORM: default: return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,15 +539,15 @@ CheckAlphaResult TextureCacheDX9::CheckAlpha(const u32 *pixelData, u32 dstFmt, i
|
||||
}
|
||||
}
|
||||
|
||||
ReplacedTextureFormat FromD3D9Format(u32 fmt) {
|
||||
Draw::DataFormat FromD3D9Format(u32 fmt) {
|
||||
switch (fmt) {
|
||||
case D3DFMT_A8R8G8B8: default: return ReplacedTextureFormat::F_8888;
|
||||
case D3DFMT_A8R8G8B8: default: return Draw::DataFormat::R8G8B8A8_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
D3DFORMAT ToD3D9Format(ReplacedTextureFormat fmt) {
|
||||
D3DFORMAT ToD3D9Format(Draw::DataFormat fmt) {
|
||||
switch (fmt) {
|
||||
case ReplacedTextureFormat::F_8888: default: return D3DFMT_A8R8G8B8;
|
||||
case Draw::DataFormat::R8G8B8A8_UNORM: default: return D3DFMT_A8R8G8B8;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,19 +425,6 @@ void TextureCacheGLES::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer,
|
||||
gstate_c.Dirty(DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_VIEWPORTSCISSOR_STATE);
|
||||
}
|
||||
|
||||
ReplacedTextureFormat FromDataFormat(Draw::DataFormat fmt) {
|
||||
// TODO: 16-bit formats are incorrect, since swizzled.
|
||||
switch (fmt) {
|
||||
case Draw::DataFormat::R8G8B8A8_UNORM: default: return ReplacedTextureFormat::F_8888;
|
||||
}
|
||||
}
|
||||
|
||||
Draw::DataFormat ToDataFormat(ReplacedTextureFormat fmt) {
|
||||
switch (fmt) {
|
||||
case ReplacedTextureFormat::F_8888: default: return Draw::DataFormat::R8G8B8A8_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
|
||||
entry->status &= ~TexCacheEntry::STATUS_ALPHA_MASK;
|
||||
|
||||
@ -640,7 +627,7 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r
|
||||
if (replaced.GetSize(level, w, h)) {
|
||||
PROFILE_THIS_SCOPE("replacetex");
|
||||
|
||||
int bpp = replaced.Format(level) == ReplacedTextureFormat::F_8888 ? 4 : 2;
|
||||
int bpp = (int)DataFormatSizeInBytes(replaced.Format(level));
|
||||
decPitch = w * bpp;
|
||||
uint8_t *rearrange = (uint8_t *)AllocateAlignedMemory(decPitch * h, 16);
|
||||
double replaceStart = time_now_d();
|
||||
@ -648,7 +635,7 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r
|
||||
replacementTimeThisFrame_ += time_now_d() - replaceStart;
|
||||
pixelData = rearrange;
|
||||
|
||||
dstFmt = ToDataFormat(replaced.Format(level));
|
||||
dstFmt = replaced.Format(level);
|
||||
} else {
|
||||
PROFILE_THIS_SCOPE("decodetex");
|
||||
|
||||
@ -683,7 +670,7 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r
|
||||
replacedInfo.isVideo = IsVideo(entry.addr);
|
||||
replacedInfo.isFinal = (entry.status & TexCacheEntry::STATUS_TO_SCALE) == 0;
|
||||
replacedInfo.scaleFactor = scaleFactor;
|
||||
replacedInfo.fmt = FromDataFormat(dstFmt);
|
||||
replacedInfo.fmt = dstFmt;
|
||||
|
||||
replacer_.NotifyTextureDecoded(replacedInfo, pixelData, decPitch, level, w, h);
|
||||
}
|
||||
|
@ -564,15 +564,15 @@ void TextureCacheVulkan::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
|
||||
curSampler_ = samplerCache_.GetOrCreateSampler(samplerKey);
|
||||
}
|
||||
|
||||
ReplacedTextureFormat FromVulkanFormat(VkFormat fmt) {
|
||||
static Draw::DataFormat FromVulkanFormat(VkFormat fmt) {
|
||||
switch (fmt) {
|
||||
case VULKAN_8888_FORMAT: default: return ReplacedTextureFormat::F_8888;
|
||||
case VULKAN_8888_FORMAT: default: return Draw::DataFormat::R8G8B8A8_UNORM;
|
||||
}
|
||||
}
|
||||
|
||||
VkFormat ToVulkanFormat(ReplacedTextureFormat fmt) {
|
||||
static VkFormat ToVulkanFormat(Draw::DataFormat fmt) {
|
||||
switch (fmt) {
|
||||
case ReplacedTextureFormat::F_8888: default: return VULKAN_8888_FORMAT;
|
||||
case Draw::DataFormat::R8G8B8A8_UNORM: default: return VULKAN_8888_FORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user