WICTextureLoader sometimes fails Hello, a week ago I started writing code for a game engine. Currently I am struggling to create textures using DirectXTK's WicTextureLoader. The WICTextureLoader works about 50% of the time on Release the release build with CPU optimization and the ID3D11Device is not created with a debug flag. On Debug the texture loading always fails. Here is the code attempting to load textures: // Convert std::string to const wchar_t* const wchar_t* convertedFilePath = std::wstring(filePath.begin(), filePath.end()).c_str(); // Load the texture ID3D11ShaderResourceView* srv = nullptr; HRESULT hr = DirectX::CreateWICTextureFromFile(TextureLoader::device, convertedFilePath, nullptr, &srv); if (FAILED(hr)) { Logger::LOG_WARNING("Failed to load texture: [%s]", filePath.c_str()); return nullptr; } else { Logger::LOG_INFO("Loaded texture: [%s]", filePath.c_str()); textures[filePath] = srv; return srv; } Some more information: The swap chain and device seem to be created just fine The application is running in x64 mode CoInitializeEx is called before attempting to load the texture Linked libraries: assimp-vc140-mt.lib, d3d11.lib, runtimeobject.lib The application's window is 'frozen'; it can't be dragged around and when the cursor hovers over it, the 'loading' cursor icon is shown I would be very grateful if someone was able to help me. Let me know if any useful information is lacking. Cheers! https://ift.tt/eA8V8J
Hello, a week ago I started writing code for a game engine. Currently I am struggling to create textures using DirectXTK's WicTextureLoader. The WICTextureLoader works about 50% of the time on Release the release build with CPU optimization and the ID3D11Device is not created with a debug flag. On Debug the texture loading always fails. Here is the code attempting to load textures: // Convert std::string to const wchar_t* const wchar_t* convertedFilePath = std::wstring(filePath.begin(), filePath.end()).c_str(); // Load the texture ID3D11ShaderResourceView* srv = nullptr; HRESULT hr = DirectX::CreateWICTextureFromFile(TextureLoader::device, convertedFilePath, nullptr, &srv); if (FAILED(hr)) { Logger::LOG_WARNING("Failed to load texture: [%s]", filePath.c_str()); return nullptr; } else { Logger::LOG_INFO("Loaded texture: [%s]", filePath.c_str()); textures[filePath] = srv; return srv; } Some more information: The swap chain and device seem to be created just fine The application is running in x64 mode CoInitializeEx is called before attempting to load the texture Linked libraries: assimp-vc140-mt.lib, d3d11.lib, runtimeobject.lib The application's window is 'frozen'; it can't be dragged around and when the cursor hovers over it, the 'loading' cursor icon is shown I would be very grateful if someone was able to help me. Let me know if any useful information is lacking. Cheers!
from GameDev.net https://ift.tt/2FHM7kK
from GameDev.net https://ift.tt/2FHM7kK
ليست هناك تعليقات