Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
drzhn committed Oct 16, 2023
1 parent 782df71 commit 5294aa1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
15 changes: 6 additions & 9 deletions Texconv/texconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1333,20 +1333,17 @@ namespace AssetConversion
ComPtr<ID3D11Device> pDevice;
int adapter = -1;

int TextureConversionInit(bool initializazeCom)
int TextureConversionInit()
{
// Set locale for output since GetErrorDesc can get localized strings.
std::locale::global(std::locale(""));

if (initializazeCom)
// Initialize COM (needed for WIC)
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (FAILED(hr))
{
// Initialize COM (needed for WIC)
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
if (FAILED(hr))
{
wprintf(L"Failed to initialize COM (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
return 1;
}
wprintf(L"Failed to initialize COM (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
return 1;
}

{
Expand Down
Binary file modified TexconvTests/pngTexture.dds
Binary file not shown.
6 changes: 3 additions & 3 deletions TexconvTests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ int main()
(1ull << OPT_FIT_POWEROF2) |
(1ull << OPT_USE_DX10);

int result = AssetConversion::TextureConversionInit(false);
int result = AssetConversion::TextureConversionInit();

{
params.format = DXGI_FORMAT_BC1_UNORM;

AssetConversion::TextureMetadata metadata;
Blob blob;

result = AssetConversion::Convert(params, options, R"(D:\CppProjects\JoyEngineDX\JoyData\textures\background.tga)", metadata, blob);
//bool isHDR = AssetConversion::IsHDR("pngTexture.png");
result = AssetConversion::Convert(params, options, "pngTexture.png", metadata, blob);
bool isHDR = AssetConversion::IsHDR("pngTexture.png");
std::ofstream fout;
fout.open("pngTexture.dds", std::ios::binary | std::ios::out);

Expand Down
2 changes: 1 addition & 1 deletion include/Texconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace AssetConversion
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
};

int TextureConversionInit(bool initializazeCom);
int TextureConversionInit();

int Convert(
const TextureConversionParams& params,
Expand Down
Binary file modified lib/x64/Debug/texconv.lib
Binary file not shown.
Binary file modified lib/x64/Release/texconv.lib
Binary file not shown.

0 comments on commit 5294aa1

Please sign in to comment.