summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3DBase
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-05-17 17:08:00 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-05-17 17:08:00 +0000
commit6c0ed372bfb1f9094422c4a46f0c6baef65c4898 (patch)
treec831629824c2844bc96d387dbc054bce339da2c8 /Graphics/GraphicsEngineD3DBase
parentMathLib test: added matrix equality tests (to cover https://github.com/Dilige... (diff)
downloadDiligentCore-6c0ed372bfb1f9094422c4a46f0c6baef65c4898.tar.gz
DiligentCore-6c0ed372bfb1f9094422c4a46f0c6baef65c4898.zip
Unified shader type defines for all backends
Diffstat (limited to 'Graphics/GraphicsEngineD3DBase')
-rw-r--r--Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp b/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp
index e880fe0f..3962a8e4 100644
--- a/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp
+++ b/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp
@@ -173,16 +173,49 @@ ShaderD3DBase::ShaderD3DBase(const ShaderCreateInfo& ShaderCI, const char* Shade
const D3D_SHADER_MACRO* pDefines = nullptr;
std::vector<D3D_SHADER_MACRO> D3DMacros;
+ switch (ShaderCI.Desc.ShaderType)
+ {
+ case SHADER_TYPE_VERTEX:
+ D3DMacros.push_back({"VERTEX_SHADER", "1"});
+ break;
+
+ case SHADER_TYPE_PIXEL:
+ D3DMacros.push_back({"FRAGMENT_SHADER", "1"});
+ D3DMacros.push_back({"PIXEL_SHADER", "1"});
+ break;
+
+ case SHADER_TYPE_GEOMETRY:
+ D3DMacros.push_back({"GEOMETRY_SHADER", "1"});
+ break;
+
+ case SHADER_TYPE_HULL:
+ D3DMacros.push_back({"TESS_CONTROL_SHADER", "1"});
+ D3DMacros.push_back({"HULL_SHADER", "1"});
+ break;
+
+ case SHADER_TYPE_DOMAIN:
+ D3DMacros.push_back({"TESS_EVALUATION_SHADER", "1"});
+ D3DMacros.push_back({"DOMAIN_SHADER", "1"});
+ break;
+
+ case SHADER_TYPE_COMPUTE:
+ D3DMacros.push_back({"COMPUTE_SHADER", "1"});
+ break;
+
+ default: UNEXPECTED("Unexpected shader type");
+ }
+
if (ShaderCI.Macros)
{
for (auto* pCurrMacro = ShaderCI.Macros; pCurrMacro->Name && pCurrMacro->Definition; ++pCurrMacro)
{
D3DMacros.push_back({pCurrMacro->Name, pCurrMacro->Definition});
}
- D3DMacros.push_back({nullptr, nullptr});
- pDefines = D3DMacros.data();
}
+ D3DMacros.push_back({nullptr, nullptr});
+ pDefines = D3DMacros.data();
+
DEV_CHECK_ERR(ShaderCI.EntryPoint != nullptr, "Entry point must not be null");
CComPtr<ID3DBlob> errors;
auto hr = CompileShader(ShaderSource.c_str(), ShaderCI.EntryPoint, pDefines, ShaderCI.pShaderSourceStreamFactory, strShaderProfile.c_str(), &m_pShaderByteCode, &errors);