Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VideoCommon: move texture dump function out of texture cache to its o…
…wn free function so it can be used elsewhere. Doing this change may also slightly improve performance of this operation
- Loading branch information
Showing
8 changed files
with
74 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2023 Dolphin Emulator Project | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include "VideoCommon/TextureUtils.h" | ||
|
||
#include <fmt/format.h> | ||
|
||
#include "Common/FileUtil.h" | ||
#include "Core/Config/GraphicsSettings.h" | ||
#include "Core/ConfigManager.h" | ||
|
||
#include "VideoCommon/AbstractTexture.h" | ||
|
||
namespace VideoCommon::TextureUtils | ||
{ | ||
void DumpTexture(const ::AbstractTexture& texture, std::string basename, unsigned int level, | ||
bool is_arbitrary) | ||
{ | ||
std::string szDir = File::GetUserPath(D_DUMPTEXTURES_IDX) + SConfig::GetInstance().GetGameID(); | ||
|
||
// make sure that the directory exists | ||
if (!File::IsDirectory(szDir)) | ||
File::CreateDir(szDir); | ||
|
||
if (is_arbitrary) | ||
{ | ||
basename += "_arb"; | ||
} | ||
|
||
if (level > 0) | ||
{ | ||
basename += fmt::format("_mip{}", level); | ||
} | ||
|
||
const std::string filename = fmt::format("{}/{}.png", szDir, basename); | ||
if (File::Exists(filename)) | ||
return; | ||
|
||
texture.Save(filename, level, Config::Get(Config::GFX_TEXTURE_PNG_COMPRESSION_LEVEL)); | ||
} | ||
} // namespace VideoCommon::TextureUtils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2023 Dolphin Emulator Project | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
|
||
class AbstractTexture; | ||
|
||
namespace VideoCommon::TextureUtils | ||
{ | ||
void DumpTexture(const ::AbstractTexture& texture, std::string basename, unsigned int level, | ||
bool is_arbitrary); | ||
} |