Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //How we compile HLSL files. Something similar probably exists for FX
- D3DX11CompileFromFile(LPCSTRfileName, 0, 0, "v_main", "vs_4_0", 0, 0, 0, &vShaderBlob, &errors, 0);
- if (CheckForShaderErrors(errors))
- return;
- bool Shader::CheckForShaderErrors(ID3D10Blob*const errors) const
- {
- if (!errors)
- return false;
- const char*const pCompileErrors = static_cast<char*>(errors->GetBufferPointer());
- const size_t bufferSize = errors->GetBufferSize();
- Array<TCHAR> wcsErrors(bufferSize);
- size_t outSize;
- mbstowcs_s(&outSize, &wcsErrors.front(), bufferSize, pCompileErrors, bufferSize);
- std::wstringstream ss(&wcsErrors.front());
- std::wstring line;
- while (std::getline(ss, line, L'\n'))
- LogMgr::Error(L"SHADER") << L"{CTX_SHADER}" << line << LogMgr::Flush();
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement