summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorMai <mai.iam2048@gmail.com>2023-12-17 14:40:39 -0500
committerGitHub <noreply@github.com>2023-12-17 14:40:39 -0500
commitf589c04aa7684e72f9866d1d85e9cb32b3d281ca (patch)
treed5cf7a22f818ad48ee5c6f4e333772058b9660ab /Source/Core/VideoCommon/TextureCacheBase.cpp
parente6c85bf8f09c54297bc71fd37432d7daa7f22bcc (diff)
parent12dd15c8ddb587e2f76351b59e0097940061485b (diff)
Merge pull request #12372 from iwubcode/texture_usage_flag
VideoBackends / VideoCommon: add type enum to dictate how the texture is used; support texture 2d
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 2c749c7703..9294748397 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -415,7 +415,8 @@ void TextureCacheBase::ScaleTextureCacheEntryTo(RcTcacheEntry& entry, u32 new_wi
}
const TextureConfig newconfig(new_width, new_height, 1, entry->GetNumLayers(), 1,
- AbstractTextureFormat::RGBA8, AbstractTextureFlag_RenderTarget);
+ AbstractTextureFormat::RGBA8, AbstractTextureFlag_RenderTarget,
+ AbstractTextureType::Texture_2DArray);
std::optional<TexPoolEntry> new_texture = AllocateTexture(newconfig);
if (!new_texture)
{
@@ -445,7 +446,8 @@ bool TextureCacheBase::CheckReadbackTexture(u32 width, u32 height, AbstractTextu
return true;
}
- TextureConfig staging_config(std::max(width, 128u), std::max(height, 128u), 1, 1, 1, format, 0);
+ TextureConfig staging_config(std::max(width, 128u), std::max(height, 128u), 1, 1, 1, format, 0,
+ AbstractTextureType::Texture_2DArray);
m_readback_texture.reset();
m_readback_texture = g_gfx->CreateStagingTexture(StagingTextureType::Readback, staging_config);
return m_readback_texture != nullptr;
@@ -1680,7 +1682,8 @@ RcTcacheEntry TextureCacheBase::CreateTextureEntry(
const u32 texLevels = no_mips ? 1 : (u32)calculate_max_levels();
const auto& first_level = assets_data[0]->m_texture.m_slices[0].m_levels[0];
const TextureConfig config(first_level.width, first_level.height, texLevels,
- static_cast<u32>(assets_data.size()), 1, first_level.format, 0);
+ static_cast<u32>(assets_data.size()), 1, first_level.format, 0,
+ AbstractTextureType::Texture_2DArray);
entry = AllocateCacheEntry(config);
if (!entry) [[unlikely]]
return entry;
@@ -1710,7 +1713,8 @@ RcTcacheEntry TextureCacheBase::CreateTextureEntry(
const u32 width = texture_info.GetRawWidth();
const u32 height = texture_info.GetRawHeight();
- const TextureConfig config(width, height, texLevels, 1, 1, AbstractTextureFormat::RGBA8, 0);
+ const TextureConfig config(width, height, texLevels, 1, 1, AbstractTextureFormat::RGBA8, 0,
+ AbstractTextureType::Texture_2DArray);
entry = AllocateCacheEntry(config);
if (!entry) [[unlikely]]
return entry;
@@ -1896,7 +1900,8 @@ RcTcacheEntry TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height
// Create a new VRAM texture, and fill it with the data from guest RAM.
entry = AllocateCacheEntry(TextureConfig(width, height, 1, 1, 1, AbstractTextureFormat::RGBA8,
- AbstractTextureFlag_RenderTarget));
+ AbstractTextureFlag_RenderTarget,
+ AbstractTextureType::Texture_2DArray));
// Compute total texture size. XFB textures aren't tiled, so this is simple.
const u32 total_size = height * stride;
@@ -2357,7 +2362,8 @@ void TextureCacheBase::CopyRenderTargetToTexture(
{
// create the texture
const TextureConfig config(scaled_tex_w, scaled_tex_h, 1, g_framebuffer_manager->GetEFBLayers(),
- 1, AbstractTextureFormat::RGBA8, AbstractTextureFlag_RenderTarget);
+ 1, AbstractTextureFormat::RGBA8, AbstractTextureFlag_RenderTarget,
+ AbstractTextureType::Texture_2DArray);
entry = AllocateCacheEntry(config);
if (entry)
{
@@ -2842,7 +2848,8 @@ void TextureCacheBase::ReleaseToPool(TCacheEntry* entry)
bool TextureCacheBase::CreateUtilityTextures()
{
constexpr TextureConfig encoding_texture_config(
- EFB_WIDTH * 4, 1024, 1, 1, 1, AbstractTextureFormat::BGRA8, AbstractTextureFlag_RenderTarget);
+ EFB_WIDTH * 4, 1024, 1, 1, 1, AbstractTextureFormat::BGRA8, AbstractTextureFlag_RenderTarget,
+ AbstractTextureType::Texture_2DArray);
m_efb_encoding_texture = g_gfx->CreateTexture(encoding_texture_config, "EFB encoding texture");
if (!m_efb_encoding_texture)
return false;
@@ -2854,7 +2861,8 @@ bool TextureCacheBase::CreateUtilityTextures()
if (g_ActiveConfig.backend_info.bSupportsGPUTextureDecoding)
{
constexpr TextureConfig decoding_texture_config(
- 1024, 1024, 1, 1, 1, AbstractTextureFormat::RGBA8, AbstractTextureFlag_ComputeImage);
+ 1024, 1024, 1, 1, 1, AbstractTextureFormat::RGBA8, AbstractTextureFlag_ComputeImage,
+ AbstractTextureType::Texture_2DArray);
m_decoding_texture =
g_gfx->CreateTexture(decoding_texture_config, "GPU texture decoding texture");
if (!m_decoding_texture)