Merge pull request #1355 from starkos/shaderincludedirs2

Add shaderincludedirs to fxcompile configuration
This commit is contained in:
Samuel Surtees 2019-10-21 11:18:56 +10:00 committed by GitHub
commit 0987dcdec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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