[Cmake-commits] CMake branch, next, updated. v3.1.0-rc2-1004-g7706df9

Brad King brad.king at kitware.com
Tue Dec 2 10:26:10 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  7706df9c17961a41b2318d171b09dae3eafcd93b (commit)
       via  5ab06dcdbddae0b3357fddcbb7682b5af7a3b60e (commit)
      from  95a7129893fdf3b70c012969406abfe7455eece0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7706df9c17961a41b2318d171b09dae3eafcd93b
commit 7706df9c17961a41b2318d171b09dae3eafcd93b
Merge: 95a7129 5ab06dc
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 2 10:26:08 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Dec 2 10:26:08 2014 -0500

    Merge topic 'vs-hlsl-settings' into next
    
    5ab06dcd VS: Add source file properties to set the hlsl shader entry point and model


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ab06dcdbddae0b3357fddcbb7682b5af7a3b60e
commit 5ab06dcdbddae0b3357fddcbb7682b5af7a3b60e
Author:     Cedric Perthuis <cedric.perthuis at gmail.com>
AuthorDate: Tue Dec 2 01:41:10 2014 -0800
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Dec 2 10:05:49 2014 -0500

    VS: Add source file properties to set the hlsl shader entry point and model
    
    Create properties VS_SHADER_ENTRYPOINT and VS_SHADER_MODEL.  Without
    these many .hlsl source files may not be possible to use.  Extend the
    VSWinStorePhone test project to cover them.

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index bf456f5..5bbb89e 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -291,6 +291,8 @@ Properties on Source Files
    /prop_sf/OBJECT_OUTPUTS
    /prop_sf/SYMBOLIC
    /prop_sf/VS_DEPLOYMENT_CONTENT
+   /prop_sf/VS_SHADER_MODEL
+   /prop_sf/VS_SHADER_ENTRYPOINT
    /prop_sf/VS_SHADER_TYPE
    /prop_sf/WRAP_EXCLUDE
    /prop_sf/XCODE_EXPLICIT_FILE_TYPE
diff --git a/Help/prop_sf/VS_SHADER_ENTRYPOINT.rst b/Help/prop_sf/VS_SHADER_ENTRYPOINT.rst
new file mode 100644
index 0000000..fe3471f
--- /dev/null
+++ b/Help/prop_sf/VS_SHADER_ENTRYPOINT.rst
@@ -0,0 +1,5 @@
+VS_SHADER_ENTRYPOINT
+--------------------
+
+Specifies the name of the entry point for the shader of a ``.hlsl`` source
+file.
diff --git a/Help/prop_sf/VS_SHADER_MODEL.rst b/Help/prop_sf/VS_SHADER_MODEL.rst
new file mode 100644
index 0000000..b1cf0df
--- /dev/null
+++ b/Help/prop_sf/VS_SHADER_MODEL.rst
@@ -0,0 +1,5 @@
+VS_SHADER_MODEL
+---------------
+
+Specifies the shader model of a ``.hlsl`` source file. Some shader types can
+only be used with recent shader models
diff --git a/Help/release/3.1.0.rst b/Help/release/3.1.0.rst
index 65aae00..ba729a3 100644
--- a/Help/release/3.1.0.rst
+++ b/Help/release/3.1.0.rst
@@ -310,8 +310,10 @@ Other
 
 * The Visual Studio generators learned to treat ``.hlsl`` source
   files as High Level Shading Language sources (using ``FXCompile``
-  in ``.vcxproj`` files).  A :prop_sf:`VS_SHADER_TYPE` source file
-  property was added to specify the Shader Type.
+  in ``.vcxproj`` files).  Source file properties
+  :prop_sf:`VS_SHADER_TYPE`, :prop_sf:`VS_SHADER_MODEL`, and
+  :prop_sf:`VS_SHADER_ENTRYPOINT` were added added to specify the
+  shader type, model, and entry point name.
 
 New Diagnostics
 ===============
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 26fc317..4fbd8fd 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1203,6 +1203,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
   bool toolHasSettings = false;
   std::string tool = "None";
   std::string shaderType;
+  std::string shaderEntryPoint;
+  std::string shaderModel;
   std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
   if(ext == "hlsl")
     {
@@ -1213,6 +1215,18 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
       shaderType = st;
       toolHasSettings = true;
       }
+    // Figure out which entry point to use if any
+    if (const char* se = sf->GetProperty("VS_SHADER_ENTRYPOINT"))
+      {
+      shaderEntryPoint = se;
+      toolHasSettings = true;
+      }
+    // Figure out which entry point to use if any
+    if (const char* sm = sf->GetProperty("VS_SHADER_MODEL"))
+      {
+      shaderModel = sm;
+      toolHasSettings = true;
+      }
     }
   else if(ext == "jpg" ||
           ext == "png")
@@ -1295,7 +1309,18 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
       (*this->BuildFileStream) << cmVS10EscapeXML(shaderType)
                                << "</ShaderType>\n";
       }
-
+    if(!shaderEntryPoint.empty())
+      {
+      this->WriteString("<EntryPointName>", 3);
+      (*this->BuildFileStream) << cmVS10EscapeXML(shaderEntryPoint)
+                               << "</EntryPointName>\n";
+      }
+    if(!shaderModel.empty())
+      {
+      this->WriteString("<ShaderModel>", 3);
+      (*this->BuildFileStream) << cmVS10EscapeXML(shaderModel)
+                               << "</ShaderModel>\n";
+      }
     this->WriteString("</", 2);
     (*this->BuildFileStream) << tool << ">\n";
     }
diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt
index 0041c75..badb7da 100644
--- a/Tests/VSWinStorePhone/CMakeLists.txt
+++ b/Tests/VSWinStorePhone/CMakeLists.txt
@@ -103,7 +103,13 @@ set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY
   VS_DEPLOYMENT_CONTENT $<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>)
 
 set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel)
+set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS)
+set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)
+
 set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex)
+set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainVS)
+set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)
+
 
 source_group("Source Files" FILES ${SOURCE_FILES})
 source_group("Header Files" FILES ${HEADER_FILES})
diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl
index d61e2c8..6796da1 100644
--- a/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl
+++ b/Tests/VSWinStorePhone/Direct3DApp1/SimplePixelShader.hlsl
@@ -4,7 +4,7 @@ struct PixelShaderInput
   float3 color : COLOR0;
 };
 
-float4 main(PixelShaderInput input) : SV_TARGET
+float4 mainPS(PixelShaderInput input) : SV_TARGET
 {
   return float4(input.color,1.0f);
 }
diff --git a/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl
index 65d60e5..0963060 100644
--- a/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl
+++ b/Tests/VSWinStorePhone/Direct3DApp1/SimpleVertexShader.hlsl
@@ -17,7 +17,7 @@ struct VertexShaderOutput
   float3 color : COLOR0;
 };
 
-VertexShaderOutput main(VertexShaderInput input)
+VertexShaderOutput mainVS(VertexShaderInput input)
 {
   VertexShaderOutput output;
   float4 pos = float4(input.pos, 1.0f);

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake-properties.7.rst                 |    2 ++
 Help/prop_sf/VS_SHADER_ENTRYPOINT.rst              |    5 ++++
 Help/prop_sf/VS_SHADER_MODEL.rst                   |    5 ++++
 Help/release/3.1.0.rst                             |    6 +++--
 Source/cmVisualStudio10TargetGenerator.cxx         |   27 +++++++++++++++++++-
 Tests/VSWinStorePhone/CMakeLists.txt               |    6 +++++
 .../Direct3DApp1/SimplePixelShader.hlsl            |    2 +-
 .../Direct3DApp1/SimpleVertexShader.hlsl           |    2 +-
 8 files changed, 50 insertions(+), 5 deletions(-)
 create mode 100644 Help/prop_sf/VS_SHADER_ENTRYPOINT.rst
 create mode 100644 Help/prop_sf/VS_SHADER_MODEL.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list