Skip to content

Commit 5b82450

Browse files
committed
Apply PR Reviews
1 parent 0225037 commit 5b82450

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

include/nbl/asset/utils/IShaderCompiler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ class NBL_API2 IShaderCompiler : public core::IReferenceCounted
136136
{
137137
IShader::E_SHADER_STAGE stage = IShader::E_SHADER_STAGE::ESS_UNKNOWN;
138138
E_SPIRV_VERSION targetSpirvVersion = E_SPIRV_VERSION::ESV_1_6;
139-
std::string_view entryPoint = "";
140139
const ISPIRVOptimizer* spirvOptimizer = nullptr;
141140
bool genDebugInfo = true;
142141
SPreprocessorOptions preprocessorOptions = {};

src/nbl/asset/utils/CGLSLCompiler.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,6 @@ core::smart_refctd_ptr<ICPUShader> CGLSLCompiler::compileToSPIRV(const char* cod
143143
return nullptr;
144144
}
145145

146-
if (glslOptions.entryPoint.compare("main") != 0)
147-
{
148-
glslOptions.preprocessorOptions.logger.log("shaderc requires entry point to be \"main\" in GLSL", system::ILogger::ELL_ERROR);
149-
return nullptr;
150-
}
151-
152146
auto newCode = preprocessShader(code, glslOptions.stage, glslOptions.preprocessorOptions);
153147

154148
shaderc::Compiler comp;
@@ -158,7 +152,7 @@ core::smart_refctd_ptr<ICPUShader> CGLSLCompiler::compileToSPIRV(const char* cod
158152
if (glslOptions.genDebugInfo)
159153
shadercOptions.SetGenerateDebugInfo();
160154

161-
shaderc::SpvCompilationResult bin_res = comp.CompileGlslToSpv(newCode.c_str(), newCode.size(), stage, glslOptions.preprocessorOptions.sourceIdentifier.data() ? glslOptions.preprocessorOptions.sourceIdentifier.data() : "", glslOptions.entryPoint.data(), shadercOptions);
155+
shaderc::SpvCompilationResult bin_res = comp.CompileGlslToSpv(newCode.c_str(), newCode.size(), stage, glslOptions.preprocessorOptions.sourceIdentifier.data() ? glslOptions.preprocessorOptions.sourceIdentifier.data() : "", "main", shadercOptions);
162156

163157
if (bin_res.GetCompilationStatus() == shaderc_compilation_status_success)
164158
{

src/nbl/asset/utils/CHLSLCompiler.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static tcpp::IInputStream* getInputStreamInclude(
6868
res_str = _inclFinder->getIncludeStandard(relDir, _requesting_source);
6969

7070
if (!res_str.size()) {
71-
return nullptr;
71+
return new tcpp::StringInputStream("#error File not found");
7272
}
7373

7474
IShaderCompiler::disableAllDirectivesExceptIncludes(res_str);
@@ -289,11 +289,12 @@ core::smart_refctd_ptr<ICPUShader> CHLSLCompiler::compileToSPIRV(const char* cod
289289

290290
// These are debug only
291291
L"-Zi", // Enables debug information
292-
L"-Qembed_debug" //Embeds debug information
292+
L"-Qembed_debug", //Embeds debug information
293+
L"-fspv-debug=file" // Embeds debug information
293294
};
294295

295296
const uint32_t nonDebugArgs = 5;
296-
const uint32_t allArgs = nonDebugArgs + 2;
297+
const uint32_t allArgs = nonDebugArgs + 3;
297298

298299
auto compileResult = dxcCompile(this, newCode, &arguments[0], hlslOptions.genDebugInfo ? allArgs : nonDebugArgs, hlslOptions);
299300

src/nbl/video/CVulkanLogicalDevice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,6 @@ class CVulkanLogicalDevice final : public ILogicalDevice
536536
commonCompileOptions.preprocessorOptions.extraDefines = getExtraShaderDefines();
537537

538538
commonCompileOptions.stage = shaderStage;
539-
commonCompileOptions.entryPoint = entryPoint;
540539
commonCompileOptions.genDebugInfo = true;
541540
commonCompileOptions.spirvOptimizer = nullptr; // TODO: create/get spirv optimizer in logical device?
542541
commonCompileOptions.targetSpirvVersion = m_physicalDevice->getLimits().spirvVersion;

0 commit comments

Comments
 (0)