I got Unhandled exception at 0x00007FFB80B9DFA4 (TextShaping.dll) in CubeHLSL.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000055C9473FC8).
The void Vulkan::MouseCallback(DOUBLE positionX, DOUBLE positionY) is a pure virtual function and it's implemented at void CubeHLSLA::MouseCallback(DOUBLE positionX, DOUBLE positionY) below
Code:
void CubeHLSLApp::MouseCallback(DOUBLE positionX, DOUBLE positionY)
{
}
Here's the exeption class
Code:
class Exeption
{
public:
virtual std::string ToString() const = 0;
};
class GeneralExeption : public Exeption
{
private:
std::string mMessage;
public:
GeneralExeption(const std::string& message);
std::string ToString() const override;
};
class VulkanExeption : public Exeption
{
private:
VkResult mResult = VK_SUCCESS;
std::string mFunctionName;
std::string mFilename;
INT32 mLineNumber = -1;
public:
VulkanExeption() = default;
VulkanExeption(VkResult result, const std::string& functionName, const std::string& filename, INT32 lineNumber);
std::string ToString() const override;
};
GeneralExeption::GeneralExeption(const std::string& message) :
mMessage(message)
{
}
std::string GeneralExeption::ToString() const
{
return mMessage;
}
VulkanExeption::VulkanExeption(VkResult result, const std::string& functionName, const std::string& filename, INT32 lineNumber) :
mResult(result),
mFunctionName(functionName),
mFilename(filename),
mLineNumber(lineNumber)
{
}
std::string VulkanExeption::ToString() const
{
std::string stringVkResult = string_VkResult(mResult);
return mFunctionName + " failed in " + mFilename + "; line " + std::to_string(mLineNumber) + "; error: " + stringVkResult;
}
Here's where the exeption thrown
Code:
VkShaderModule VulkanUtil::CreateShaderModule(VkDevice device, const std::string& filename)
{
std::ifstream file(filename, std::ios_base::binary);
if (file.is_open() == false)
throw GeneralExeption(std::string("Failed to open ") + filename);
file.seekg(0, std::ios_base::end);
UINT64 byteSize = file.tellg();
file.seekg(0, std::ios_base::beg);
char* fileData = new char[byteSize];
file.read(fileData, byteSize);
file.close();
VkShaderModuleCreateInfo shaderModuleCreateInfo = {};
shaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
shaderModuleCreateInfo.codeSize = byteSize;
shaderModuleCreateInfo.pCode = reinterpret_cast<UINT*>(fileData);
VkShaderModule shader;
ThrowIfFailed(vkCreateShaderModule(device, &shaderModuleCreateInfo, nullptr, &shader));
delete[] fileData;
return shader;
}
Here's where the weird things, when i put a breakpoint somewhere before exeption is thrown it works as desired
Here's the try catch block in the main function
Code:
int main()
{
try
{
CubeHLSLApp cubeHLSLApp;
if (cubeHLSLApp.Init() == false)
return 1;
return cubeHLSLApp.Run();
}
catch (Exeption& ex)
{
MessageBoxA(nullptr, ex.ToString().c_str(), "ERROR", MB_ICONSTOP);
return 1;
}
}
Thank you.