Skip to content

Commit

Permalink
added void efxc2Compiler::print_compiler_params_begin and void efxc2C…
Browse files Browse the repository at this point in the history
…ompiler::print_compiler_params_end to refactor some debug output.
  • Loading branch information
JPeterMugaas committed Jul 1, 2024
1 parent 676a9d4 commit da0a9df
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

cmake_minimum_required (VERSION 3.21)

set(EFXC2_VERSION 0.0.13.266)
set(EFXC2_VERSION 0.0.13.268)
project (efxc2 VERSION ${EFXC2_VERSION}
DESCRIPTION "Enhanced fxc2"
HOMEPAGE_URL "https://github.com/JPeterMugaas/efxc2"
Expand Down
34 changes: 20 additions & 14 deletions efxc2Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ void efxc2Compiler::print_compiler_error(std::string op, ID3DBlob* errors, HRESU
console.std_out_reset();
}

void efxc2Compiler::print_compiler_params_begin(efxc2Utils::M_BUFFER SourceCode,
size_t SourceLen,
const char* inputFile,
std::vector<D3D_SHADER_MACRO> const& defines) {
print_source_code_sample(SourceCode);
std::cout << M_FORMAT("\t {},\n", SourceLen);
std::cout << M_FORMAT("\t {}, \n", inputFile);
print_defines(defines);
std::cout << "\t includeDirs,\n";
}

void efxc2Compiler::print_compiler_params_end() {
std::cout << "\t &CompilerOutput,\n";
std::cout << "\t &errors);\n";
}

void efxc2Compiler::Compiler::Preprocess() {
auto SourceCode = params.get_SourceCode();
if (SourceCode == nullptr) {
Expand All @@ -91,13 +107,8 @@ void efxc2Compiler::Compiler::Preprocess() {
ID3DBlob* errors = nullptr;
if (params.get_verbose() && params.get_debug()) {
std::cout << "Calling D3DPreprocess(\n";
print_source_code_sample(SourceCode);
std::cout << M_FORMAT("\t {},\n", SourceLen);
std::cout << M_FORMAT("\t {}, \n", inputFile);
print_defines(*defines.get());
std::cout << "\t D3D_COMPILE_STANDARD_FILE_INCLUDE,\n";
std::cout << "\t &CompilerOutput,\n";
std::cout << "\t &errors);\n";
print_compiler_params_begin(SourceCode, SourceLen, inputFile, *defines.get());
print_compiler_params_end();
}
/*
HRESULT D3DPreprocess(
Expand Down Expand Up @@ -153,11 +164,7 @@ void efxc2Compiler::Compiler::Compile() {
ID3DBlob* errors = nullptr;
if (params.get_verbose() && params.get_debug()) {
std::cout << "Calling D3DCompile2(\n";
print_source_code_sample(SourceCode);
std::cout << M_FORMAT("\t {},\n", SourceLen);
std::cout << M_FORMAT("\t {}, \n", inputFile);
print_defines( *defines.get() );
std::cout << "\t D3D_COMPILE_STANDARD_FILE_INCLUDE,\n";
print_compiler_params_begin(SourceCode, SourceLen, inputFile, *defines.get());
if (entryPoint == nullptr) {
std::cout << M_FORMAT("\t nullptr,\n");
}
Expand All @@ -170,8 +177,7 @@ void efxc2Compiler::Compiler::Compile() {
std::cout << M_FORMAT("\t {:#08x},\n", secondary_flags);
std::cout << "\t nullptr,\n";
std::cout << "\t 0,\n";
std::cout << "\t &CompilerOutput,\n";
std::cout << "\t &errors);\n";
print_compiler_params_end();
}
/*
HRESULT D3DCompile2(
Expand Down
5 changes: 5 additions & 0 deletions efxc2Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ namespace efxc2Compiler {
void SetupDefines(efxc2Utils::M_COMPILER_DEFINES _defines, std::vector<D3D_SHADER_MACRO>& defines);
void print_compiler_error(std::string op, ID3DBlob* errors, HRESULT hr);

void print_compiler_params_begin(efxc2Utils::M_BUFFER SourceCode,
size_t SourceLen,
const char* inputFile,
std::vector<D3D_SHADER_MACRO> const& defines);
void print_compiler_params_end();
}

#endif /* EFXC2COMPILER_H_INCLUDED */

0 comments on commit da0a9df

Please sign in to comment.