| 61 | } |
| 62 | |
| 63 | HLSLReflection HLSLShaderFactory::CompileAndReflect(std::string const& name, |
| 64 | std::string const& source, std::string const& entry, |
| 65 | std::string const& target, ProgramDefines const& defines, |
| 66 | uint32_t compileFlags) |
| 67 | { |
| 68 | std::string type = target.substr(0, 3); |
| 69 | if (type == "vs_" || type == "gs_" || type == "ps_" || type == "cs_") |
| 70 | { |
| 71 | ID3DBlob* compiledCode = CompileShader(name, source, entry, target, |
| 72 | compileFlags, defines); |
| 73 | if (!compiledCode) |
| 74 | { |
| 75 | // Errors are recorded to a logfile by CompileShader. |
| 76 | return HLSLReflection(); |
| 77 | } |
| 78 | |
| 79 | HLSLReflection shader; |
| 80 | if (!ReflectShader(name, entry, target, compiledCode, shader)) |
| 81 | { |
| 82 | // Errors are recorded to a logfile by ReflectShader. |
| 83 | shader = HLSLReflection(); |
| 84 | } |
| 85 | DX11::SafeRelease(compiledCode); |
| 86 | return shader; |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | LogError("Invalid target " + target); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | ID3DBlob* HLSLShaderFactory::CompileShader(std::string const& name, |
| 95 | std::string const& source, std::string const& entry, |
nothing calls this directly
no test coverage detected