10 #if defined(GTE_USE_DX12) 11 #include <Graphics/DX12/GteDX12Include.h> 27 D3DCOMPILE_ENABLE_STRICTNESS |
28 D3DCOMPILE_IEEE_STRICTNESS |
29 D3DCOMPILE_OPTIMIZATION_LEVEL3);
51 std::vector<unsigned char>
const& vsBytecode,
52 std::vector<unsigned char>
const& psBytecode,
53 std::vector<unsigned char>
const& gsBytecode)
55 if (vsBytecode.size() == 0 || psBytecode.size() == 0)
57 LogError(
"A program must have a vertex shader and a pixel shader.");
61 std::shared_ptr<VertexShader> vshader;
62 std::shared_ptr<PixelShader> pshader;
63 std::shared_ptr<GeometryShader> gshader;
71 std::static_pointer_cast<
VertexShader>(std::make_shared<Shader>(hlslVShader));
84 std::static_pointer_cast<
PixelShader>(std::make_shared<Shader>(hlslPShader));
92 if (gsBytecode.size() > 0)
100 std::static_pointer_cast<
GeometryShader>(std::make_shared<Shader>(hlslGShader));
108 std::shared_ptr<HLSLVisualProgram>
program = std::make_shared<HLSLVisualProgram>();
109 program->SetVShader(vshader);
110 program->SetPShader(pshader);
111 program->SetGShader(gshader);
120 LogError(
"A program must have a compute shader.");
128 std::shared_ptr<ComputeShader> cshader =
129 std::static_pointer_cast<
ComputeShader>(std::make_shared<Shader>(hlslCShader));
131 std::shared_ptr<HLSLComputeProgram>
program = std::make_shared<HLSLComputeProgram>();
132 program->SetCShader(cshader);
146 if (vsSource ==
"" || psSource ==
"")
148 LogError(
"A program must have a vertex shader and a pixel shader.");
152 std::shared_ptr<VertexShader> vshader;
153 std::shared_ptr<PixelShader> pshader;
154 std::shared_ptr<GeometryShader> gshader;
161 std::static_pointer_cast<
VertexShader>(std::make_shared<Shader>(hlslVShader));
173 std::static_pointer_cast<
PixelShader>(std::make_shared<Shader>(hlslPShader));
188 std::static_pointer_cast<
GeometryShader>(std::make_shared<Shader>(hlslGShader));
196 std::shared_ptr<HLSLVisualProgram>
program = std::make_shared<HLSLVisualProgram>();
197 program->SetVShader(vshader);
198 program->SetPShader(pshader);
199 program->SetGShader(gshader);
204 std::vector<unsigned char>
const& csBytecode)
206 if (csBytecode.size() == 0)
208 LogError(
"A program must have a compute shader.");
217 std::shared_ptr<ComputeShader> cshader =
218 std::static_pointer_cast<
ComputeShader>(std::make_shared<Shader>(hlslCShader));
220 std::shared_ptr<HLSLComputeProgram>
program = std::make_shared<HLSLComputeProgram>();
221 program->SetCShader(cshader);
virtual int GetAPI() const
static std::string defaultVersion
static HLSLShader CreateFromBytecode(std::string const &name, std::string const &entry, std::string const &target, size_t numBytes, unsigned char const *bytecode)
static std::string defaultCSEntry
GLbitfield GLuint program
static std::string defaultVSEntry
static std::string defaultGSEntry
GLsizei const GLchar *const * string
#define LogError(message)
static std::string defaultPSEntry
std::shared_ptr< VisualProgram > CreateFromBytecode(std::vector< unsigned char > const &vsBytecode, std::vector< unsigned char > const &psBytecode, std::vector< unsigned char > const &gsBytecode)
virtual std::shared_ptr< ComputeProgram > CreateFromNamedSource(std::string const &csName, std::string const &csSource)
virtual std::shared_ptr< VisualProgram > CreateFromNamedSources(std::string const &vsName, std::string const &vsSource, std::string const &psName, std::string const &psSource, std::string const &gsName, std::string const &gsSource)
virtual ~HLSLProgramFactory()
static HLSLShader CreateFromString(std::string const &name, std::string const &source, std::string const &entry, std::string const &target, ProgramDefines const &defines, unsigned int compileFlags)
static unsigned int defaultFlags