Skip to content

Commit fe5be0a

Browse files
committed
Iron some things out
1 parent 5f64a71 commit fe5be0a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

include/nbl/asset/utils/CHLSLCompiler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class NBL_API2 CHLSLCompiler final : public IShaderCompiler
2020
IShader::E_CONTENT_TYPE getCodeContentType() const override { return IShader::E_CONTENT_TYPE::ECT_HLSL; };
2121

2222
CHLSLCompiler(core::smart_refctd_ptr<system::ISystem>&& system);
23+
~CHLSLCompiler();
2324

2425
struct SOptions : IShaderCompiler::SCompilerOptions
2526
{
@@ -61,7 +62,7 @@ class NBL_API2 CHLSLCompiler final : public IShaderCompiler
6162

6263
class DxcCompilationResult
6364
{
64-
public:
65+
public:
6566
std::unique_ptr<IDxcBlobEncoding> errorMessages;
6667
std::unique_ptr<IDxcBlob> objectBlob;
6768
std::unique_ptr<IDxcResult> compileResult;

src/nbl/asset/utils/CHLSLCompiler.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ CHLSLCompiler::CHLSLCompiler(core::smart_refctd_ptr<system::ISystem>&& system)
3030
m_dxcCompiler = std::unique_ptr<IDxcCompiler3>(compiler);
3131
}
3232

33+
CHLSLCompiler::~CHLSLCompiler()
34+
{
35+
m_dxcUtils->Release();
36+
m_dxcCompiler->Release();
37+
}
38+
3339
CHLSLCompiler::DxcCompilationResult CHLSLCompiler::dxcCompile(asset::ICPUShader* source, LPCWSTR* args, uint32_t argCount, const SOptions& options)
3440
{
3541
DxcBuffer sourceBuffer;
@@ -93,13 +99,14 @@ core::smart_refctd_ptr<ICPUShader> CHLSLCompiler::compileToSPIRV(const char* cod
9399
LPCWSTR arguments[] = {
94100
// These will always be present
95101
L"-spirv",
102+
L"-HLSL2021",
96103

97104
// These are debug only
98105
L"-DPARTI",
99106
L"-DBOY"
100107
};
101-
const uint32_t allArgs = 3;
102-
const uint32_t nonDebugArgs = 1;
108+
const uint32_t nonDebugArgs = 2;
109+
const uint32_t allArgs = nonDebugArgs + 2;
103110

104111
DxcCompilationResult compileResult = dxcCompile(includesResolved.get(), &arguments[0], hlslOptions.genDebugInfo ? allArgs : nonDebugArgs, hlslOptions);
105112

0 commit comments

Comments
 (0)