Skip to content
Snippets Groups Projects
Verified Commit af28426d authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Remove workarounds

parent 7de1e310
No related branches found
No related tags found
1 merge request!114Draft: Resolve "Denoising Module"
...@@ -23,9 +23,6 @@ namespace vkcv::shader { ...@@ -23,9 +23,6 @@ namespace vkcv::shader {
private: private:
HLSLCompileTarget m_target; HLSLCompileTarget m_target;
protected:
std::string processShaderSource(const std::string& shaderSource) override;
public: public:
/** /**
* The constructor of a runtime HLSL shader compiler instance. * The constructor of a runtime HLSL shader compiler instance.
......
...@@ -152,47 +152,6 @@ namespace vkcv::shader { ...@@ -152,47 +152,6 @@ namespace vkcv::shader {
resources.limits.generalConstantMatrixVectorIndexing = true; resources.limits.generalConstantMatrixVectorIndexing = true;
} }
// This is a workaround for multiple compatibility issues!
static std::string& fixShaderSource(std::string& source) {
size_t pos = 0;
while ((pos = source.find("float16_t", pos)) < std::string::npos) {
source = source.erase(pos + 5, 4);
}
pos = 0;
while ((pos = source.find("float const", pos)) < std::string::npos) {
source = source.replace(pos, 11, "const float");
}
pos = 0;
while ((pos = source.find("0b", pos)) < std::string::npos) {
size_t len = 0;
while (source[pos + 2 + len] == '0' || source[pos + 2 + len] == '1') {
len++;
}
uint64_t value = 0;
for (size_t i = 0; i < len; i++) {
if (source[pos + 2 + i] == '1') {
value |= static_cast<uint64_t>(1) << static_cast<uint64_t>(len - i - 1);
}
}
const size_t cut_len = 2 + len + (source[pos + 2 + len] == 'u'? 1 : 0);
source = source.replace(pos, cut_len, std::to_string(value));
}
return source;
}
std::string HLSLCompiler::processShaderSource(const std::string &shaderSource) {
std::string source = Compiler::processShaderSource(shaderSource);
source = fixShaderSource(source); // TODO: do it properly!
return shaderSource;
}
bool HLSLCompiler::compileSource(ShaderStage shaderStage, bool HLSLCompiler::compileSource(ShaderStage shaderStage,
const std::string& shaderSource, const std::string& shaderSource,
const ShaderCompiledFunction &compiled, const ShaderCompiledFunction &compiled,
...@@ -203,7 +162,7 @@ namespace vkcv::shader { ...@@ -203,7 +162,7 @@ namespace vkcv::shader {
vkcv_log(LogLevel::ERROR, "Shader stage not supported"); vkcv_log(LogLevel::ERROR, "Shader stage not supported");
return false; return false;
} }
glslang::TShader shader (language); glslang::TShader shader (language);
shader.setEntryPoint("main"); shader.setEntryPoint("main");
...@@ -259,7 +218,7 @@ namespace vkcv::shader { ...@@ -259,7 +218,7 @@ namespace vkcv::shader {
EShMsgVulkanRules | EShMsgVulkanRules |
EShMsgReadHlsl | EShMsgReadHlsl |
EShMsgHlslOffsets | EShMsgHlslOffsets |
//EShMsgHlslEnable16BitTypes | // TODO: not supported yet EShMsgHlslEnable16BitTypes |
EShMsgHlslLegalization | EShMsgHlslLegalization |
EShMsgHlslDX9Compatible EShMsgHlslDX9Compatible
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment