Add shaderincludedirs to fxcompile configuration

This commit is contained in:
arcturus 2019-03-20 19:44:18 +00:00 committed by starkos
parent 00052e182d
commit 983333eab3
3 changed files with 45 additions and 0 deletions

View File

@ -39,6 +39,14 @@
tokens = true,
}
p.api.register {
name = "shaderincludedirs",
scope = "config",
kind = "list:directory",
tokens = true,
pathVars = true,
}
p.api.register {
name = "shadertype",
scope = "config",

View File

@ -77,6 +77,35 @@
]]
end
---
-- Test FxCompileAdditionalIncludeDirectories
---
function suite.onFxCompileAdditionalIncludeDirectories()
files { "shader.hlsl" }
shaderincludedirs { "../includes" }
prepare()
test.capture [[
<FxCompile>
<AdditionalIncludeDirectories>..\includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</FxCompile>
]]
end
function suite.onFxCompileAdditionalIncludeDirectories_multipleDefines()
files { "shader.hlsl" }
shaderincludedirs { "../includes", "otherpath/embedded" }
prepare()
test.capture [[
<FxCompile>
<AdditionalIncludeDirectories>..\includes;otherpath\embedded;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</FxCompile>
]]
end
---
-- Test FxCompileShaderType
---

View File

@ -403,6 +403,7 @@
m.elements.fxCompile = function(cfg)
return {
m.fxCompilePreprocessorDefinition,
m.fxCompileAdditionalIncludeDirs,
m.fxCompileShaderType,
m.fxCompileShaderModel,
m.fxCompileShaderEntry,
@ -806,6 +807,7 @@
return {
m.excludedFromBuild,
m.fxCompilePreprocessorDefinition,
m.fxCompileAdditionalIncludeDirs,
m.fxCompileShaderType,
m.fxCompileShaderModel,
m.fxCompileShaderEntry,
@ -2692,6 +2694,12 @@
end
end
function m.fxCompileAdditionalIncludeDirs(cfg, condition)
if cfg.shaderincludedirs and #cfg.shaderincludedirs > 0 then
local dirs = vstudio.path(cfg, cfg.shaderincludedirs)
m.element('AdditionalIncludeDirectories', condition, "%s;%%(AdditionalIncludeDirectories)", table.concat(dirs, ";"))
end
end
function m.fxCompileShaderType(cfg, condition)
if cfg.shadertype then