<div dir="ltr">Hi Brad and Gilles.<div><br></div><div>I have updated the patch suggestion, please find it below. Gilles, I took your spelling for ENTRYPOINT and your documentation.</div><div><br></div><div>Gilles' fork is more exhaustive than the minimal patch I am suggesting. </div><div>What's important for me, is to have one or the other pushed as soon as possible, as the addition of the shader support without the shader model and without the entrypoint is breaking some of the projects I am working on. And I suspect that it will break many people.</div><div><br></div><div>I leave it up to you guys to decide which patch you prefer.<br></div><div><br></div><div>Thanks again for the quick answers, it's really nice to get an answer so fast!</div><div><br></div><div><br></div><div><div><div>From e92c4b804b1b253f96297fff4e4915934e5e0c59 Mon Sep 17 00:00:00 2001</div><div>From: cperthuis <<a href="mailto:cedric.perthuis@gmail.com">cedric.perthuis@gmail.com</a>></div><div>Date: Tue, 2 Dec 2014 01:41:10 -0800</div><div>Subject: [PATCH] added VS_SHADER_ENTRYPOINT and VS_SHADER_MODEL file </div><div> properties for Visual Studio shader custom tool</div><div><br></div><div>---</div><div> Help/manual/cmake-properties.7.rst                 |  2 ++</div><div> Help/prop_sf/VS_SHADER_ENTRYPOINT.rst              |  5 ++++</div><div> Help/prop_sf/VS_SHADER_MODEL.rst                   |  5 ++++</div><div> Source/cmVisualStudio10TargetGenerator.cxx         | 27 +++++++++++++++++++++-</div><div> Tests/VSWinStorePhone/CMakeLists.txt               |  6 +++++</div><div> .../Direct3DApp1/SimplePixelShader.hlsl            |  2 +-</div><div> .../Direct3DApp1/SimpleVertexShader.hlsl           |  2 +-</div><div> 7 files changed, 46 insertions(+), 3 deletions(-)</div><div> create mode 100644 Help/prop_sf/VS_SHADER_ENTRYPOINT.rst</div><div> create mode 100644 Help/prop_sf/VS_SHADER_MODEL.rst</div><div><br></div><div>diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst</div><div>index bf456f5..5bbb89e 100644</div><div>--- a/Help/manual/cmake-properties.7.rst</div><div>+++ b/Help/manual/cmake-properties.7.rst</div><div>@@ -291,6 +291,8 @@ Properties on Source Files</div><div>    /prop_sf/OBJECT_OUTPUTS</div><div>    /prop_sf/SYMBOLIC</div><div>    /prop_sf/VS_DEPLOYMENT_CONTENT</div><div>+   /prop_sf/VS_SHADER_MODEL</div><div>+   /prop_sf/VS_SHADER_ENTRYPOINT</div><div>    /prop_sf/VS_SHADER_TYPE</div><div>    /prop_sf/WRAP_EXCLUDE</div><div>    /prop_sf/XCODE_EXPLICIT_FILE_TYPE</div><div>diff --git a/Help/prop_sf/VS_SHADER_ENTRYPOINT.rst b/Help/prop_sf/VS_SHADER_ENTRYPOINT.rst</div><div>new file mode 100644</div><div>index 0000000..69ff3e6</div><div>--- /dev/null</div><div>+++ b/Help/prop_sf/VS_SHADER_ENTRYPOINT.rst</div><div>@@ -0,0 +1,5 @@</div><div>+VS_SHADER_ENTRYPOINT</div><div>+--------------</div><div>+</div><div>+Specifies the name of the entry point for the shader of a ``.hlsl`` source</div><div>+file.</div><div>diff --git a/Help/prop_sf/VS_SHADER_MODEL.rst b/Help/prop_sf/VS_SHADER_MODEL.rst</div><div>new file mode 100644</div><div>index 0000000..5adb680</div><div>--- /dev/null</div><div>+++ b/Help/prop_sf/VS_SHADER_MODEL.rst</div><div>@@ -0,0 +1,5 @@</div><div>+VS_SHADER_MODEL</div><div>+--------------</div><div>+</div><div>+Specifies the shader model of a ``.hlsl`` source file. Some shader types can</div><div>+only be used with recent shader models</div><div>diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx</div><div>index f591fc8..d1031cc 100644</div><div>--- a/Source/cmVisualStudio10TargetGenerator.cxx</div><div>+++ b/Source/cmVisualStudio10TargetGenerator.cxx</div><div>@@ -1203,6 +1203,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)</div><div>   bool toolHasSettings = false;</div><div>   std::string tool = "None";</div><div>   std::string shaderType;</div><div>+  std::string shaderEntryPoint;</div><div>+  std::string shaderModel;</div><div>   std::string ext = cmSystemTools::LowerCase(sf->GetExtension());</div><div>   if(ext == "hlsl")</div><div>     {</div><div>@@ -1213,6 +1215,18 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)</div><div>       shaderType = st;</div><div>       toolHasSettings = true;</div><div>       }</div><div>+    // Figure out which entry point to use if any</div><div>+    if (const char* se = sf->GetProperty("VS_SHADER_ENTRYPOINT"))</div><div>+      {</div><div>+      shaderEntryPoint = se;</div><div>+      toolHasSettings = true;</div><div>+      }</div><div>+    // Figure out which entry point to use if any</div><div>+    if (const char* sm = sf->GetProperty("VS_SHADER_MODEL"))</div><div>+      {</div><div>+      shaderModel = sm;</div><div>+      toolHasSettings = true;</div><div>+      }</div><div>     }</div><div>   else if(ext == "jpg" ||</div><div>           ext == "png")</div><div>@@ -1295,7 +1309,18 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)</div><div>       (*this->BuildFileStream) << cmVS10EscapeXML(shaderType)</div><div>                                << "</ShaderType>\n";</div><div>       }</div><div>-</div><div>+    if(!shaderEntryPoint.empty())</div><div>+      {</div><div>+      this->WriteString("<EntryPointName>", 3);</div><div>+      (*this->BuildFileStream) << cmVS10EscapeXML(shaderEntryPoint)</div><div>+                               << "</EntryPointName>\n";</div><div>+      }</div><div>+    if(!shaderModel.empty())</div><div>+      {</div><div>+      this->WriteString("<ShaderModel>", 3);</div><div>+      (*this->BuildFileStream) << cmVS10EscapeXML(shaderModel)</div><div>+                               << "</ShaderModel>\n";</div><div>+      }</div><div>     this->WriteString("</", 2);</div><div>     (*this->BuildFileStream) << tool << ">\n";</div><div>     }</div><div>diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt</div><div>index 0041c75..c6f814d 100644</div><div>--- a/Tests/VSWinStorePhone/CMakeLists.txt</div><div>+++ b/Tests/VSWinStorePhone/CMakeLists.txt</div><div>@@ -103,7 +103,13 @@ set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY</div><div>   VS_DEPLOYMENT_CONTENT $<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>)</div><div> </div><div> set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel)</div><div>+set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS)</div><div>+set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)</div><div>+</div><div> set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex)</div><div>+set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainVS)</div><div>+set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)</div><div>+</div><div> </div><div> source_group("Source Files" FILES ${SOURCE_FILES})</div><div> source_group("Header Files" FILES ${HEADER_FILES})</div><div>diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl</div><div>index d61e2c8..6796da1 100644</div><div>--- a/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl</div><div>+++ b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl</div><div>@@ -4,7 +4,7 @@ struct PixelShaderInput</div><div>   float3 color : COLOR0;</div><div> };</div><div> </div><div>-float4 main(PixelShaderInput input) : SV_TARGET</div><div>+float4 mainPS(PixelShaderInput input) : SV_TARGET</div><div> {</div><div>   return float4(input.color,1.0f);</div><div> }</div><div>diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl</div><div>index 65d60e5..0963060 100644</div><div>--- a/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl</div><div>+++ b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl</div><div>@@ -17,7 +17,7 @@ struct VertexShaderOutput</div><div>   float3 color : COLOR0;</div><div> };</div><div> </div><div>-VertexShaderOutput main(VertexShaderInput input)</div><div>+VertexShaderOutput mainVS(VertexShaderInput input)</div><div> {</div><div>   VertexShaderOutput output;</div><div>   float4 pos = float4(input.pos, 1.0f);</div><div>-- </div><div>1.9.4.msysgit.2</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 1, 2014 at 7:59 AM, Gilles Khouzam <span dir="ltr"><<a href="mailto:Gilles.Khouzam@microsoft.com" target="_blank">Gilles.Khouzam@microsoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Cedric<br>
<br>
Thanks for the patch,<br>
<br>
I had started adding a full set of shader property support on our fork:<br>
<br>
<a href="https://cmakems.codeplex.com/SourceControl/changeset/c5f9c207ee3490dda1e4c2a0eb647492b934fc11" target="_blank">https://cmakems.codeplex.com/SourceControl/changeset/c5f9c207ee3490dda1e4c2a0eb647492b934fc11</a><br>
<br>
I haven't asked to get this pulled in because with the number of options, it is probably better to add this support as a flag set instead of having a set of specific if statements. I haven't had a chance to complete this work though.<br>
<div class=""><div class="h5"><br>
-----Original Message-----<br>
From: Brad King [mailto:<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>]<br>
Sent: Monday, December 1, 2014 07:06<br>
To: Cedric Perthuis<br>
Cc: <a href="mailto:cmake-developers@cmake.org">cmake-developers@cmake.org</a>; Gilles Khouzam<br>
Subject: Re: [cmake-developers] Patch pull request: support for shader entry point and shader model for Visual Studio FXCompiler custom tool build<br>
<br>
On 11/29/2014 12:51 AM, Cedric Perthuis wrote:<br>
> So, here's a patch to address this.<br>
[snip]<br>
> +    if (const char* se = sf->GetProperty("VS_SHADER_ENTRY_POINT"))<br>
[snip]<br>
> +    if (const char* sm = sf->GetProperty("VS_SHADER_MODEL"))<br>
<br>
Thanks.  Here are some comments on the patch:<br>
<br>
* Please update the documentation too.  See<br>
<br>
   Help/manual/cmake-properties.7.rst<br>
   Help/prop_sf/VS_SHADER_TYPE.rst<br>
<br>
  for how VS_SHADER_TYPE is documented.<br>
<br>
* Please update the test.  See<br>
<br>
   Tests/VSWinStorePhone/CMakeLists.txt<br>
<br>
  for current testing of VS_SHADER_TYPE.<br>
<br>
Thanks,<br>
-Brad<br>
</div></div></blockquote></div><br></div></div>