thin3d: Remove unused shader language support

This commit is contained in:
Henrik Rydgård 2018-12-16 20:18:40 +01:00
parent 956af61ff5
commit a135dc1547
4 changed files with 64 additions and 81 deletions

View File

@ -204,13 +204,8 @@ enum class ShaderLanguage {
GLSL_ES_300 = 2,
GLSL_410 = 4,
GLSL_VULKAN = 8,
SPIRV_VULKAN = 16,
HLSL_D3D9 = 32,
HLSL_D3D11 = 64,
HLSL_D3D9_BYTECODE = 128,
HLSL_D3D11_BYTECODE = 256,
METAL = 512,
METAL_BYTECODE = 1024,
};
enum FormatSupport {

View File

@ -48,7 +48,7 @@ public:
return deviceList_;
}
uint32_t GetSupportedShaderLanguages() const override {
return (uint32_t)ShaderLanguage::HLSL_D3D11 | (uint32_t)ShaderLanguage::HLSL_D3D11_BYTECODE;
return (uint32_t)ShaderLanguage::HLSL_D3D11;
}
uint32_t GetDataFormatSupport(DataFormat fmt) const override;
@ -806,11 +806,7 @@ public:
};
ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize) {
switch (language) {
case ShaderLanguage::HLSL_D3D11:
case ShaderLanguage::HLSL_D3D11_BYTECODE:
break;
default:
if (language != ShaderLanguage::HLSL_D3D11) {
ELOG("Unsupported shader language");
return nullptr;
}
@ -826,7 +822,6 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang
std::string compiled;
std::string errors;
if (language == ShaderLanguage::HLSL_D3D11) {
const char *target = nullptr;
switch (stage) {
case ShaderStage::FRAGMENT: target = fragmentModel; break;
@ -865,17 +860,11 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang
}
// OK, we can now proceed
language = ShaderLanguage::HLSL_D3D11_BYTECODE;
data = (const uint8_t *)compiled.c_str();
dataSize = compiled.size();
}
if (language == ShaderLanguage::HLSL_D3D11_BYTECODE) {
// Easy!
D3D11ShaderModule *module = new D3D11ShaderModule();
module->stage = stage;
module->byteCode_ = std::vector<uint8_t>(data, data + dataSize);
HRESULT result = S_OK;
switch (stage) {
case ShaderStage::VERTEX:
result = device_->CreateVertexShader(data, dataSize, nullptr, &module->vs);
@ -897,7 +886,6 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang
delete module;
return nullptr;
}
}
return nullptr;
}

View File

@ -465,7 +465,7 @@ public:
return caps_;
}
uint32_t GetSupportedShaderLanguages() const override {
return (uint32_t)ShaderLanguage::HLSL_D3D9 | (uint32_t)ShaderLanguage::HLSL_D3D9_BYTECODE;
return (uint32_t)ShaderLanguage::HLSL_D3D9;
}
uint32_t GetDataFormatSupport(DataFormat fmt) const override;

View File

@ -353,7 +353,7 @@ public:
return list;
}
uint32_t GetSupportedShaderLanguages() const override {
return (uint32_t)ShaderLanguage::GLSL_VULKAN | (uint32_t)ShaderLanguage::SPIRV_VULKAN;
return (uint32_t)ShaderLanguage::GLSL_VULKAN;
}
uint32_t GetDataFormatSupport(DataFormat fmt) const override;