mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-13 10:39:07 -06:00
VS: Add source file property to set hlsl debug and optimization flags
Add `VS_SHADER_DISABLE_OPTIMIZATIONS` and `VS_SHADER_ENABLE_DEBUG` source file properties to control these settings on `.hlsl` files in the VS generator. Fixes: #17406
This commit is contained in:
committed by
Brad King
parent
8ffc1c3d89
commit
025221df2a
@@ -390,6 +390,8 @@ Properties on Source Files
|
|||||||
/prop_sf/VS_DEPLOYMENT_LOCATION
|
/prop_sf/VS_DEPLOYMENT_LOCATION
|
||||||
/prop_sf/VS_INCLUDE_IN_VSIX
|
/prop_sf/VS_INCLUDE_IN_VSIX
|
||||||
/prop_sf/VS_RESOURCE_GENERATOR
|
/prop_sf/VS_RESOURCE_GENERATOR
|
||||||
|
/prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS
|
||||||
|
/prop_sf/VS_SHADER_ENABLE_DEBUG
|
||||||
/prop_sf/VS_SHADER_ENTRYPOINT
|
/prop_sf/VS_SHADER_ENTRYPOINT
|
||||||
/prop_sf/VS_SHADER_FLAGS
|
/prop_sf/VS_SHADER_FLAGS
|
||||||
/prop_sf/VS_SHADER_MODEL
|
/prop_sf/VS_SHADER_MODEL
|
||||||
|
|||||||
6
Help/prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS.rst
Normal file
6
Help/prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS.rst
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
VS_SHADER_DISABLE_OPTIMIZATIONS
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
Disable compiler optimizations for an ``.hlsl`` source file. This adds the
|
||||||
|
``-Od`` flag to the command line for the FxCompiler tool. Specify the value
|
||||||
|
``true`` for this property to disable compiler optimizations.
|
||||||
6
Help/prop_sf/VS_SHADER_ENABLE_DEBUG.rst
Normal file
6
Help/prop_sf/VS_SHADER_ENABLE_DEBUG.rst
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
VS_SHADER_ENABLE_DEBUG
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
Enable debugging information for an ``.hlsl`` source file. This adds the
|
||||||
|
``-Zi`` flag to the command line for the FxCompiler tool. Specify the value
|
||||||
|
``true`` to generate debugging information for the compiled shader.
|
||||||
6
Help/release/dev/vs-hlsl-opt-dbg.rst
Normal file
6
Help/release/dev/vs-hlsl-opt-dbg.rst
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
vs-hlsl-opt-dbg
|
||||||
|
---------------
|
||||||
|
|
||||||
|
* Source file properties :prop_sf:`VS_SHADER_DISABLE_OPTIMIZATIONS` and
|
||||||
|
:prop_sf:`VS_SHADER_ENABLE_DEBUG` have been added to specify more
|
||||||
|
details of ``.hlsl`` sources with :ref:`Visual Studio Generators`.
|
||||||
@@ -1602,6 +1602,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
|
|||||||
std::string shaderEntryPoint;
|
std::string shaderEntryPoint;
|
||||||
std::string shaderModel;
|
std::string shaderModel;
|
||||||
std::string shaderAdditionalFlags;
|
std::string shaderAdditionalFlags;
|
||||||
|
std::string shaderDisableOptimizations;
|
||||||
|
std::string shaderEnableDebug;
|
||||||
std::string outputHeaderFile;
|
std::string outputHeaderFile;
|
||||||
std::string variableName;
|
std::string variableName;
|
||||||
std::string settingsGenerator;
|
std::string settingsGenerator;
|
||||||
@@ -1668,6 +1670,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
|
|||||||
shaderAdditionalFlags = saf;
|
shaderAdditionalFlags = saf;
|
||||||
toolHasSettings = true;
|
toolHasSettings = true;
|
||||||
}
|
}
|
||||||
|
// Figure out if debug information should be generated
|
||||||
|
if (const char* sed = sf->GetProperty("VS_SHADER_ENABLE_DEBUG")) {
|
||||||
|
shaderEnableDebug = cmSystemTools::IsOn(sed) ? "true" : "false";
|
||||||
|
toolHasSettings = true;
|
||||||
|
}
|
||||||
|
// Figure out if optimizations should be disabled
|
||||||
|
if (const char* sdo = sf->GetProperty("VS_SHADER_DISABLE_OPTIMIZATIONS")) {
|
||||||
|
shaderDisableOptimizations = cmSystemTools::IsOn(sdo) ? "true" : "false";
|
||||||
|
toolHasSettings = true;
|
||||||
|
}
|
||||||
} else if (ext == "jpg" || ext == "png") {
|
} else if (ext == "jpg" || ext == "png") {
|
||||||
tool = "Image";
|
tool = "Image";
|
||||||
} else if (ext == "resw") {
|
} else if (ext == "resw") {
|
||||||
@@ -1810,6 +1822,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
|
|||||||
this->WriteString("</VariableName>\n", 0);
|
this->WriteString("</VariableName>\n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!shaderEnableDebug.empty()) {
|
||||||
|
this->WriteString("<EnableDebuggingInformation>", 3);
|
||||||
|
(*this->BuildFileStream) << cmVS10EscapeXML(shaderEnableDebug)
|
||||||
|
<< "</EnableDebuggingInformation>\n";
|
||||||
|
}
|
||||||
|
if (!shaderDisableOptimizations.empty()) {
|
||||||
|
this->WriteString("<DisableOptimizations>", 3);
|
||||||
|
(*this->BuildFileStream) << cmVS10EscapeXML(shaderDisableOptimizations)
|
||||||
|
<< "</DisableOptimizations>\n";
|
||||||
|
}
|
||||||
if (!shaderAdditionalFlags.empty()) {
|
if (!shaderAdditionalFlags.empty()) {
|
||||||
this->WriteString("<AdditionalOptions>", 3);
|
this->WriteString("<AdditionalOptions>", 3);
|
||||||
(*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags)
|
(*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags)
|
||||||
|
|||||||
Reference in New Issue
Block a user