-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathefxc2CompilerTasks.cpp
More file actions
53 lines (52 loc) · 2.13 KB
/
efxc2CompilerTasks.cpp
File metadata and controls
53 lines (52 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//--------------------------------------------------------------------------------------
// File: efxc2CompilerTasks.cpp
//
// Copyright (c) J. Peter Mugaas
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//--------------------------------------------------------------------------------------
#include "efxc2CompilerTasks.h"
#include "efxc2Utils.h"
#include "efxc2Compiler.h"
#include "efxc2Files.h"
#include "efxc2Exception.h"
#ifdef _WIN32
void efxc2CompilerTasks::CompilerTasks(efxc2Compiler::Compiler& compiler, efxc2Files::Files& files, const efxc2CompilerParams::CompilerParams& params) {
#else
void efxc2CompilerTasks::CompilerTasks(efxc2Compiler::Compiler & compiler, efxc2Files::Files & files, const efxc2CompilerParams::CompilerParams & params) {
#endif
if ((params.get_commands() & efxc2Utils::CMD_PREPROCESS_FILE) == efxc2Utils::CMD_PREPROCESS_FILE) {
if (params.get_commands() != efxc2Utils::CMD_PREPROCESS_FILE) {
efxc2Console::Console console = efxc2Console::console;
console.std_err_pink();
std::cerr << "The /P option may only be used with the /D and /I parameters.";
console.std_err_reset();
throw efxc2Exception::InvalidPOption();
}
compiler.Preprocess();
files.WritePreprocessFile(compiler, params);
}
else {
compiler.Compile();
if (params.get_PrivateData() != nullptr) {
compiler.EmbedPrivateData();
}
compiler.StripShader();
if ((params.get_commands() & efxc2Utils::CMD_WRITE_HEADER) == efxc2Utils::CMD_WRITE_HEADER) {
files.WriteIncludeFile(compiler, params);
}
if ((params.get_commands() & efxc2Utils::CMD_WRITE_PDB_FILE) == efxc2Utils::CMD_WRITE_PDB_FILE) {
files.WritePDBFile(compiler, params);
}
if ((params.get_commands() & efxc2Utils::CMD_WRITE_OBJECT) == efxc2Utils::CMD_WRITE_OBJECT) {
files.WriteObjectFile(compiler, params);
}
if ((params.get_commands() & efxc2Utils::CMD_WRITE_ASSEMBLY_CODE) == efxc2Utils::CMD_WRITE_ASSEMBLY_CODE) {
compiler.Disassemble();
files.WriteDisassembly(compiler, params);
}
}
return;
}