MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / CompileAndReflect

Method CompileAndReflect

GTE/Graphics/DX11/HLSLShaderFactory.cpp:63–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63HLSLReflection 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
94ID3DBlob* HLSLShaderFactory::CompileShader(std::string const& name,
95 std::string const& source, std::string const& entry,

Callers

nothing calls this directly

Calls 1

HLSLReflectionClass · 0.85

Tested by

no test coverage detected