@@ -101,20 +101,56 @@ core::smart_refctd_ptr<ICPUShader> CHLSLCompiler::compileToSPIRV(const char* cod
101
101
hlslOptions.preprocessorOptions .logger .log (" code is nullptr" , system::ILogger::ELL_ERROR);
102
102
return nullptr ;
103
103
}
104
-
105
- auto newCode = preprocessShader (code, hlslOptions.stage , hlslOptions.preprocessorOptions );
104
+
105
+ auto newCode = std::string (code);// preprocessShader(code, hlslOptions.stage, hlslOptions.preprocessorOptions);
106
+
107
+ // Suffix is the shader model version
108
+ std::wstring targetProfile (L" XX_6_2" );
109
+
110
+ // Set profile two letter prefix based on stage
111
+ switch (options.stage ) {
112
+ case asset::IShader::ESS_VERTEX:
113
+ targetProfile.replace (0 , 2 , L" vs" );
114
+ break ;
115
+ case asset::IShader::ESS_TESSELLATION_CONTROL:
116
+ targetProfile.replace (0 , 2 , L" ds" );
117
+ break ;
118
+ case asset::IShader::ESS_TESSELLATION_EVALUATION:
119
+ targetProfile.replace (0 , 2 , L" hs" );
120
+ break ;
121
+ case asset::IShader::ESS_GEOMETRY:
122
+ targetProfile.replace (0 , 2 , L" gs" );
123
+ break ;
124
+ case asset::IShader::ESS_FRAGMENT:
125
+ targetProfile.replace (0 , 2 , L" ps" );
126
+ break ;
127
+ case asset::IShader::ESS_COMPUTE:
128
+ targetProfile.replace (0 , 2 , L" cs" );
129
+ break ;
130
+ case asset::IShader::ESS_TASK:
131
+ targetProfile.replace (0 , 2 , L" as" );
132
+ break ;
133
+ case asset::IShader::ESS_MESH:
134
+ targetProfile.replace (0 , 2 , L" ms" );
135
+ break ;
136
+ default :
137
+ hlslOptions.preprocessorOptions .logger .log (" invalid shader stage %i" , system::ILogger::ELL_ERROR, options.stage );
138
+ return nullptr ;
139
+ };
106
140
107
141
LPCWSTR arguments[] = {
108
142
// These will always be present
109
143
L" -spirv" ,
110
- L" -HLSL2021" ,
144
+ L" -HV" , L" 2021" ,
145
+ L" -T" , targetProfile.c_str (),
111
146
112
147
// These are debug only
113
- L" -Qembed_debug"
148
+ L" -Zi" , // Enables debug information
149
+ L" -Qembed_debug" // Embeds debug information
114
150
};
115
151
116
- const uint32_t nonDebugArgs = 2 ;
117
- const uint32_t allArgs = nonDebugArgs + 0 ;
152
+ const uint32_t nonDebugArgs = 3 ;
153
+ const uint32_t allArgs = nonDebugArgs + 1 ;
118
154
119
155
DxcCompilationResult compileResult = dxcCompile (newCode, &arguments[0 ], hlslOptions.genDebugInfo ? allArgs : nonDebugArgs, hlslOptions);
120
156
0 commit comments